Package org.stringtemplate.v4

Examples of org.stringtemplate.v4.STErrorListener


    String templates =
      "foo() ::= {";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:11: missing final '}' in {...} anonymous template" +newline+
              "t.stg 1:10: no viable alternative at input '{'"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here


        String templates =
            "foo( ::= << >>\n";
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:5: no viable alternative at input '::='"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    @Test public void testValidButOutOfPlaceChar() throws Exception {
        String templates =
            "foo() ::= <<hi <.> mom>>\n";
        writeFile(tmpdir, "t.stg", templates);

    STErrorListener errors = new ErrorBuffer();
    STGroupFile group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
        String expected = "t.stg 1:15: doesn't look like an expression"+newline;
        String result = errors.toString();
        assertEquals(expected, result);
    }
View Full Code Here

        String templates =
            "foo() ::= \"hi <name:{[<aaa.bb!>]}> mom\"\n";
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:29: '!' came as a complete surprise to me"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    String templates =
      "foo() ::= \"hi <name\"";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:19: premature EOF"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    String templates =
      "foo() ::= \"hi <name:{x|[<aaa.bb>]}\"\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:34: premature EOF"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    String templates =
      "foo() ::= << <f(\"foo>>\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:20: EOF in string"+newline +
              "t.stg 1:20: premature EOF"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    String templates =
      "foo() ::= << <!foo> >>";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected =
      "t.stg 1:20: Nonterminated comment starting at 1:1: '!>' missing" +newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    String templates =
      "foo() ::= \"hi <foo(>\"\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:19: '>' came as a complete surprise to me"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

    String templates =
      "foo() ::= \"<a,b:t(),u()>\"\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:19: mismatched input ',' expecting RDELIM"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

TOP

Related Classes of org.stringtemplate.v4.STErrorListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.