Package org.stringtemplate.v4.misc

Examples of org.stringtemplate.v4.misc.ErrorBuffer


            "foo) ::= << >>\n" +
            "bar() ::= <<bar>>\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:0: garbled template definition starting at 'foo'"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here


        String templates =
            "foo(a,) ::= << >>\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:6: missing ID at ')'"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

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

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected =
      "[t.stg 1:6: missing ID at ',', " +
View Full Code Here

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

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected =
      "[t.stg 1:6: no viable alternative at input 'b']";
View Full Code Here

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

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected =
      "[t.stg 1:12: required parameters (b) must appear before optional parameters]";
View Full Code Here

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

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "[t.stg 1:15: 'b' came as a complete surprise to me]";
    String result = errors.errors.toString();
View Full Code Here

        String templates =
            "d ::= []\n";
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "[t.stg 1:7: missing dictionary entry at ']']";
    String result = errors.errors.toString();
View Full Code Here

        String templates =
            "d ::= [\"k\":]\n";
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "[t.stg 1:11: missing value for key at ']']";
    String result = errors.errors.toString();
View Full Code Here

        String templates =
            "d ::= [\"k\":{dfkj}}]\n"; // extra }
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "[t.stg 1:17: invalid character '}']";
    String result = errors.errors.toString();
View Full Code Here

        String templates =
            "f() ::= \""; // extra }
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    ErrorBuffer errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "[t.stg 1:9: unterminated string, t.stg 1:9: missing template at '<EOF>']";
    String result = errors.errors.toString();
View Full Code Here

TOP

Related Classes of org.stringtemplate.v4.misc.ErrorBuffer

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.