From c1f473e6ef91812a7ea6656dde18d7cd8358dc6e Mon Sep 17 00:00:00 2001 From: Peter Boyer Date: Fri, 18 Dec 2015 16:39:49 -0500 Subject: [PATCH] Stubbed out test suite --- .../antlr/v4/test/runtime/go/BaseTest.java | 1036 ++++ .../test/runtime/go/TestCompositeLexers.java | 67 + .../test/runtime/go/TestCompositeParsers.java | 427 ++ .../runtime/go/TestFullContextParsing.java | 462 ++ .../v4/test/runtime/go/TestLeftRecursion.java | 3066 ++++++++++ .../v4/test/runtime/go/TestLexerErrors.java | 235 + .../v4/test/runtime/go/TestLexerExec.java | 4935 +++++++++++++++++ .../v4/test/runtime/go/TestListeners.java | 396 ++ .../v4/test/runtime/go/TestParseTrees.java | 229 + .../v4/test/runtime/go/TestParserErrors.java | 624 +++ .../v4/test/runtime/go/TestParserExec.java | 695 +++ .../v4/test/runtime/go/TestPerformance.java | 212 + .../test/runtime/go/TestSemPredEvalLexer.java | 204 + .../runtime/go/TestSemPredEvalParser.java | 684 +++ .../antlr/v4/test/runtime/go/TestSets.java | 408 ++ 15 files changed, 13680 insertions(+) create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java new file mode 100644 index 000000000..59b68d14c --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseTest.java @@ -0,0 +1,1036 @@ +/* + * [The "BSD license"] + * Copyright (c) 2012 Terence Parr + * Copyright (c) 2012 Sam Harwell + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.antlr.v4.Tool; +import org.antlr.v4.automata.ATNFactory; +import org.antlr.v4.automata.ATNPrinter; +import org.antlr.v4.automata.LexerATNFactory; +import org.antlr.v4.automata.ParserATNFactory; +import org.antlr.v4.codegen.CodeGenerator; +import org.antlr.v4.runtime.ANTLRInputStream; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.CommonToken; +import org.antlr.v4.runtime.CommonTokenStream; +import org.antlr.v4.runtime.IntStream; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.RuleContext; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenSource; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.WritableToken; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.ATNSerializer; +import org.antlr.v4.runtime.atn.ATNState; +import org.antlr.v4.runtime.atn.LexerATNSimulator; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.IntegerList; +import org.antlr.v4.runtime.misc.Interval; +import org.antlr.v4.semantics.SemanticPipeline; +import org.antlr.v4.test.runtime.java.ErrorQueue; +import org.antlr.v4.tool.ANTLRMessage; +import org.antlr.v4.tool.DOTGenerator; +import org.antlr.v4.tool.DefaultToolListener; +import org.antlr.v4.tool.Grammar; +import org.antlr.v4.tool.GrammarSemanticsMessage; +import org.antlr.v4.tool.LexerGrammar; +import org.antlr.v4.tool.Rule; +import org.junit.Before; +import org.junit.rules.TestRule; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; +import org.stringtemplate.v4.ST; +import org.stringtemplate.v4.STGroup; +import org.stringtemplate.v4.STGroupString; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public abstract class BaseTest { + // -J-Dorg.antlr.v4.test.BaseTest.level=FINE + // private static final Logger LOGGER = + // Logger.getLogger(BaseTest.class.getName()); + + public static final String newline = System.getProperty("line.separator"); + public static final String pathSep = System.getProperty("path.separator"); + + public String tmpdir = null; + + /** + * If error during parser execution, store stderr here; can't return stdout + * and stderr. This doesn't trap errors from running antlr. + */ + protected String stderrDuringParse; + + @org.junit.Rule + public final TestRule testWatcher = new TestWatcher() { + + @Override + protected void succeeded(Description description) { + // remove tmpdir if no error. + eraseTempDir(); + } + + }; + + @Before + public void setUp() throws Exception { + // new output dir for each test + String prop = System.getProperty("antlr-javascript-test-dir"); + if (prop != null && prop.length() > 0) + tmpdir = prop; + else + tmpdir = new File(System.getProperty("java.io.tmpdir"), getClass() + .getSimpleName() + "-" + System.currentTimeMillis()) + .getAbsolutePath(); + File dir = new File(tmpdir); + if (dir.exists()) + this.eraseFiles(dir); + } + + protected org.antlr.v4.Tool newTool(String[] args) { + Tool tool = new Tool(args); + return tool; + } + + protected Tool newTool() { + org.antlr.v4.Tool tool = new Tool(new String[] { "-o", tmpdir }); + return tool; + } + + protected ATN createATN(Grammar g, boolean useSerializer) { + if (g.atn == null) { + semanticProcess(g); + assertEquals(0, g.tool.getNumErrors()); + + ParserATNFactory f; + if (g.isLexer()) { + f = new LexerATNFactory((LexerGrammar) g); + } else { + f = new ParserATNFactory(g); + } + + g.atn = f.createATN(); + assertEquals(0, g.tool.getNumErrors()); + } + + ATN atn = g.atn; + if (useSerializer) { + char[] serialized = ATNSerializer.getSerializedAsChars(atn); + return new ATNDeserializer().deserialize(serialized); + } + + return atn; + } + + protected void semanticProcess(Grammar g) { + if (g.ast != null && !g.ast.hasErrors) { + System.out.println(g.ast.toStringTree()); + Tool antlr = new Tool(); + SemanticPipeline sem = new SemanticPipeline(g); + sem.process(); + if (g.getImportedGrammars() != null) { // process imported grammars + // (if any) + for (Grammar imp : g.getImportedGrammars()) { + antlr.processNonCombinedGrammar(imp, false); + } + } + } + } + + IntegerList getTypesFromString(Grammar g, String expecting) { + IntegerList expectingTokenTypes = new IntegerList(); + if (expecting != null && !expecting.trim().isEmpty()) { + for (String tname : expecting.replace(" ", "").split(",")) { + int ttype = g.getTokenType(tname); + expectingTokenTypes.add(ttype); + } + } + return expectingTokenTypes; + } + + public IntegerList getTokenTypesViaATN(String input, + LexerATNSimulator lexerATN) { + ANTLRInputStream in = new ANTLRInputStream(input); + IntegerList tokenTypes = new IntegerList(); + int ttype; + do { + ttype = lexerATN.match(in, Lexer.DEFAULT_MODE); + tokenTypes.add(ttype); + } while (ttype != Token.EOF); + return tokenTypes; + } + + public List getTokenTypes(LexerGrammar lg, ATN atn, CharStream input) { + LexerATNSimulator interp = new LexerATNSimulator(atn, + new DFA[] { new DFA( + atn.modeToStartState.get(Lexer.DEFAULT_MODE)) }, null); + List tokenTypes = new ArrayList(); + int ttype; + boolean hitEOF = false; + do { + if (hitEOF) { + tokenTypes.add("EOF"); + break; + } + int t = input.LA(1); + ttype = interp.match(input, Lexer.DEFAULT_MODE); + if (ttype == Token.EOF) { + tokenTypes.add("EOF"); + } else { + tokenTypes.add(lg.typeToTokenList.get(ttype)); + } + + if (t == IntStream.EOF) { + hitEOF = true; + } + } while (ttype != Token.EOF); + return tokenTypes; + } + + /** Return true if all is ok, no errors */ + protected ErrorQueue antlr(String fileName, String grammarFileName, + String grammarStr, boolean defaultListener, String... extraOptions) { + if(grammarStr!=null) { + System.out.println("dir " + tmpdir); + mkdir(tmpdir); + writeFile(tmpdir, fileName, grammarStr); + } + final List options = new ArrayList(); + Collections.addAll(options, extraOptions); + options.add("-Dlanguage=JavaScript"); + options.add("-o"); + options.add(tmpdir); + options.add("-lib"); + options.add(tmpdir); + options.add(new File(tmpdir, grammarFileName).toString()); + + final String[] optionsA = new String[options.size()]; + options.toArray(optionsA); + Tool antlr = newTool(optionsA); + ErrorQueue equeue = new ErrorQueue(antlr); + antlr.addListener(equeue); + if (defaultListener) { + antlr.addListener(new DefaultToolListener(antlr)); + } + antlr.processGrammarsOnCommandLine(); + + if (!defaultListener && !equeue.errors.isEmpty()) { + System.err.println("antlr reports errors from " + options); + for (int i = 0; i < equeue.errors.size(); i++) { + ANTLRMessage msg = equeue.errors.get(i); + System.err.println(msg); + } + System.out.println("!!!\ngrammar:"); + System.out.println(grammarStr); + System.out.println("###"); + } + if (!defaultListener && !equeue.warnings.isEmpty()) { + System.err.println("antlr reports warnings from " + options); + for (int i = 0; i < equeue.warnings.size(); i++) { + ANTLRMessage msg = equeue.warnings.get(i); + System.err.println(msg); + } + } + + return equeue; + } + + protected String execLexer(String grammarFileName, String grammarStr, + String lexerName, String input) { + return execLexer(grammarFileName, grammarStr, lexerName, input, false); + } + + protected String execLexer(String grammarFileName, String grammarStr, + String lexerName, String input, boolean showDFA) { + boolean success = rawGenerateAndBuildRecognizer(grammarFileName, + grammarStr, null, lexerName, "-no-listener"); + assertTrue(success); + writeFile(tmpdir, "input", input); + writeLexerTestFile(lexerName, showDFA); + String output = execModule("Test.js"); + if (stderrDuringParse != null && stderrDuringParse.length() > 0) { + System.err.println(stderrDuringParse); + } + return output; + } + + protected String execParser(String grammarFileName, String grammarStr, + String parserName, String lexerName, String listenerName, + String visitorName, String startRuleName, String input, + boolean debug) { + boolean success = rawGenerateAndBuildRecognizer(grammarFileName, + grammarStr, parserName, lexerName, "-visitor"); + assertTrue(success); + writeFile(tmpdir, "input", input); + rawBuildRecognizerTestFile(parserName, lexerName, listenerName, + visitorName, startRuleName, debug); + return execRecognizer(); + } + + /** Return true if all is well */ + protected boolean rawGenerateAndBuildRecognizer(String grammarFileName, + String grammarStr, String parserName, String lexerName, + String... extraOptions) { + return rawGenerateAndBuildRecognizer(grammarFileName, grammarStr, + parserName, lexerName, false, extraOptions); + } + + /** Return true if all is well */ + protected boolean rawGenerateAndBuildRecognizer(String grammarFileName, + String grammarStr, String parserName, String lexerName, + boolean defaultListener, String... extraOptions) { + ErrorQueue equeue = antlr(grammarFileName, grammarFileName, grammarStr, + defaultListener, extraOptions); + if (!equeue.errors.isEmpty()) { + return false; + } + + List files = new ArrayList(); + if (lexerName != null) { + files.add(lexerName + ".js"); + } + if (parserName != null) { + files.add(parserName + ".js"); + Set optionsSet = new HashSet( + Arrays.asList(extraOptions)); + if (!optionsSet.contains("-no-listener")) { + files.add(grammarFileName.substring(0, + grammarFileName.lastIndexOf('.')) + + "Listener.js"); + } + if (optionsSet.contains("-visitor")) { + files.add(grammarFileName.substring(0, + grammarFileName.lastIndexOf('.')) + + "Visitor.js"); + } + } + return true; // allIsWell: no compile + } + + protected void rawBuildRecognizerTestFile(String parserName, + String lexerName, String listenerName, String visitorName, + String parserStartRuleName, boolean debug) { + this.stderrDuringParse = null; + if (parserName == null) { + writeLexerTestFile(lexerName, false); + } else { + writeParserTestFile(parserName, lexerName, listenerName, + visitorName, parserStartRuleName, debug); + } + } + + public String execRecognizer() { + return execModule("Test.js"); + } + + public String execModule(String fileName) { + String nodejsPath = locateNodeJS(); + String runtimePath = locateRuntime(); + String modulePath = new File(new File(tmpdir), fileName) + .getAbsolutePath(); + String inputPath = new File(new File(tmpdir), "input") + .getAbsolutePath(); + try { + ProcessBuilder builder = new ProcessBuilder(nodejsPath, modulePath, + inputPath); + builder.environment().put("NODE_PATH", + runtimePath + File.pathSeparator + tmpdir); + builder.directory(new File(tmpdir)); + Process process = builder.start(); + StreamVacuum stdoutVacuum = new StreamVacuum( + process.getInputStream()); + StreamVacuum stderrVacuum = new StreamVacuum( + process.getErrorStream()); + stdoutVacuum.start(); + stderrVacuum.start(); + process.waitFor(); + stdoutVacuum.join(); + stderrVacuum.join(); + String output = stdoutVacuum.toString(); + if (stderrVacuum.toString().length() > 0) { + this.stderrDuringParse = stderrVacuum.toString(); + System.err.println("exec stderrVacuum: " + stderrVacuum); + } + return output; + } + catch (Exception e) { + System.err.println("can't exec recognizer"); + e.printStackTrace(System.err); + } + return null; + } + + private String locateTool(String tool) { + String[] roots = { "/usr/bin/", "/usr/local/bin/" }; + for (String root : roots) { + if (new File(root + tool).exists()) { + return root + tool; + } + } + return null; + } + + private String locateNodeJS() { + // typically /usr/local/bin/node + String propName = "antlr-javascript-nodejs"; + String prop = System.getProperty(propName); + if (prop == null || prop.length() == 0) { + prop = locateTool("nodejs"); // seems to be nodejs on ubuntu + } + if ( prop==null ) { + prop = locateTool("node"); // seems to be node on mac + } + File file = new File(prop); + if (!file.exists()) { + throw new RuntimeException("Missing system property:" + propName); + } + return prop; + } + + private String locateRuntime() { + final ClassLoader loader = Thread.currentThread().getContextClassLoader(); + final URL runtimeSrc = loader.getResource("JavaScript/src"); + if ( runtimeSrc==null ) { + throw new RuntimeException("Cannot find JavaScript runtime"); + } + return runtimeSrc.getPath(); + } + + public void testErrors(String[] pairs, boolean printTree) { + for (int i = 0; i < pairs.length; i += 2) { + String input = pairs[i]; + String expect = pairs[i + 1]; + + String[] lines = input.split("\n"); + String fileName = getFilenameFromFirstLineOfGrammar(lines[0]); + ErrorQueue equeue = antlr(fileName, fileName, input, false); + + String actual = equeue.toString(true); + actual = actual.replace(tmpdir + File.separator, ""); + System.err.println(actual); + String msg = input; + msg = msg.replace("\n", "\\n"); + msg = msg.replace("\r", "\\r"); + msg = msg.replace("\t", "\\t"); + + assertEquals("error in: " + msg, expect, actual); + } + } + + public String getFilenameFromFirstLineOfGrammar(String line) { + String fileName = "A" + Tool.GRAMMAR_EXTENSION; + int grIndex = line.lastIndexOf("grammar"); + int semi = line.lastIndexOf(';'); + if (grIndex >= 0 && semi >= 0) { + int space = line.indexOf(' ', grIndex); + fileName = line.substring(space + 1, semi) + Tool.GRAMMAR_EXTENSION; + } + if (fileName.length() == Tool.GRAMMAR_EXTENSION.length()) + fileName = "A" + Tool.GRAMMAR_EXTENSION; + return fileName; + } + + // void ambig(List msgs, int[] expectedAmbigAlts, String + // expectedAmbigInput) + // throws Exception + // { + // ambig(msgs, 0, expectedAmbigAlts, expectedAmbigInput); + // } + + // void ambig(List msgs, int i, int[] expectedAmbigAlts, String + // expectedAmbigInput) + // throws Exception + // { + // List amsgs = getMessagesOfType(msgs, AmbiguityMessage.class); + // AmbiguityMessage a = (AmbiguityMessage)amsgs.get(i); + // if ( a==null ) assertNull(expectedAmbigAlts); + // else { + // assertEquals(a.conflictingAlts.toString(), + // Arrays.toString(expectedAmbigAlts)); + // } + // assertEquals(expectedAmbigInput, a.input); + // } + + // void unreachable(List msgs, int[] expectedUnreachableAlts) + // throws Exception + // { + // unreachable(msgs, 0, expectedUnreachableAlts); + // } + + // void unreachable(List msgs, int i, int[] + // expectedUnreachableAlts) + // throws Exception + // { + // List amsgs = getMessagesOfType(msgs, + // UnreachableAltsMessage.class); + // UnreachableAltsMessage u = (UnreachableAltsMessage)amsgs.get(i); + // if ( u==null ) assertNull(expectedUnreachableAlts); + // else { + // assertEquals(u.conflictingAlts.toString(), + // Arrays.toString(expectedUnreachableAlts)); + // } + // } + + List getMessagesOfType(List msgs, + Class c) { + List filtered = new ArrayList(); + for (ANTLRMessage m : msgs) { + if (m.getClass() == c) + filtered.add(m); + } + return filtered; + } + + void checkRuleATN(Grammar g, String ruleName, String expecting) { + ParserATNFactory f = new ParserATNFactory(g); + ATN atn = f.createATN(); + + DOTGenerator dot = new DOTGenerator(g); + System.out + .println(dot.getDOT(atn.ruleToStartState[g.getRule(ruleName).index])); + + Rule r = g.getRule(ruleName); + ATNState startState = atn.ruleToStartState[r.index]; + ATNPrinter serializer = new ATNPrinter(g, startState); + String result = serializer.asString(); + + // System.out.print(result); + assertEquals(expecting, result); + } + + public void testActions(String templates, String actionName, String action, + String expected) throws org.antlr.runtime.RecognitionException { + int lp = templates.indexOf('('); + String name = templates.substring(0, lp); + STGroup group = new STGroupString(templates); + ST st = group.getInstanceOf(name); + st.add(actionName, action); + String grammar = st.render(); + ErrorQueue equeue = new ErrorQueue(); + Grammar g = new Grammar(grammar, equeue); + if (g.ast != null && !g.ast.hasErrors) { + SemanticPipeline sem = new SemanticPipeline(g); + sem.process(); + + ATNFactory factory = new ParserATNFactory(g); + if (g.isLexer()) + factory = new LexerATNFactory((LexerGrammar) g); + g.atn = factory.createATN(); + + CodeGenerator gen = new CodeGenerator(g); + ST outputFileST = gen.generateParser(); + String output = outputFileST.render(); + // System.out.println(output); + String b = "#" + actionName + "#"; + int start = output.indexOf(b); + String e = "#end-" + actionName + "#"; + int end = output.indexOf(e); + String snippet = output.substring(start + b.length(), end); + assertEquals(expected, snippet); + } + if (equeue.size() > 0) { + System.err.println(equeue.toString()); + } + } + + public static class StreamVacuum implements Runnable { + StringBuilder buf = new StringBuilder(); + BufferedReader in; + Thread sucker; + + public StreamVacuum(InputStream in) { + this.in = new BufferedReader(new InputStreamReader(in)); + } + + public void start() { + sucker = new Thread(this); + sucker.start(); + } + + @Override + public void run() { + try { + String line = in.readLine(); + while (line != null) { + buf.append(line); + buf.append('\n'); + line = in.readLine(); + } + } catch (IOException ioe) { + System.err.println("can't read output from process"); + } + } + + /** wait for the thread to finish */ + public void join() throws InterruptedException { + sucker.join(); + } + + @Override + public String toString() { + return buf.toString(); + } + } + + protected void checkGrammarSemanticsError(ErrorQueue equeue, + GrammarSemanticsMessage expectedMessage) throws Exception { + ANTLRMessage foundMsg = null; + for (int i = 0; i < equeue.errors.size(); i++) { + ANTLRMessage m = equeue.errors.get(i); + if (m.getErrorType() == expectedMessage.getErrorType()) { + foundMsg = m; + } + } + assertNotNull("no error; " + expectedMessage.getErrorType() + + " expected", foundMsg); + assertTrue("error is not a GrammarSemanticsMessage", + foundMsg instanceof GrammarSemanticsMessage); + assertEquals(Arrays.toString(expectedMessage.getArgs()), + Arrays.toString(foundMsg.getArgs())); + if (equeue.size() != 1) { + System.err.println(equeue); + } + } + + protected void checkGrammarSemanticsWarning(ErrorQueue equeue, + GrammarSemanticsMessage expectedMessage) throws Exception { + ANTLRMessage foundMsg = null; + for (int i = 0; i < equeue.warnings.size(); i++) { + ANTLRMessage m = equeue.warnings.get(i); + if (m.getErrorType() == expectedMessage.getErrorType()) { + foundMsg = m; + } + } + assertNotNull("no error; " + expectedMessage.getErrorType() + + " expected", foundMsg); + assertTrue("error is not a GrammarSemanticsMessage", + foundMsg instanceof GrammarSemanticsMessage); + assertEquals(Arrays.toString(expectedMessage.getArgs()), + Arrays.toString(foundMsg.getArgs())); + if (equeue.size() != 1) { + System.err.println(equeue); + } + } + + protected void checkError(ErrorQueue equeue, ANTLRMessage expectedMessage) + throws Exception { + // System.out.println("errors="+equeue); + ANTLRMessage foundMsg = null; + for (int i = 0; i < equeue.errors.size(); i++) { + ANTLRMessage m = equeue.errors.get(i); + if (m.getErrorType() == expectedMessage.getErrorType()) { + foundMsg = m; + } + } + assertTrue("no error; " + expectedMessage.getErrorType() + " expected", + !equeue.errors.isEmpty()); + assertTrue("too many errors; " + equeue.errors, + equeue.errors.size() <= 1); + assertNotNull( + "couldn't find expected error: " + + expectedMessage.getErrorType(), foundMsg); + /* + * assertTrue("error is not a GrammarSemanticsMessage", foundMsg + * instanceof GrammarSemanticsMessage); + */ + assertArrayEquals(expectedMessage.getArgs(), foundMsg.getArgs()); + } + + public static class FilteringTokenStream extends CommonTokenStream { + public FilteringTokenStream(TokenSource src) { + super(src); + } + + Set hide = new HashSet(); + + @Override + protected boolean sync(int i) { + if (!super.sync(i)) { + return false; + } + + Token t = get(i); + if (hide.contains(t.getType())) { + ((WritableToken) t).setChannel(Token.HIDDEN_CHANNEL); + } + + return true; + } + + public void setTokenTypeChannel(int ttype, int channel) { + hide.add(ttype); + } + } + + public static void writeFile(String dir, String fileName, String content) { + try { + File f = new File(dir, fileName); + FileWriter w = new FileWriter(f); + BufferedWriter bw = new BufferedWriter(w); + bw.write(content); + bw.close(); + w.close(); + } catch (IOException ioe) { + System.err.println("can't write file"); + ioe.printStackTrace(System.err); + } + } + + public static void writeFile(String dir, String fileName, InputStream content) { + try { + File f = new File(dir, fileName); + OutputStream output = new FileOutputStream(f); + while(content.available()>0) { + int b = content.read(); + output.write(b); + } + output.close(); + } catch (IOException ioe) { + System.err.println("can't write file"); + ioe.printStackTrace(System.err); + } + } + + protected void mkdir(String dir) { + File f = new File(dir); + f.mkdirs(); + } + + protected void writeParserTestFile(String parserName, String lexerName, + String listenerName, String visitorName, + String parserStartRuleName, boolean debug) { + ST outputFileST = new ST( + "var antlr4 = require('antlr4');\n" + + "var = require('./');\n" + + "var = require('./');\n" + + "var = require('./').;\n" + + "var = require('./').;\n" + + "\n" + + "function TreeShapeListener() {\n" + + " antlr4.tree.ParseTreeListener.call(this);\n" + + " return this;\n" + + "}\n" + + "\n" + + "TreeShapeListener.prototype = Object.create(antlr4.tree.ParseTreeListener.prototype);\n" + + "TreeShapeListener.prototype.constructor = TreeShapeListener;\n" + + "\n" + + "TreeShapeListener.prototype.enterEveryRule = function(ctx) {\n" + + " for(var i=0;i\\.(input);\n" + + " var stream = new antlr4.CommonTokenStream(lexer);\n" + + "" + + " parser.buildParseTrees = true;\n" + + " printer = function() {\n" + + " this.println = function(s) { console.log(s); }\n" + + " this.print = function(s) { process.stdout.write(s); }\n" + + " return this;\n" + + " };\n" + + " parser.printer = new printer();\n" + + " var tree = parser.();\n" + + " antlr4.tree.ParseTreeWalker.DEFAULT.walk(new TreeShapeListener(), tree);\n" + + "}\n" + "\n" + "main(process.argv);\n" + "\n"); + ST createParserST = new ST( + " var parser = new .(stream);\n"); + if (debug) { + createParserST = new ST( + " var parser = new .(stream);\n" + + " parser.addErrorListener(new antlr4.error.DiagnosticErrorListener());\n"); + } + outputFileST.add("createParser", createParserST); + outputFileST.add("parserName", parserName); + outputFileST.add("lexerName", lexerName); + outputFileST.add("listenerName", listenerName); + outputFileST.add("visitorName", visitorName); + outputFileST.add("parserStartRuleName", parserStartRuleName); + writeFile(tmpdir, "Test.js", outputFileST.render()); + } + + protected void writeLexerTestFile(String lexerName, boolean showDFA) { + ST outputFileST = new ST( + "var antlr4 = require('antlr4');\n" + + "var = require('./');\n" + + "\n" + + "function main(argv) {\n" + + " var input = new antlr4.FileStream(argv[2]);\n" + + " var lexer = new .(input);\n" + + " var stream = new antlr4.CommonTokenStream(lexer);\n" + + " stream.fill();\n" + + " for(var i=0; i\\ 0) + doErase = Boolean.getBoolean(prop); + if (doErase) { + File tmpdirF = new File(tmpdir); + if (tmpdirF.exists()) { + eraseFiles(tmpdirF); + tmpdirF.delete(); + } + } + } + + public String getFirstLineOfException() { + if (this.stderrDuringParse == null) { + return null; + } + String[] lines = this.stderrDuringParse.split("\n"); + String prefix = "Exception in thread \"main\" "; + return lines[0].substring(prefix.length(), lines[0].length()); + } + + /** + * When looking at a result set that consists of a Map/HashTable we cannot + * rely on the output order, as the hashing algorithm or other aspects of + * the implementation may be different on differnt JDKs or platforms. Hence + * we take the Map, convert the keys to a List, sort them and Stringify the + * Map, which is a bit of a hack, but guarantees that we get the same order + * on all systems. We assume that the keys are strings. + * + * @param m + * The Map that contains keys we wish to return in sorted order + * @return A string that represents all the keys in sorted order. + */ + public String sortMapToString(Map m) { + // Pass in crap, and get nothing back + // + if (m == null) { + return null; + } + + System.out.println("Map toString looks like: " + m.toString()); + + // Sort the keys in the Map + // + TreeMap nset = new TreeMap(m); + + System.out.println("Tree map looks like: " + nset.toString()); + return nset.toString(); + } + + public List realElements(List elements) { + return elements.subList(Token.MIN_USER_TOKEN_TYPE, elements.size()); + } + + public void assertNotNullOrEmpty(String message, String text) { + assertNotNull(message, text); + assertFalse(message, text.isEmpty()); + } + + public void assertNotNullOrEmpty(String text) { + assertNotNull(text); + assertFalse(text.isEmpty()); + } + + public static class IntTokenStream implements TokenStream { + IntegerList types; + int p = 0; + + public IntTokenStream(IntegerList types) { + this.types = types; + } + + @Override + public void consume() { + p++; + } + + @Override + public int LA(int i) { + return LT(i).getType(); + } + + @Override + public int mark() { + return index(); + } + + @Override + public int index() { + return p; + } + + @Override + public void release(int marker) { + seek(marker); + } + + @Override + public void seek(int index) { + p = index; + } + + @Override + public int size() { + return types.size(); + } + + @Override + public String getSourceName() { + return null; + } + + @Override + public Token LT(int i) { + CommonToken t; + int rawIndex = p + i - 1; + if (rawIndex >= types.size()) + t = new CommonToken(Token.EOF); + else + t = new CommonToken(types.get(rawIndex)); + t.setTokenIndex(rawIndex); + return t; + } + + @Override + public Token get(int i) { + return new org.antlr.v4.runtime.CommonToken(types.get(i)); + } + + @Override + public TokenSource getTokenSource() { + return null; + } + + @Override + public String getText() { + throw new UnsupportedOperationException("can't give strings"); + } + + @Override + public String getText(Interval interval) { + throw new UnsupportedOperationException("can't give strings"); + } + + @Override + public String getText(RuleContext ctx) { + throw new UnsupportedOperationException("can't give strings"); + } + + @Override + public String getText(Token start, Token stop) { + throw new UnsupportedOperationException("can't give strings"); + } + } + + /** Sort a list */ + public > List sort(List data) { + List dup = new ArrayList(); + dup.addAll(data); + Collections.sort(dup); + return dup; + } + + /** Return map sorted by key */ + public , V> LinkedHashMap sort( + Map data) { + LinkedHashMap dup = new LinkedHashMap(); + List keys = new ArrayList(); + keys.addAll(data.keySet()); + Collections.sort(keys); + for (K k : keys) { + dup.put(k, data.get(k)); + } + return dup; + } +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java new file mode 100644 index 000000000..dad1ac891 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java @@ -0,0 +1,67 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestCompositeLexers extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerDelegatorInvokesDelegateRule() throws Exception { + mkdir(tmpdir); + String slave_S = + "lexer grammar S;\n" + + "A : 'a' {console.log(\"S.A\");};\n" + + "C : 'c' ;"; + writeFile(tmpdir, "S.g4", slave_S); + + + StringBuilder grammarBuilder = new StringBuilder(61); + grammarBuilder.append("lexer grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("B : 'b';\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execLexer("M.g4", grammar, "M", input, false); + assertEquals( + "S.A\n" + + "[@0,0:0='a',<3>,1:0]\n" + + "[@1,1:1='b',<1>,1:1]\n" + + "[@2,2:2='c',<4>,1:2]\n" + + "[@3,3:2='',<-1>,1:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerDelegatorRuleOverridesDelegate() throws Exception { + mkdir(tmpdir); + String slave_S = + "lexer grammar S;\n" + + "A : 'a' {console.log(\"S.A\");} ;\n" + + "B : 'b' {console.log(\"S.B\");} ;"; + writeFile(tmpdir, "S.g4", slave_S); + + + StringBuilder grammarBuilder = new StringBuilder(86); + grammarBuilder.append("lexer grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("A : 'a' B {console.log(\"M.A\");} ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="ab"; + String found = execLexer("M.g4", grammar, "M", input, false); + assertEquals( + "M.A\n" + + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,2:1='',<-1>,1:2]\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java new file mode 100644 index 000000000..8690954e3 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java @@ -0,0 +1,427 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +import org.antlr.v4.test.runtime.java.ErrorQueue; +import org.antlr.v4.tool.Grammar; + +@SuppressWarnings("unused") +public class TestCompositeParsers extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testBringInLiteralsFromDelegate() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a : '=' 'a' {process.stdout.write(\"S.a\");};"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(54); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : a ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="=a"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("S.a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCombinedImportsCombined() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "tokens { A, B, C }\n" + + "x : 'x' INT {console.log(\"S.x\");};\n" + + "INT : '0'..'9'+ ;\n" + + "WS : (' '|'\\n') -> skip ;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(31); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : x INT;"); + String grammar = grammarBuilder.toString(); + String input ="x 34 9"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("S.x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatesSeeSameTokenType() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "tokens { A, B, C }\n" + + "x : A {console.log(\"S.x\");};"; + writeFile(tmpdir, "S.g4", slave_S); + + String slave_T = + "parser grammar T;\n" + + "tokens { C, B, A } // reverse order\n" + + "y : A {console.log(\"T.y\");};"; + writeFile(tmpdir, "T.g4", slave_T); + + StringBuilder grammarBuilder = new StringBuilder(598); + grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n"); + grammarBuilder.append("// The associated token types A, B, C must have the same value\n"); + grammarBuilder.append("// and all import'd parsers. Since ANTLR regenerates all imports\n"); + grammarBuilder.append("// for use with the delegator M, it can generate the same token type\n"); + grammarBuilder.append("// mapping in each parser:\n"); + grammarBuilder.append("// public static final int C=6;\n"); + grammarBuilder.append("// public static final int EOF=-1;\n"); + grammarBuilder.append("// public static final int B=5;\n"); + grammarBuilder.append("// public static final int WS=7;\n"); + grammarBuilder.append("// public static final int A=4;\n"); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S,T;\n"); + grammarBuilder.append("s : x y ; // matches AA, which should be 'aa'\n"); + grammarBuilder.append("B : 'b' ; // another order: B, A, C\n"); + grammarBuilder.append("A : 'a' ; \n"); + grammarBuilder.append("C : 'c' ; \n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="aa"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals( + "S.x\n" + + "T.y\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorAccessesDelegateMembers() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "@parser::members {\n" + + "this.foo = function() {console.log('foo');};\n" + + "}\n" + + "a : B;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(127); + grammarBuilder.append("grammar M; // uses no rules from the import\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : 'b' {this.foo();} ; // gS is import pointer\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("foo\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorInvokesDelegateRule() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a : B {console.log(\"S.a\");};"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(104); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : a ;\n"); + grammarBuilder.append("B : 'b' ; // defines B from inherited token space\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("S.a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorInvokesDelegateRuleWithArgs() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a[int x] returns [int y] : B {process.stdout.write(\"S.a\");} {$y=1000;} ;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(138); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : label=a[3] {console.log($label.y);} ;\n"); + grammarBuilder.append("B : 'b' ; // defines B from inherited token space\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("S.a1000\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorInvokesDelegateRuleWithReturnStruct() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a : B {process.stdout.write(\"S.a\");} ;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(137); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : a {process.stdout.write($a.text);} ;\n"); + grammarBuilder.append("B : 'b' ; // defines B from inherited token space\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("S.ab\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a : b {console.log(\"S.a\");};\n" + + "b : B;"; + writeFile(tmpdir, "S.g4", slave_S); + + String slave_T = + "parser grammar T;\n" + + "a : B {console.log(\"T.a\");};"; + writeFile(tmpdir, "T.g4", slave_T); + + StringBuilder grammarBuilder = new StringBuilder(106); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S,T;\n"); + grammarBuilder.append("s : a ;\n"); + grammarBuilder.append("B : 'b' ; // defines B from inherited token space\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("S.a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorRuleOverridesDelegate() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a : b {process.stdout.write(\"S.a\");};\n" + + "b : B ;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(59); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("b : 'b'|'c';\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="c"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "a", input, false); + assertEquals("S.a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorRuleOverridesDelegates() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a : b {console.log(\"S.a\");};\n" + + "b : 'b' ;"; + writeFile(tmpdir, "S.g4", slave_S); + + String slave_T = + "parser grammar T;\n" + + "tokens { A }\n" + + "b : 'b' {console.log(\"T.b\");};"; + writeFile(tmpdir, "T.g4", slave_T); + + StringBuilder grammarBuilder = new StringBuilder(88); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S, T;\n"); + grammarBuilder.append("b : 'b'|'c' {console.log(\"M.b\");}|B|A;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="c"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "a", input, false); + assertEquals( + "M.b\n" + + "S.a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDelegatorRuleOverridesLookaheadInDelegate() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "type_ : 'int' ;\n" + + "decl : type_ ID ';'\n" + + " | type_ ID init ';' {process.stdout.write(\"JavaDecl: \" + $text);};\n" + + "init : '=' INT;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(121); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("prog : decl ;\n"); + grammarBuilder.append("type_ : 'int' | 'float' ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="float x = 3;"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "prog", input, false); + assertEquals("JavaDecl: floatx=3;\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testImportLexerWithOnlyFragmentRules() throws Exception { + mkdir(tmpdir); + String slave_Unicode = + "lexer grammar Unicode;\n" + + "\n" + + "fragment\n" + + "UNICODE_CLASS_Zs : '\\u0020' | '\\u00A0' | '\\u1680' | '\\u180E'\n" + + " | '\\u2000'..'\\u200A'\n" + + " | '\\u202F' | '\\u205F' | '\\u3000'\n" + + " ;\n"; + writeFile(tmpdir, "Unicode.g4", slave_Unicode); + + StringBuilder grammarBuilder = new StringBuilder(91); + grammarBuilder.append("grammar Test;\n"); + grammarBuilder.append("import Unicode;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("program : 'test' 'test';\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("WS : (UNICODE_CLASS_Zs)+ -> skip;\n"); + String grammar = grammarBuilder.toString(); + String input ="test test"; + String found = execParser("Test.g4", grammar, "TestParser", "TestLexer", + "TestListener", "TestVisitor", + "program", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testImportedGrammarWithEmptyOptions() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "options {}\n" + + "a : B ;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(64); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : a ;\n"); + grammarBuilder.append("B : 'b' ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testImportedRuleWithAction() throws Exception { + mkdir(tmpdir); + String slave_S = + "parser grammar S;\n" + + "a @after {this.x = 0;} : B;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(62); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("s : a;\n"); + grammarBuilder.append("B : 'b';\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "s", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testKeywordVSIDOrder() throws Exception { + mkdir(tmpdir); + String slave_S = + "lexer grammar S;\n" + + "ID : 'a'..'z'+;"; + writeFile(tmpdir, "S.g4", slave_S); + + StringBuilder grammarBuilder = new StringBuilder(115); + grammarBuilder.append("grammar M;\n"); + grammarBuilder.append("import S;\n"); + grammarBuilder.append("a : A {console.log(\"M.a: \" + $A);};\n"); + grammarBuilder.append("A : 'abc' {console.log(\"M.A\");};\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("M.g4", grammar, "MParser", "MLexer", + "MListener", "MVisitor", + "a", input, false); + assertEquals( + "M.A\n" + + "M.a: [@0,0:2='abc',<1>,1:0]\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java new file mode 100644 index 000000000..62039ccd7 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java @@ -0,0 +1,462 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestFullContextParsing extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbigYieldsCtxSensitiveDFA() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(101); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {this.dumpDFA();}\n"); + grammarBuilder.append(" : ID | ID {} ;\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 0:\n" + + "s0-ID->:s1^=>1\n", found); + + assertEquals("line 1:0 reportAttemptingFullContext d=0 (s), input='abc'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbiguityNoLoop() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(224); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("prog\n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append(" : expr expr {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | expr\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: '@'\n"); + grammarBuilder.append(" | ID '@'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\r\\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a@"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "prog", input, true); + assertEquals("alt 1\n", found); + + assertEquals( + "line 1:2 reportAttemptingFullContext d=0 (prog), input='a@'\n" + + "line 1:2 reportAmbiguity d=0 (prog): ambigAlts={1, 2}, input='a@'\n" + + "line 1:2 reportAttemptingFullContext d=1 (expr), input='a@'\n" + + "line 1:2 reportContextSensitivity d=1 (expr), input='a@'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCtxSensitiveDFATwoDiffInput() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(165); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {this.dumpDFA();}\n"); + grammarBuilder.append(" : ('$' a | '@' b)+ ;\n"); + grammarBuilder.append("a : e ID ;\n"); + grammarBuilder.append("b : e INT ID ;\n"); + grammarBuilder.append("e : INT | ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="$ 34 abc @ 34 abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 2:\n" + + "s0-INT->s1\n" + + "s1-ID->:s2^=>1\n", found); + + assertEquals( + "line 1:5 reportAttemptingFullContext d=2 (e), input='34abc'\n" + + "line 1:2 reportContextSensitivity d=2 (e), input='34'\n" + + "line 1:14 reportAttemptingFullContext d=2 (e), input='34abc'\n" + + "line 1:14 reportContextSensitivity d=2 (e), input='34abc'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCtxSensitiveDFA_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(162); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '$' a | '@' b ;\n"); + grammarBuilder.append("a : e ID ;\n"); + grammarBuilder.append("b : e INT ID ;\n"); + grammarBuilder.append("e : INT | ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="$ 34 abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-INT->s1\n" + + "s1-ID->:s2^=>1\n", found); + + assertEquals( + "line 1:5 reportAttemptingFullContext d=1 (e), input='34abc'\n" + + "line 1:2 reportContextSensitivity d=1 (e), input='34'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCtxSensitiveDFA_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(162); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '$' a | '@' b ;\n"); + grammarBuilder.append("a : e ID ;\n"); + grammarBuilder.append("b : e INT ID ;\n"); + grammarBuilder.append("e : INT | ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="@ 34 abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-INT->s1\n" + + "s1-ID->:s2^=>1\n", found); + + assertEquals( + "line 1:5 reportAttemptingFullContext d=1 (e), input='34abc'\n" + + "line 1:5 reportContextSensitivity d=1 (e), input='34abc'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExprAmbiguity_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(304); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append(": expr[0] {console.log($expr.ctx.toStringTree(null, this));};\n"); + grammarBuilder.append(" expr[int _p]\n"); + grammarBuilder.append(" : ID \n"); + grammarBuilder.append(" ( \n"); + grammarBuilder.append(" {5 >= $_p}? '*' expr[6]\n"); + grammarBuilder.append(" | {4 >= $_p}? '+' expr[5]\n"); + grammarBuilder.append(" )*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ;\n"); + grammarBuilder.append("WS : [ \\r\\n\\t]+ -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="a+b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals("(expr a + (expr b))\n", found); + + assertEquals( + "line 1:1 reportAttemptingFullContext d=1 (expr), input='+'\n" + + "line 1:2 reportContextSensitivity d=1 (expr), input='+b'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExprAmbiguity_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(304); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append(": expr[0] {console.log($expr.ctx.toStringTree(null, this));};\n"); + grammarBuilder.append(" expr[int _p]\n"); + grammarBuilder.append(" : ID \n"); + grammarBuilder.append(" ( \n"); + grammarBuilder.append(" {5 >= $_p}? '*' expr[6]\n"); + grammarBuilder.append(" | {4 >= $_p}? '+' expr[5]\n"); + grammarBuilder.append(" )*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ;\n"); + grammarBuilder.append("WS : [ \\r\\n\\t]+ -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="a+b*c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals("(expr a + (expr b * (expr c)))\n", found); + + assertEquals( + "line 1:1 reportAttemptingFullContext d=1 (expr), input='+'\n" + + "line 1:2 reportContextSensitivity d=1 (expr), input='+b'\n" + + "line 1:3 reportAttemptingFullContext d=1 (expr), input='*'\n" + + "line 1:5 reportAmbiguity d=1 (expr): ambigAlts={1, 2}, input='*c'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testFullContextIF_THEN_ELSEParse_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s \n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append("@after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '{' stat* '}' ;\n"); + grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n"); + grammarBuilder.append(" | 'return'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="{ if x then return }"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-'}'->:s1=>2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testFullContextIF_THEN_ELSEParse_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s \n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append("@after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '{' stat* '}' ;\n"); + grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n"); + grammarBuilder.append(" | 'return'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="{ if x then return else foo }"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-'else'->:s1^=>1\n", found); + + assertEquals( + "line 1:19 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 1:19 reportContextSensitivity d=1 (stat), input='else'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testFullContextIF_THEN_ELSEParse_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s \n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append("@after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '{' stat* '}' ;\n"); + grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n"); + grammarBuilder.append(" | 'return'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="{ if x then if y then return else foo }"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-'}'->:s2=>2\n" + + "s0-'else'->:s1^=>1\n", found); + + assertEquals( + "line 1:29 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 1:38 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testFullContextIF_THEN_ELSEParse_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s \n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append("@after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '{' stat* '}' ;\n"); + grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n"); + grammarBuilder.append(" | 'return'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="{ if x then if y then return else foo else bar }"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-'else'->:s1^=>1\n", found); + + assertEquals( + "line 1:29 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 1:38 reportContextSensitivity d=1 (stat), input='elsefooelse'\n" + + "line 1:38 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 1:38 reportContextSensitivity d=1 (stat), input='else'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testFullContextIF_THEN_ELSEParse_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s \n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append("@after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '{' stat* '}' ;\n"); + grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n"); + grammarBuilder.append(" | 'return'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input = + "{ if x then return else foo\n" + + "if x then if y then return else foo }"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-'}'->:s2=>2\n" + + "s0-'else'->:s1^=>1\n", found); + + assertEquals( + "line 1:19 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 1:19 reportContextSensitivity d=1 (stat), input='else'\n" + + "line 2:27 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 2:36 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testFullContextIF_THEN_ELSEParse_6() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s \n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append("@after {this.dumpDFA();}\n"); + grammarBuilder.append(" : '{' stat* '}' ;\n"); + grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n"); + grammarBuilder.append(" | 'return'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input = + "{ if x then return else foo\n" + + "if x then if y then return else foo }"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 1:\n" + + "s0-'}'->:s2=>2\n" + + "s0-'else'->:s1^=>1\n", found); + + assertEquals( + "line 1:19 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 1:19 reportContextSensitivity d=1 (stat), input='else'\n" + + "line 2:27 reportAttemptingFullContext d=1 (stat), input='else'\n" + + "line 2:36 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLoopsSimulateTailRecursion() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(324); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("prog\n"); + grammarBuilder.append("@init {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;}\n"); + grammarBuilder.append(" : expr_or_assign*;\n"); + grammarBuilder.append("expr_or_assign\n"); + grammarBuilder.append(" : expr '++' {console.log(\"fail.\");}\n"); + grammarBuilder.append(" | expr {console.log(\"pass: \"+$expr.text);}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: expr_primary ('<-' ID)?;\n"); + grammarBuilder.append("expr_primary\n"); + grammarBuilder.append(" : '(' ID ')'\n"); + grammarBuilder.append(" | ID '(' ID ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : [a-z]+ ;"); + String grammar = grammarBuilder.toString(); + String input ="a(i)<-x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "prog", input, true); + assertEquals("pass: a(i)<-x\n", found); + + assertEquals( + "line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)'\n" + + "line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)<-x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSLLSeesEOFInLLGrammar() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(149); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {this.dumpDFA();}\n"); + grammarBuilder.append(" : a;\n"); + grammarBuilder.append("a : e ID ;\n"); + grammarBuilder.append("b : e INT ID ;\n"); + grammarBuilder.append("e : INT | ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="34 abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "Decision 0:\n" + + "s0-INT->s1\n" + + "s1-ID->:s2^=>1\n", found); + + assertEquals( + "line 1:3 reportAttemptingFullContext d=0 (e), input='34abc'\n" + + "line 1:0 reportContextSensitivity d=0 (e), input='34'\n", this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java new file mode 100644 index 000000000..53fb15efb --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java @@ -0,0 +1,3066 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestLeftRecursion extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbigLR_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(705); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog: stat ;\n"); + grammarBuilder.append("stat: expr NEWLINE # printExpr\n"); + grammarBuilder.append(" | ID '=' expr NEWLINE # assign\n"); + grammarBuilder.append(" | NEWLINE # blank\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: expr ('*'|'/') expr # MulDiv\n"); + grammarBuilder.append(" | expr ('+'|'-') expr # AddSub\n"); + grammarBuilder.append(" | INT # int\n"); + grammarBuilder.append(" | ID # id\n"); + grammarBuilder.append(" | '(' expr ')' # parens\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("MUL : '*' ; // assigns token name to '*' used above in grammar\n"); + grammarBuilder.append("DIV : '/' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("SUB : '-' ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ; // match identifiers\n"); + grammarBuilder.append("INT : [0-9]+ ; // match integers\n"); + grammarBuilder.append("NEWLINE:'\\r'? '\\n' ; // return newlines to parser (is end-statement signal)\n"); + grammarBuilder.append("WS : [ \\t]+ -> skip ; // toss out whitespace"); + String grammar = grammarBuilder.toString(); + String input ="1\n"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbigLR_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(705); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog: stat ;\n"); + grammarBuilder.append("stat: expr NEWLINE # printExpr\n"); + grammarBuilder.append(" | ID '=' expr NEWLINE # assign\n"); + grammarBuilder.append(" | NEWLINE # blank\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: expr ('*'|'/') expr # MulDiv\n"); + grammarBuilder.append(" | expr ('+'|'-') expr # AddSub\n"); + grammarBuilder.append(" | INT # int\n"); + grammarBuilder.append(" | ID # id\n"); + grammarBuilder.append(" | '(' expr ')' # parens\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("MUL : '*' ; // assigns token name to '*' used above in grammar\n"); + grammarBuilder.append("DIV : '/' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("SUB : '-' ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ; // match identifiers\n"); + grammarBuilder.append("INT : [0-9]+ ; // match integers\n"); + grammarBuilder.append("NEWLINE:'\\r'? '\\n' ; // return newlines to parser (is end-statement signal)\n"); + grammarBuilder.append("WS : [ \\t]+ -> skip ; // toss out whitespace"); + String grammar = grammarBuilder.toString(); + String input ="a = 5\n"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbigLR_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(705); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog: stat ;\n"); + grammarBuilder.append("stat: expr NEWLINE # printExpr\n"); + grammarBuilder.append(" | ID '=' expr NEWLINE # assign\n"); + grammarBuilder.append(" | NEWLINE # blank\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: expr ('*'|'/') expr # MulDiv\n"); + grammarBuilder.append(" | expr ('+'|'-') expr # AddSub\n"); + grammarBuilder.append(" | INT # int\n"); + grammarBuilder.append(" | ID # id\n"); + grammarBuilder.append(" | '(' expr ')' # parens\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("MUL : '*' ; // assigns token name to '*' used above in grammar\n"); + grammarBuilder.append("DIV : '/' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("SUB : '-' ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ; // match identifiers\n"); + grammarBuilder.append("INT : [0-9]+ ; // match integers\n"); + grammarBuilder.append("NEWLINE:'\\r'? '\\n' ; // return newlines to parser (is end-statement signal)\n"); + grammarBuilder.append("WS : [ \\t]+ -> skip ; // toss out whitespace"); + String grammar = grammarBuilder.toString(); + String input ="b = 6\n"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbigLR_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(705); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog: stat ;\n"); + grammarBuilder.append("stat: expr NEWLINE # printExpr\n"); + grammarBuilder.append(" | ID '=' expr NEWLINE # assign\n"); + grammarBuilder.append(" | NEWLINE # blank\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: expr ('*'|'/') expr # MulDiv\n"); + grammarBuilder.append(" | expr ('+'|'-') expr # AddSub\n"); + grammarBuilder.append(" | INT # int\n"); + grammarBuilder.append(" | ID # id\n"); + grammarBuilder.append(" | '(' expr ')' # parens\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("MUL : '*' ; // assigns token name to '*' used above in grammar\n"); + grammarBuilder.append("DIV : '/' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("SUB : '-' ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ; // match identifiers\n"); + grammarBuilder.append("INT : [0-9]+ ; // match integers\n"); + grammarBuilder.append("NEWLINE:'\\r'? '\\n' ; // return newlines to parser (is end-statement signal)\n"); + grammarBuilder.append("WS : [ \\t]+ -> skip ; // toss out whitespace"); + String grammar = grammarBuilder.toString(); + String input ="a+b*2\n"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAmbigLR_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(705); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog: stat ;\n"); + grammarBuilder.append("stat: expr NEWLINE # printExpr\n"); + grammarBuilder.append(" | ID '=' expr NEWLINE # assign\n"); + grammarBuilder.append(" | NEWLINE # blank\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expr: expr ('*'|'/') expr # MulDiv\n"); + grammarBuilder.append(" | expr ('+'|'-') expr # AddSub\n"); + grammarBuilder.append(" | INT # int\n"); + grammarBuilder.append(" | ID # id\n"); + grammarBuilder.append(" | '(' expr ')' # parens\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("MUL : '*' ; // assigns token name to '*' used above in grammar\n"); + grammarBuilder.append("DIV : '/' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("SUB : '-' ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ; // match identifiers\n"); + grammarBuilder.append("INT : [0-9]+ ; // match integers\n"); + grammarBuilder.append("NEWLINE:'\\r'? '\\n' ; // return newlines to parser (is end-statement signal)\n"); + grammarBuilder.append("WS : [ \\t]+ -> skip ; // toss out whitespace"); + String grammar = grammarBuilder.toString(); + String input ="(1+2)*3\n"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator a) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_10() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(*a)[]"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator (declarator ( (declarator * (declarator a)) )) [ ]) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="*a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator * (declarator a)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="**a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator * (declarator * (declarator a))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a[3]"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator (declarator a) [ (e 3) ]) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b[]"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator (declarator b) [ ]) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_6() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(a)"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator ( (declarator a) )) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_7() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a[]()"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator (declarator (declarator a) [ ]) ( )) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_8() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a[][]"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator (declarator (declarator a) [ ]) [ ]) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDeclarations_9() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(398); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : declarator EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("declarator\n"); + grammarBuilder.append(" : declarator '[' e ']'\n"); + grammarBuilder.append(" | declarator '[' ']'\n"); + grammarBuilder.append(" | declarator '(' ')'\n"); + grammarBuilder.append(" | '*' declarator // binds less tight than suffixes\n"); + grammarBuilder.append(" | '(' declarator ')'\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : INT ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="*a[]"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (declarator * (declarator (declarator a) [ ])) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDirectCallToLeftRecursiveRule_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(126); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a @after {console.log($ctx.toStringTree(null, this));} : a ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("(a x)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDirectCallToLeftRecursiveRule_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(126); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a @after {console.log($ctx.toStringTree(null, this));} : a ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("(a (a x) y)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDirectCallToLeftRecursiveRule_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(126); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a @after {console.log($ctx.toStringTree(null, this));} : a ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y z"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("(a (a (a x) y) z)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e a) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e 1) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a-1"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) - (e 1)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a.b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) . b) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a.this"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) . this) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_6() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="-a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e - (e a)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressions_7() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(257); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("e : e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | '-' e\n"); + grammarBuilder.append(" | e '*' e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="-a+b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e - (e a)) + (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a|b&c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) | (e (e b) & (e c))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_10() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a.f(x)==T.c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e (e (e a) . f) ( (expressionList (e x)) )) == (e (e T) . c)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_11() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a.f().g(x,1)"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e (e (e (e a) . f) ( )) . g) ( (expressionList (e x) , (e 1)) )) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_12() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="new T[((n-1) * x) + 1]"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e new (typespec T) [ (e (e ( (e (e ( (e (e n) - (e 1)) )) * (e x)) )) + (e 1)) ]) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(a|b)&c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e ( (e (e a) | (e b)) )) & (e c)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a > b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) > (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a >> b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) >> (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a=b=c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) = (e (e b) = (e c))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_6() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a^b^c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ^ (e (e b) ^ (e c))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_7() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(T)x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e ( (typespec T) ) (e x)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_8() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="new A().b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e new (typespec A) ( )) . b) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testJavaExpressions_9() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(1254); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow\n"); + grammarBuilder.append("expressionList\n"); + grammarBuilder.append(" : e (',' e)*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("e : '(' e ')'\n"); + grammarBuilder.append(" | 'this'\n"); + grammarBuilder.append(" | 'super'\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" | typespec '.' 'class'\n"); + grammarBuilder.append(" | e '.' ID\n"); + grammarBuilder.append(" | e '.' 'this'\n"); + grammarBuilder.append(" | e '.' 'super' '(' expressionList? ')'\n"); + grammarBuilder.append(" | e '.' 'new' ID '(' expressionList? ')'\n"); + grammarBuilder.append(" | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)\n"); + grammarBuilder.append(" | e '[' e ']'\n"); + grammarBuilder.append(" | '(' typespec ')' e\n"); + grammarBuilder.append(" | e ('++' | '--')\n"); + grammarBuilder.append(" | e '(' expressionList? ')'\n"); + grammarBuilder.append(" | ('+'|'-'|'++'|'--') e\n"); + grammarBuilder.append(" | ('~'|'!') e\n"); + grammarBuilder.append(" | e ('*'|'/'|'%') e\n"); + grammarBuilder.append(" | e ('+'|'-') e\n"); + grammarBuilder.append(" | e ('<<' | '>>>' | '>>') e\n"); + grammarBuilder.append(" | e ('<=' | '>=' | '>' | '<') e\n"); + grammarBuilder.append(" | e 'instanceof' e\n"); + grammarBuilder.append(" | e ('==' | '!=') e\n"); + grammarBuilder.append(" | e '&' e\n"); + grammarBuilder.append(" | e '^' e\n"); + grammarBuilder.append(" | e '|' e\n"); + grammarBuilder.append(" | e '&&' e\n"); + grammarBuilder.append(" | e '||' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" |\n"); + grammarBuilder.append(" e ('='\n"); + grammarBuilder.append(" |'+='\n"); + grammarBuilder.append(" |'-='\n"); + grammarBuilder.append(" |'*='\n"); + grammarBuilder.append(" |'/='\n"); + grammarBuilder.append(" |'&='\n"); + grammarBuilder.append(" |'|='\n"); + grammarBuilder.append(" |'^='\n"); + grammarBuilder.append(" |'>>='\n"); + grammarBuilder.append(" |'>>>='\n"); + grammarBuilder.append(" |'<<='\n"); + grammarBuilder.append(" |'%=') e\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("typespec\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | ID '[' ']'\n"); + grammarBuilder.append(" | 'int'\n"); + grammarBuilder.append(" | 'int' '[' ']'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(T)t.f()"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e ( (typespec T) ) (e (e t) . f)) ( )) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLabelsOnOpSubrule_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(177); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}\n"); + grammarBuilder.append(" | INT {}\n"); + grammarBuilder.append(" | '(' x=e ')' {}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e 4))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLabelsOnOpSubrule_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(177); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}\n"); + grammarBuilder.append(" | INT {}\n"); + grammarBuilder.append(" | '(' x=e ')' {}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1*2/3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e (e 1) * (e 2)) / (e 3)))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLabelsOnOpSubrule_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(177); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}\n"); + grammarBuilder.append(" | INT {}\n"); + grammarBuilder.append(" | '(' x=e ')' {}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(1/2)*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e ( (e (e 1) / (e 2)) )) * (e 3)))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleActionsPredicatesOptions_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e ;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{true}?\n"); + grammarBuilder.append(" | a=e op=('+'|'-') b=e {}{true}?\n"); + grammarBuilder.append(" | INT {}{}\n"); + grammarBuilder.append(" | '(' x=e ')' {}{}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e 4))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleActionsPredicatesOptions_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e ;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{true}?\n"); + grammarBuilder.append(" | a=e op=('+'|'-') b=e {}{true}?\n"); + grammarBuilder.append(" | INT {}{}\n"); + grammarBuilder.append(" | '(' x=e ')' {}{}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1*2/3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e (e 1) * (e 2)) / (e 3)))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleActionsPredicatesOptions_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e ;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{true}?\n"); + grammarBuilder.append(" | a=e op=('+'|'-') b=e {}{true}?\n"); + grammarBuilder.append(" | INT {}{}\n"); + grammarBuilder.append(" | '(' x=e ')' {}{}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(1/2)*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e ( (e (e 1) / (e 2)) )) * (e 3)))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleActions_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(184); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e ;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{}\n"); + grammarBuilder.append(" | INT {}{}\n"); + grammarBuilder.append(" | '(' x=e ')' {}{}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e 4))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleActions_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(184); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e ;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{}\n"); + grammarBuilder.append(" | INT {}{}\n"); + grammarBuilder.append(" | '(' x=e ')' {}{}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1*2/3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e (e 1) * (e 2)) / (e 3)))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleActions_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(184); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e ;\n"); + grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{}\n"); + grammarBuilder.append(" | INT {}{}\n"); + grammarBuilder.append(" | '(' x=e ')' {}{}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="(1/2)*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e ( (e (e 1) / (e 2)) )) * (e 3)))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleAlternativesWithCommonLabel_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(639); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);};\n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : e '*' e {$v = $ctx.e(0).v * $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | e '+' e {$v = $ctx.e(0).v + $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n"); + grammarBuilder.append(" | left=e INC {console.assert($ctx.INC() != null);$v = $left.v + 1;} # unary\n"); + grammarBuilder.append(" | left=e DEC {console.assert($ctx.DEC() != null);$v = $left.v - 1;} # unary\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("INC : '++' ;\n"); + grammarBuilder.append("DEC : '--' ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("4\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleAlternativesWithCommonLabel_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(639); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);};\n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : e '*' e {$v = $ctx.e(0).v * $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | e '+' e {$v = $ctx.e(0).v + $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n"); + grammarBuilder.append(" | left=e INC {console.assert($ctx.INC() != null);$v = $left.v + 1;} # unary\n"); + grammarBuilder.append(" | left=e DEC {console.assert($ctx.DEC() != null);$v = $left.v - 1;} # unary\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("INC : '++' ;\n"); + grammarBuilder.append("DEC : '--' ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1+2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleAlternativesWithCommonLabel_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(639); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);};\n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : e '*' e {$v = $ctx.e(0).v * $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | e '+' e {$v = $ctx.e(0).v + $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n"); + grammarBuilder.append(" | left=e INC {console.assert($ctx.INC() != null);$v = $left.v + 1;} # unary\n"); + grammarBuilder.append(" | left=e DEC {console.assert($ctx.DEC() != null);$v = $left.v - 1;} # unary\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("INC : '++' ;\n"); + grammarBuilder.append("DEC : '--' ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1+2*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("7\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleAlternativesWithCommonLabel_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(639); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);};\n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : e '*' e {$v = $ctx.e(0).v * $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | e '+' e {$v = $ctx.e(0).v + $ctx.e(1).v;} # binary\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n"); + grammarBuilder.append(" | left=e INC {console.assert($ctx.INC() != null);$v = $left.v + 1;} # unary\n"); + grammarBuilder.append(" | left=e DEC {console.assert($ctx.DEC() != null);$v = $left.v - 1;} # unary\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("INC : '++' ;\n"); + grammarBuilder.append("DEC : '--' ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="i++*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("12\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPrecedenceFilterConsidersContext() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(149); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("prog \n"); + grammarBuilder.append("@after {console.log($ctx.toStringTree(null, this));}\n"); + grammarBuilder.append(": statement* EOF {};\n"); + grammarBuilder.append("statement: letterA | statement letterA 'b' ;\n"); + grammarBuilder.append("letterA: 'a';"); + String grammar = grammarBuilder.toString(); + String input ="aa"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "prog", input, false); + assertEquals("(prog (statement (letterA a)) (statement (letterA a)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPrefixOpWithActionAndLabel_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(336); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.result);} ;\n"); + grammarBuilder.append("e returns [String result]\n"); + grammarBuilder.append(" : ID '=' e1=e {$result = \"(\" + $ID.text + \"=\" + $e1.result + \")\";}\n"); + grammarBuilder.append(" | ID {$result = $ID.text;}\n"); + grammarBuilder.append(" | e1=e '+' e2=e {$result = \"(\" + $e1.result + \"+\" + $e2.result + \")\";}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPrefixOpWithActionAndLabel_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(336); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.result);} ;\n"); + grammarBuilder.append("e returns [String result]\n"); + grammarBuilder.append(" : ID '=' e1=e {$result = \"(\" + $ID.text + \"=\" + $e1.result + \")\";}\n"); + grammarBuilder.append(" | ID {$result = $ID.text;}\n"); + grammarBuilder.append(" | e1=e '+' e2=e {$result = \"(\" + $e1.result + \"+\" + $e2.result + \")\";}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a+b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a+b)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPrefixOpWithActionAndLabel_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(336); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.result);} ;\n"); + grammarBuilder.append("e returns [String result]\n"); + grammarBuilder.append(" : ID '=' e1=e {$result = \"(\" + $ID.text + \"=\" + $e1.result + \")\";}\n"); + grammarBuilder.append(" | ID {$result = $ID.text;}\n"); + grammarBuilder.append(" | e1=e '+' e2=e {$result = \"(\" + $e1.result + \"+\" + $e2.result + \")\";}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a=b+c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("((a=b)+c)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsAndLabels_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(454); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : q=e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;} # parens\n"); + grammarBuilder.append(" | x=e '++' {$v = $x.v+1;} # inc\n"); + grammarBuilder.append(" | e '--' # dec\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ; \n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("4\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsAndLabels_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(454); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : q=e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;} # parens\n"); + grammarBuilder.append(" | x=e '++' {$v = $x.v+1;} # inc\n"); + grammarBuilder.append(" | e '--' # dec\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ; \n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1+2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsAndLabels_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(454); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : q=e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;} # parens\n"); + grammarBuilder.append(" | x=e '++' {$v = $x.v+1;} # inc\n"); + grammarBuilder.append(" | e '--' # dec\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ; \n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1+2*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("7\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsAndLabels_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(454); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : q=e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v]\n"); + grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n"); + grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;} # parens\n"); + grammarBuilder.append(" | x=e '++' {$v = $x.v+1;} # inc\n"); + grammarBuilder.append(" | e '--' # dec\n"); + grammarBuilder.append(" | ID {$v = 3;} # anID\n"); + grammarBuilder.append(" ; \n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="i++*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("12\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList1_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(307); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a*b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr (expr a) * (expr b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList1_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(307); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a,c>>x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr (expr a) , (expr c) >> (expr x)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList1_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(307); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr x) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList1_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(307); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a*b,c,x*y>>r"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr (expr (expr a) * (expr b)) , (expr c) , (expr (expr x) * (expr y)) >> (expr r)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList2_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(324); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n"); + grammarBuilder.append(" | b+=expr '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a*b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr (expr a) * (expr b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList2_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(324); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n"); + grammarBuilder.append(" | b+=expr '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a,c>>x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr (expr (expr a) , (expr c)) >> (expr x)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList2_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(324); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n"); + grammarBuilder.append(" | b+=expr '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr x) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActionsList2_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(324); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : expr EOF;\n"); + grammarBuilder.append("expr:\n"); + grammarBuilder.append(" a=expr '*' a=expr #Factor\n"); + grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n"); + grammarBuilder.append(" | b+=expr '>>' c=expr #Send\n"); + grammarBuilder.append(" | ID #JustId //semantic check on modifiers\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : ('a'..'z'|'A'..'Z'|'_')\n"); + grammarBuilder.append(" ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a*b,c,x*y>>r"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (expr (expr (expr (expr (expr a) * (expr b)) , (expr c)) , (expr (expr x) * (expr y))) >> (expr r)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActions_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v, list ignored]\n"); + grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n"); + grammarBuilder.append(" | INT {$v = $INT.int;}\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("4\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActions_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v, list ignored]\n"); + grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n"); + grammarBuilder.append(" | INT {$v = $INT.int;}\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="1+2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActions_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v, list ignored]\n"); + grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n"); + grammarBuilder.append(" | INT {$v = $INT.int;}\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="1+2*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("7\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReturnValueAndActions_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(246); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e {console.log($e.v);}; \n"); + grammarBuilder.append("e returns [int v, list ignored]\n"); + grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n"); + grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n"); + grammarBuilder.append(" | INT {$v = $INT.int;}\n"); + grammarBuilder.append(" | '(' x=e ')' {$v = $x.v;}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="(1+2)*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("9\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSemPred() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(142); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : a ;\n"); + grammarBuilder.append("a : a {true}? ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y z"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (a (a (a x) y) z))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSemPredFailOption() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(166); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : a ;\n"); + grammarBuilder.append("a : a ID {false}?\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y z"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (a (a x) y z))\n", found); + + assertEquals("line 1:4 rule a custom message\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSimple_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(134); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : a ;\n"); + grammarBuilder.append("a : a ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (a x))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSimple_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(134); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : a ;\n"); + grammarBuilder.append("a : a ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (a (a x) y))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSimple_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(134); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : a ;\n"); + grammarBuilder.append("a : a ID\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y z"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (a (a (a x) y) z))\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e a) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a+b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) + (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a*b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) * (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b:c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e b) : (e c)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a=b=c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) = (e (e b) = (e c))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_6() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b+c:d"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e (e b) + (e c)) : (e d)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_7() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b=c:d"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e (e b) = (e c)) : (e d)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_8() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a? b?c:d : e"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e (e b) ? (e c) : (e d)) : (e e)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExprExplicitAssociativity_9() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(290); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b: c?d:e"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e b) : (e (e c) ? (e d) : (e e))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e a) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a+b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) + (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a*b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) * (e b)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b:c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e b) : (e c)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_5() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a=b=c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) = (e (e b) = (e c))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_6() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b+c:d"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e (e b) + (e c)) : (e d)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_7() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b=c:d"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e (e b) = (e c)) : (e d)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_8() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a? b?c:d : e"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e (e b) ? (e c) : (e d)) : (e e)) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTernaryExpr_9() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s @after {console.log($ctx.toStringTree(null, this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n"); + grammarBuilder.append("e : e '*' e\n"); + grammarBuilder.append(" | e '+' e\n"); + grammarBuilder.append(" | e '?' e ':' e\n"); + grammarBuilder.append(" | e '=' e\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a?b: c?d:e"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(s (e (e a) ? (e b) : (e (e c) ? (e d) : (e e))) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testWhitespaceInfluence_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(2763); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog : expression EOF;\n"); + grammarBuilder.append("expression\n"); + grammarBuilder.append(" : ID '(' expression (',' expression)* ')' # doFunction\n"); + grammarBuilder.append(" | '(' expression ')' # doParenthesis\n"); + grammarBuilder.append(" | '!' expression # doNot\n"); + grammarBuilder.append(" | '-' expression # doNegate\n"); + grammarBuilder.append(" | '+' expression # doPositiv\n"); + grammarBuilder.append(" | expression '^' expression # doPower\n"); + grammarBuilder.append(" | expression '*' expression # doMultipy\n"); + grammarBuilder.append(" | expression '/' expression # doDivide\n"); + grammarBuilder.append(" | expression '%' expression # doModulo\n"); + grammarBuilder.append(" | expression '-' expression # doMinus\n"); + grammarBuilder.append(" | expression '+' expression # doPlus\n"); + grammarBuilder.append(" | expression '=' expression # doEqual\n"); + grammarBuilder.append(" | expression '!=' expression # doNotEqual\n"); + grammarBuilder.append(" | expression '>' expression # doGreather\n"); + grammarBuilder.append(" | expression '>=' expression # doGreatherEqual\n"); + grammarBuilder.append(" | expression '<' expression # doLesser\n"); + grammarBuilder.append(" | expression '<=' expression # doLesserEqual\n"); + grammarBuilder.append(" | expression K_IN '(' expression (',' expression)* ')' # doIn\n"); + grammarBuilder.append(" | expression ( '&' | K_AND) expression # doAnd\n"); + grammarBuilder.append(" | expression ( '|' | K_OR) expression # doOr\n"); + grammarBuilder.append(" | '[' expression (',' expression)* ']' # newArray\n"); + grammarBuilder.append(" | K_TRUE # newTrueBoolean\n"); + grammarBuilder.append(" | K_FALSE # newFalseBoolean\n"); + grammarBuilder.append(" | NUMBER # newNumber\n"); + grammarBuilder.append(" | DATE # newDateTime\n"); + grammarBuilder.append(" | ID # newIdentifier\n"); + grammarBuilder.append(" | SQ_STRING # newString\n"); + grammarBuilder.append(" | K_NULL # newNull\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("// Fragments\n"); + grammarBuilder.append("fragment DIGIT : '0' .. '9'; \n"); + grammarBuilder.append("fragment UPPER : 'A' .. 'Z';\n"); + grammarBuilder.append("fragment LOWER : 'a' .. 'z';\n"); + grammarBuilder.append("fragment LETTER : LOWER | UPPER;\n"); + grammarBuilder.append("fragment WORD : LETTER | '_' | '$' | '#' | '.';\n"); + grammarBuilder.append("fragment ALPHANUM : WORD | DIGIT; \n"); + grammarBuilder.append("\n"); + grammarBuilder.append("// Tokens\n"); + grammarBuilder.append("ID : LETTER ALPHANUM*;\n"); + grammarBuilder.append("NUMBER : DIGIT+ ('.' DIGIT+)? (('e'|'E')('+'|'-')? DIGIT+)?;\n"); + grammarBuilder.append("DATE : '\\'' DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT (' ' DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT ('.' DIGIT+)?)? '\\'';\n"); + grammarBuilder.append("SQ_STRING : '\\'' ('\\'\\'' | ~'\\'')* '\\'';\n"); + grammarBuilder.append("DQ_STRING : '\"' ('\\\\\"' | ~'\"')* '\"';\n"); + grammarBuilder.append("WS : [ \\t\\n\\r]+ -> skip ;\n"); + grammarBuilder.append("COMMENTS : ('/*' .*? '*/' | '//' ~'\\n'* '\\n' ) -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="Test(1,3)"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testWhitespaceInfluence_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(2763); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("prog : expression EOF;\n"); + grammarBuilder.append("expression\n"); + grammarBuilder.append(" : ID '(' expression (',' expression)* ')' # doFunction\n"); + grammarBuilder.append(" | '(' expression ')' # doParenthesis\n"); + grammarBuilder.append(" | '!' expression # doNot\n"); + grammarBuilder.append(" | '-' expression # doNegate\n"); + grammarBuilder.append(" | '+' expression # doPositiv\n"); + grammarBuilder.append(" | expression '^' expression # doPower\n"); + grammarBuilder.append(" | expression '*' expression # doMultipy\n"); + grammarBuilder.append(" | expression '/' expression # doDivide\n"); + grammarBuilder.append(" | expression '%' expression # doModulo\n"); + grammarBuilder.append(" | expression '-' expression # doMinus\n"); + grammarBuilder.append(" | expression '+' expression # doPlus\n"); + grammarBuilder.append(" | expression '=' expression # doEqual\n"); + grammarBuilder.append(" | expression '!=' expression # doNotEqual\n"); + grammarBuilder.append(" | expression '>' expression # doGreather\n"); + grammarBuilder.append(" | expression '>=' expression # doGreatherEqual\n"); + grammarBuilder.append(" | expression '<' expression # doLesser\n"); + grammarBuilder.append(" | expression '<=' expression # doLesserEqual\n"); + grammarBuilder.append(" | expression K_IN '(' expression (',' expression)* ')' # doIn\n"); + grammarBuilder.append(" | expression ( '&' | K_AND) expression # doAnd\n"); + grammarBuilder.append(" | expression ( '|' | K_OR) expression # doOr\n"); + grammarBuilder.append(" | '[' expression (',' expression)* ']' # newArray\n"); + grammarBuilder.append(" | K_TRUE # newTrueBoolean\n"); + grammarBuilder.append(" | K_FALSE # newFalseBoolean\n"); + grammarBuilder.append(" | NUMBER # newNumber\n"); + grammarBuilder.append(" | DATE # newDateTime\n"); + grammarBuilder.append(" | ID # newIdentifier\n"); + grammarBuilder.append(" | SQ_STRING # newString\n"); + grammarBuilder.append(" | K_NULL # newNull\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("// Fragments\n"); + grammarBuilder.append("fragment DIGIT : '0' .. '9'; \n"); + grammarBuilder.append("fragment UPPER : 'A' .. 'Z';\n"); + grammarBuilder.append("fragment LOWER : 'a' .. 'z';\n"); + grammarBuilder.append("fragment LETTER : LOWER | UPPER;\n"); + grammarBuilder.append("fragment WORD : LETTER | '_' | '$' | '#' | '.';\n"); + grammarBuilder.append("fragment ALPHANUM : WORD | DIGIT; \n"); + grammarBuilder.append("\n"); + grammarBuilder.append("// Tokens\n"); + grammarBuilder.append("ID : LETTER ALPHANUM*;\n"); + grammarBuilder.append("NUMBER : DIGIT+ ('.' DIGIT+)? (('e'|'E')('+'|'-')? DIGIT+)?;\n"); + grammarBuilder.append("DATE : '\\'' DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT (' ' DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT ('.' DIGIT+)?)? '\\'';\n"); + grammarBuilder.append("SQ_STRING : '\\'' ('\\'\\'' | ~'\\'')* '\\'';\n"); + grammarBuilder.append("DQ_STRING : '\"' ('\\\\\"' | ~'\"')* '\"';\n"); + grammarBuilder.append("WS : [ \\t\\n\\r]+ -> skip ;\n"); + grammarBuilder.append("COMMENTS : ('/*' .*? '*/' | '//' ~'\\n'* '\\n' ) -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="Test(1, 3)"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "prog", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java new file mode 100644 index 000000000..7ab3cfddd --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java @@ -0,0 +1,235 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestLexerErrors extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDFAToATNThatFailsBackToDFA() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(39); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'ab' ;\n"); + grammarBuilder.append("B : 'abc' ;"); + String grammar = grammarBuilder.toString(); + String input ="ababx"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,2:3='ab',<1>,1:2]\n" + + "[@2,5:4='',<-1>,1:5]\n", found); + + assertEquals("line 1:4 token recognition error at: 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDFAToATNThatMatchesThenFailsInATN() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(52); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'ab' ;\n"); + grammarBuilder.append("B : 'abc' ;\n"); + grammarBuilder.append("C : 'abcd' ;"); + String grammar = grammarBuilder.toString(); + String input ="ababcx"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,2:4='abc',<2>,1:2]\n" + + "[@2,6:5='',<-1>,1:6]\n", found); + + assertEquals("line 1:5 token recognition error at: 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEnforcedGreedyNestedBrances_1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(77); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ACTION : '{' (ACTION | ~[{}])* '}';\n"); + grammarBuilder.append("WS : [ \\r\\n\\t]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="{ { } }"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:6='{ { } }',<1>,1:0]\n" + + "[@1,7:6='',<-1>,1:7]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEnforcedGreedyNestedBrances_2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(77); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ACTION : '{' (ACTION | ~[{}])* '}';\n"); + grammarBuilder.append("WS : [ \\r\\n\\t]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="{ { }"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals("[@0,5:4='',<-1>,1:5]\n", found); + + assertEquals("line 1:0 token recognition error at: '{ { }'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testErrorInMiddle() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(28); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'abc' ;"); + String grammar = grammarBuilder.toString(); + String input ="abx"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals("[@0,3:2='',<-1>,1:3]\n", found); + + assertEquals("line 1:0 token recognition error at: 'abx'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testInvalidCharAtStart() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(30); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'a' 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals("[@0,1:0='',<-1>,1:1]\n", found); + + assertEquals("line 1:0 token recognition error at: 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testInvalidCharAtStartAfterDFACache() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(30); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'a' 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="abx"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,3:2='',<-1>,1:3]\n", found); + + assertEquals("line 1:2 token recognition error at: 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testInvalidCharInToken() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(30); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'a' 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="ax"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals("[@0,2:1='',<-1>,1:2]\n", found); + + assertEquals("line 1:0 token recognition error at: 'ax'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testInvalidCharInTokenAfterDFACache() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(30); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'a' 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="abax"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,4:3='',<-1>,1:4]\n", found); + + assertEquals("line 1:2 token recognition error at: 'ax'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerExecDFA() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(98); + grammarBuilder.append("grammar L;\n"); + grammarBuilder.append("start : ID ':' expr;\n"); + grammarBuilder.append("expr : primary expr? {} | expr '->' ID;\n"); + grammarBuilder.append("primary : ID;\n"); + grammarBuilder.append("ID : [a-z]+;"); + String grammar = grammarBuilder.toString(); + String input ="x : x"; + String found = execLexer("L.g4", grammar, "LLexer", input, false); + assertEquals( + "[@0,0:0='x',<3>,1:0]\n" + + "[@1,2:2=':',<1>,1:2]\n" + + "[@2,4:4='x',<3>,1:4]\n" + + "[@3,5:4='',<-1>,1:5]\n", found); + + assertEquals( + "line 1:1 token recognition error at: ' '\n" + + "line 1:3 token recognition error at: ' '\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testStringsEmbeddedInActions_1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(109); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ACTION2 : '[' (STRING | ~'\"')*? ']';\n"); + grammarBuilder.append("STRING : '\"' ('\\\"' | .)*? '\"';\n"); + grammarBuilder.append("WS : [ \\t\\r\\n]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="[\"foo\"]"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:6='[\"foo\"]',<1>,1:0]\n" + + "[@1,7:6='',<-1>,1:7]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testStringsEmbeddedInActions_2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(109); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ACTION2 : '[' (STRING | ~'\"')*? ']';\n"); + grammarBuilder.append("STRING : '\"' ('\\\"' | .)*? '\"';\n"); + grammarBuilder.append("WS : [ \\t\\r\\n]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="[\"foo]"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals("[@0,6:5='',<-1>,1:6]\n", found); + + assertEquals("line 1:0 token recognition error at: '[\"foo]'\n", this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java new file mode 100644 index 000000000..7b353bea7 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java @@ -0,0 +1,4935 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestLexerExec extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testActionPlacement() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(263); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : ({console.log(\"stuff fail: \" + this.text);} 'a'\n"); + grammarBuilder.append("| {console.log(\"stuff0: \" + this.text);}\n"); + grammarBuilder.append(" 'a' {console.log(\"stuff1: \" + this.text);}\n"); + grammarBuilder.append(" 'b' {console.log(\"stuff2: \" + this.text);})\n"); + grammarBuilder.append(" {console.log(this.text);} ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + grammarBuilder.append("J : .;"); + String grammar = grammarBuilder.toString(); + String input ="ab"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "stuff0: \n" + + "stuff1: a\n" + + "stuff2: ab\n" + + "ab\n" + + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,2:1='',<-1>,1:2]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSet() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(79); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : '0'..'9'+ {console.log(\"I\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\u000D] -> skip ;"); + String grammar = grammarBuilder.toString(); + String input = + "34\n" + + " 34"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "I\n" + + "[@0,0:1='34',<1>,1:0]\n" + + "[@1,4:5='34',<1>,2:1]\n" + + "[@2,6:5='',<-1>,2:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetInSet() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(86); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : (~[ab \\n]|'a') {console.log(\"I\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a x"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "I\n" + + "[@0,0:0='a',<1>,1:0]\n" + + "[@1,2:2='x',<1>,1:2]\n" + + "[@2,3:2='',<-1>,1:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetNot() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(89); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : ~[ab \\n] ~[ \\ncd]* {console.log(\"I\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="xaf"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "[@0,0:2='xaf',<1>,1:0]\n" + + "[@1,3:2='',<-1>,1:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetPlus() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(80); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : '0'..'9'+ {console.log(\"I\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input = + "34\n" + + " 34"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "I\n" + + "[@0,0:1='34',<1>,1:0]\n" + + "[@1,4:5='34',<1>,2:1]\n" + + "[@2,6:5='',<-1>,2:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetRange() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(129); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : [0-9]+ {console.log(\"I\");} ;\n"); + grammarBuilder.append("ID : [a-zA-Z] [a-zA-Z0-9]* {console.log(\"ID\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\u0009\\r]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input = + "34\n" + + " 34 a2 abc \n" + + " "; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "I\n" + + "ID\n" + + "ID\n" + + "[@0,0:1='34',<1>,1:0]\n" + + "[@1,4:5='34',<1>,2:1]\n" + + "[@2,7:8='a2',<2>,2:4]\n" + + "[@3,10:12='abc',<2>,2:7]\n" + + "[@4,18:17='',<-1>,3:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetWithEscapedChar() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(88); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("DASHBRACK : [\\-\\]]+ {console.log(\"DASHBRACK\");} ;\n"); + grammarBuilder.append("WS : [ \\u]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="- ] "; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "DASHBRACK\n" + + "DASHBRACK\n" + + "[@0,0:0='-',<1>,1:0]\n" + + "[@1,2:2=']',<1>,1:2]\n" + + "[@2,4:3='',<-1>,1:4]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetWithMissingEndRange() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(76); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : [0-]+ {console.log(\"I\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="00\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "[@0,0:1='00',<1>,1:0]\n" + + "[@1,3:2='',<-1>,2:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetWithMissingEscapeChar() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(71); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : [0-9]+ {console.log(\"I\");} ;\n"); + grammarBuilder.append("WS : [ \\u]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="34 "; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "I\n" + + "[@0,0:1='34',<1>,1:0]\n" + + "[@1,3:2='',<-1>,1:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetWithQuote1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(74); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : [\"a-z]+ {console.log(\"A\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b\"a"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "A\n" + + "[@0,0:2='b\"a',<1>,1:0]\n" + + "[@1,3:2='',<-1>,1:3]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetWithQuote2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(75); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : [\"\\\\ab]+ {console.log(\"A\");} ;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="b\"\\a"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "A\n" + + "[@0,0:3='b\"\\a',<1>,1:0]\n" + + "[@1,4:3='',<-1>,1:4]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetWithReversedRange() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(72); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : [z-a9]+ {console.log(\"A\");} ;\n"); + grammarBuilder.append("WS : [ \\u]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="9"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "A\n" + + "[@0,0:0='9',<1>,1:0]\n" + + "[@1,1:0='',<-1>,1:1]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEOFByItself() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(38); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("DONE : EOF ;\n"); + grammarBuilder.append("A : 'a';"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:-1='',<1>,1:0]\n" + + "[@1,0:-1='',<-1>,1:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEOFSuffixInFirstRule_1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(48); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'a' EOF ;\n"); + grammarBuilder.append("B : 'a';\n"); + grammarBuilder.append("C : 'c';"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals("[@0,0:-1='',<-1>,1:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEOFSuffixInFirstRule_2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(48); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : 'a' EOF ;\n"); + grammarBuilder.append("B : 'a';\n"); + grammarBuilder.append("C : 'c';"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:0='a',<1>,1:0]\n" + + "[@1,1:0='',<-1>,1:1]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testGreedyClosure() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(60); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '//' .*? '\\n' CMT*;\n"); + grammarBuilder.append("WS : (' '|'\\t')+;"); + String grammar = grammarBuilder.toString(); + String input = + "//blah\n" + + "//blah\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" + + "[@1,14:13='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testGreedyConfigs() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(94); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : ('a' | 'ab') {console.log(this.text);} ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + grammarBuilder.append("J : .;"); + String grammar = grammarBuilder.toString(); + String input ="ab"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "ab\n" + + "[@0,0:1='ab',<1>,1:0]\n" + + "[@1,2:1='',<-1>,1:2]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testGreedyOptional() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(60); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '//' .*? '\\n' CMT?;\n"); + grammarBuilder.append("WS : (' '|'\\t')+;"); + String grammar = grammarBuilder.toString(); + String input = + "//blah\n" + + "//blah\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" + + "[@1,14:13='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testGreedyPositiveClosure() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(58); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : ('//' .*? '\\n')+;\n"); + grammarBuilder.append("WS : (' '|'\\t')+;"); + String grammar = grammarBuilder.toString(); + String input = + "//blah\n" + + "//blah\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:13='//blah\\n//blah\\n',<1>,1:0]\n" + + "[@1,14:13='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testHexVsID() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(265); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("HexLiteral : '0' ('x'|'X') HexDigit+ ;\n"); + grammarBuilder.append("DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) ;\n"); + grammarBuilder.append("FloatingPointLiteral : ('0x' | '0X') HexDigit* ('.' HexDigit*)? ;\n"); + grammarBuilder.append("DOT : '.' ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+;"); + String grammar = grammarBuilder.toString(); + String input ="x 0 1 a.b a.l"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:0='x',<5>,1:0]\n" + + "[@1,1:1=' ',<6>,1:1]\n" + + "[@2,2:2='0',<2>,1:2]\n" + + "[@3,3:3=' ',<6>,1:3]\n" + + "[@4,4:4='1',<2>,1:4]\n" + + "[@5,5:5=' ',<6>,1:5]\n" + + "[@6,6:6='a',<5>,1:6]\n" + + "[@7,7:7='.',<4>,1:7]\n" + + "[@8,8:8='b',<5>,1:8]\n" + + "[@9,9:9=' ',<6>,1:9]\n" + + "[@10,10:10='a',<5>,1:10]\n" + + "[@11,11:11='.',<4>,1:11]\n" + + "[@12,12:12='l',<5>,1:12]\n" + + "[@13,13:12='',<-1>,1:13]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testKeywordID() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(82); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("KEND : 'end' ; // has priority\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+;"); + String grammar = grammarBuilder.toString(); + String input ="end eend ending a"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:2='end',<1>,1:0]\n" + + "[@1,3:3=' ',<3>,1:3]\n" + + "[@2,4:7='eend',<2>,1:4]\n" + + "[@3,8:8=' ',<3>,1:8]\n" + + "[@4,9:14='ending',<2>,1:9]\n" + + "[@5,15:15=' ',<3>,1:15]\n" + + "[@6,16:16='a',<2>,1:16]\n" + + "[@7,17:16='',<-1>,1:17]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLargeLexer() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(85821); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("WS : [ \\t\\r\\n]+ -> skip;\n"); + grammarBuilder.append("KW0 : 'KW' '0';\n"); + grammarBuilder.append("KW1 : 'KW' '1';\n"); + grammarBuilder.append("KW2 : 'KW' '2';\n"); + grammarBuilder.append("KW3 : 'KW' '3';\n"); + grammarBuilder.append("KW4 : 'KW' '4';\n"); + grammarBuilder.append("KW5 : 'KW' '5';\n"); + grammarBuilder.append("KW6 : 'KW' '6';\n"); + grammarBuilder.append("KW7 : 'KW' '7';\n"); + grammarBuilder.append("KW8 : 'KW' '8';\n"); + grammarBuilder.append("KW9 : 'KW' '9';\n"); + grammarBuilder.append("KW10 : 'KW' '10';\n"); + grammarBuilder.append("KW11 : 'KW' '11';\n"); + grammarBuilder.append("KW12 : 'KW' '12';\n"); + grammarBuilder.append("KW13 : 'KW' '13';\n"); + grammarBuilder.append("KW14 : 'KW' '14';\n"); + grammarBuilder.append("KW15 : 'KW' '15';\n"); + grammarBuilder.append("KW16 : 'KW' '16';\n"); + grammarBuilder.append("KW17 : 'KW' '17';\n"); + grammarBuilder.append("KW18 : 'KW' '18';\n"); + grammarBuilder.append("KW19 : 'KW' '19';\n"); + grammarBuilder.append("KW20 : 'KW' '20';\n"); + grammarBuilder.append("KW21 : 'KW' '21';\n"); + grammarBuilder.append("KW22 : 'KW' '22';\n"); + grammarBuilder.append("KW23 : 'KW' '23';\n"); + grammarBuilder.append("KW24 : 'KW' '24';\n"); + grammarBuilder.append("KW25 : 'KW' '25';\n"); + grammarBuilder.append("KW26 : 'KW' '26';\n"); + grammarBuilder.append("KW27 : 'KW' '27';\n"); + grammarBuilder.append("KW28 : 'KW' '28';\n"); + grammarBuilder.append("KW29 : 'KW' '29';\n"); + grammarBuilder.append("KW30 : 'KW' '30';\n"); + grammarBuilder.append("KW31 : 'KW' '31';\n"); + grammarBuilder.append("KW32 : 'KW' '32';\n"); + grammarBuilder.append("KW33 : 'KW' '33';\n"); + grammarBuilder.append("KW34 : 'KW' '34';\n"); + grammarBuilder.append("KW35 : 'KW' '35';\n"); + grammarBuilder.append("KW36 : 'KW' '36';\n"); + grammarBuilder.append("KW37 : 'KW' '37';\n"); + grammarBuilder.append("KW38 : 'KW' '38';\n"); + grammarBuilder.append("KW39 : 'KW' '39';\n"); + grammarBuilder.append("KW40 : 'KW' '40';\n"); + grammarBuilder.append("KW41 : 'KW' '41';\n"); + grammarBuilder.append("KW42 : 'KW' '42';\n"); + grammarBuilder.append("KW43 : 'KW' '43';\n"); + grammarBuilder.append("KW44 : 'KW' '44';\n"); + grammarBuilder.append("KW45 : 'KW' '45';\n"); + grammarBuilder.append("KW46 : 'KW' '46';\n"); + grammarBuilder.append("KW47 : 'KW' '47';\n"); + grammarBuilder.append("KW48 : 'KW' '48';\n"); + grammarBuilder.append("KW49 : 'KW' '49';\n"); + grammarBuilder.append("KW50 : 'KW' '50';\n"); + grammarBuilder.append("KW51 : 'KW' '51';\n"); + grammarBuilder.append("KW52 : 'KW' '52';\n"); + grammarBuilder.append("KW53 : 'KW' '53';\n"); + grammarBuilder.append("KW54 : 'KW' '54';\n"); + grammarBuilder.append("KW55 : 'KW' '55';\n"); + grammarBuilder.append("KW56 : 'KW' '56';\n"); + grammarBuilder.append("KW57 : 'KW' '57';\n"); + grammarBuilder.append("KW58 : 'KW' '58';\n"); + grammarBuilder.append("KW59 : 'KW' '59';\n"); + grammarBuilder.append("KW60 : 'KW' '60';\n"); + grammarBuilder.append("KW61 : 'KW' '61';\n"); + grammarBuilder.append("KW62 : 'KW' '62';\n"); + grammarBuilder.append("KW63 : 'KW' '63';\n"); + grammarBuilder.append("KW64 : 'KW' '64';\n"); + grammarBuilder.append("KW65 : 'KW' '65';\n"); + grammarBuilder.append("KW66 : 'KW' '66';\n"); + grammarBuilder.append("KW67 : 'KW' '67';\n"); + grammarBuilder.append("KW68 : 'KW' '68';\n"); + grammarBuilder.append("KW69 : 'KW' '69';\n"); + grammarBuilder.append("KW70 : 'KW' '70';\n"); + grammarBuilder.append("KW71 : 'KW' '71';\n"); + grammarBuilder.append("KW72 : 'KW' '72';\n"); + grammarBuilder.append("KW73 : 'KW' '73';\n"); + grammarBuilder.append("KW74 : 'KW' '74';\n"); + grammarBuilder.append("KW75 : 'KW' '75';\n"); + grammarBuilder.append("KW76 : 'KW' '76';\n"); + grammarBuilder.append("KW77 : 'KW' '77';\n"); + grammarBuilder.append("KW78 : 'KW' '78';\n"); + grammarBuilder.append("KW79 : 'KW' '79';\n"); + grammarBuilder.append("KW80 : 'KW' '80';\n"); + grammarBuilder.append("KW81 : 'KW' '81';\n"); + grammarBuilder.append("KW82 : 'KW' '82';\n"); + grammarBuilder.append("KW83 : 'KW' '83';\n"); + grammarBuilder.append("KW84 : 'KW' '84';\n"); + grammarBuilder.append("KW85 : 'KW' '85';\n"); + grammarBuilder.append("KW86 : 'KW' '86';\n"); + grammarBuilder.append("KW87 : 'KW' '87';\n"); + grammarBuilder.append("KW88 : 'KW' '88';\n"); + grammarBuilder.append("KW89 : 'KW' '89';\n"); + grammarBuilder.append("KW90 : 'KW' '90';\n"); + grammarBuilder.append("KW91 : 'KW' '91';\n"); + grammarBuilder.append("KW92 : 'KW' '92';\n"); + grammarBuilder.append("KW93 : 'KW' '93';\n"); + grammarBuilder.append("KW94 : 'KW' '94';\n"); + grammarBuilder.append("KW95 : 'KW' '95';\n"); + grammarBuilder.append("KW96 : 'KW' '96';\n"); + grammarBuilder.append("KW97 : 'KW' '97';\n"); + grammarBuilder.append("KW98 : 'KW' '98';\n"); + grammarBuilder.append("KW99 : 'KW' '99';\n"); + grammarBuilder.append("KW100 : 'KW' '100';\n"); + grammarBuilder.append("KW101 : 'KW' '101';\n"); + grammarBuilder.append("KW102 : 'KW' '102';\n"); + grammarBuilder.append("KW103 : 'KW' '103';\n"); + grammarBuilder.append("KW104 : 'KW' '104';\n"); + grammarBuilder.append("KW105 : 'KW' '105';\n"); + grammarBuilder.append("KW106 : 'KW' '106';\n"); + grammarBuilder.append("KW107 : 'KW' '107';\n"); + grammarBuilder.append("KW108 : 'KW' '108';\n"); + grammarBuilder.append("KW109 : 'KW' '109';\n"); + grammarBuilder.append("KW110 : 'KW' '110';\n"); + grammarBuilder.append("KW111 : 'KW' '111';\n"); + grammarBuilder.append("KW112 : 'KW' '112';\n"); + grammarBuilder.append("KW113 : 'KW' '113';\n"); + grammarBuilder.append("KW114 : 'KW' '114';\n"); + grammarBuilder.append("KW115 : 'KW' '115';\n"); + grammarBuilder.append("KW116 : 'KW' '116';\n"); + grammarBuilder.append("KW117 : 'KW' '117';\n"); + grammarBuilder.append("KW118 : 'KW' '118';\n"); + grammarBuilder.append("KW119 : 'KW' '119';\n"); + grammarBuilder.append("KW120 : 'KW' '120';\n"); + grammarBuilder.append("KW121 : 'KW' '121';\n"); + grammarBuilder.append("KW122 : 'KW' '122';\n"); + grammarBuilder.append("KW123 : 'KW' '123';\n"); + grammarBuilder.append("KW124 : 'KW' '124';\n"); + grammarBuilder.append("KW125 : 'KW' '125';\n"); + grammarBuilder.append("KW126 : 'KW' '126';\n"); + grammarBuilder.append("KW127 : 'KW' '127';\n"); + grammarBuilder.append("KW128 : 'KW' '128';\n"); + grammarBuilder.append("KW129 : 'KW' '129';\n"); + grammarBuilder.append("KW130 : 'KW' '130';\n"); + grammarBuilder.append("KW131 : 'KW' '131';\n"); + grammarBuilder.append("KW132 : 'KW' '132';\n"); + grammarBuilder.append("KW133 : 'KW' '133';\n"); + grammarBuilder.append("KW134 : 'KW' '134';\n"); + grammarBuilder.append("KW135 : 'KW' '135';\n"); + grammarBuilder.append("KW136 : 'KW' '136';\n"); + grammarBuilder.append("KW137 : 'KW' '137';\n"); + grammarBuilder.append("KW138 : 'KW' '138';\n"); + grammarBuilder.append("KW139 : 'KW' '139';\n"); + grammarBuilder.append("KW140 : 'KW' '140';\n"); + grammarBuilder.append("KW141 : 'KW' '141';\n"); + grammarBuilder.append("KW142 : 'KW' '142';\n"); + grammarBuilder.append("KW143 : 'KW' '143';\n"); + grammarBuilder.append("KW144 : 'KW' '144';\n"); + grammarBuilder.append("KW145 : 'KW' '145';\n"); + grammarBuilder.append("KW146 : 'KW' '146';\n"); + grammarBuilder.append("KW147 : 'KW' '147';\n"); + grammarBuilder.append("KW148 : 'KW' '148';\n"); + grammarBuilder.append("KW149 : 'KW' '149';\n"); + grammarBuilder.append("KW150 : 'KW' '150';\n"); + grammarBuilder.append("KW151 : 'KW' '151';\n"); + grammarBuilder.append("KW152 : 'KW' '152';\n"); + grammarBuilder.append("KW153 : 'KW' '153';\n"); + grammarBuilder.append("KW154 : 'KW' '154';\n"); + grammarBuilder.append("KW155 : 'KW' '155';\n"); + grammarBuilder.append("KW156 : 'KW' '156';\n"); + grammarBuilder.append("KW157 : 'KW' '157';\n"); + grammarBuilder.append("KW158 : 'KW' '158';\n"); + grammarBuilder.append("KW159 : 'KW' '159';\n"); + grammarBuilder.append("KW160 : 'KW' '160';\n"); + grammarBuilder.append("KW161 : 'KW' '161';\n"); + grammarBuilder.append("KW162 : 'KW' '162';\n"); + grammarBuilder.append("KW163 : 'KW' '163';\n"); + grammarBuilder.append("KW164 : 'KW' '164';\n"); + grammarBuilder.append("KW165 : 'KW' '165';\n"); + grammarBuilder.append("KW166 : 'KW' '166';\n"); + grammarBuilder.append("KW167 : 'KW' '167';\n"); + grammarBuilder.append("KW168 : 'KW' '168';\n"); + grammarBuilder.append("KW169 : 'KW' '169';\n"); + grammarBuilder.append("KW170 : 'KW' '170';\n"); + grammarBuilder.append("KW171 : 'KW' '171';\n"); + grammarBuilder.append("KW172 : 'KW' '172';\n"); + grammarBuilder.append("KW173 : 'KW' '173';\n"); + grammarBuilder.append("KW174 : 'KW' '174';\n"); + grammarBuilder.append("KW175 : 'KW' '175';\n"); + grammarBuilder.append("KW176 : 'KW' '176';\n"); + grammarBuilder.append("KW177 : 'KW' '177';\n"); + grammarBuilder.append("KW178 : 'KW' '178';\n"); + grammarBuilder.append("KW179 : 'KW' '179';\n"); + grammarBuilder.append("KW180 : 'KW' '180';\n"); + grammarBuilder.append("KW181 : 'KW' '181';\n"); + grammarBuilder.append("KW182 : 'KW' '182';\n"); + grammarBuilder.append("KW183 : 'KW' '183';\n"); + grammarBuilder.append("KW184 : 'KW' '184';\n"); + grammarBuilder.append("KW185 : 'KW' '185';\n"); + grammarBuilder.append("KW186 : 'KW' '186';\n"); + grammarBuilder.append("KW187 : 'KW' '187';\n"); + grammarBuilder.append("KW188 : 'KW' '188';\n"); + grammarBuilder.append("KW189 : 'KW' '189';\n"); + grammarBuilder.append("KW190 : 'KW' '190';\n"); + grammarBuilder.append("KW191 : 'KW' '191';\n"); + grammarBuilder.append("KW192 : 'KW' '192';\n"); + grammarBuilder.append("KW193 : 'KW' '193';\n"); + grammarBuilder.append("KW194 : 'KW' '194';\n"); + grammarBuilder.append("KW195 : 'KW' '195';\n"); + grammarBuilder.append("KW196 : 'KW' '196';\n"); + grammarBuilder.append("KW197 : 'KW' '197';\n"); + grammarBuilder.append("KW198 : 'KW' '198';\n"); + grammarBuilder.append("KW199 : 'KW' '199';\n"); + grammarBuilder.append("KW200 : 'KW' '200';\n"); + grammarBuilder.append("KW201 : 'KW' '201';\n"); + grammarBuilder.append("KW202 : 'KW' '202';\n"); + grammarBuilder.append("KW203 : 'KW' '203';\n"); + grammarBuilder.append("KW204 : 'KW' '204';\n"); + grammarBuilder.append("KW205 : 'KW' '205';\n"); + grammarBuilder.append("KW206 : 'KW' '206';\n"); + grammarBuilder.append("KW207 : 'KW' '207';\n"); + grammarBuilder.append("KW208 : 'KW' '208';\n"); + grammarBuilder.append("KW209 : 'KW' '209';\n"); + grammarBuilder.append("KW210 : 'KW' '210';\n"); + grammarBuilder.append("KW211 : 'KW' '211';\n"); + grammarBuilder.append("KW212 : 'KW' '212';\n"); + grammarBuilder.append("KW213 : 'KW' '213';\n"); + grammarBuilder.append("KW214 : 'KW' '214';\n"); + grammarBuilder.append("KW215 : 'KW' '215';\n"); + grammarBuilder.append("KW216 : 'KW' '216';\n"); + grammarBuilder.append("KW217 : 'KW' '217';\n"); + grammarBuilder.append("KW218 : 'KW' '218';\n"); + grammarBuilder.append("KW219 : 'KW' '219';\n"); + grammarBuilder.append("KW220 : 'KW' '220';\n"); + grammarBuilder.append("KW221 : 'KW' '221';\n"); + grammarBuilder.append("KW222 : 'KW' '222';\n"); + grammarBuilder.append("KW223 : 'KW' '223';\n"); + grammarBuilder.append("KW224 : 'KW' '224';\n"); + grammarBuilder.append("KW225 : 'KW' '225';\n"); + grammarBuilder.append("KW226 : 'KW' '226';\n"); + grammarBuilder.append("KW227 : 'KW' '227';\n"); + grammarBuilder.append("KW228 : 'KW' '228';\n"); + grammarBuilder.append("KW229 : 'KW' '229';\n"); + grammarBuilder.append("KW230 : 'KW' '230';\n"); + grammarBuilder.append("KW231 : 'KW' '231';\n"); + grammarBuilder.append("KW232 : 'KW' '232';\n"); + grammarBuilder.append("KW233 : 'KW' '233';\n"); + grammarBuilder.append("KW234 : 'KW' '234';\n"); + grammarBuilder.append("KW235 : 'KW' '235';\n"); + grammarBuilder.append("KW236 : 'KW' '236';\n"); + grammarBuilder.append("KW237 : 'KW' '237';\n"); + grammarBuilder.append("KW238 : 'KW' '238';\n"); + grammarBuilder.append("KW239 : 'KW' '239';\n"); + grammarBuilder.append("KW240 : 'KW' '240';\n"); + grammarBuilder.append("KW241 : 'KW' '241';\n"); + grammarBuilder.append("KW242 : 'KW' '242';\n"); + grammarBuilder.append("KW243 : 'KW' '243';\n"); + grammarBuilder.append("KW244 : 'KW' '244';\n"); + grammarBuilder.append("KW245 : 'KW' '245';\n"); + grammarBuilder.append("KW246 : 'KW' '246';\n"); + grammarBuilder.append("KW247 : 'KW' '247';\n"); + grammarBuilder.append("KW248 : 'KW' '248';\n"); + grammarBuilder.append("KW249 : 'KW' '249';\n"); + grammarBuilder.append("KW250 : 'KW' '250';\n"); + grammarBuilder.append("KW251 : 'KW' '251';\n"); + grammarBuilder.append("KW252 : 'KW' '252';\n"); + grammarBuilder.append("KW253 : 'KW' '253';\n"); + grammarBuilder.append("KW254 : 'KW' '254';\n"); + grammarBuilder.append("KW255 : 'KW' '255';\n"); + grammarBuilder.append("KW256 : 'KW' '256';\n"); + grammarBuilder.append("KW257 : 'KW' '257';\n"); + grammarBuilder.append("KW258 : 'KW' '258';\n"); + grammarBuilder.append("KW259 : 'KW' '259';\n"); + grammarBuilder.append("KW260 : 'KW' '260';\n"); + grammarBuilder.append("KW261 : 'KW' '261';\n"); + grammarBuilder.append("KW262 : 'KW' '262';\n"); + grammarBuilder.append("KW263 : 'KW' '263';\n"); + grammarBuilder.append("KW264 : 'KW' '264';\n"); + grammarBuilder.append("KW265 : 'KW' '265';\n"); + grammarBuilder.append("KW266 : 'KW' '266';\n"); + grammarBuilder.append("KW267 : 'KW' '267';\n"); + grammarBuilder.append("KW268 : 'KW' '268';\n"); + grammarBuilder.append("KW269 : 'KW' '269';\n"); + grammarBuilder.append("KW270 : 'KW' '270';\n"); + grammarBuilder.append("KW271 : 'KW' '271';\n"); + grammarBuilder.append("KW272 : 'KW' '272';\n"); + grammarBuilder.append("KW273 : 'KW' '273';\n"); + grammarBuilder.append("KW274 : 'KW' '274';\n"); + grammarBuilder.append("KW275 : 'KW' '275';\n"); + grammarBuilder.append("KW276 : 'KW' '276';\n"); + grammarBuilder.append("KW277 : 'KW' '277';\n"); + grammarBuilder.append("KW278 : 'KW' '278';\n"); + grammarBuilder.append("KW279 : 'KW' '279';\n"); + grammarBuilder.append("KW280 : 'KW' '280';\n"); + grammarBuilder.append("KW281 : 'KW' '281';\n"); + grammarBuilder.append("KW282 : 'KW' '282';\n"); + grammarBuilder.append("KW283 : 'KW' '283';\n"); + grammarBuilder.append("KW284 : 'KW' '284';\n"); + grammarBuilder.append("KW285 : 'KW' '285';\n"); + grammarBuilder.append("KW286 : 'KW' '286';\n"); + grammarBuilder.append("KW287 : 'KW' '287';\n"); + grammarBuilder.append("KW288 : 'KW' '288';\n"); + grammarBuilder.append("KW289 : 'KW' '289';\n"); + grammarBuilder.append("KW290 : 'KW' '290';\n"); + grammarBuilder.append("KW291 : 'KW' '291';\n"); + grammarBuilder.append("KW292 : 'KW' '292';\n"); + grammarBuilder.append("KW293 : 'KW' '293';\n"); + grammarBuilder.append("KW294 : 'KW' '294';\n"); + grammarBuilder.append("KW295 : 'KW' '295';\n"); + grammarBuilder.append("KW296 : 'KW' '296';\n"); + grammarBuilder.append("KW297 : 'KW' '297';\n"); + grammarBuilder.append("KW298 : 'KW' '298';\n"); + grammarBuilder.append("KW299 : 'KW' '299';\n"); + grammarBuilder.append("KW300 : 'KW' '300';\n"); + grammarBuilder.append("KW301 : 'KW' '301';\n"); + grammarBuilder.append("KW302 : 'KW' '302';\n"); + grammarBuilder.append("KW303 : 'KW' '303';\n"); + grammarBuilder.append("KW304 : 'KW' '304';\n"); + grammarBuilder.append("KW305 : 'KW' '305';\n"); + grammarBuilder.append("KW306 : 'KW' '306';\n"); + grammarBuilder.append("KW307 : 'KW' '307';\n"); + grammarBuilder.append("KW308 : 'KW' '308';\n"); + grammarBuilder.append("KW309 : 'KW' '309';\n"); + grammarBuilder.append("KW310 : 'KW' '310';\n"); + grammarBuilder.append("KW311 : 'KW' '311';\n"); + grammarBuilder.append("KW312 : 'KW' '312';\n"); + grammarBuilder.append("KW313 : 'KW' '313';\n"); + grammarBuilder.append("KW314 : 'KW' '314';\n"); + grammarBuilder.append("KW315 : 'KW' '315';\n"); + grammarBuilder.append("KW316 : 'KW' '316';\n"); + grammarBuilder.append("KW317 : 'KW' '317';\n"); + grammarBuilder.append("KW318 : 'KW' '318';\n"); + grammarBuilder.append("KW319 : 'KW' '319';\n"); + grammarBuilder.append("KW320 : 'KW' '320';\n"); + grammarBuilder.append("KW321 : 'KW' '321';\n"); + grammarBuilder.append("KW322 : 'KW' '322';\n"); + grammarBuilder.append("KW323 : 'KW' '323';\n"); + grammarBuilder.append("KW324 : 'KW' '324';\n"); + grammarBuilder.append("KW325 : 'KW' '325';\n"); + grammarBuilder.append("KW326 : 'KW' '326';\n"); + grammarBuilder.append("KW327 : 'KW' '327';\n"); + grammarBuilder.append("KW328 : 'KW' '328';\n"); + grammarBuilder.append("KW329 : 'KW' '329';\n"); + grammarBuilder.append("KW330 : 'KW' '330';\n"); + grammarBuilder.append("KW331 : 'KW' '331';\n"); + grammarBuilder.append("KW332 : 'KW' '332';\n"); + grammarBuilder.append("KW333 : 'KW' '333';\n"); + grammarBuilder.append("KW334 : 'KW' '334';\n"); + grammarBuilder.append("KW335 : 'KW' '335';\n"); + grammarBuilder.append("KW336 : 'KW' '336';\n"); + grammarBuilder.append("KW337 : 'KW' '337';\n"); + grammarBuilder.append("KW338 : 'KW' '338';\n"); + grammarBuilder.append("KW339 : 'KW' '339';\n"); + grammarBuilder.append("KW340 : 'KW' '340';\n"); + grammarBuilder.append("KW341 : 'KW' '341';\n"); + grammarBuilder.append("KW342 : 'KW' '342';\n"); + grammarBuilder.append("KW343 : 'KW' '343';\n"); + grammarBuilder.append("KW344 : 'KW' '344';\n"); + grammarBuilder.append("KW345 : 'KW' '345';\n"); + grammarBuilder.append("KW346 : 'KW' '346';\n"); + grammarBuilder.append("KW347 : 'KW' '347';\n"); + grammarBuilder.append("KW348 : 'KW' '348';\n"); + grammarBuilder.append("KW349 : 'KW' '349';\n"); + grammarBuilder.append("KW350 : 'KW' '350';\n"); + grammarBuilder.append("KW351 : 'KW' '351';\n"); + grammarBuilder.append("KW352 : 'KW' '352';\n"); + grammarBuilder.append("KW353 : 'KW' '353';\n"); + grammarBuilder.append("KW354 : 'KW' '354';\n"); + grammarBuilder.append("KW355 : 'KW' '355';\n"); + grammarBuilder.append("KW356 : 'KW' '356';\n"); + grammarBuilder.append("KW357 : 'KW' '357';\n"); + grammarBuilder.append("KW358 : 'KW' '358';\n"); + grammarBuilder.append("KW359 : 'KW' '359';\n"); + grammarBuilder.append("KW360 : 'KW' '360';\n"); + grammarBuilder.append("KW361 : 'KW' '361';\n"); + grammarBuilder.append("KW362 : 'KW' '362';\n"); + grammarBuilder.append("KW363 : 'KW' '363';\n"); + grammarBuilder.append("KW364 : 'KW' '364';\n"); + grammarBuilder.append("KW365 : 'KW' '365';\n"); + grammarBuilder.append("KW366 : 'KW' '366';\n"); + grammarBuilder.append("KW367 : 'KW' '367';\n"); + grammarBuilder.append("KW368 : 'KW' '368';\n"); + grammarBuilder.append("KW369 : 'KW' '369';\n"); + grammarBuilder.append("KW370 : 'KW' '370';\n"); + grammarBuilder.append("KW371 : 'KW' '371';\n"); + grammarBuilder.append("KW372 : 'KW' '372';\n"); + grammarBuilder.append("KW373 : 'KW' '373';\n"); + grammarBuilder.append("KW374 : 'KW' '374';\n"); + grammarBuilder.append("KW375 : 'KW' '375';\n"); + grammarBuilder.append("KW376 : 'KW' '376';\n"); + grammarBuilder.append("KW377 : 'KW' '377';\n"); + grammarBuilder.append("KW378 : 'KW' '378';\n"); + grammarBuilder.append("KW379 : 'KW' '379';\n"); + grammarBuilder.append("KW380 : 'KW' '380';\n"); + grammarBuilder.append("KW381 : 'KW' '381';\n"); + grammarBuilder.append("KW382 : 'KW' '382';\n"); + grammarBuilder.append("KW383 : 'KW' '383';\n"); + grammarBuilder.append("KW384 : 'KW' '384';\n"); + grammarBuilder.append("KW385 : 'KW' '385';\n"); + grammarBuilder.append("KW386 : 'KW' '386';\n"); + grammarBuilder.append("KW387 : 'KW' '387';\n"); + grammarBuilder.append("KW388 : 'KW' '388';\n"); + grammarBuilder.append("KW389 : 'KW' '389';\n"); + grammarBuilder.append("KW390 : 'KW' '390';\n"); + grammarBuilder.append("KW391 : 'KW' '391';\n"); + grammarBuilder.append("KW392 : 'KW' '392';\n"); + grammarBuilder.append("KW393 : 'KW' '393';\n"); + grammarBuilder.append("KW394 : 'KW' '394';\n"); + grammarBuilder.append("KW395 : 'KW' '395';\n"); + grammarBuilder.append("KW396 : 'KW' '396';\n"); + grammarBuilder.append("KW397 : 'KW' '397';\n"); + grammarBuilder.append("KW398 : 'KW' '398';\n"); + grammarBuilder.append("KW399 : 'KW' '399';\n"); + grammarBuilder.append("KW400 : 'KW' '400';\n"); + grammarBuilder.append("KW401 : 'KW' '401';\n"); + grammarBuilder.append("KW402 : 'KW' '402';\n"); + grammarBuilder.append("KW403 : 'KW' '403';\n"); + grammarBuilder.append("KW404 : 'KW' '404';\n"); + grammarBuilder.append("KW405 : 'KW' '405';\n"); + grammarBuilder.append("KW406 : 'KW' '406';\n"); + grammarBuilder.append("KW407 : 'KW' '407';\n"); + grammarBuilder.append("KW408 : 'KW' '408';\n"); + grammarBuilder.append("KW409 : 'KW' '409';\n"); + grammarBuilder.append("KW410 : 'KW' '410';\n"); + grammarBuilder.append("KW411 : 'KW' '411';\n"); + grammarBuilder.append("KW412 : 'KW' '412';\n"); + grammarBuilder.append("KW413 : 'KW' '413';\n"); + grammarBuilder.append("KW414 : 'KW' '414';\n"); + grammarBuilder.append("KW415 : 'KW' '415';\n"); + grammarBuilder.append("KW416 : 'KW' '416';\n"); + grammarBuilder.append("KW417 : 'KW' '417';\n"); + grammarBuilder.append("KW418 : 'KW' '418';\n"); + grammarBuilder.append("KW419 : 'KW' '419';\n"); + grammarBuilder.append("KW420 : 'KW' '420';\n"); + grammarBuilder.append("KW421 : 'KW' '421';\n"); + grammarBuilder.append("KW422 : 'KW' '422';\n"); + grammarBuilder.append("KW423 : 'KW' '423';\n"); + grammarBuilder.append("KW424 : 'KW' '424';\n"); + grammarBuilder.append("KW425 : 'KW' '425';\n"); + grammarBuilder.append("KW426 : 'KW' '426';\n"); + grammarBuilder.append("KW427 : 'KW' '427';\n"); + grammarBuilder.append("KW428 : 'KW' '428';\n"); + grammarBuilder.append("KW429 : 'KW' '429';\n"); + grammarBuilder.append("KW430 : 'KW' '430';\n"); + grammarBuilder.append("KW431 : 'KW' '431';\n"); + grammarBuilder.append("KW432 : 'KW' '432';\n"); + grammarBuilder.append("KW433 : 'KW' '433';\n"); + grammarBuilder.append("KW434 : 'KW' '434';\n"); + grammarBuilder.append("KW435 : 'KW' '435';\n"); + grammarBuilder.append("KW436 : 'KW' '436';\n"); + grammarBuilder.append("KW437 : 'KW' '437';\n"); + grammarBuilder.append("KW438 : 'KW' '438';\n"); + grammarBuilder.append("KW439 : 'KW' '439';\n"); + grammarBuilder.append("KW440 : 'KW' '440';\n"); + grammarBuilder.append("KW441 : 'KW' '441';\n"); + grammarBuilder.append("KW442 : 'KW' '442';\n"); + grammarBuilder.append("KW443 : 'KW' '443';\n"); + grammarBuilder.append("KW444 : 'KW' '444';\n"); + grammarBuilder.append("KW445 : 'KW' '445';\n"); + grammarBuilder.append("KW446 : 'KW' '446';\n"); + grammarBuilder.append("KW447 : 'KW' '447';\n"); + grammarBuilder.append("KW448 : 'KW' '448';\n"); + grammarBuilder.append("KW449 : 'KW' '449';\n"); + grammarBuilder.append("KW450 : 'KW' '450';\n"); + grammarBuilder.append("KW451 : 'KW' '451';\n"); + grammarBuilder.append("KW452 : 'KW' '452';\n"); + grammarBuilder.append("KW453 : 'KW' '453';\n"); + grammarBuilder.append("KW454 : 'KW' '454';\n"); + grammarBuilder.append("KW455 : 'KW' '455';\n"); + grammarBuilder.append("KW456 : 'KW' '456';\n"); + grammarBuilder.append("KW457 : 'KW' '457';\n"); + grammarBuilder.append("KW458 : 'KW' '458';\n"); + grammarBuilder.append("KW459 : 'KW' '459';\n"); + grammarBuilder.append("KW460 : 'KW' '460';\n"); + grammarBuilder.append("KW461 : 'KW' '461';\n"); + grammarBuilder.append("KW462 : 'KW' '462';\n"); + grammarBuilder.append("KW463 : 'KW' '463';\n"); + grammarBuilder.append("KW464 : 'KW' '464';\n"); + grammarBuilder.append("KW465 : 'KW' '465';\n"); + grammarBuilder.append("KW466 : 'KW' '466';\n"); + grammarBuilder.append("KW467 : 'KW' '467';\n"); + grammarBuilder.append("KW468 : 'KW' '468';\n"); + grammarBuilder.append("KW469 : 'KW' '469';\n"); + grammarBuilder.append("KW470 : 'KW' '470';\n"); + grammarBuilder.append("KW471 : 'KW' '471';\n"); + grammarBuilder.append("KW472 : 'KW' '472';\n"); + grammarBuilder.append("KW473 : 'KW' '473';\n"); + grammarBuilder.append("KW474 : 'KW' '474';\n"); + grammarBuilder.append("KW475 : 'KW' '475';\n"); + grammarBuilder.append("KW476 : 'KW' '476';\n"); + grammarBuilder.append("KW477 : 'KW' '477';\n"); + grammarBuilder.append("KW478 : 'KW' '478';\n"); + grammarBuilder.append("KW479 : 'KW' '479';\n"); + grammarBuilder.append("KW480 : 'KW' '480';\n"); + grammarBuilder.append("KW481 : 'KW' '481';\n"); + grammarBuilder.append("KW482 : 'KW' '482';\n"); + grammarBuilder.append("KW483 : 'KW' '483';\n"); + grammarBuilder.append("KW484 : 'KW' '484';\n"); + grammarBuilder.append("KW485 : 'KW' '485';\n"); + grammarBuilder.append("KW486 : 'KW' '486';\n"); + grammarBuilder.append("KW487 : 'KW' '487';\n"); + grammarBuilder.append("KW488 : 'KW' '488';\n"); + grammarBuilder.append("KW489 : 'KW' '489';\n"); + grammarBuilder.append("KW490 : 'KW' '490';\n"); + grammarBuilder.append("KW491 : 'KW' '491';\n"); + grammarBuilder.append("KW492 : 'KW' '492';\n"); + grammarBuilder.append("KW493 : 'KW' '493';\n"); + grammarBuilder.append("KW494 : 'KW' '494';\n"); + grammarBuilder.append("KW495 : 'KW' '495';\n"); + grammarBuilder.append("KW496 : 'KW' '496';\n"); + grammarBuilder.append("KW497 : 'KW' '497';\n"); + grammarBuilder.append("KW498 : 'KW' '498';\n"); + grammarBuilder.append("KW499 : 'KW' '499';\n"); + grammarBuilder.append("KW500 : 'KW' '500';\n"); + grammarBuilder.append("KW501 : 'KW' '501';\n"); + grammarBuilder.append("KW502 : 'KW' '502';\n"); + grammarBuilder.append("KW503 : 'KW' '503';\n"); + grammarBuilder.append("KW504 : 'KW' '504';\n"); + grammarBuilder.append("KW505 : 'KW' '505';\n"); + grammarBuilder.append("KW506 : 'KW' '506';\n"); + grammarBuilder.append("KW507 : 'KW' '507';\n"); + grammarBuilder.append("KW508 : 'KW' '508';\n"); + grammarBuilder.append("KW509 : 'KW' '509';\n"); + grammarBuilder.append("KW510 : 'KW' '510';\n"); + grammarBuilder.append("KW511 : 'KW' '511';\n"); + grammarBuilder.append("KW512 : 'KW' '512';\n"); + grammarBuilder.append("KW513 : 'KW' '513';\n"); + grammarBuilder.append("KW514 : 'KW' '514';\n"); + grammarBuilder.append("KW515 : 'KW' '515';\n"); + grammarBuilder.append("KW516 : 'KW' '516';\n"); + grammarBuilder.append("KW517 : 'KW' '517';\n"); + grammarBuilder.append("KW518 : 'KW' '518';\n"); + grammarBuilder.append("KW519 : 'KW' '519';\n"); + grammarBuilder.append("KW520 : 'KW' '520';\n"); + grammarBuilder.append("KW521 : 'KW' '521';\n"); + grammarBuilder.append("KW522 : 'KW' '522';\n"); + grammarBuilder.append("KW523 : 'KW' '523';\n"); + grammarBuilder.append("KW524 : 'KW' '524';\n"); + grammarBuilder.append("KW525 : 'KW' '525';\n"); + grammarBuilder.append("KW526 : 'KW' '526';\n"); + grammarBuilder.append("KW527 : 'KW' '527';\n"); + grammarBuilder.append("KW528 : 'KW' '528';\n"); + grammarBuilder.append("KW529 : 'KW' '529';\n"); + grammarBuilder.append("KW530 : 'KW' '530';\n"); + grammarBuilder.append("KW531 : 'KW' '531';\n"); + grammarBuilder.append("KW532 : 'KW' '532';\n"); + grammarBuilder.append("KW533 : 'KW' '533';\n"); + grammarBuilder.append("KW534 : 'KW' '534';\n"); + grammarBuilder.append("KW535 : 'KW' '535';\n"); + grammarBuilder.append("KW536 : 'KW' '536';\n"); + grammarBuilder.append("KW537 : 'KW' '537';\n"); + grammarBuilder.append("KW538 : 'KW' '538';\n"); + grammarBuilder.append("KW539 : 'KW' '539';\n"); + grammarBuilder.append("KW540 : 'KW' '540';\n"); + grammarBuilder.append("KW541 : 'KW' '541';\n"); + grammarBuilder.append("KW542 : 'KW' '542';\n"); + grammarBuilder.append("KW543 : 'KW' '543';\n"); + grammarBuilder.append("KW544 : 'KW' '544';\n"); + grammarBuilder.append("KW545 : 'KW' '545';\n"); + grammarBuilder.append("KW546 : 'KW' '546';\n"); + grammarBuilder.append("KW547 : 'KW' '547';\n"); + grammarBuilder.append("KW548 : 'KW' '548';\n"); + grammarBuilder.append("KW549 : 'KW' '549';\n"); + grammarBuilder.append("KW550 : 'KW' '550';\n"); + grammarBuilder.append("KW551 : 'KW' '551';\n"); + grammarBuilder.append("KW552 : 'KW' '552';\n"); + grammarBuilder.append("KW553 : 'KW' '553';\n"); + grammarBuilder.append("KW554 : 'KW' '554';\n"); + grammarBuilder.append("KW555 : 'KW' '555';\n"); + grammarBuilder.append("KW556 : 'KW' '556';\n"); + grammarBuilder.append("KW557 : 'KW' '557';\n"); + grammarBuilder.append("KW558 : 'KW' '558';\n"); + grammarBuilder.append("KW559 : 'KW' '559';\n"); + grammarBuilder.append("KW560 : 'KW' '560';\n"); + grammarBuilder.append("KW561 : 'KW' '561';\n"); + grammarBuilder.append("KW562 : 'KW' '562';\n"); + grammarBuilder.append("KW563 : 'KW' '563';\n"); + grammarBuilder.append("KW564 : 'KW' '564';\n"); + grammarBuilder.append("KW565 : 'KW' '565';\n"); + grammarBuilder.append("KW566 : 'KW' '566';\n"); + grammarBuilder.append("KW567 : 'KW' '567';\n"); + grammarBuilder.append("KW568 : 'KW' '568';\n"); + grammarBuilder.append("KW569 : 'KW' '569';\n"); + grammarBuilder.append("KW570 : 'KW' '570';\n"); + grammarBuilder.append("KW571 : 'KW' '571';\n"); + grammarBuilder.append("KW572 : 'KW' '572';\n"); + grammarBuilder.append("KW573 : 'KW' '573';\n"); + grammarBuilder.append("KW574 : 'KW' '574';\n"); + grammarBuilder.append("KW575 : 'KW' '575';\n"); + grammarBuilder.append("KW576 : 'KW' '576';\n"); + grammarBuilder.append("KW577 : 'KW' '577';\n"); + grammarBuilder.append("KW578 : 'KW' '578';\n"); + grammarBuilder.append("KW579 : 'KW' '579';\n"); + grammarBuilder.append("KW580 : 'KW' '580';\n"); + grammarBuilder.append("KW581 : 'KW' '581';\n"); + grammarBuilder.append("KW582 : 'KW' '582';\n"); + grammarBuilder.append("KW583 : 'KW' '583';\n"); + grammarBuilder.append("KW584 : 'KW' '584';\n"); + grammarBuilder.append("KW585 : 'KW' '585';\n"); + grammarBuilder.append("KW586 : 'KW' '586';\n"); + grammarBuilder.append("KW587 : 'KW' '587';\n"); + grammarBuilder.append("KW588 : 'KW' '588';\n"); + grammarBuilder.append("KW589 : 'KW' '589';\n"); + grammarBuilder.append("KW590 : 'KW' '590';\n"); + grammarBuilder.append("KW591 : 'KW' '591';\n"); + grammarBuilder.append("KW592 : 'KW' '592';\n"); + grammarBuilder.append("KW593 : 'KW' '593';\n"); + grammarBuilder.append("KW594 : 'KW' '594';\n"); + grammarBuilder.append("KW595 : 'KW' '595';\n"); + grammarBuilder.append("KW596 : 'KW' '596';\n"); + grammarBuilder.append("KW597 : 'KW' '597';\n"); + grammarBuilder.append("KW598 : 'KW' '598';\n"); + grammarBuilder.append("KW599 : 'KW' '599';\n"); + grammarBuilder.append("KW600 : 'KW' '600';\n"); + grammarBuilder.append("KW601 : 'KW' '601';\n"); + grammarBuilder.append("KW602 : 'KW' '602';\n"); + grammarBuilder.append("KW603 : 'KW' '603';\n"); + grammarBuilder.append("KW604 : 'KW' '604';\n"); + grammarBuilder.append("KW605 : 'KW' '605';\n"); + grammarBuilder.append("KW606 : 'KW' '606';\n"); + grammarBuilder.append("KW607 : 'KW' '607';\n"); + grammarBuilder.append("KW608 : 'KW' '608';\n"); + grammarBuilder.append("KW609 : 'KW' '609';\n"); + grammarBuilder.append("KW610 : 'KW' '610';\n"); + grammarBuilder.append("KW611 : 'KW' '611';\n"); + grammarBuilder.append("KW612 : 'KW' '612';\n"); + grammarBuilder.append("KW613 : 'KW' '613';\n"); + grammarBuilder.append("KW614 : 'KW' '614';\n"); + grammarBuilder.append("KW615 : 'KW' '615';\n"); + grammarBuilder.append("KW616 : 'KW' '616';\n"); + grammarBuilder.append("KW617 : 'KW' '617';\n"); + grammarBuilder.append("KW618 : 'KW' '618';\n"); + grammarBuilder.append("KW619 : 'KW' '619';\n"); + grammarBuilder.append("KW620 : 'KW' '620';\n"); + grammarBuilder.append("KW621 : 'KW' '621';\n"); + grammarBuilder.append("KW622 : 'KW' '622';\n"); + grammarBuilder.append("KW623 : 'KW' '623';\n"); + grammarBuilder.append("KW624 : 'KW' '624';\n"); + grammarBuilder.append("KW625 : 'KW' '625';\n"); + grammarBuilder.append("KW626 : 'KW' '626';\n"); + grammarBuilder.append("KW627 : 'KW' '627';\n"); + grammarBuilder.append("KW628 : 'KW' '628';\n"); + grammarBuilder.append("KW629 : 'KW' '629';\n"); + grammarBuilder.append("KW630 : 'KW' '630';\n"); + grammarBuilder.append("KW631 : 'KW' '631';\n"); + grammarBuilder.append("KW632 : 'KW' '632';\n"); + grammarBuilder.append("KW633 : 'KW' '633';\n"); + grammarBuilder.append("KW634 : 'KW' '634';\n"); + grammarBuilder.append("KW635 : 'KW' '635';\n"); + grammarBuilder.append("KW636 : 'KW' '636';\n"); + grammarBuilder.append("KW637 : 'KW' '637';\n"); + grammarBuilder.append("KW638 : 'KW' '638';\n"); + grammarBuilder.append("KW639 : 'KW' '639';\n"); + grammarBuilder.append("KW640 : 'KW' '640';\n"); + grammarBuilder.append("KW641 : 'KW' '641';\n"); + grammarBuilder.append("KW642 : 'KW' '642';\n"); + grammarBuilder.append("KW643 : 'KW' '643';\n"); + grammarBuilder.append("KW644 : 'KW' '644';\n"); + grammarBuilder.append("KW645 : 'KW' '645';\n"); + grammarBuilder.append("KW646 : 'KW' '646';\n"); + grammarBuilder.append("KW647 : 'KW' '647';\n"); + grammarBuilder.append("KW648 : 'KW' '648';\n"); + grammarBuilder.append("KW649 : 'KW' '649';\n"); + grammarBuilder.append("KW650 : 'KW' '650';\n"); + grammarBuilder.append("KW651 : 'KW' '651';\n"); + grammarBuilder.append("KW652 : 'KW' '652';\n"); + grammarBuilder.append("KW653 : 'KW' '653';\n"); + grammarBuilder.append("KW654 : 'KW' '654';\n"); + grammarBuilder.append("KW655 : 'KW' '655';\n"); + grammarBuilder.append("KW656 : 'KW' '656';\n"); + grammarBuilder.append("KW657 : 'KW' '657';\n"); + grammarBuilder.append("KW658 : 'KW' '658';\n"); + grammarBuilder.append("KW659 : 'KW' '659';\n"); + grammarBuilder.append("KW660 : 'KW' '660';\n"); + grammarBuilder.append("KW661 : 'KW' '661';\n"); + grammarBuilder.append("KW662 : 'KW' '662';\n"); + grammarBuilder.append("KW663 : 'KW' '663';\n"); + grammarBuilder.append("KW664 : 'KW' '664';\n"); + grammarBuilder.append("KW665 : 'KW' '665';\n"); + grammarBuilder.append("KW666 : 'KW' '666';\n"); + grammarBuilder.append("KW667 : 'KW' '667';\n"); + grammarBuilder.append("KW668 : 'KW' '668';\n"); + grammarBuilder.append("KW669 : 'KW' '669';\n"); + grammarBuilder.append("KW670 : 'KW' '670';\n"); + grammarBuilder.append("KW671 : 'KW' '671';\n"); + grammarBuilder.append("KW672 : 'KW' '672';\n"); + grammarBuilder.append("KW673 : 'KW' '673';\n"); + grammarBuilder.append("KW674 : 'KW' '674';\n"); + grammarBuilder.append("KW675 : 'KW' '675';\n"); + grammarBuilder.append("KW676 : 'KW' '676';\n"); + grammarBuilder.append("KW677 : 'KW' '677';\n"); + grammarBuilder.append("KW678 : 'KW' '678';\n"); + grammarBuilder.append("KW679 : 'KW' '679';\n"); + grammarBuilder.append("KW680 : 'KW' '680';\n"); + grammarBuilder.append("KW681 : 'KW' '681';\n"); + grammarBuilder.append("KW682 : 'KW' '682';\n"); + grammarBuilder.append("KW683 : 'KW' '683';\n"); + grammarBuilder.append("KW684 : 'KW' '684';\n"); + grammarBuilder.append("KW685 : 'KW' '685';\n"); + grammarBuilder.append("KW686 : 'KW' '686';\n"); + grammarBuilder.append("KW687 : 'KW' '687';\n"); + grammarBuilder.append("KW688 : 'KW' '688';\n"); + grammarBuilder.append("KW689 : 'KW' '689';\n"); + grammarBuilder.append("KW690 : 'KW' '690';\n"); + grammarBuilder.append("KW691 : 'KW' '691';\n"); + grammarBuilder.append("KW692 : 'KW' '692';\n"); + grammarBuilder.append("KW693 : 'KW' '693';\n"); + grammarBuilder.append("KW694 : 'KW' '694';\n"); + grammarBuilder.append("KW695 : 'KW' '695';\n"); + grammarBuilder.append("KW696 : 'KW' '696';\n"); + grammarBuilder.append("KW697 : 'KW' '697';\n"); + grammarBuilder.append("KW698 : 'KW' '698';\n"); + grammarBuilder.append("KW699 : 'KW' '699';\n"); + grammarBuilder.append("KW700 : 'KW' '700';\n"); + grammarBuilder.append("KW701 : 'KW' '701';\n"); + grammarBuilder.append("KW702 : 'KW' '702';\n"); + grammarBuilder.append("KW703 : 'KW' '703';\n"); + grammarBuilder.append("KW704 : 'KW' '704';\n"); + grammarBuilder.append("KW705 : 'KW' '705';\n"); + grammarBuilder.append("KW706 : 'KW' '706';\n"); + grammarBuilder.append("KW707 : 'KW' '707';\n"); + grammarBuilder.append("KW708 : 'KW' '708';\n"); + grammarBuilder.append("KW709 : 'KW' '709';\n"); + grammarBuilder.append("KW710 : 'KW' '710';\n"); + grammarBuilder.append("KW711 : 'KW' '711';\n"); + grammarBuilder.append("KW712 : 'KW' '712';\n"); + grammarBuilder.append("KW713 : 'KW' '713';\n"); + grammarBuilder.append("KW714 : 'KW' '714';\n"); + grammarBuilder.append("KW715 : 'KW' '715';\n"); + grammarBuilder.append("KW716 : 'KW' '716';\n"); + grammarBuilder.append("KW717 : 'KW' '717';\n"); + grammarBuilder.append("KW718 : 'KW' '718';\n"); + grammarBuilder.append("KW719 : 'KW' '719';\n"); + grammarBuilder.append("KW720 : 'KW' '720';\n"); + grammarBuilder.append("KW721 : 'KW' '721';\n"); + grammarBuilder.append("KW722 : 'KW' '722';\n"); + grammarBuilder.append("KW723 : 'KW' '723';\n"); + grammarBuilder.append("KW724 : 'KW' '724';\n"); + grammarBuilder.append("KW725 : 'KW' '725';\n"); + grammarBuilder.append("KW726 : 'KW' '726';\n"); + grammarBuilder.append("KW727 : 'KW' '727';\n"); + grammarBuilder.append("KW728 : 'KW' '728';\n"); + grammarBuilder.append("KW729 : 'KW' '729';\n"); + grammarBuilder.append("KW730 : 'KW' '730';\n"); + grammarBuilder.append("KW731 : 'KW' '731';\n"); + grammarBuilder.append("KW732 : 'KW' '732';\n"); + grammarBuilder.append("KW733 : 'KW' '733';\n"); + grammarBuilder.append("KW734 : 'KW' '734';\n"); + grammarBuilder.append("KW735 : 'KW' '735';\n"); + grammarBuilder.append("KW736 : 'KW' '736';\n"); + grammarBuilder.append("KW737 : 'KW' '737';\n"); + grammarBuilder.append("KW738 : 'KW' '738';\n"); + grammarBuilder.append("KW739 : 'KW' '739';\n"); + grammarBuilder.append("KW740 : 'KW' '740';\n"); + grammarBuilder.append("KW741 : 'KW' '741';\n"); + grammarBuilder.append("KW742 : 'KW' '742';\n"); + grammarBuilder.append("KW743 : 'KW' '743';\n"); + grammarBuilder.append("KW744 : 'KW' '744';\n"); + grammarBuilder.append("KW745 : 'KW' '745';\n"); + grammarBuilder.append("KW746 : 'KW' '746';\n"); + grammarBuilder.append("KW747 : 'KW' '747';\n"); + grammarBuilder.append("KW748 : 'KW' '748';\n"); + grammarBuilder.append("KW749 : 'KW' '749';\n"); + grammarBuilder.append("KW750 : 'KW' '750';\n"); + grammarBuilder.append("KW751 : 'KW' '751';\n"); + grammarBuilder.append("KW752 : 'KW' '752';\n"); + grammarBuilder.append("KW753 : 'KW' '753';\n"); + grammarBuilder.append("KW754 : 'KW' '754';\n"); + grammarBuilder.append("KW755 : 'KW' '755';\n"); + grammarBuilder.append("KW756 : 'KW' '756';\n"); + grammarBuilder.append("KW757 : 'KW' '757';\n"); + grammarBuilder.append("KW758 : 'KW' '758';\n"); + grammarBuilder.append("KW759 : 'KW' '759';\n"); + grammarBuilder.append("KW760 : 'KW' '760';\n"); + grammarBuilder.append("KW761 : 'KW' '761';\n"); + grammarBuilder.append("KW762 : 'KW' '762';\n"); + grammarBuilder.append("KW763 : 'KW' '763';\n"); + grammarBuilder.append("KW764 : 'KW' '764';\n"); + grammarBuilder.append("KW765 : 'KW' '765';\n"); + grammarBuilder.append("KW766 : 'KW' '766';\n"); + grammarBuilder.append("KW767 : 'KW' '767';\n"); + grammarBuilder.append("KW768 : 'KW' '768';\n"); + grammarBuilder.append("KW769 : 'KW' '769';\n"); + grammarBuilder.append("KW770 : 'KW' '770';\n"); + grammarBuilder.append("KW771 : 'KW' '771';\n"); + grammarBuilder.append("KW772 : 'KW' '772';\n"); + grammarBuilder.append("KW773 : 'KW' '773';\n"); + grammarBuilder.append("KW774 : 'KW' '774';\n"); + grammarBuilder.append("KW775 : 'KW' '775';\n"); + grammarBuilder.append("KW776 : 'KW' '776';\n"); + grammarBuilder.append("KW777 : 'KW' '777';\n"); + grammarBuilder.append("KW778 : 'KW' '778';\n"); + grammarBuilder.append("KW779 : 'KW' '779';\n"); + grammarBuilder.append("KW780 : 'KW' '780';\n"); + grammarBuilder.append("KW781 : 'KW' '781';\n"); + grammarBuilder.append("KW782 : 'KW' '782';\n"); + grammarBuilder.append("KW783 : 'KW' '783';\n"); + grammarBuilder.append("KW784 : 'KW' '784';\n"); + grammarBuilder.append("KW785 : 'KW' '785';\n"); + grammarBuilder.append("KW786 : 'KW' '786';\n"); + grammarBuilder.append("KW787 : 'KW' '787';\n"); + grammarBuilder.append("KW788 : 'KW' '788';\n"); + grammarBuilder.append("KW789 : 'KW' '789';\n"); + grammarBuilder.append("KW790 : 'KW' '790';\n"); + grammarBuilder.append("KW791 : 'KW' '791';\n"); + grammarBuilder.append("KW792 : 'KW' '792';\n"); + grammarBuilder.append("KW793 : 'KW' '793';\n"); + grammarBuilder.append("KW794 : 'KW' '794';\n"); + grammarBuilder.append("KW795 : 'KW' '795';\n"); + grammarBuilder.append("KW796 : 'KW' '796';\n"); + grammarBuilder.append("KW797 : 'KW' '797';\n"); + grammarBuilder.append("KW798 : 'KW' '798';\n"); + grammarBuilder.append("KW799 : 'KW' '799';\n"); + grammarBuilder.append("KW800 : 'KW' '800';\n"); + grammarBuilder.append("KW801 : 'KW' '801';\n"); + grammarBuilder.append("KW802 : 'KW' '802';\n"); + grammarBuilder.append("KW803 : 'KW' '803';\n"); + grammarBuilder.append("KW804 : 'KW' '804';\n"); + grammarBuilder.append("KW805 : 'KW' '805';\n"); + grammarBuilder.append("KW806 : 'KW' '806';\n"); + grammarBuilder.append("KW807 : 'KW' '807';\n"); + grammarBuilder.append("KW808 : 'KW' '808';\n"); + grammarBuilder.append("KW809 : 'KW' '809';\n"); + grammarBuilder.append("KW810 : 'KW' '810';\n"); + grammarBuilder.append("KW811 : 'KW' '811';\n"); + grammarBuilder.append("KW812 : 'KW' '812';\n"); + grammarBuilder.append("KW813 : 'KW' '813';\n"); + grammarBuilder.append("KW814 : 'KW' '814';\n"); + grammarBuilder.append("KW815 : 'KW' '815';\n"); + grammarBuilder.append("KW816 : 'KW' '816';\n"); + grammarBuilder.append("KW817 : 'KW' '817';\n"); + grammarBuilder.append("KW818 : 'KW' '818';\n"); + grammarBuilder.append("KW819 : 'KW' '819';\n"); + grammarBuilder.append("KW820 : 'KW' '820';\n"); + grammarBuilder.append("KW821 : 'KW' '821';\n"); + grammarBuilder.append("KW822 : 'KW' '822';\n"); + grammarBuilder.append("KW823 : 'KW' '823';\n"); + grammarBuilder.append("KW824 : 'KW' '824';\n"); + grammarBuilder.append("KW825 : 'KW' '825';\n"); + grammarBuilder.append("KW826 : 'KW' '826';\n"); + grammarBuilder.append("KW827 : 'KW' '827';\n"); + grammarBuilder.append("KW828 : 'KW' '828';\n"); + grammarBuilder.append("KW829 : 'KW' '829';\n"); + grammarBuilder.append("KW830 : 'KW' '830';\n"); + grammarBuilder.append("KW831 : 'KW' '831';\n"); + grammarBuilder.append("KW832 : 'KW' '832';\n"); + grammarBuilder.append("KW833 : 'KW' '833';\n"); + grammarBuilder.append("KW834 : 'KW' '834';\n"); + grammarBuilder.append("KW835 : 'KW' '835';\n"); + grammarBuilder.append("KW836 : 'KW' '836';\n"); + grammarBuilder.append("KW837 : 'KW' '837';\n"); + grammarBuilder.append("KW838 : 'KW' '838';\n"); + grammarBuilder.append("KW839 : 'KW' '839';\n"); + grammarBuilder.append("KW840 : 'KW' '840';\n"); + grammarBuilder.append("KW841 : 'KW' '841';\n"); + grammarBuilder.append("KW842 : 'KW' '842';\n"); + grammarBuilder.append("KW843 : 'KW' '843';\n"); + grammarBuilder.append("KW844 : 'KW' '844';\n"); + grammarBuilder.append("KW845 : 'KW' '845';\n"); + grammarBuilder.append("KW846 : 'KW' '846';\n"); + grammarBuilder.append("KW847 : 'KW' '847';\n"); + grammarBuilder.append("KW848 : 'KW' '848';\n"); + grammarBuilder.append("KW849 : 'KW' '849';\n"); + grammarBuilder.append("KW850 : 'KW' '850';\n"); + grammarBuilder.append("KW851 : 'KW' '851';\n"); + grammarBuilder.append("KW852 : 'KW' '852';\n"); + grammarBuilder.append("KW853 : 'KW' '853';\n"); + grammarBuilder.append("KW854 : 'KW' '854';\n"); + grammarBuilder.append("KW855 : 'KW' '855';\n"); + grammarBuilder.append("KW856 : 'KW' '856';\n"); + grammarBuilder.append("KW857 : 'KW' '857';\n"); + grammarBuilder.append("KW858 : 'KW' '858';\n"); + grammarBuilder.append("KW859 : 'KW' '859';\n"); + grammarBuilder.append("KW860 : 'KW' '860';\n"); + grammarBuilder.append("KW861 : 'KW' '861';\n"); + grammarBuilder.append("KW862 : 'KW' '862';\n"); + grammarBuilder.append("KW863 : 'KW' '863';\n"); + grammarBuilder.append("KW864 : 'KW' '864';\n"); + grammarBuilder.append("KW865 : 'KW' '865';\n"); + grammarBuilder.append("KW866 : 'KW' '866';\n"); + grammarBuilder.append("KW867 : 'KW' '867';\n"); + grammarBuilder.append("KW868 : 'KW' '868';\n"); + grammarBuilder.append("KW869 : 'KW' '869';\n"); + grammarBuilder.append("KW870 : 'KW' '870';\n"); + grammarBuilder.append("KW871 : 'KW' '871';\n"); + grammarBuilder.append("KW872 : 'KW' '872';\n"); + grammarBuilder.append("KW873 : 'KW' '873';\n"); + grammarBuilder.append("KW874 : 'KW' '874';\n"); + grammarBuilder.append("KW875 : 'KW' '875';\n"); + grammarBuilder.append("KW876 : 'KW' '876';\n"); + grammarBuilder.append("KW877 : 'KW' '877';\n"); + grammarBuilder.append("KW878 : 'KW' '878';\n"); + grammarBuilder.append("KW879 : 'KW' '879';\n"); + grammarBuilder.append("KW880 : 'KW' '880';\n"); + grammarBuilder.append("KW881 : 'KW' '881';\n"); + grammarBuilder.append("KW882 : 'KW' '882';\n"); + grammarBuilder.append("KW883 : 'KW' '883';\n"); + grammarBuilder.append("KW884 : 'KW' '884';\n"); + grammarBuilder.append("KW885 : 'KW' '885';\n"); + grammarBuilder.append("KW886 : 'KW' '886';\n"); + grammarBuilder.append("KW887 : 'KW' '887';\n"); + grammarBuilder.append("KW888 : 'KW' '888';\n"); + grammarBuilder.append("KW889 : 'KW' '889';\n"); + grammarBuilder.append("KW890 : 'KW' '890';\n"); + grammarBuilder.append("KW891 : 'KW' '891';\n"); + grammarBuilder.append("KW892 : 'KW' '892';\n"); + grammarBuilder.append("KW893 : 'KW' '893';\n"); + grammarBuilder.append("KW894 : 'KW' '894';\n"); + grammarBuilder.append("KW895 : 'KW' '895';\n"); + grammarBuilder.append("KW896 : 'KW' '896';\n"); + grammarBuilder.append("KW897 : 'KW' '897';\n"); + grammarBuilder.append("KW898 : 'KW' '898';\n"); + grammarBuilder.append("KW899 : 'KW' '899';\n"); + grammarBuilder.append("KW900 : 'KW' '900';\n"); + grammarBuilder.append("KW901 : 'KW' '901';\n"); + grammarBuilder.append("KW902 : 'KW' '902';\n"); + grammarBuilder.append("KW903 : 'KW' '903';\n"); + grammarBuilder.append("KW904 : 'KW' '904';\n"); + grammarBuilder.append("KW905 : 'KW' '905';\n"); + grammarBuilder.append("KW906 : 'KW' '906';\n"); + grammarBuilder.append("KW907 : 'KW' '907';\n"); + grammarBuilder.append("KW908 : 'KW' '908';\n"); + grammarBuilder.append("KW909 : 'KW' '909';\n"); + grammarBuilder.append("KW910 : 'KW' '910';\n"); + grammarBuilder.append("KW911 : 'KW' '911';\n"); + grammarBuilder.append("KW912 : 'KW' '912';\n"); + grammarBuilder.append("KW913 : 'KW' '913';\n"); + grammarBuilder.append("KW914 : 'KW' '914';\n"); + grammarBuilder.append("KW915 : 'KW' '915';\n"); + grammarBuilder.append("KW916 : 'KW' '916';\n"); + grammarBuilder.append("KW917 : 'KW' '917';\n"); + grammarBuilder.append("KW918 : 'KW' '918';\n"); + grammarBuilder.append("KW919 : 'KW' '919';\n"); + grammarBuilder.append("KW920 : 'KW' '920';\n"); + grammarBuilder.append("KW921 : 'KW' '921';\n"); + grammarBuilder.append("KW922 : 'KW' '922';\n"); + grammarBuilder.append("KW923 : 'KW' '923';\n"); + grammarBuilder.append("KW924 : 'KW' '924';\n"); + grammarBuilder.append("KW925 : 'KW' '925';\n"); + grammarBuilder.append("KW926 : 'KW' '926';\n"); + grammarBuilder.append("KW927 : 'KW' '927';\n"); + grammarBuilder.append("KW928 : 'KW' '928';\n"); + grammarBuilder.append("KW929 : 'KW' '929';\n"); + grammarBuilder.append("KW930 : 'KW' '930';\n"); + grammarBuilder.append("KW931 : 'KW' '931';\n"); + grammarBuilder.append("KW932 : 'KW' '932';\n"); + grammarBuilder.append("KW933 : 'KW' '933';\n"); + grammarBuilder.append("KW934 : 'KW' '934';\n"); + grammarBuilder.append("KW935 : 'KW' '935';\n"); + grammarBuilder.append("KW936 : 'KW' '936';\n"); + grammarBuilder.append("KW937 : 'KW' '937';\n"); + grammarBuilder.append("KW938 : 'KW' '938';\n"); + grammarBuilder.append("KW939 : 'KW' '939';\n"); + grammarBuilder.append("KW940 : 'KW' '940';\n"); + grammarBuilder.append("KW941 : 'KW' '941';\n"); + grammarBuilder.append("KW942 : 'KW' '942';\n"); + grammarBuilder.append("KW943 : 'KW' '943';\n"); + grammarBuilder.append("KW944 : 'KW' '944';\n"); + grammarBuilder.append("KW945 : 'KW' '945';\n"); + grammarBuilder.append("KW946 : 'KW' '946';\n"); + grammarBuilder.append("KW947 : 'KW' '947';\n"); + grammarBuilder.append("KW948 : 'KW' '948';\n"); + grammarBuilder.append("KW949 : 'KW' '949';\n"); + grammarBuilder.append("KW950 : 'KW' '950';\n"); + grammarBuilder.append("KW951 : 'KW' '951';\n"); + grammarBuilder.append("KW952 : 'KW' '952';\n"); + grammarBuilder.append("KW953 : 'KW' '953';\n"); + grammarBuilder.append("KW954 : 'KW' '954';\n"); + grammarBuilder.append("KW955 : 'KW' '955';\n"); + grammarBuilder.append("KW956 : 'KW' '956';\n"); + grammarBuilder.append("KW957 : 'KW' '957';\n"); + grammarBuilder.append("KW958 : 'KW' '958';\n"); + grammarBuilder.append("KW959 : 'KW' '959';\n"); + grammarBuilder.append("KW960 : 'KW' '960';\n"); + grammarBuilder.append("KW961 : 'KW' '961';\n"); + grammarBuilder.append("KW962 : 'KW' '962';\n"); + grammarBuilder.append("KW963 : 'KW' '963';\n"); + grammarBuilder.append("KW964 : 'KW' '964';\n"); + grammarBuilder.append("KW965 : 'KW' '965';\n"); + grammarBuilder.append("KW966 : 'KW' '966';\n"); + grammarBuilder.append("KW967 : 'KW' '967';\n"); + grammarBuilder.append("KW968 : 'KW' '968';\n"); + grammarBuilder.append("KW969 : 'KW' '969';\n"); + grammarBuilder.append("KW970 : 'KW' '970';\n"); + grammarBuilder.append("KW971 : 'KW' '971';\n"); + grammarBuilder.append("KW972 : 'KW' '972';\n"); + grammarBuilder.append("KW973 : 'KW' '973';\n"); + grammarBuilder.append("KW974 : 'KW' '974';\n"); + grammarBuilder.append("KW975 : 'KW' '975';\n"); + grammarBuilder.append("KW976 : 'KW' '976';\n"); + grammarBuilder.append("KW977 : 'KW' '977';\n"); + grammarBuilder.append("KW978 : 'KW' '978';\n"); + grammarBuilder.append("KW979 : 'KW' '979';\n"); + grammarBuilder.append("KW980 : 'KW' '980';\n"); + grammarBuilder.append("KW981 : 'KW' '981';\n"); + grammarBuilder.append("KW982 : 'KW' '982';\n"); + grammarBuilder.append("KW983 : 'KW' '983';\n"); + grammarBuilder.append("KW984 : 'KW' '984';\n"); + grammarBuilder.append("KW985 : 'KW' '985';\n"); + grammarBuilder.append("KW986 : 'KW' '986';\n"); + grammarBuilder.append("KW987 : 'KW' '987';\n"); + grammarBuilder.append("KW988 : 'KW' '988';\n"); + grammarBuilder.append("KW989 : 'KW' '989';\n"); + grammarBuilder.append("KW990 : 'KW' '990';\n"); + grammarBuilder.append("KW991 : 'KW' '991';\n"); + grammarBuilder.append("KW992 : 'KW' '992';\n"); + grammarBuilder.append("KW993 : 'KW' '993';\n"); + grammarBuilder.append("KW994 : 'KW' '994';\n"); + grammarBuilder.append("KW995 : 'KW' '995';\n"); + grammarBuilder.append("KW996 : 'KW' '996';\n"); + grammarBuilder.append("KW997 : 'KW' '997';\n"); + grammarBuilder.append("KW998 : 'KW' '998';\n"); + grammarBuilder.append("KW999 : 'KW' '999';\n"); + grammarBuilder.append("KW1000 : 'KW' '1000';\n"); + grammarBuilder.append("KW1001 : 'KW' '1001';\n"); + grammarBuilder.append("KW1002 : 'KW' '1002';\n"); + grammarBuilder.append("KW1003 : 'KW' '1003';\n"); + grammarBuilder.append("KW1004 : 'KW' '1004';\n"); + grammarBuilder.append("KW1005 : 'KW' '1005';\n"); + grammarBuilder.append("KW1006 : 'KW' '1006';\n"); + grammarBuilder.append("KW1007 : 'KW' '1007';\n"); + grammarBuilder.append("KW1008 : 'KW' '1008';\n"); + grammarBuilder.append("KW1009 : 'KW' '1009';\n"); + grammarBuilder.append("KW1010 : 'KW' '1010';\n"); + grammarBuilder.append("KW1011 : 'KW' '1011';\n"); + grammarBuilder.append("KW1012 : 'KW' '1012';\n"); + grammarBuilder.append("KW1013 : 'KW' '1013';\n"); + grammarBuilder.append("KW1014 : 'KW' '1014';\n"); + grammarBuilder.append("KW1015 : 'KW' '1015';\n"); + grammarBuilder.append("KW1016 : 'KW' '1016';\n"); + grammarBuilder.append("KW1017 : 'KW' '1017';\n"); + grammarBuilder.append("KW1018 : 'KW' '1018';\n"); + grammarBuilder.append("KW1019 : 'KW' '1019';\n"); + grammarBuilder.append("KW1020 : 'KW' '1020';\n"); + grammarBuilder.append("KW1021 : 'KW' '1021';\n"); + grammarBuilder.append("KW1022 : 'KW' '1022';\n"); + grammarBuilder.append("KW1023 : 'KW' '1023';\n"); + grammarBuilder.append("KW1024 : 'KW' '1024';\n"); + grammarBuilder.append("KW1025 : 'KW' '1025';\n"); + grammarBuilder.append("KW1026 : 'KW' '1026';\n"); + grammarBuilder.append("KW1027 : 'KW' '1027';\n"); + grammarBuilder.append("KW1028 : 'KW' '1028';\n"); + grammarBuilder.append("KW1029 : 'KW' '1029';\n"); + grammarBuilder.append("KW1030 : 'KW' '1030';\n"); + grammarBuilder.append("KW1031 : 'KW' '1031';\n"); + grammarBuilder.append("KW1032 : 'KW' '1032';\n"); + grammarBuilder.append("KW1033 : 'KW' '1033';\n"); + grammarBuilder.append("KW1034 : 'KW' '1034';\n"); + grammarBuilder.append("KW1035 : 'KW' '1035';\n"); + grammarBuilder.append("KW1036 : 'KW' '1036';\n"); + grammarBuilder.append("KW1037 : 'KW' '1037';\n"); + grammarBuilder.append("KW1038 : 'KW' '1038';\n"); + grammarBuilder.append("KW1039 : 'KW' '1039';\n"); + grammarBuilder.append("KW1040 : 'KW' '1040';\n"); + grammarBuilder.append("KW1041 : 'KW' '1041';\n"); + grammarBuilder.append("KW1042 : 'KW' '1042';\n"); + grammarBuilder.append("KW1043 : 'KW' '1043';\n"); + grammarBuilder.append("KW1044 : 'KW' '1044';\n"); + grammarBuilder.append("KW1045 : 'KW' '1045';\n"); + grammarBuilder.append("KW1046 : 'KW' '1046';\n"); + grammarBuilder.append("KW1047 : 'KW' '1047';\n"); + grammarBuilder.append("KW1048 : 'KW' '1048';\n"); + grammarBuilder.append("KW1049 : 'KW' '1049';\n"); + grammarBuilder.append("KW1050 : 'KW' '1050';\n"); + grammarBuilder.append("KW1051 : 'KW' '1051';\n"); + grammarBuilder.append("KW1052 : 'KW' '1052';\n"); + grammarBuilder.append("KW1053 : 'KW' '1053';\n"); + grammarBuilder.append("KW1054 : 'KW' '1054';\n"); + grammarBuilder.append("KW1055 : 'KW' '1055';\n"); + grammarBuilder.append("KW1056 : 'KW' '1056';\n"); + grammarBuilder.append("KW1057 : 'KW' '1057';\n"); + grammarBuilder.append("KW1058 : 'KW' '1058';\n"); + grammarBuilder.append("KW1059 : 'KW' '1059';\n"); + grammarBuilder.append("KW1060 : 'KW' '1060';\n"); + grammarBuilder.append("KW1061 : 'KW' '1061';\n"); + grammarBuilder.append("KW1062 : 'KW' '1062';\n"); + grammarBuilder.append("KW1063 : 'KW' '1063';\n"); + grammarBuilder.append("KW1064 : 'KW' '1064';\n"); + grammarBuilder.append("KW1065 : 'KW' '1065';\n"); + grammarBuilder.append("KW1066 : 'KW' '1066';\n"); + grammarBuilder.append("KW1067 : 'KW' '1067';\n"); + grammarBuilder.append("KW1068 : 'KW' '1068';\n"); + grammarBuilder.append("KW1069 : 'KW' '1069';\n"); + grammarBuilder.append("KW1070 : 'KW' '1070';\n"); + grammarBuilder.append("KW1071 : 'KW' '1071';\n"); + grammarBuilder.append("KW1072 : 'KW' '1072';\n"); + grammarBuilder.append("KW1073 : 'KW' '1073';\n"); + grammarBuilder.append("KW1074 : 'KW' '1074';\n"); + grammarBuilder.append("KW1075 : 'KW' '1075';\n"); + grammarBuilder.append("KW1076 : 'KW' '1076';\n"); + grammarBuilder.append("KW1077 : 'KW' '1077';\n"); + grammarBuilder.append("KW1078 : 'KW' '1078';\n"); + grammarBuilder.append("KW1079 : 'KW' '1079';\n"); + grammarBuilder.append("KW1080 : 'KW' '1080';\n"); + grammarBuilder.append("KW1081 : 'KW' '1081';\n"); + grammarBuilder.append("KW1082 : 'KW' '1082';\n"); + grammarBuilder.append("KW1083 : 'KW' '1083';\n"); + grammarBuilder.append("KW1084 : 'KW' '1084';\n"); + grammarBuilder.append("KW1085 : 'KW' '1085';\n"); + grammarBuilder.append("KW1086 : 'KW' '1086';\n"); + grammarBuilder.append("KW1087 : 'KW' '1087';\n"); + grammarBuilder.append("KW1088 : 'KW' '1088';\n"); + grammarBuilder.append("KW1089 : 'KW' '1089';\n"); + grammarBuilder.append("KW1090 : 'KW' '1090';\n"); + grammarBuilder.append("KW1091 : 'KW' '1091';\n"); + grammarBuilder.append("KW1092 : 'KW' '1092';\n"); + grammarBuilder.append("KW1093 : 'KW' '1093';\n"); + grammarBuilder.append("KW1094 : 'KW' '1094';\n"); + grammarBuilder.append("KW1095 : 'KW' '1095';\n"); + grammarBuilder.append("KW1096 : 'KW' '1096';\n"); + grammarBuilder.append("KW1097 : 'KW' '1097';\n"); + grammarBuilder.append("KW1098 : 'KW' '1098';\n"); + grammarBuilder.append("KW1099 : 'KW' '1099';\n"); + grammarBuilder.append("KW1100 : 'KW' '1100';\n"); + grammarBuilder.append("KW1101 : 'KW' '1101';\n"); + grammarBuilder.append("KW1102 : 'KW' '1102';\n"); + grammarBuilder.append("KW1103 : 'KW' '1103';\n"); + grammarBuilder.append("KW1104 : 'KW' '1104';\n"); + grammarBuilder.append("KW1105 : 'KW' '1105';\n"); + grammarBuilder.append("KW1106 : 'KW' '1106';\n"); + grammarBuilder.append("KW1107 : 'KW' '1107';\n"); + grammarBuilder.append("KW1108 : 'KW' '1108';\n"); + grammarBuilder.append("KW1109 : 'KW' '1109';\n"); + grammarBuilder.append("KW1110 : 'KW' '1110';\n"); + grammarBuilder.append("KW1111 : 'KW' '1111';\n"); + grammarBuilder.append("KW1112 : 'KW' '1112';\n"); + grammarBuilder.append("KW1113 : 'KW' '1113';\n"); + grammarBuilder.append("KW1114 : 'KW' '1114';\n"); + grammarBuilder.append("KW1115 : 'KW' '1115';\n"); + grammarBuilder.append("KW1116 : 'KW' '1116';\n"); + grammarBuilder.append("KW1117 : 'KW' '1117';\n"); + grammarBuilder.append("KW1118 : 'KW' '1118';\n"); + grammarBuilder.append("KW1119 : 'KW' '1119';\n"); + grammarBuilder.append("KW1120 : 'KW' '1120';\n"); + grammarBuilder.append("KW1121 : 'KW' '1121';\n"); + grammarBuilder.append("KW1122 : 'KW' '1122';\n"); + grammarBuilder.append("KW1123 : 'KW' '1123';\n"); + grammarBuilder.append("KW1124 : 'KW' '1124';\n"); + grammarBuilder.append("KW1125 : 'KW' '1125';\n"); + grammarBuilder.append("KW1126 : 'KW' '1126';\n"); + grammarBuilder.append("KW1127 : 'KW' '1127';\n"); + grammarBuilder.append("KW1128 : 'KW' '1128';\n"); + grammarBuilder.append("KW1129 : 'KW' '1129';\n"); + grammarBuilder.append("KW1130 : 'KW' '1130';\n"); + grammarBuilder.append("KW1131 : 'KW' '1131';\n"); + grammarBuilder.append("KW1132 : 'KW' '1132';\n"); + grammarBuilder.append("KW1133 : 'KW' '1133';\n"); + grammarBuilder.append("KW1134 : 'KW' '1134';\n"); + grammarBuilder.append("KW1135 : 'KW' '1135';\n"); + grammarBuilder.append("KW1136 : 'KW' '1136';\n"); + grammarBuilder.append("KW1137 : 'KW' '1137';\n"); + grammarBuilder.append("KW1138 : 'KW' '1138';\n"); + grammarBuilder.append("KW1139 : 'KW' '1139';\n"); + grammarBuilder.append("KW1140 : 'KW' '1140';\n"); + grammarBuilder.append("KW1141 : 'KW' '1141';\n"); + grammarBuilder.append("KW1142 : 'KW' '1142';\n"); + grammarBuilder.append("KW1143 : 'KW' '1143';\n"); + grammarBuilder.append("KW1144 : 'KW' '1144';\n"); + grammarBuilder.append("KW1145 : 'KW' '1145';\n"); + grammarBuilder.append("KW1146 : 'KW' '1146';\n"); + grammarBuilder.append("KW1147 : 'KW' '1147';\n"); + grammarBuilder.append("KW1148 : 'KW' '1148';\n"); + grammarBuilder.append("KW1149 : 'KW' '1149';\n"); + grammarBuilder.append("KW1150 : 'KW' '1150';\n"); + grammarBuilder.append("KW1151 : 'KW' '1151';\n"); + grammarBuilder.append("KW1152 : 'KW' '1152';\n"); + grammarBuilder.append("KW1153 : 'KW' '1153';\n"); + grammarBuilder.append("KW1154 : 'KW' '1154';\n"); + grammarBuilder.append("KW1155 : 'KW' '1155';\n"); + grammarBuilder.append("KW1156 : 'KW' '1156';\n"); + grammarBuilder.append("KW1157 : 'KW' '1157';\n"); + grammarBuilder.append("KW1158 : 'KW' '1158';\n"); + grammarBuilder.append("KW1159 : 'KW' '1159';\n"); + grammarBuilder.append("KW1160 : 'KW' '1160';\n"); + grammarBuilder.append("KW1161 : 'KW' '1161';\n"); + grammarBuilder.append("KW1162 : 'KW' '1162';\n"); + grammarBuilder.append("KW1163 : 'KW' '1163';\n"); + grammarBuilder.append("KW1164 : 'KW' '1164';\n"); + grammarBuilder.append("KW1165 : 'KW' '1165';\n"); + grammarBuilder.append("KW1166 : 'KW' '1166';\n"); + grammarBuilder.append("KW1167 : 'KW' '1167';\n"); + grammarBuilder.append("KW1168 : 'KW' '1168';\n"); + grammarBuilder.append("KW1169 : 'KW' '1169';\n"); + grammarBuilder.append("KW1170 : 'KW' '1170';\n"); + grammarBuilder.append("KW1171 : 'KW' '1171';\n"); + grammarBuilder.append("KW1172 : 'KW' '1172';\n"); + grammarBuilder.append("KW1173 : 'KW' '1173';\n"); + grammarBuilder.append("KW1174 : 'KW' '1174';\n"); + grammarBuilder.append("KW1175 : 'KW' '1175';\n"); + grammarBuilder.append("KW1176 : 'KW' '1176';\n"); + grammarBuilder.append("KW1177 : 'KW' '1177';\n"); + grammarBuilder.append("KW1178 : 'KW' '1178';\n"); + grammarBuilder.append("KW1179 : 'KW' '1179';\n"); + grammarBuilder.append("KW1180 : 'KW' '1180';\n"); + grammarBuilder.append("KW1181 : 'KW' '1181';\n"); + grammarBuilder.append("KW1182 : 'KW' '1182';\n"); + grammarBuilder.append("KW1183 : 'KW' '1183';\n"); + grammarBuilder.append("KW1184 : 'KW' '1184';\n"); + grammarBuilder.append("KW1185 : 'KW' '1185';\n"); + grammarBuilder.append("KW1186 : 'KW' '1186';\n"); + grammarBuilder.append("KW1187 : 'KW' '1187';\n"); + grammarBuilder.append("KW1188 : 'KW' '1188';\n"); + grammarBuilder.append("KW1189 : 'KW' '1189';\n"); + grammarBuilder.append("KW1190 : 'KW' '1190';\n"); + grammarBuilder.append("KW1191 : 'KW' '1191';\n"); + grammarBuilder.append("KW1192 : 'KW' '1192';\n"); + grammarBuilder.append("KW1193 : 'KW' '1193';\n"); + grammarBuilder.append("KW1194 : 'KW' '1194';\n"); + grammarBuilder.append("KW1195 : 'KW' '1195';\n"); + grammarBuilder.append("KW1196 : 'KW' '1196';\n"); + grammarBuilder.append("KW1197 : 'KW' '1197';\n"); + grammarBuilder.append("KW1198 : 'KW' '1198';\n"); + grammarBuilder.append("KW1199 : 'KW' '1199';\n"); + grammarBuilder.append("KW1200 : 'KW' '1200';\n"); + grammarBuilder.append("KW1201 : 'KW' '1201';\n"); + grammarBuilder.append("KW1202 : 'KW' '1202';\n"); + grammarBuilder.append("KW1203 : 'KW' '1203';\n"); + grammarBuilder.append("KW1204 : 'KW' '1204';\n"); + grammarBuilder.append("KW1205 : 'KW' '1205';\n"); + grammarBuilder.append("KW1206 : 'KW' '1206';\n"); + grammarBuilder.append("KW1207 : 'KW' '1207';\n"); + grammarBuilder.append("KW1208 : 'KW' '1208';\n"); + grammarBuilder.append("KW1209 : 'KW' '1209';\n"); + grammarBuilder.append("KW1210 : 'KW' '1210';\n"); + grammarBuilder.append("KW1211 : 'KW' '1211';\n"); + grammarBuilder.append("KW1212 : 'KW' '1212';\n"); + grammarBuilder.append("KW1213 : 'KW' '1213';\n"); + grammarBuilder.append("KW1214 : 'KW' '1214';\n"); + grammarBuilder.append("KW1215 : 'KW' '1215';\n"); + grammarBuilder.append("KW1216 : 'KW' '1216';\n"); + grammarBuilder.append("KW1217 : 'KW' '1217';\n"); + grammarBuilder.append("KW1218 : 'KW' '1218';\n"); + grammarBuilder.append("KW1219 : 'KW' '1219';\n"); + grammarBuilder.append("KW1220 : 'KW' '1220';\n"); + grammarBuilder.append("KW1221 : 'KW' '1221';\n"); + grammarBuilder.append("KW1222 : 'KW' '1222';\n"); + grammarBuilder.append("KW1223 : 'KW' '1223';\n"); + grammarBuilder.append("KW1224 : 'KW' '1224';\n"); + grammarBuilder.append("KW1225 : 'KW' '1225';\n"); + grammarBuilder.append("KW1226 : 'KW' '1226';\n"); + grammarBuilder.append("KW1227 : 'KW' '1227';\n"); + grammarBuilder.append("KW1228 : 'KW' '1228';\n"); + grammarBuilder.append("KW1229 : 'KW' '1229';\n"); + grammarBuilder.append("KW1230 : 'KW' '1230';\n"); + grammarBuilder.append("KW1231 : 'KW' '1231';\n"); + grammarBuilder.append("KW1232 : 'KW' '1232';\n"); + grammarBuilder.append("KW1233 : 'KW' '1233';\n"); + grammarBuilder.append("KW1234 : 'KW' '1234';\n"); + grammarBuilder.append("KW1235 : 'KW' '1235';\n"); + grammarBuilder.append("KW1236 : 'KW' '1236';\n"); + grammarBuilder.append("KW1237 : 'KW' '1237';\n"); + grammarBuilder.append("KW1238 : 'KW' '1238';\n"); + grammarBuilder.append("KW1239 : 'KW' '1239';\n"); + grammarBuilder.append("KW1240 : 'KW' '1240';\n"); + grammarBuilder.append("KW1241 : 'KW' '1241';\n"); + grammarBuilder.append("KW1242 : 'KW' '1242';\n"); + grammarBuilder.append("KW1243 : 'KW' '1243';\n"); + grammarBuilder.append("KW1244 : 'KW' '1244';\n"); + grammarBuilder.append("KW1245 : 'KW' '1245';\n"); + grammarBuilder.append("KW1246 : 'KW' '1246';\n"); + grammarBuilder.append("KW1247 : 'KW' '1247';\n"); + grammarBuilder.append("KW1248 : 'KW' '1248';\n"); + grammarBuilder.append("KW1249 : 'KW' '1249';\n"); + grammarBuilder.append("KW1250 : 'KW' '1250';\n"); + grammarBuilder.append("KW1251 : 'KW' '1251';\n"); + grammarBuilder.append("KW1252 : 'KW' '1252';\n"); + grammarBuilder.append("KW1253 : 'KW' '1253';\n"); + grammarBuilder.append("KW1254 : 'KW' '1254';\n"); + grammarBuilder.append("KW1255 : 'KW' '1255';\n"); + grammarBuilder.append("KW1256 : 'KW' '1256';\n"); + grammarBuilder.append("KW1257 : 'KW' '1257';\n"); + grammarBuilder.append("KW1258 : 'KW' '1258';\n"); + grammarBuilder.append("KW1259 : 'KW' '1259';\n"); + grammarBuilder.append("KW1260 : 'KW' '1260';\n"); + grammarBuilder.append("KW1261 : 'KW' '1261';\n"); + grammarBuilder.append("KW1262 : 'KW' '1262';\n"); + grammarBuilder.append("KW1263 : 'KW' '1263';\n"); + grammarBuilder.append("KW1264 : 'KW' '1264';\n"); + grammarBuilder.append("KW1265 : 'KW' '1265';\n"); + grammarBuilder.append("KW1266 : 'KW' '1266';\n"); + grammarBuilder.append("KW1267 : 'KW' '1267';\n"); + grammarBuilder.append("KW1268 : 'KW' '1268';\n"); + grammarBuilder.append("KW1269 : 'KW' '1269';\n"); + grammarBuilder.append("KW1270 : 'KW' '1270';\n"); + grammarBuilder.append("KW1271 : 'KW' '1271';\n"); + grammarBuilder.append("KW1272 : 'KW' '1272';\n"); + grammarBuilder.append("KW1273 : 'KW' '1273';\n"); + grammarBuilder.append("KW1274 : 'KW' '1274';\n"); + grammarBuilder.append("KW1275 : 'KW' '1275';\n"); + grammarBuilder.append("KW1276 : 'KW' '1276';\n"); + grammarBuilder.append("KW1277 : 'KW' '1277';\n"); + grammarBuilder.append("KW1278 : 'KW' '1278';\n"); + grammarBuilder.append("KW1279 : 'KW' '1279';\n"); + grammarBuilder.append("KW1280 : 'KW' '1280';\n"); + grammarBuilder.append("KW1281 : 'KW' '1281';\n"); + grammarBuilder.append("KW1282 : 'KW' '1282';\n"); + grammarBuilder.append("KW1283 : 'KW' '1283';\n"); + grammarBuilder.append("KW1284 : 'KW' '1284';\n"); + grammarBuilder.append("KW1285 : 'KW' '1285';\n"); + grammarBuilder.append("KW1286 : 'KW' '1286';\n"); + grammarBuilder.append("KW1287 : 'KW' '1287';\n"); + grammarBuilder.append("KW1288 : 'KW' '1288';\n"); + grammarBuilder.append("KW1289 : 'KW' '1289';\n"); + grammarBuilder.append("KW1290 : 'KW' '1290';\n"); + grammarBuilder.append("KW1291 : 'KW' '1291';\n"); + grammarBuilder.append("KW1292 : 'KW' '1292';\n"); + grammarBuilder.append("KW1293 : 'KW' '1293';\n"); + grammarBuilder.append("KW1294 : 'KW' '1294';\n"); + grammarBuilder.append("KW1295 : 'KW' '1295';\n"); + grammarBuilder.append("KW1296 : 'KW' '1296';\n"); + grammarBuilder.append("KW1297 : 'KW' '1297';\n"); + grammarBuilder.append("KW1298 : 'KW' '1298';\n"); + grammarBuilder.append("KW1299 : 'KW' '1299';\n"); + grammarBuilder.append("KW1300 : 'KW' '1300';\n"); + grammarBuilder.append("KW1301 : 'KW' '1301';\n"); + grammarBuilder.append("KW1302 : 'KW' '1302';\n"); + grammarBuilder.append("KW1303 : 'KW' '1303';\n"); + grammarBuilder.append("KW1304 : 'KW' '1304';\n"); + grammarBuilder.append("KW1305 : 'KW' '1305';\n"); + grammarBuilder.append("KW1306 : 'KW' '1306';\n"); + grammarBuilder.append("KW1307 : 'KW' '1307';\n"); + grammarBuilder.append("KW1308 : 'KW' '1308';\n"); + grammarBuilder.append("KW1309 : 'KW' '1309';\n"); + grammarBuilder.append("KW1310 : 'KW' '1310';\n"); + grammarBuilder.append("KW1311 : 'KW' '1311';\n"); + grammarBuilder.append("KW1312 : 'KW' '1312';\n"); + grammarBuilder.append("KW1313 : 'KW' '1313';\n"); + grammarBuilder.append("KW1314 : 'KW' '1314';\n"); + grammarBuilder.append("KW1315 : 'KW' '1315';\n"); + grammarBuilder.append("KW1316 : 'KW' '1316';\n"); + grammarBuilder.append("KW1317 : 'KW' '1317';\n"); + grammarBuilder.append("KW1318 : 'KW' '1318';\n"); + grammarBuilder.append("KW1319 : 'KW' '1319';\n"); + grammarBuilder.append("KW1320 : 'KW' '1320';\n"); + grammarBuilder.append("KW1321 : 'KW' '1321';\n"); + grammarBuilder.append("KW1322 : 'KW' '1322';\n"); + grammarBuilder.append("KW1323 : 'KW' '1323';\n"); + grammarBuilder.append("KW1324 : 'KW' '1324';\n"); + grammarBuilder.append("KW1325 : 'KW' '1325';\n"); + grammarBuilder.append("KW1326 : 'KW' '1326';\n"); + grammarBuilder.append("KW1327 : 'KW' '1327';\n"); + grammarBuilder.append("KW1328 : 'KW' '1328';\n"); + grammarBuilder.append("KW1329 : 'KW' '1329';\n"); + grammarBuilder.append("KW1330 : 'KW' '1330';\n"); + grammarBuilder.append("KW1331 : 'KW' '1331';\n"); + grammarBuilder.append("KW1332 : 'KW' '1332';\n"); + grammarBuilder.append("KW1333 : 'KW' '1333';\n"); + grammarBuilder.append("KW1334 : 'KW' '1334';\n"); + grammarBuilder.append("KW1335 : 'KW' '1335';\n"); + grammarBuilder.append("KW1336 : 'KW' '1336';\n"); + grammarBuilder.append("KW1337 : 'KW' '1337';\n"); + grammarBuilder.append("KW1338 : 'KW' '1338';\n"); + grammarBuilder.append("KW1339 : 'KW' '1339';\n"); + grammarBuilder.append("KW1340 : 'KW' '1340';\n"); + grammarBuilder.append("KW1341 : 'KW' '1341';\n"); + grammarBuilder.append("KW1342 : 'KW' '1342';\n"); + grammarBuilder.append("KW1343 : 'KW' '1343';\n"); + grammarBuilder.append("KW1344 : 'KW' '1344';\n"); + grammarBuilder.append("KW1345 : 'KW' '1345';\n"); + grammarBuilder.append("KW1346 : 'KW' '1346';\n"); + grammarBuilder.append("KW1347 : 'KW' '1347';\n"); + grammarBuilder.append("KW1348 : 'KW' '1348';\n"); + grammarBuilder.append("KW1349 : 'KW' '1349';\n"); + grammarBuilder.append("KW1350 : 'KW' '1350';\n"); + grammarBuilder.append("KW1351 : 'KW' '1351';\n"); + grammarBuilder.append("KW1352 : 'KW' '1352';\n"); + grammarBuilder.append("KW1353 : 'KW' '1353';\n"); + grammarBuilder.append("KW1354 : 'KW' '1354';\n"); + grammarBuilder.append("KW1355 : 'KW' '1355';\n"); + grammarBuilder.append("KW1356 : 'KW' '1356';\n"); + grammarBuilder.append("KW1357 : 'KW' '1357';\n"); + grammarBuilder.append("KW1358 : 'KW' '1358';\n"); + grammarBuilder.append("KW1359 : 'KW' '1359';\n"); + grammarBuilder.append("KW1360 : 'KW' '1360';\n"); + grammarBuilder.append("KW1361 : 'KW' '1361';\n"); + grammarBuilder.append("KW1362 : 'KW' '1362';\n"); + grammarBuilder.append("KW1363 : 'KW' '1363';\n"); + grammarBuilder.append("KW1364 : 'KW' '1364';\n"); + grammarBuilder.append("KW1365 : 'KW' '1365';\n"); + grammarBuilder.append("KW1366 : 'KW' '1366';\n"); + grammarBuilder.append("KW1367 : 'KW' '1367';\n"); + grammarBuilder.append("KW1368 : 'KW' '1368';\n"); + grammarBuilder.append("KW1369 : 'KW' '1369';\n"); + grammarBuilder.append("KW1370 : 'KW' '1370';\n"); + grammarBuilder.append("KW1371 : 'KW' '1371';\n"); + grammarBuilder.append("KW1372 : 'KW' '1372';\n"); + grammarBuilder.append("KW1373 : 'KW' '1373';\n"); + grammarBuilder.append("KW1374 : 'KW' '1374';\n"); + grammarBuilder.append("KW1375 : 'KW' '1375';\n"); + grammarBuilder.append("KW1376 : 'KW' '1376';\n"); + grammarBuilder.append("KW1377 : 'KW' '1377';\n"); + grammarBuilder.append("KW1378 : 'KW' '1378';\n"); + grammarBuilder.append("KW1379 : 'KW' '1379';\n"); + grammarBuilder.append("KW1380 : 'KW' '1380';\n"); + grammarBuilder.append("KW1381 : 'KW' '1381';\n"); + grammarBuilder.append("KW1382 : 'KW' '1382';\n"); + grammarBuilder.append("KW1383 : 'KW' '1383';\n"); + grammarBuilder.append("KW1384 : 'KW' '1384';\n"); + grammarBuilder.append("KW1385 : 'KW' '1385';\n"); + grammarBuilder.append("KW1386 : 'KW' '1386';\n"); + grammarBuilder.append("KW1387 : 'KW' '1387';\n"); + grammarBuilder.append("KW1388 : 'KW' '1388';\n"); + grammarBuilder.append("KW1389 : 'KW' '1389';\n"); + grammarBuilder.append("KW1390 : 'KW' '1390';\n"); + grammarBuilder.append("KW1391 : 'KW' '1391';\n"); + grammarBuilder.append("KW1392 : 'KW' '1392';\n"); + grammarBuilder.append("KW1393 : 'KW' '1393';\n"); + grammarBuilder.append("KW1394 : 'KW' '1394';\n"); + grammarBuilder.append("KW1395 : 'KW' '1395';\n"); + grammarBuilder.append("KW1396 : 'KW' '1396';\n"); + grammarBuilder.append("KW1397 : 'KW' '1397';\n"); + grammarBuilder.append("KW1398 : 'KW' '1398';\n"); + grammarBuilder.append("KW1399 : 'KW' '1399';\n"); + grammarBuilder.append("KW1400 : 'KW' '1400';\n"); + grammarBuilder.append("KW1401 : 'KW' '1401';\n"); + grammarBuilder.append("KW1402 : 'KW' '1402';\n"); + grammarBuilder.append("KW1403 : 'KW' '1403';\n"); + grammarBuilder.append("KW1404 : 'KW' '1404';\n"); + grammarBuilder.append("KW1405 : 'KW' '1405';\n"); + grammarBuilder.append("KW1406 : 'KW' '1406';\n"); + grammarBuilder.append("KW1407 : 'KW' '1407';\n"); + grammarBuilder.append("KW1408 : 'KW' '1408';\n"); + grammarBuilder.append("KW1409 : 'KW' '1409';\n"); + grammarBuilder.append("KW1410 : 'KW' '1410';\n"); + grammarBuilder.append("KW1411 : 'KW' '1411';\n"); + grammarBuilder.append("KW1412 : 'KW' '1412';\n"); + grammarBuilder.append("KW1413 : 'KW' '1413';\n"); + grammarBuilder.append("KW1414 : 'KW' '1414';\n"); + grammarBuilder.append("KW1415 : 'KW' '1415';\n"); + grammarBuilder.append("KW1416 : 'KW' '1416';\n"); + grammarBuilder.append("KW1417 : 'KW' '1417';\n"); + grammarBuilder.append("KW1418 : 'KW' '1418';\n"); + grammarBuilder.append("KW1419 : 'KW' '1419';\n"); + grammarBuilder.append("KW1420 : 'KW' '1420';\n"); + grammarBuilder.append("KW1421 : 'KW' '1421';\n"); + grammarBuilder.append("KW1422 : 'KW' '1422';\n"); + grammarBuilder.append("KW1423 : 'KW' '1423';\n"); + grammarBuilder.append("KW1424 : 'KW' '1424';\n"); + grammarBuilder.append("KW1425 : 'KW' '1425';\n"); + grammarBuilder.append("KW1426 : 'KW' '1426';\n"); + grammarBuilder.append("KW1427 : 'KW' '1427';\n"); + grammarBuilder.append("KW1428 : 'KW' '1428';\n"); + grammarBuilder.append("KW1429 : 'KW' '1429';\n"); + grammarBuilder.append("KW1430 : 'KW' '1430';\n"); + grammarBuilder.append("KW1431 : 'KW' '1431';\n"); + grammarBuilder.append("KW1432 : 'KW' '1432';\n"); + grammarBuilder.append("KW1433 : 'KW' '1433';\n"); + grammarBuilder.append("KW1434 : 'KW' '1434';\n"); + grammarBuilder.append("KW1435 : 'KW' '1435';\n"); + grammarBuilder.append("KW1436 : 'KW' '1436';\n"); + grammarBuilder.append("KW1437 : 'KW' '1437';\n"); + grammarBuilder.append("KW1438 : 'KW' '1438';\n"); + grammarBuilder.append("KW1439 : 'KW' '1439';\n"); + grammarBuilder.append("KW1440 : 'KW' '1440';\n"); + grammarBuilder.append("KW1441 : 'KW' '1441';\n"); + grammarBuilder.append("KW1442 : 'KW' '1442';\n"); + grammarBuilder.append("KW1443 : 'KW' '1443';\n"); + grammarBuilder.append("KW1444 : 'KW' '1444';\n"); + grammarBuilder.append("KW1445 : 'KW' '1445';\n"); + grammarBuilder.append("KW1446 : 'KW' '1446';\n"); + grammarBuilder.append("KW1447 : 'KW' '1447';\n"); + grammarBuilder.append("KW1448 : 'KW' '1448';\n"); + grammarBuilder.append("KW1449 : 'KW' '1449';\n"); + grammarBuilder.append("KW1450 : 'KW' '1450';\n"); + grammarBuilder.append("KW1451 : 'KW' '1451';\n"); + grammarBuilder.append("KW1452 : 'KW' '1452';\n"); + grammarBuilder.append("KW1453 : 'KW' '1453';\n"); + grammarBuilder.append("KW1454 : 'KW' '1454';\n"); + grammarBuilder.append("KW1455 : 'KW' '1455';\n"); + grammarBuilder.append("KW1456 : 'KW' '1456';\n"); + grammarBuilder.append("KW1457 : 'KW' '1457';\n"); + grammarBuilder.append("KW1458 : 'KW' '1458';\n"); + grammarBuilder.append("KW1459 : 'KW' '1459';\n"); + grammarBuilder.append("KW1460 : 'KW' '1460';\n"); + grammarBuilder.append("KW1461 : 'KW' '1461';\n"); + grammarBuilder.append("KW1462 : 'KW' '1462';\n"); + grammarBuilder.append("KW1463 : 'KW' '1463';\n"); + grammarBuilder.append("KW1464 : 'KW' '1464';\n"); + grammarBuilder.append("KW1465 : 'KW' '1465';\n"); + grammarBuilder.append("KW1466 : 'KW' '1466';\n"); + grammarBuilder.append("KW1467 : 'KW' '1467';\n"); + grammarBuilder.append("KW1468 : 'KW' '1468';\n"); + grammarBuilder.append("KW1469 : 'KW' '1469';\n"); + grammarBuilder.append("KW1470 : 'KW' '1470';\n"); + grammarBuilder.append("KW1471 : 'KW' '1471';\n"); + grammarBuilder.append("KW1472 : 'KW' '1472';\n"); + grammarBuilder.append("KW1473 : 'KW' '1473';\n"); + grammarBuilder.append("KW1474 : 'KW' '1474';\n"); + grammarBuilder.append("KW1475 : 'KW' '1475';\n"); + grammarBuilder.append("KW1476 : 'KW' '1476';\n"); + grammarBuilder.append("KW1477 : 'KW' '1477';\n"); + grammarBuilder.append("KW1478 : 'KW' '1478';\n"); + grammarBuilder.append("KW1479 : 'KW' '1479';\n"); + grammarBuilder.append("KW1480 : 'KW' '1480';\n"); + grammarBuilder.append("KW1481 : 'KW' '1481';\n"); + grammarBuilder.append("KW1482 : 'KW' '1482';\n"); + grammarBuilder.append("KW1483 : 'KW' '1483';\n"); + grammarBuilder.append("KW1484 : 'KW' '1484';\n"); + grammarBuilder.append("KW1485 : 'KW' '1485';\n"); + grammarBuilder.append("KW1486 : 'KW' '1486';\n"); + grammarBuilder.append("KW1487 : 'KW' '1487';\n"); + grammarBuilder.append("KW1488 : 'KW' '1488';\n"); + grammarBuilder.append("KW1489 : 'KW' '1489';\n"); + grammarBuilder.append("KW1490 : 'KW' '1490';\n"); + grammarBuilder.append("KW1491 : 'KW' '1491';\n"); + grammarBuilder.append("KW1492 : 'KW' '1492';\n"); + grammarBuilder.append("KW1493 : 'KW' '1493';\n"); + grammarBuilder.append("KW1494 : 'KW' '1494';\n"); + grammarBuilder.append("KW1495 : 'KW' '1495';\n"); + grammarBuilder.append("KW1496 : 'KW' '1496';\n"); + grammarBuilder.append("KW1497 : 'KW' '1497';\n"); + grammarBuilder.append("KW1498 : 'KW' '1498';\n"); + grammarBuilder.append("KW1499 : 'KW' '1499';\n"); + grammarBuilder.append("KW1500 : 'KW' '1500';\n"); + grammarBuilder.append("KW1501 : 'KW' '1501';\n"); + grammarBuilder.append("KW1502 : 'KW' '1502';\n"); + grammarBuilder.append("KW1503 : 'KW' '1503';\n"); + grammarBuilder.append("KW1504 : 'KW' '1504';\n"); + grammarBuilder.append("KW1505 : 'KW' '1505';\n"); + grammarBuilder.append("KW1506 : 'KW' '1506';\n"); + grammarBuilder.append("KW1507 : 'KW' '1507';\n"); + grammarBuilder.append("KW1508 : 'KW' '1508';\n"); + grammarBuilder.append("KW1509 : 'KW' '1509';\n"); + grammarBuilder.append("KW1510 : 'KW' '1510';\n"); + grammarBuilder.append("KW1511 : 'KW' '1511';\n"); + grammarBuilder.append("KW1512 : 'KW' '1512';\n"); + grammarBuilder.append("KW1513 : 'KW' '1513';\n"); + grammarBuilder.append("KW1514 : 'KW' '1514';\n"); + grammarBuilder.append("KW1515 : 'KW' '1515';\n"); + grammarBuilder.append("KW1516 : 'KW' '1516';\n"); + grammarBuilder.append("KW1517 : 'KW' '1517';\n"); + grammarBuilder.append("KW1518 : 'KW' '1518';\n"); + grammarBuilder.append("KW1519 : 'KW' '1519';\n"); + grammarBuilder.append("KW1520 : 'KW' '1520';\n"); + grammarBuilder.append("KW1521 : 'KW' '1521';\n"); + grammarBuilder.append("KW1522 : 'KW' '1522';\n"); + grammarBuilder.append("KW1523 : 'KW' '1523';\n"); + grammarBuilder.append("KW1524 : 'KW' '1524';\n"); + grammarBuilder.append("KW1525 : 'KW' '1525';\n"); + grammarBuilder.append("KW1526 : 'KW' '1526';\n"); + grammarBuilder.append("KW1527 : 'KW' '1527';\n"); + grammarBuilder.append("KW1528 : 'KW' '1528';\n"); + grammarBuilder.append("KW1529 : 'KW' '1529';\n"); + grammarBuilder.append("KW1530 : 'KW' '1530';\n"); + grammarBuilder.append("KW1531 : 'KW' '1531';\n"); + grammarBuilder.append("KW1532 : 'KW' '1532';\n"); + grammarBuilder.append("KW1533 : 'KW' '1533';\n"); + grammarBuilder.append("KW1534 : 'KW' '1534';\n"); + grammarBuilder.append("KW1535 : 'KW' '1535';\n"); + grammarBuilder.append("KW1536 : 'KW' '1536';\n"); + grammarBuilder.append("KW1537 : 'KW' '1537';\n"); + grammarBuilder.append("KW1538 : 'KW' '1538';\n"); + grammarBuilder.append("KW1539 : 'KW' '1539';\n"); + grammarBuilder.append("KW1540 : 'KW' '1540';\n"); + grammarBuilder.append("KW1541 : 'KW' '1541';\n"); + grammarBuilder.append("KW1542 : 'KW' '1542';\n"); + grammarBuilder.append("KW1543 : 'KW' '1543';\n"); + grammarBuilder.append("KW1544 : 'KW' '1544';\n"); + grammarBuilder.append("KW1545 : 'KW' '1545';\n"); + grammarBuilder.append("KW1546 : 'KW' '1546';\n"); + grammarBuilder.append("KW1547 : 'KW' '1547';\n"); + grammarBuilder.append("KW1548 : 'KW' '1548';\n"); + grammarBuilder.append("KW1549 : 'KW' '1549';\n"); + grammarBuilder.append("KW1550 : 'KW' '1550';\n"); + grammarBuilder.append("KW1551 : 'KW' '1551';\n"); + grammarBuilder.append("KW1552 : 'KW' '1552';\n"); + grammarBuilder.append("KW1553 : 'KW' '1553';\n"); + grammarBuilder.append("KW1554 : 'KW' '1554';\n"); + grammarBuilder.append("KW1555 : 'KW' '1555';\n"); + grammarBuilder.append("KW1556 : 'KW' '1556';\n"); + grammarBuilder.append("KW1557 : 'KW' '1557';\n"); + grammarBuilder.append("KW1558 : 'KW' '1558';\n"); + grammarBuilder.append("KW1559 : 'KW' '1559';\n"); + grammarBuilder.append("KW1560 : 'KW' '1560';\n"); + grammarBuilder.append("KW1561 : 'KW' '1561';\n"); + grammarBuilder.append("KW1562 : 'KW' '1562';\n"); + grammarBuilder.append("KW1563 : 'KW' '1563';\n"); + grammarBuilder.append("KW1564 : 'KW' '1564';\n"); + grammarBuilder.append("KW1565 : 'KW' '1565';\n"); + grammarBuilder.append("KW1566 : 'KW' '1566';\n"); + grammarBuilder.append("KW1567 : 'KW' '1567';\n"); + grammarBuilder.append("KW1568 : 'KW' '1568';\n"); + grammarBuilder.append("KW1569 : 'KW' '1569';\n"); + grammarBuilder.append("KW1570 : 'KW' '1570';\n"); + grammarBuilder.append("KW1571 : 'KW' '1571';\n"); + grammarBuilder.append("KW1572 : 'KW' '1572';\n"); + grammarBuilder.append("KW1573 : 'KW' '1573';\n"); + grammarBuilder.append("KW1574 : 'KW' '1574';\n"); + grammarBuilder.append("KW1575 : 'KW' '1575';\n"); + grammarBuilder.append("KW1576 : 'KW' '1576';\n"); + grammarBuilder.append("KW1577 : 'KW' '1577';\n"); + grammarBuilder.append("KW1578 : 'KW' '1578';\n"); + grammarBuilder.append("KW1579 : 'KW' '1579';\n"); + grammarBuilder.append("KW1580 : 'KW' '1580';\n"); + grammarBuilder.append("KW1581 : 'KW' '1581';\n"); + grammarBuilder.append("KW1582 : 'KW' '1582';\n"); + grammarBuilder.append("KW1583 : 'KW' '1583';\n"); + grammarBuilder.append("KW1584 : 'KW' '1584';\n"); + grammarBuilder.append("KW1585 : 'KW' '1585';\n"); + grammarBuilder.append("KW1586 : 'KW' '1586';\n"); + grammarBuilder.append("KW1587 : 'KW' '1587';\n"); + grammarBuilder.append("KW1588 : 'KW' '1588';\n"); + grammarBuilder.append("KW1589 : 'KW' '1589';\n"); + grammarBuilder.append("KW1590 : 'KW' '1590';\n"); + grammarBuilder.append("KW1591 : 'KW' '1591';\n"); + grammarBuilder.append("KW1592 : 'KW' '1592';\n"); + grammarBuilder.append("KW1593 : 'KW' '1593';\n"); + grammarBuilder.append("KW1594 : 'KW' '1594';\n"); + grammarBuilder.append("KW1595 : 'KW' '1595';\n"); + grammarBuilder.append("KW1596 : 'KW' '1596';\n"); + grammarBuilder.append("KW1597 : 'KW' '1597';\n"); + grammarBuilder.append("KW1598 : 'KW' '1598';\n"); + grammarBuilder.append("KW1599 : 'KW' '1599';\n"); + grammarBuilder.append("KW1600 : 'KW' '1600';\n"); + grammarBuilder.append("KW1601 : 'KW' '1601';\n"); + grammarBuilder.append("KW1602 : 'KW' '1602';\n"); + grammarBuilder.append("KW1603 : 'KW' '1603';\n"); + grammarBuilder.append("KW1604 : 'KW' '1604';\n"); + grammarBuilder.append("KW1605 : 'KW' '1605';\n"); + grammarBuilder.append("KW1606 : 'KW' '1606';\n"); + grammarBuilder.append("KW1607 : 'KW' '1607';\n"); + grammarBuilder.append("KW1608 : 'KW' '1608';\n"); + grammarBuilder.append("KW1609 : 'KW' '1609';\n"); + grammarBuilder.append("KW1610 : 'KW' '1610';\n"); + grammarBuilder.append("KW1611 : 'KW' '1611';\n"); + grammarBuilder.append("KW1612 : 'KW' '1612';\n"); + grammarBuilder.append("KW1613 : 'KW' '1613';\n"); + grammarBuilder.append("KW1614 : 'KW' '1614';\n"); + grammarBuilder.append("KW1615 : 'KW' '1615';\n"); + grammarBuilder.append("KW1616 : 'KW' '1616';\n"); + grammarBuilder.append("KW1617 : 'KW' '1617';\n"); + grammarBuilder.append("KW1618 : 'KW' '1618';\n"); + grammarBuilder.append("KW1619 : 'KW' '1619';\n"); + grammarBuilder.append("KW1620 : 'KW' '1620';\n"); + grammarBuilder.append("KW1621 : 'KW' '1621';\n"); + grammarBuilder.append("KW1622 : 'KW' '1622';\n"); + grammarBuilder.append("KW1623 : 'KW' '1623';\n"); + grammarBuilder.append("KW1624 : 'KW' '1624';\n"); + grammarBuilder.append("KW1625 : 'KW' '1625';\n"); + grammarBuilder.append("KW1626 : 'KW' '1626';\n"); + grammarBuilder.append("KW1627 : 'KW' '1627';\n"); + grammarBuilder.append("KW1628 : 'KW' '1628';\n"); + grammarBuilder.append("KW1629 : 'KW' '1629';\n"); + grammarBuilder.append("KW1630 : 'KW' '1630';\n"); + grammarBuilder.append("KW1631 : 'KW' '1631';\n"); + grammarBuilder.append("KW1632 : 'KW' '1632';\n"); + grammarBuilder.append("KW1633 : 'KW' '1633';\n"); + grammarBuilder.append("KW1634 : 'KW' '1634';\n"); + grammarBuilder.append("KW1635 : 'KW' '1635';\n"); + grammarBuilder.append("KW1636 : 'KW' '1636';\n"); + grammarBuilder.append("KW1637 : 'KW' '1637';\n"); + grammarBuilder.append("KW1638 : 'KW' '1638';\n"); + grammarBuilder.append("KW1639 : 'KW' '1639';\n"); + grammarBuilder.append("KW1640 : 'KW' '1640';\n"); + grammarBuilder.append("KW1641 : 'KW' '1641';\n"); + grammarBuilder.append("KW1642 : 'KW' '1642';\n"); + grammarBuilder.append("KW1643 : 'KW' '1643';\n"); + grammarBuilder.append("KW1644 : 'KW' '1644';\n"); + grammarBuilder.append("KW1645 : 'KW' '1645';\n"); + grammarBuilder.append("KW1646 : 'KW' '1646';\n"); + grammarBuilder.append("KW1647 : 'KW' '1647';\n"); + grammarBuilder.append("KW1648 : 'KW' '1648';\n"); + grammarBuilder.append("KW1649 : 'KW' '1649';\n"); + grammarBuilder.append("KW1650 : 'KW' '1650';\n"); + grammarBuilder.append("KW1651 : 'KW' '1651';\n"); + grammarBuilder.append("KW1652 : 'KW' '1652';\n"); + grammarBuilder.append("KW1653 : 'KW' '1653';\n"); + grammarBuilder.append("KW1654 : 'KW' '1654';\n"); + grammarBuilder.append("KW1655 : 'KW' '1655';\n"); + grammarBuilder.append("KW1656 : 'KW' '1656';\n"); + grammarBuilder.append("KW1657 : 'KW' '1657';\n"); + grammarBuilder.append("KW1658 : 'KW' '1658';\n"); + grammarBuilder.append("KW1659 : 'KW' '1659';\n"); + grammarBuilder.append("KW1660 : 'KW' '1660';\n"); + grammarBuilder.append("KW1661 : 'KW' '1661';\n"); + grammarBuilder.append("KW1662 : 'KW' '1662';\n"); + grammarBuilder.append("KW1663 : 'KW' '1663';\n"); + grammarBuilder.append("KW1664 : 'KW' '1664';\n"); + grammarBuilder.append("KW1665 : 'KW' '1665';\n"); + grammarBuilder.append("KW1666 : 'KW' '1666';\n"); + grammarBuilder.append("KW1667 : 'KW' '1667';\n"); + grammarBuilder.append("KW1668 : 'KW' '1668';\n"); + grammarBuilder.append("KW1669 : 'KW' '1669';\n"); + grammarBuilder.append("KW1670 : 'KW' '1670';\n"); + grammarBuilder.append("KW1671 : 'KW' '1671';\n"); + grammarBuilder.append("KW1672 : 'KW' '1672';\n"); + grammarBuilder.append("KW1673 : 'KW' '1673';\n"); + grammarBuilder.append("KW1674 : 'KW' '1674';\n"); + grammarBuilder.append("KW1675 : 'KW' '1675';\n"); + grammarBuilder.append("KW1676 : 'KW' '1676';\n"); + grammarBuilder.append("KW1677 : 'KW' '1677';\n"); + grammarBuilder.append("KW1678 : 'KW' '1678';\n"); + grammarBuilder.append("KW1679 : 'KW' '1679';\n"); + grammarBuilder.append("KW1680 : 'KW' '1680';\n"); + grammarBuilder.append("KW1681 : 'KW' '1681';\n"); + grammarBuilder.append("KW1682 : 'KW' '1682';\n"); + grammarBuilder.append("KW1683 : 'KW' '1683';\n"); + grammarBuilder.append("KW1684 : 'KW' '1684';\n"); + grammarBuilder.append("KW1685 : 'KW' '1685';\n"); + grammarBuilder.append("KW1686 : 'KW' '1686';\n"); + grammarBuilder.append("KW1687 : 'KW' '1687';\n"); + grammarBuilder.append("KW1688 : 'KW' '1688';\n"); + grammarBuilder.append("KW1689 : 'KW' '1689';\n"); + grammarBuilder.append("KW1690 : 'KW' '1690';\n"); + grammarBuilder.append("KW1691 : 'KW' '1691';\n"); + grammarBuilder.append("KW1692 : 'KW' '1692';\n"); + grammarBuilder.append("KW1693 : 'KW' '1693';\n"); + grammarBuilder.append("KW1694 : 'KW' '1694';\n"); + grammarBuilder.append("KW1695 : 'KW' '1695';\n"); + grammarBuilder.append("KW1696 : 'KW' '1696';\n"); + grammarBuilder.append("KW1697 : 'KW' '1697';\n"); + grammarBuilder.append("KW1698 : 'KW' '1698';\n"); + grammarBuilder.append("KW1699 : 'KW' '1699';\n"); + grammarBuilder.append("KW1700 : 'KW' '1700';\n"); + grammarBuilder.append("KW1701 : 'KW' '1701';\n"); + grammarBuilder.append("KW1702 : 'KW' '1702';\n"); + grammarBuilder.append("KW1703 : 'KW' '1703';\n"); + grammarBuilder.append("KW1704 : 'KW' '1704';\n"); + grammarBuilder.append("KW1705 : 'KW' '1705';\n"); + grammarBuilder.append("KW1706 : 'KW' '1706';\n"); + grammarBuilder.append("KW1707 : 'KW' '1707';\n"); + grammarBuilder.append("KW1708 : 'KW' '1708';\n"); + grammarBuilder.append("KW1709 : 'KW' '1709';\n"); + grammarBuilder.append("KW1710 : 'KW' '1710';\n"); + grammarBuilder.append("KW1711 : 'KW' '1711';\n"); + grammarBuilder.append("KW1712 : 'KW' '1712';\n"); + grammarBuilder.append("KW1713 : 'KW' '1713';\n"); + grammarBuilder.append("KW1714 : 'KW' '1714';\n"); + grammarBuilder.append("KW1715 : 'KW' '1715';\n"); + grammarBuilder.append("KW1716 : 'KW' '1716';\n"); + grammarBuilder.append("KW1717 : 'KW' '1717';\n"); + grammarBuilder.append("KW1718 : 'KW' '1718';\n"); + grammarBuilder.append("KW1719 : 'KW' '1719';\n"); + grammarBuilder.append("KW1720 : 'KW' '1720';\n"); + grammarBuilder.append("KW1721 : 'KW' '1721';\n"); + grammarBuilder.append("KW1722 : 'KW' '1722';\n"); + grammarBuilder.append("KW1723 : 'KW' '1723';\n"); + grammarBuilder.append("KW1724 : 'KW' '1724';\n"); + grammarBuilder.append("KW1725 : 'KW' '1725';\n"); + grammarBuilder.append("KW1726 : 'KW' '1726';\n"); + grammarBuilder.append("KW1727 : 'KW' '1727';\n"); + grammarBuilder.append("KW1728 : 'KW' '1728';\n"); + grammarBuilder.append("KW1729 : 'KW' '1729';\n"); + grammarBuilder.append("KW1730 : 'KW' '1730';\n"); + grammarBuilder.append("KW1731 : 'KW' '1731';\n"); + grammarBuilder.append("KW1732 : 'KW' '1732';\n"); + grammarBuilder.append("KW1733 : 'KW' '1733';\n"); + grammarBuilder.append("KW1734 : 'KW' '1734';\n"); + grammarBuilder.append("KW1735 : 'KW' '1735';\n"); + grammarBuilder.append("KW1736 : 'KW' '1736';\n"); + grammarBuilder.append("KW1737 : 'KW' '1737';\n"); + grammarBuilder.append("KW1738 : 'KW' '1738';\n"); + grammarBuilder.append("KW1739 : 'KW' '1739';\n"); + grammarBuilder.append("KW1740 : 'KW' '1740';\n"); + grammarBuilder.append("KW1741 : 'KW' '1741';\n"); + grammarBuilder.append("KW1742 : 'KW' '1742';\n"); + grammarBuilder.append("KW1743 : 'KW' '1743';\n"); + grammarBuilder.append("KW1744 : 'KW' '1744';\n"); + grammarBuilder.append("KW1745 : 'KW' '1745';\n"); + grammarBuilder.append("KW1746 : 'KW' '1746';\n"); + grammarBuilder.append("KW1747 : 'KW' '1747';\n"); + grammarBuilder.append("KW1748 : 'KW' '1748';\n"); + grammarBuilder.append("KW1749 : 'KW' '1749';\n"); + grammarBuilder.append("KW1750 : 'KW' '1750';\n"); + grammarBuilder.append("KW1751 : 'KW' '1751';\n"); + grammarBuilder.append("KW1752 : 'KW' '1752';\n"); + grammarBuilder.append("KW1753 : 'KW' '1753';\n"); + grammarBuilder.append("KW1754 : 'KW' '1754';\n"); + grammarBuilder.append("KW1755 : 'KW' '1755';\n"); + grammarBuilder.append("KW1756 : 'KW' '1756';\n"); + grammarBuilder.append("KW1757 : 'KW' '1757';\n"); + grammarBuilder.append("KW1758 : 'KW' '1758';\n"); + grammarBuilder.append("KW1759 : 'KW' '1759';\n"); + grammarBuilder.append("KW1760 : 'KW' '1760';\n"); + grammarBuilder.append("KW1761 : 'KW' '1761';\n"); + grammarBuilder.append("KW1762 : 'KW' '1762';\n"); + grammarBuilder.append("KW1763 : 'KW' '1763';\n"); + grammarBuilder.append("KW1764 : 'KW' '1764';\n"); + grammarBuilder.append("KW1765 : 'KW' '1765';\n"); + grammarBuilder.append("KW1766 : 'KW' '1766';\n"); + grammarBuilder.append("KW1767 : 'KW' '1767';\n"); + grammarBuilder.append("KW1768 : 'KW' '1768';\n"); + grammarBuilder.append("KW1769 : 'KW' '1769';\n"); + grammarBuilder.append("KW1770 : 'KW' '1770';\n"); + grammarBuilder.append("KW1771 : 'KW' '1771';\n"); + grammarBuilder.append("KW1772 : 'KW' '1772';\n"); + grammarBuilder.append("KW1773 : 'KW' '1773';\n"); + grammarBuilder.append("KW1774 : 'KW' '1774';\n"); + grammarBuilder.append("KW1775 : 'KW' '1775';\n"); + grammarBuilder.append("KW1776 : 'KW' '1776';\n"); + grammarBuilder.append("KW1777 : 'KW' '1777';\n"); + grammarBuilder.append("KW1778 : 'KW' '1778';\n"); + grammarBuilder.append("KW1779 : 'KW' '1779';\n"); + grammarBuilder.append("KW1780 : 'KW' '1780';\n"); + grammarBuilder.append("KW1781 : 'KW' '1781';\n"); + grammarBuilder.append("KW1782 : 'KW' '1782';\n"); + grammarBuilder.append("KW1783 : 'KW' '1783';\n"); + grammarBuilder.append("KW1784 : 'KW' '1784';\n"); + grammarBuilder.append("KW1785 : 'KW' '1785';\n"); + grammarBuilder.append("KW1786 : 'KW' '1786';\n"); + grammarBuilder.append("KW1787 : 'KW' '1787';\n"); + grammarBuilder.append("KW1788 : 'KW' '1788';\n"); + grammarBuilder.append("KW1789 : 'KW' '1789';\n"); + grammarBuilder.append("KW1790 : 'KW' '1790';\n"); + grammarBuilder.append("KW1791 : 'KW' '1791';\n"); + grammarBuilder.append("KW1792 : 'KW' '1792';\n"); + grammarBuilder.append("KW1793 : 'KW' '1793';\n"); + grammarBuilder.append("KW1794 : 'KW' '1794';\n"); + grammarBuilder.append("KW1795 : 'KW' '1795';\n"); + grammarBuilder.append("KW1796 : 'KW' '1796';\n"); + grammarBuilder.append("KW1797 : 'KW' '1797';\n"); + grammarBuilder.append("KW1798 : 'KW' '1798';\n"); + grammarBuilder.append("KW1799 : 'KW' '1799';\n"); + grammarBuilder.append("KW1800 : 'KW' '1800';\n"); + grammarBuilder.append("KW1801 : 'KW' '1801';\n"); + grammarBuilder.append("KW1802 : 'KW' '1802';\n"); + grammarBuilder.append("KW1803 : 'KW' '1803';\n"); + grammarBuilder.append("KW1804 : 'KW' '1804';\n"); + grammarBuilder.append("KW1805 : 'KW' '1805';\n"); + grammarBuilder.append("KW1806 : 'KW' '1806';\n"); + grammarBuilder.append("KW1807 : 'KW' '1807';\n"); + grammarBuilder.append("KW1808 : 'KW' '1808';\n"); + grammarBuilder.append("KW1809 : 'KW' '1809';\n"); + grammarBuilder.append("KW1810 : 'KW' '1810';\n"); + grammarBuilder.append("KW1811 : 'KW' '1811';\n"); + grammarBuilder.append("KW1812 : 'KW' '1812';\n"); + grammarBuilder.append("KW1813 : 'KW' '1813';\n"); + grammarBuilder.append("KW1814 : 'KW' '1814';\n"); + grammarBuilder.append("KW1815 : 'KW' '1815';\n"); + grammarBuilder.append("KW1816 : 'KW' '1816';\n"); + grammarBuilder.append("KW1817 : 'KW' '1817';\n"); + grammarBuilder.append("KW1818 : 'KW' '1818';\n"); + grammarBuilder.append("KW1819 : 'KW' '1819';\n"); + grammarBuilder.append("KW1820 : 'KW' '1820';\n"); + grammarBuilder.append("KW1821 : 'KW' '1821';\n"); + grammarBuilder.append("KW1822 : 'KW' '1822';\n"); + grammarBuilder.append("KW1823 : 'KW' '1823';\n"); + grammarBuilder.append("KW1824 : 'KW' '1824';\n"); + grammarBuilder.append("KW1825 : 'KW' '1825';\n"); + grammarBuilder.append("KW1826 : 'KW' '1826';\n"); + grammarBuilder.append("KW1827 : 'KW' '1827';\n"); + grammarBuilder.append("KW1828 : 'KW' '1828';\n"); + grammarBuilder.append("KW1829 : 'KW' '1829';\n"); + grammarBuilder.append("KW1830 : 'KW' '1830';\n"); + grammarBuilder.append("KW1831 : 'KW' '1831';\n"); + grammarBuilder.append("KW1832 : 'KW' '1832';\n"); + grammarBuilder.append("KW1833 : 'KW' '1833';\n"); + grammarBuilder.append("KW1834 : 'KW' '1834';\n"); + grammarBuilder.append("KW1835 : 'KW' '1835';\n"); + grammarBuilder.append("KW1836 : 'KW' '1836';\n"); + grammarBuilder.append("KW1837 : 'KW' '1837';\n"); + grammarBuilder.append("KW1838 : 'KW' '1838';\n"); + grammarBuilder.append("KW1839 : 'KW' '1839';\n"); + grammarBuilder.append("KW1840 : 'KW' '1840';\n"); + grammarBuilder.append("KW1841 : 'KW' '1841';\n"); + grammarBuilder.append("KW1842 : 'KW' '1842';\n"); + grammarBuilder.append("KW1843 : 'KW' '1843';\n"); + grammarBuilder.append("KW1844 : 'KW' '1844';\n"); + grammarBuilder.append("KW1845 : 'KW' '1845';\n"); + grammarBuilder.append("KW1846 : 'KW' '1846';\n"); + grammarBuilder.append("KW1847 : 'KW' '1847';\n"); + grammarBuilder.append("KW1848 : 'KW' '1848';\n"); + grammarBuilder.append("KW1849 : 'KW' '1849';\n"); + grammarBuilder.append("KW1850 : 'KW' '1850';\n"); + grammarBuilder.append("KW1851 : 'KW' '1851';\n"); + grammarBuilder.append("KW1852 : 'KW' '1852';\n"); + grammarBuilder.append("KW1853 : 'KW' '1853';\n"); + grammarBuilder.append("KW1854 : 'KW' '1854';\n"); + grammarBuilder.append("KW1855 : 'KW' '1855';\n"); + grammarBuilder.append("KW1856 : 'KW' '1856';\n"); + grammarBuilder.append("KW1857 : 'KW' '1857';\n"); + grammarBuilder.append("KW1858 : 'KW' '1858';\n"); + grammarBuilder.append("KW1859 : 'KW' '1859';\n"); + grammarBuilder.append("KW1860 : 'KW' '1860';\n"); + grammarBuilder.append("KW1861 : 'KW' '1861';\n"); + grammarBuilder.append("KW1862 : 'KW' '1862';\n"); + grammarBuilder.append("KW1863 : 'KW' '1863';\n"); + grammarBuilder.append("KW1864 : 'KW' '1864';\n"); + grammarBuilder.append("KW1865 : 'KW' '1865';\n"); + grammarBuilder.append("KW1866 : 'KW' '1866';\n"); + grammarBuilder.append("KW1867 : 'KW' '1867';\n"); + grammarBuilder.append("KW1868 : 'KW' '1868';\n"); + grammarBuilder.append("KW1869 : 'KW' '1869';\n"); + grammarBuilder.append("KW1870 : 'KW' '1870';\n"); + grammarBuilder.append("KW1871 : 'KW' '1871';\n"); + grammarBuilder.append("KW1872 : 'KW' '1872';\n"); + grammarBuilder.append("KW1873 : 'KW' '1873';\n"); + grammarBuilder.append("KW1874 : 'KW' '1874';\n"); + grammarBuilder.append("KW1875 : 'KW' '1875';\n"); + grammarBuilder.append("KW1876 : 'KW' '1876';\n"); + grammarBuilder.append("KW1877 : 'KW' '1877';\n"); + grammarBuilder.append("KW1878 : 'KW' '1878';\n"); + grammarBuilder.append("KW1879 : 'KW' '1879';\n"); + grammarBuilder.append("KW1880 : 'KW' '1880';\n"); + grammarBuilder.append("KW1881 : 'KW' '1881';\n"); + grammarBuilder.append("KW1882 : 'KW' '1882';\n"); + grammarBuilder.append("KW1883 : 'KW' '1883';\n"); + grammarBuilder.append("KW1884 : 'KW' '1884';\n"); + grammarBuilder.append("KW1885 : 'KW' '1885';\n"); + grammarBuilder.append("KW1886 : 'KW' '1886';\n"); + grammarBuilder.append("KW1887 : 'KW' '1887';\n"); + grammarBuilder.append("KW1888 : 'KW' '1888';\n"); + grammarBuilder.append("KW1889 : 'KW' '1889';\n"); + grammarBuilder.append("KW1890 : 'KW' '1890';\n"); + grammarBuilder.append("KW1891 : 'KW' '1891';\n"); + grammarBuilder.append("KW1892 : 'KW' '1892';\n"); + grammarBuilder.append("KW1893 : 'KW' '1893';\n"); + grammarBuilder.append("KW1894 : 'KW' '1894';\n"); + grammarBuilder.append("KW1895 : 'KW' '1895';\n"); + grammarBuilder.append("KW1896 : 'KW' '1896';\n"); + grammarBuilder.append("KW1897 : 'KW' '1897';\n"); + grammarBuilder.append("KW1898 : 'KW' '1898';\n"); + grammarBuilder.append("KW1899 : 'KW' '1899';\n"); + grammarBuilder.append("KW1900 : 'KW' '1900';\n"); + grammarBuilder.append("KW1901 : 'KW' '1901';\n"); + grammarBuilder.append("KW1902 : 'KW' '1902';\n"); + grammarBuilder.append("KW1903 : 'KW' '1903';\n"); + grammarBuilder.append("KW1904 : 'KW' '1904';\n"); + grammarBuilder.append("KW1905 : 'KW' '1905';\n"); + grammarBuilder.append("KW1906 : 'KW' '1906';\n"); + grammarBuilder.append("KW1907 : 'KW' '1907';\n"); + grammarBuilder.append("KW1908 : 'KW' '1908';\n"); + grammarBuilder.append("KW1909 : 'KW' '1909';\n"); + grammarBuilder.append("KW1910 : 'KW' '1910';\n"); + grammarBuilder.append("KW1911 : 'KW' '1911';\n"); + grammarBuilder.append("KW1912 : 'KW' '1912';\n"); + grammarBuilder.append("KW1913 : 'KW' '1913';\n"); + grammarBuilder.append("KW1914 : 'KW' '1914';\n"); + grammarBuilder.append("KW1915 : 'KW' '1915';\n"); + grammarBuilder.append("KW1916 : 'KW' '1916';\n"); + grammarBuilder.append("KW1917 : 'KW' '1917';\n"); + grammarBuilder.append("KW1918 : 'KW' '1918';\n"); + grammarBuilder.append("KW1919 : 'KW' '1919';\n"); + grammarBuilder.append("KW1920 : 'KW' '1920';\n"); + grammarBuilder.append("KW1921 : 'KW' '1921';\n"); + grammarBuilder.append("KW1922 : 'KW' '1922';\n"); + grammarBuilder.append("KW1923 : 'KW' '1923';\n"); + grammarBuilder.append("KW1924 : 'KW' '1924';\n"); + grammarBuilder.append("KW1925 : 'KW' '1925';\n"); + grammarBuilder.append("KW1926 : 'KW' '1926';\n"); + grammarBuilder.append("KW1927 : 'KW' '1927';\n"); + grammarBuilder.append("KW1928 : 'KW' '1928';\n"); + grammarBuilder.append("KW1929 : 'KW' '1929';\n"); + grammarBuilder.append("KW1930 : 'KW' '1930';\n"); + grammarBuilder.append("KW1931 : 'KW' '1931';\n"); + grammarBuilder.append("KW1932 : 'KW' '1932';\n"); + grammarBuilder.append("KW1933 : 'KW' '1933';\n"); + grammarBuilder.append("KW1934 : 'KW' '1934';\n"); + grammarBuilder.append("KW1935 : 'KW' '1935';\n"); + grammarBuilder.append("KW1936 : 'KW' '1936';\n"); + grammarBuilder.append("KW1937 : 'KW' '1937';\n"); + grammarBuilder.append("KW1938 : 'KW' '1938';\n"); + grammarBuilder.append("KW1939 : 'KW' '1939';\n"); + grammarBuilder.append("KW1940 : 'KW' '1940';\n"); + grammarBuilder.append("KW1941 : 'KW' '1941';\n"); + grammarBuilder.append("KW1942 : 'KW' '1942';\n"); + grammarBuilder.append("KW1943 : 'KW' '1943';\n"); + grammarBuilder.append("KW1944 : 'KW' '1944';\n"); + grammarBuilder.append("KW1945 : 'KW' '1945';\n"); + grammarBuilder.append("KW1946 : 'KW' '1946';\n"); + grammarBuilder.append("KW1947 : 'KW' '1947';\n"); + grammarBuilder.append("KW1948 : 'KW' '1948';\n"); + grammarBuilder.append("KW1949 : 'KW' '1949';\n"); + grammarBuilder.append("KW1950 : 'KW' '1950';\n"); + grammarBuilder.append("KW1951 : 'KW' '1951';\n"); + grammarBuilder.append("KW1952 : 'KW' '1952';\n"); + grammarBuilder.append("KW1953 : 'KW' '1953';\n"); + grammarBuilder.append("KW1954 : 'KW' '1954';\n"); + grammarBuilder.append("KW1955 : 'KW' '1955';\n"); + grammarBuilder.append("KW1956 : 'KW' '1956';\n"); + grammarBuilder.append("KW1957 : 'KW' '1957';\n"); + grammarBuilder.append("KW1958 : 'KW' '1958';\n"); + grammarBuilder.append("KW1959 : 'KW' '1959';\n"); + grammarBuilder.append("KW1960 : 'KW' '1960';\n"); + grammarBuilder.append("KW1961 : 'KW' '1961';\n"); + grammarBuilder.append("KW1962 : 'KW' '1962';\n"); + grammarBuilder.append("KW1963 : 'KW' '1963';\n"); + grammarBuilder.append("KW1964 : 'KW' '1964';\n"); + grammarBuilder.append("KW1965 : 'KW' '1965';\n"); + grammarBuilder.append("KW1966 : 'KW' '1966';\n"); + grammarBuilder.append("KW1967 : 'KW' '1967';\n"); + grammarBuilder.append("KW1968 : 'KW' '1968';\n"); + grammarBuilder.append("KW1969 : 'KW' '1969';\n"); + grammarBuilder.append("KW1970 : 'KW' '1970';\n"); + grammarBuilder.append("KW1971 : 'KW' '1971';\n"); + grammarBuilder.append("KW1972 : 'KW' '1972';\n"); + grammarBuilder.append("KW1973 : 'KW' '1973';\n"); + grammarBuilder.append("KW1974 : 'KW' '1974';\n"); + grammarBuilder.append("KW1975 : 'KW' '1975';\n"); + grammarBuilder.append("KW1976 : 'KW' '1976';\n"); + grammarBuilder.append("KW1977 : 'KW' '1977';\n"); + grammarBuilder.append("KW1978 : 'KW' '1978';\n"); + grammarBuilder.append("KW1979 : 'KW' '1979';\n"); + grammarBuilder.append("KW1980 : 'KW' '1980';\n"); + grammarBuilder.append("KW1981 : 'KW' '1981';\n"); + grammarBuilder.append("KW1982 : 'KW' '1982';\n"); + grammarBuilder.append("KW1983 : 'KW' '1983';\n"); + grammarBuilder.append("KW1984 : 'KW' '1984';\n"); + grammarBuilder.append("KW1985 : 'KW' '1985';\n"); + grammarBuilder.append("KW1986 : 'KW' '1986';\n"); + grammarBuilder.append("KW1987 : 'KW' '1987';\n"); + grammarBuilder.append("KW1988 : 'KW' '1988';\n"); + grammarBuilder.append("KW1989 : 'KW' '1989';\n"); + grammarBuilder.append("KW1990 : 'KW' '1990';\n"); + grammarBuilder.append("KW1991 : 'KW' '1991';\n"); + grammarBuilder.append("KW1992 : 'KW' '1992';\n"); + grammarBuilder.append("KW1993 : 'KW' '1993';\n"); + grammarBuilder.append("KW1994 : 'KW' '1994';\n"); + grammarBuilder.append("KW1995 : 'KW' '1995';\n"); + grammarBuilder.append("KW1996 : 'KW' '1996';\n"); + grammarBuilder.append("KW1997 : 'KW' '1997';\n"); + grammarBuilder.append("KW1998 : 'KW' '1998';\n"); + grammarBuilder.append("KW1999 : 'KW' '1999';\n"); + grammarBuilder.append("KW2000 : 'KW' '2000';\n"); + grammarBuilder.append("KW2001 : 'KW' '2001';\n"); + grammarBuilder.append("KW2002 : 'KW' '2002';\n"); + grammarBuilder.append("KW2003 : 'KW' '2003';\n"); + grammarBuilder.append("KW2004 : 'KW' '2004';\n"); + grammarBuilder.append("KW2005 : 'KW' '2005';\n"); + grammarBuilder.append("KW2006 : 'KW' '2006';\n"); + grammarBuilder.append("KW2007 : 'KW' '2007';\n"); + grammarBuilder.append("KW2008 : 'KW' '2008';\n"); + grammarBuilder.append("KW2009 : 'KW' '2009';\n"); + grammarBuilder.append("KW2010 : 'KW' '2010';\n"); + grammarBuilder.append("KW2011 : 'KW' '2011';\n"); + grammarBuilder.append("KW2012 : 'KW' '2012';\n"); + grammarBuilder.append("KW2013 : 'KW' '2013';\n"); + grammarBuilder.append("KW2014 : 'KW' '2014';\n"); + grammarBuilder.append("KW2015 : 'KW' '2015';\n"); + grammarBuilder.append("KW2016 : 'KW' '2016';\n"); + grammarBuilder.append("KW2017 : 'KW' '2017';\n"); + grammarBuilder.append("KW2018 : 'KW' '2018';\n"); + grammarBuilder.append("KW2019 : 'KW' '2019';\n"); + grammarBuilder.append("KW2020 : 'KW' '2020';\n"); + grammarBuilder.append("KW2021 : 'KW' '2021';\n"); + grammarBuilder.append("KW2022 : 'KW' '2022';\n"); + grammarBuilder.append("KW2023 : 'KW' '2023';\n"); + grammarBuilder.append("KW2024 : 'KW' '2024';\n"); + grammarBuilder.append("KW2025 : 'KW' '2025';\n"); + grammarBuilder.append("KW2026 : 'KW' '2026';\n"); + grammarBuilder.append("KW2027 : 'KW' '2027';\n"); + grammarBuilder.append("KW2028 : 'KW' '2028';\n"); + grammarBuilder.append("KW2029 : 'KW' '2029';\n"); + grammarBuilder.append("KW2030 : 'KW' '2030';\n"); + grammarBuilder.append("KW2031 : 'KW' '2031';\n"); + grammarBuilder.append("KW2032 : 'KW' '2032';\n"); + grammarBuilder.append("KW2033 : 'KW' '2033';\n"); + grammarBuilder.append("KW2034 : 'KW' '2034';\n"); + grammarBuilder.append("KW2035 : 'KW' '2035';\n"); + grammarBuilder.append("KW2036 : 'KW' '2036';\n"); + grammarBuilder.append("KW2037 : 'KW' '2037';\n"); + grammarBuilder.append("KW2038 : 'KW' '2038';\n"); + grammarBuilder.append("KW2039 : 'KW' '2039';\n"); + grammarBuilder.append("KW2040 : 'KW' '2040';\n"); + grammarBuilder.append("KW2041 : 'KW' '2041';\n"); + grammarBuilder.append("KW2042 : 'KW' '2042';\n"); + grammarBuilder.append("KW2043 : 'KW' '2043';\n"); + grammarBuilder.append("KW2044 : 'KW' '2044';\n"); + grammarBuilder.append("KW2045 : 'KW' '2045';\n"); + grammarBuilder.append("KW2046 : 'KW' '2046';\n"); + grammarBuilder.append("KW2047 : 'KW' '2047';\n"); + grammarBuilder.append("KW2048 : 'KW' '2048';\n"); + grammarBuilder.append("KW2049 : 'KW' '2049';\n"); + grammarBuilder.append("KW2050 : 'KW' '2050';\n"); + grammarBuilder.append("KW2051 : 'KW' '2051';\n"); + grammarBuilder.append("KW2052 : 'KW' '2052';\n"); + grammarBuilder.append("KW2053 : 'KW' '2053';\n"); + grammarBuilder.append("KW2054 : 'KW' '2054';\n"); + grammarBuilder.append("KW2055 : 'KW' '2055';\n"); + grammarBuilder.append("KW2056 : 'KW' '2056';\n"); + grammarBuilder.append("KW2057 : 'KW' '2057';\n"); + grammarBuilder.append("KW2058 : 'KW' '2058';\n"); + grammarBuilder.append("KW2059 : 'KW' '2059';\n"); + grammarBuilder.append("KW2060 : 'KW' '2060';\n"); + grammarBuilder.append("KW2061 : 'KW' '2061';\n"); + grammarBuilder.append("KW2062 : 'KW' '2062';\n"); + grammarBuilder.append("KW2063 : 'KW' '2063';\n"); + grammarBuilder.append("KW2064 : 'KW' '2064';\n"); + grammarBuilder.append("KW2065 : 'KW' '2065';\n"); + grammarBuilder.append("KW2066 : 'KW' '2066';\n"); + grammarBuilder.append("KW2067 : 'KW' '2067';\n"); + grammarBuilder.append("KW2068 : 'KW' '2068';\n"); + grammarBuilder.append("KW2069 : 'KW' '2069';\n"); + grammarBuilder.append("KW2070 : 'KW' '2070';\n"); + grammarBuilder.append("KW2071 : 'KW' '2071';\n"); + grammarBuilder.append("KW2072 : 'KW' '2072';\n"); + grammarBuilder.append("KW2073 : 'KW' '2073';\n"); + grammarBuilder.append("KW2074 : 'KW' '2074';\n"); + grammarBuilder.append("KW2075 : 'KW' '2075';\n"); + grammarBuilder.append("KW2076 : 'KW' '2076';\n"); + grammarBuilder.append("KW2077 : 'KW' '2077';\n"); + grammarBuilder.append("KW2078 : 'KW' '2078';\n"); + grammarBuilder.append("KW2079 : 'KW' '2079';\n"); + grammarBuilder.append("KW2080 : 'KW' '2080';\n"); + grammarBuilder.append("KW2081 : 'KW' '2081';\n"); + grammarBuilder.append("KW2082 : 'KW' '2082';\n"); + grammarBuilder.append("KW2083 : 'KW' '2083';\n"); + grammarBuilder.append("KW2084 : 'KW' '2084';\n"); + grammarBuilder.append("KW2085 : 'KW' '2085';\n"); + grammarBuilder.append("KW2086 : 'KW' '2086';\n"); + grammarBuilder.append("KW2087 : 'KW' '2087';\n"); + grammarBuilder.append("KW2088 : 'KW' '2088';\n"); + grammarBuilder.append("KW2089 : 'KW' '2089';\n"); + grammarBuilder.append("KW2090 : 'KW' '2090';\n"); + grammarBuilder.append("KW2091 : 'KW' '2091';\n"); + grammarBuilder.append("KW2092 : 'KW' '2092';\n"); + grammarBuilder.append("KW2093 : 'KW' '2093';\n"); + grammarBuilder.append("KW2094 : 'KW' '2094';\n"); + grammarBuilder.append("KW2095 : 'KW' '2095';\n"); + grammarBuilder.append("KW2096 : 'KW' '2096';\n"); + grammarBuilder.append("KW2097 : 'KW' '2097';\n"); + grammarBuilder.append("KW2098 : 'KW' '2098';\n"); + grammarBuilder.append("KW2099 : 'KW' '2099';\n"); + grammarBuilder.append("KW2100 : 'KW' '2100';\n"); + grammarBuilder.append("KW2101 : 'KW' '2101';\n"); + grammarBuilder.append("KW2102 : 'KW' '2102';\n"); + grammarBuilder.append("KW2103 : 'KW' '2103';\n"); + grammarBuilder.append("KW2104 : 'KW' '2104';\n"); + grammarBuilder.append("KW2105 : 'KW' '2105';\n"); + grammarBuilder.append("KW2106 : 'KW' '2106';\n"); + grammarBuilder.append("KW2107 : 'KW' '2107';\n"); + grammarBuilder.append("KW2108 : 'KW' '2108';\n"); + grammarBuilder.append("KW2109 : 'KW' '2109';\n"); + grammarBuilder.append("KW2110 : 'KW' '2110';\n"); + grammarBuilder.append("KW2111 : 'KW' '2111';\n"); + grammarBuilder.append("KW2112 : 'KW' '2112';\n"); + grammarBuilder.append("KW2113 : 'KW' '2113';\n"); + grammarBuilder.append("KW2114 : 'KW' '2114';\n"); + grammarBuilder.append("KW2115 : 'KW' '2115';\n"); + grammarBuilder.append("KW2116 : 'KW' '2116';\n"); + grammarBuilder.append("KW2117 : 'KW' '2117';\n"); + grammarBuilder.append("KW2118 : 'KW' '2118';\n"); + grammarBuilder.append("KW2119 : 'KW' '2119';\n"); + grammarBuilder.append("KW2120 : 'KW' '2120';\n"); + grammarBuilder.append("KW2121 : 'KW' '2121';\n"); + grammarBuilder.append("KW2122 : 'KW' '2122';\n"); + grammarBuilder.append("KW2123 : 'KW' '2123';\n"); + grammarBuilder.append("KW2124 : 'KW' '2124';\n"); + grammarBuilder.append("KW2125 : 'KW' '2125';\n"); + grammarBuilder.append("KW2126 : 'KW' '2126';\n"); + grammarBuilder.append("KW2127 : 'KW' '2127';\n"); + grammarBuilder.append("KW2128 : 'KW' '2128';\n"); + grammarBuilder.append("KW2129 : 'KW' '2129';\n"); + grammarBuilder.append("KW2130 : 'KW' '2130';\n"); + grammarBuilder.append("KW2131 : 'KW' '2131';\n"); + grammarBuilder.append("KW2132 : 'KW' '2132';\n"); + grammarBuilder.append("KW2133 : 'KW' '2133';\n"); + grammarBuilder.append("KW2134 : 'KW' '2134';\n"); + grammarBuilder.append("KW2135 : 'KW' '2135';\n"); + grammarBuilder.append("KW2136 : 'KW' '2136';\n"); + grammarBuilder.append("KW2137 : 'KW' '2137';\n"); + grammarBuilder.append("KW2138 : 'KW' '2138';\n"); + grammarBuilder.append("KW2139 : 'KW' '2139';\n"); + grammarBuilder.append("KW2140 : 'KW' '2140';\n"); + grammarBuilder.append("KW2141 : 'KW' '2141';\n"); + grammarBuilder.append("KW2142 : 'KW' '2142';\n"); + grammarBuilder.append("KW2143 : 'KW' '2143';\n"); + grammarBuilder.append("KW2144 : 'KW' '2144';\n"); + grammarBuilder.append("KW2145 : 'KW' '2145';\n"); + grammarBuilder.append("KW2146 : 'KW' '2146';\n"); + grammarBuilder.append("KW2147 : 'KW' '2147';\n"); + grammarBuilder.append("KW2148 : 'KW' '2148';\n"); + grammarBuilder.append("KW2149 : 'KW' '2149';\n"); + grammarBuilder.append("KW2150 : 'KW' '2150';\n"); + grammarBuilder.append("KW2151 : 'KW' '2151';\n"); + grammarBuilder.append("KW2152 : 'KW' '2152';\n"); + grammarBuilder.append("KW2153 : 'KW' '2153';\n"); + grammarBuilder.append("KW2154 : 'KW' '2154';\n"); + grammarBuilder.append("KW2155 : 'KW' '2155';\n"); + grammarBuilder.append("KW2156 : 'KW' '2156';\n"); + grammarBuilder.append("KW2157 : 'KW' '2157';\n"); + grammarBuilder.append("KW2158 : 'KW' '2158';\n"); + grammarBuilder.append("KW2159 : 'KW' '2159';\n"); + grammarBuilder.append("KW2160 : 'KW' '2160';\n"); + grammarBuilder.append("KW2161 : 'KW' '2161';\n"); + grammarBuilder.append("KW2162 : 'KW' '2162';\n"); + grammarBuilder.append("KW2163 : 'KW' '2163';\n"); + grammarBuilder.append("KW2164 : 'KW' '2164';\n"); + grammarBuilder.append("KW2165 : 'KW' '2165';\n"); + grammarBuilder.append("KW2166 : 'KW' '2166';\n"); + grammarBuilder.append("KW2167 : 'KW' '2167';\n"); + grammarBuilder.append("KW2168 : 'KW' '2168';\n"); + grammarBuilder.append("KW2169 : 'KW' '2169';\n"); + grammarBuilder.append("KW2170 : 'KW' '2170';\n"); + grammarBuilder.append("KW2171 : 'KW' '2171';\n"); + grammarBuilder.append("KW2172 : 'KW' '2172';\n"); + grammarBuilder.append("KW2173 : 'KW' '2173';\n"); + grammarBuilder.append("KW2174 : 'KW' '2174';\n"); + grammarBuilder.append("KW2175 : 'KW' '2175';\n"); + grammarBuilder.append("KW2176 : 'KW' '2176';\n"); + grammarBuilder.append("KW2177 : 'KW' '2177';\n"); + grammarBuilder.append("KW2178 : 'KW' '2178';\n"); + grammarBuilder.append("KW2179 : 'KW' '2179';\n"); + grammarBuilder.append("KW2180 : 'KW' '2180';\n"); + grammarBuilder.append("KW2181 : 'KW' '2181';\n"); + grammarBuilder.append("KW2182 : 'KW' '2182';\n"); + grammarBuilder.append("KW2183 : 'KW' '2183';\n"); + grammarBuilder.append("KW2184 : 'KW' '2184';\n"); + grammarBuilder.append("KW2185 : 'KW' '2185';\n"); + grammarBuilder.append("KW2186 : 'KW' '2186';\n"); + grammarBuilder.append("KW2187 : 'KW' '2187';\n"); + grammarBuilder.append("KW2188 : 'KW' '2188';\n"); + grammarBuilder.append("KW2189 : 'KW' '2189';\n"); + grammarBuilder.append("KW2190 : 'KW' '2190';\n"); + grammarBuilder.append("KW2191 : 'KW' '2191';\n"); + grammarBuilder.append("KW2192 : 'KW' '2192';\n"); + grammarBuilder.append("KW2193 : 'KW' '2193';\n"); + grammarBuilder.append("KW2194 : 'KW' '2194';\n"); + grammarBuilder.append("KW2195 : 'KW' '2195';\n"); + grammarBuilder.append("KW2196 : 'KW' '2196';\n"); + grammarBuilder.append("KW2197 : 'KW' '2197';\n"); + grammarBuilder.append("KW2198 : 'KW' '2198';\n"); + grammarBuilder.append("KW2199 : 'KW' '2199';\n"); + grammarBuilder.append("KW2200 : 'KW' '2200';\n"); + grammarBuilder.append("KW2201 : 'KW' '2201';\n"); + grammarBuilder.append("KW2202 : 'KW' '2202';\n"); + grammarBuilder.append("KW2203 : 'KW' '2203';\n"); + grammarBuilder.append("KW2204 : 'KW' '2204';\n"); + grammarBuilder.append("KW2205 : 'KW' '2205';\n"); + grammarBuilder.append("KW2206 : 'KW' '2206';\n"); + grammarBuilder.append("KW2207 : 'KW' '2207';\n"); + grammarBuilder.append("KW2208 : 'KW' '2208';\n"); + grammarBuilder.append("KW2209 : 'KW' '2209';\n"); + grammarBuilder.append("KW2210 : 'KW' '2210';\n"); + grammarBuilder.append("KW2211 : 'KW' '2211';\n"); + grammarBuilder.append("KW2212 : 'KW' '2212';\n"); + grammarBuilder.append("KW2213 : 'KW' '2213';\n"); + grammarBuilder.append("KW2214 : 'KW' '2214';\n"); + grammarBuilder.append("KW2215 : 'KW' '2215';\n"); + grammarBuilder.append("KW2216 : 'KW' '2216';\n"); + grammarBuilder.append("KW2217 : 'KW' '2217';\n"); + grammarBuilder.append("KW2218 : 'KW' '2218';\n"); + grammarBuilder.append("KW2219 : 'KW' '2219';\n"); + grammarBuilder.append("KW2220 : 'KW' '2220';\n"); + grammarBuilder.append("KW2221 : 'KW' '2221';\n"); + grammarBuilder.append("KW2222 : 'KW' '2222';\n"); + grammarBuilder.append("KW2223 : 'KW' '2223';\n"); + grammarBuilder.append("KW2224 : 'KW' '2224';\n"); + grammarBuilder.append("KW2225 : 'KW' '2225';\n"); + grammarBuilder.append("KW2226 : 'KW' '2226';\n"); + grammarBuilder.append("KW2227 : 'KW' '2227';\n"); + grammarBuilder.append("KW2228 : 'KW' '2228';\n"); + grammarBuilder.append("KW2229 : 'KW' '2229';\n"); + grammarBuilder.append("KW2230 : 'KW' '2230';\n"); + grammarBuilder.append("KW2231 : 'KW' '2231';\n"); + grammarBuilder.append("KW2232 : 'KW' '2232';\n"); + grammarBuilder.append("KW2233 : 'KW' '2233';\n"); + grammarBuilder.append("KW2234 : 'KW' '2234';\n"); + grammarBuilder.append("KW2235 : 'KW' '2235';\n"); + grammarBuilder.append("KW2236 : 'KW' '2236';\n"); + grammarBuilder.append("KW2237 : 'KW' '2237';\n"); + grammarBuilder.append("KW2238 : 'KW' '2238';\n"); + grammarBuilder.append("KW2239 : 'KW' '2239';\n"); + grammarBuilder.append("KW2240 : 'KW' '2240';\n"); + grammarBuilder.append("KW2241 : 'KW' '2241';\n"); + grammarBuilder.append("KW2242 : 'KW' '2242';\n"); + grammarBuilder.append("KW2243 : 'KW' '2243';\n"); + grammarBuilder.append("KW2244 : 'KW' '2244';\n"); + grammarBuilder.append("KW2245 : 'KW' '2245';\n"); + grammarBuilder.append("KW2246 : 'KW' '2246';\n"); + grammarBuilder.append("KW2247 : 'KW' '2247';\n"); + grammarBuilder.append("KW2248 : 'KW' '2248';\n"); + grammarBuilder.append("KW2249 : 'KW' '2249';\n"); + grammarBuilder.append("KW2250 : 'KW' '2250';\n"); + grammarBuilder.append("KW2251 : 'KW' '2251';\n"); + grammarBuilder.append("KW2252 : 'KW' '2252';\n"); + grammarBuilder.append("KW2253 : 'KW' '2253';\n"); + grammarBuilder.append("KW2254 : 'KW' '2254';\n"); + grammarBuilder.append("KW2255 : 'KW' '2255';\n"); + grammarBuilder.append("KW2256 : 'KW' '2256';\n"); + grammarBuilder.append("KW2257 : 'KW' '2257';\n"); + grammarBuilder.append("KW2258 : 'KW' '2258';\n"); + grammarBuilder.append("KW2259 : 'KW' '2259';\n"); + grammarBuilder.append("KW2260 : 'KW' '2260';\n"); + grammarBuilder.append("KW2261 : 'KW' '2261';\n"); + grammarBuilder.append("KW2262 : 'KW' '2262';\n"); + grammarBuilder.append("KW2263 : 'KW' '2263';\n"); + grammarBuilder.append("KW2264 : 'KW' '2264';\n"); + grammarBuilder.append("KW2265 : 'KW' '2265';\n"); + grammarBuilder.append("KW2266 : 'KW' '2266';\n"); + grammarBuilder.append("KW2267 : 'KW' '2267';\n"); + grammarBuilder.append("KW2268 : 'KW' '2268';\n"); + grammarBuilder.append("KW2269 : 'KW' '2269';\n"); + grammarBuilder.append("KW2270 : 'KW' '2270';\n"); + grammarBuilder.append("KW2271 : 'KW' '2271';\n"); + grammarBuilder.append("KW2272 : 'KW' '2272';\n"); + grammarBuilder.append("KW2273 : 'KW' '2273';\n"); + grammarBuilder.append("KW2274 : 'KW' '2274';\n"); + grammarBuilder.append("KW2275 : 'KW' '2275';\n"); + grammarBuilder.append("KW2276 : 'KW' '2276';\n"); + grammarBuilder.append("KW2277 : 'KW' '2277';\n"); + grammarBuilder.append("KW2278 : 'KW' '2278';\n"); + grammarBuilder.append("KW2279 : 'KW' '2279';\n"); + grammarBuilder.append("KW2280 : 'KW' '2280';\n"); + grammarBuilder.append("KW2281 : 'KW' '2281';\n"); + grammarBuilder.append("KW2282 : 'KW' '2282';\n"); + grammarBuilder.append("KW2283 : 'KW' '2283';\n"); + grammarBuilder.append("KW2284 : 'KW' '2284';\n"); + grammarBuilder.append("KW2285 : 'KW' '2285';\n"); + grammarBuilder.append("KW2286 : 'KW' '2286';\n"); + grammarBuilder.append("KW2287 : 'KW' '2287';\n"); + grammarBuilder.append("KW2288 : 'KW' '2288';\n"); + grammarBuilder.append("KW2289 : 'KW' '2289';\n"); + grammarBuilder.append("KW2290 : 'KW' '2290';\n"); + grammarBuilder.append("KW2291 : 'KW' '2291';\n"); + grammarBuilder.append("KW2292 : 'KW' '2292';\n"); + grammarBuilder.append("KW2293 : 'KW' '2293';\n"); + grammarBuilder.append("KW2294 : 'KW' '2294';\n"); + grammarBuilder.append("KW2295 : 'KW' '2295';\n"); + grammarBuilder.append("KW2296 : 'KW' '2296';\n"); + grammarBuilder.append("KW2297 : 'KW' '2297';\n"); + grammarBuilder.append("KW2298 : 'KW' '2298';\n"); + grammarBuilder.append("KW2299 : 'KW' '2299';\n"); + grammarBuilder.append("KW2300 : 'KW' '2300';\n"); + grammarBuilder.append("KW2301 : 'KW' '2301';\n"); + grammarBuilder.append("KW2302 : 'KW' '2302';\n"); + grammarBuilder.append("KW2303 : 'KW' '2303';\n"); + grammarBuilder.append("KW2304 : 'KW' '2304';\n"); + grammarBuilder.append("KW2305 : 'KW' '2305';\n"); + grammarBuilder.append("KW2306 : 'KW' '2306';\n"); + grammarBuilder.append("KW2307 : 'KW' '2307';\n"); + grammarBuilder.append("KW2308 : 'KW' '2308';\n"); + grammarBuilder.append("KW2309 : 'KW' '2309';\n"); + grammarBuilder.append("KW2310 : 'KW' '2310';\n"); + grammarBuilder.append("KW2311 : 'KW' '2311';\n"); + grammarBuilder.append("KW2312 : 'KW' '2312';\n"); + grammarBuilder.append("KW2313 : 'KW' '2313';\n"); + grammarBuilder.append("KW2314 : 'KW' '2314';\n"); + grammarBuilder.append("KW2315 : 'KW' '2315';\n"); + grammarBuilder.append("KW2316 : 'KW' '2316';\n"); + grammarBuilder.append("KW2317 : 'KW' '2317';\n"); + grammarBuilder.append("KW2318 : 'KW' '2318';\n"); + grammarBuilder.append("KW2319 : 'KW' '2319';\n"); + grammarBuilder.append("KW2320 : 'KW' '2320';\n"); + grammarBuilder.append("KW2321 : 'KW' '2321';\n"); + grammarBuilder.append("KW2322 : 'KW' '2322';\n"); + grammarBuilder.append("KW2323 : 'KW' '2323';\n"); + grammarBuilder.append("KW2324 : 'KW' '2324';\n"); + grammarBuilder.append("KW2325 : 'KW' '2325';\n"); + grammarBuilder.append("KW2326 : 'KW' '2326';\n"); + grammarBuilder.append("KW2327 : 'KW' '2327';\n"); + grammarBuilder.append("KW2328 : 'KW' '2328';\n"); + grammarBuilder.append("KW2329 : 'KW' '2329';\n"); + grammarBuilder.append("KW2330 : 'KW' '2330';\n"); + grammarBuilder.append("KW2331 : 'KW' '2331';\n"); + grammarBuilder.append("KW2332 : 'KW' '2332';\n"); + grammarBuilder.append("KW2333 : 'KW' '2333';\n"); + grammarBuilder.append("KW2334 : 'KW' '2334';\n"); + grammarBuilder.append("KW2335 : 'KW' '2335';\n"); + grammarBuilder.append("KW2336 : 'KW' '2336';\n"); + grammarBuilder.append("KW2337 : 'KW' '2337';\n"); + grammarBuilder.append("KW2338 : 'KW' '2338';\n"); + grammarBuilder.append("KW2339 : 'KW' '2339';\n"); + grammarBuilder.append("KW2340 : 'KW' '2340';\n"); + grammarBuilder.append("KW2341 : 'KW' '2341';\n"); + grammarBuilder.append("KW2342 : 'KW' '2342';\n"); + grammarBuilder.append("KW2343 : 'KW' '2343';\n"); + grammarBuilder.append("KW2344 : 'KW' '2344';\n"); + grammarBuilder.append("KW2345 : 'KW' '2345';\n"); + grammarBuilder.append("KW2346 : 'KW' '2346';\n"); + grammarBuilder.append("KW2347 : 'KW' '2347';\n"); + grammarBuilder.append("KW2348 : 'KW' '2348';\n"); + grammarBuilder.append("KW2349 : 'KW' '2349';\n"); + grammarBuilder.append("KW2350 : 'KW' '2350';\n"); + grammarBuilder.append("KW2351 : 'KW' '2351';\n"); + grammarBuilder.append("KW2352 : 'KW' '2352';\n"); + grammarBuilder.append("KW2353 : 'KW' '2353';\n"); + grammarBuilder.append("KW2354 : 'KW' '2354';\n"); + grammarBuilder.append("KW2355 : 'KW' '2355';\n"); + grammarBuilder.append("KW2356 : 'KW' '2356';\n"); + grammarBuilder.append("KW2357 : 'KW' '2357';\n"); + grammarBuilder.append("KW2358 : 'KW' '2358';\n"); + grammarBuilder.append("KW2359 : 'KW' '2359';\n"); + grammarBuilder.append("KW2360 : 'KW' '2360';\n"); + grammarBuilder.append("KW2361 : 'KW' '2361';\n"); + grammarBuilder.append("KW2362 : 'KW' '2362';\n"); + grammarBuilder.append("KW2363 : 'KW' '2363';\n"); + grammarBuilder.append("KW2364 : 'KW' '2364';\n"); + grammarBuilder.append("KW2365 : 'KW' '2365';\n"); + grammarBuilder.append("KW2366 : 'KW' '2366';\n"); + grammarBuilder.append("KW2367 : 'KW' '2367';\n"); + grammarBuilder.append("KW2368 : 'KW' '2368';\n"); + grammarBuilder.append("KW2369 : 'KW' '2369';\n"); + grammarBuilder.append("KW2370 : 'KW' '2370';\n"); + grammarBuilder.append("KW2371 : 'KW' '2371';\n"); + grammarBuilder.append("KW2372 : 'KW' '2372';\n"); + grammarBuilder.append("KW2373 : 'KW' '2373';\n"); + grammarBuilder.append("KW2374 : 'KW' '2374';\n"); + grammarBuilder.append("KW2375 : 'KW' '2375';\n"); + grammarBuilder.append("KW2376 : 'KW' '2376';\n"); + grammarBuilder.append("KW2377 : 'KW' '2377';\n"); + grammarBuilder.append("KW2378 : 'KW' '2378';\n"); + grammarBuilder.append("KW2379 : 'KW' '2379';\n"); + grammarBuilder.append("KW2380 : 'KW' '2380';\n"); + grammarBuilder.append("KW2381 : 'KW' '2381';\n"); + grammarBuilder.append("KW2382 : 'KW' '2382';\n"); + grammarBuilder.append("KW2383 : 'KW' '2383';\n"); + grammarBuilder.append("KW2384 : 'KW' '2384';\n"); + grammarBuilder.append("KW2385 : 'KW' '2385';\n"); + grammarBuilder.append("KW2386 : 'KW' '2386';\n"); + grammarBuilder.append("KW2387 : 'KW' '2387';\n"); + grammarBuilder.append("KW2388 : 'KW' '2388';\n"); + grammarBuilder.append("KW2389 : 'KW' '2389';\n"); + grammarBuilder.append("KW2390 : 'KW' '2390';\n"); + grammarBuilder.append("KW2391 : 'KW' '2391';\n"); + grammarBuilder.append("KW2392 : 'KW' '2392';\n"); + grammarBuilder.append("KW2393 : 'KW' '2393';\n"); + grammarBuilder.append("KW2394 : 'KW' '2394';\n"); + grammarBuilder.append("KW2395 : 'KW' '2395';\n"); + grammarBuilder.append("KW2396 : 'KW' '2396';\n"); + grammarBuilder.append("KW2397 : 'KW' '2397';\n"); + grammarBuilder.append("KW2398 : 'KW' '2398';\n"); + grammarBuilder.append("KW2399 : 'KW' '2399';\n"); + grammarBuilder.append("KW2400 : 'KW' '2400';\n"); + grammarBuilder.append("KW2401 : 'KW' '2401';\n"); + grammarBuilder.append("KW2402 : 'KW' '2402';\n"); + grammarBuilder.append("KW2403 : 'KW' '2403';\n"); + grammarBuilder.append("KW2404 : 'KW' '2404';\n"); + grammarBuilder.append("KW2405 : 'KW' '2405';\n"); + grammarBuilder.append("KW2406 : 'KW' '2406';\n"); + grammarBuilder.append("KW2407 : 'KW' '2407';\n"); + grammarBuilder.append("KW2408 : 'KW' '2408';\n"); + grammarBuilder.append("KW2409 : 'KW' '2409';\n"); + grammarBuilder.append("KW2410 : 'KW' '2410';\n"); + grammarBuilder.append("KW2411 : 'KW' '2411';\n"); + grammarBuilder.append("KW2412 : 'KW' '2412';\n"); + grammarBuilder.append("KW2413 : 'KW' '2413';\n"); + grammarBuilder.append("KW2414 : 'KW' '2414';\n"); + grammarBuilder.append("KW2415 : 'KW' '2415';\n"); + grammarBuilder.append("KW2416 : 'KW' '2416';\n"); + grammarBuilder.append("KW2417 : 'KW' '2417';\n"); + grammarBuilder.append("KW2418 : 'KW' '2418';\n"); + grammarBuilder.append("KW2419 : 'KW' '2419';\n"); + grammarBuilder.append("KW2420 : 'KW' '2420';\n"); + grammarBuilder.append("KW2421 : 'KW' '2421';\n"); + grammarBuilder.append("KW2422 : 'KW' '2422';\n"); + grammarBuilder.append("KW2423 : 'KW' '2423';\n"); + grammarBuilder.append("KW2424 : 'KW' '2424';\n"); + grammarBuilder.append("KW2425 : 'KW' '2425';\n"); + grammarBuilder.append("KW2426 : 'KW' '2426';\n"); + grammarBuilder.append("KW2427 : 'KW' '2427';\n"); + grammarBuilder.append("KW2428 : 'KW' '2428';\n"); + grammarBuilder.append("KW2429 : 'KW' '2429';\n"); + grammarBuilder.append("KW2430 : 'KW' '2430';\n"); + grammarBuilder.append("KW2431 : 'KW' '2431';\n"); + grammarBuilder.append("KW2432 : 'KW' '2432';\n"); + grammarBuilder.append("KW2433 : 'KW' '2433';\n"); + grammarBuilder.append("KW2434 : 'KW' '2434';\n"); + grammarBuilder.append("KW2435 : 'KW' '2435';\n"); + grammarBuilder.append("KW2436 : 'KW' '2436';\n"); + grammarBuilder.append("KW2437 : 'KW' '2437';\n"); + grammarBuilder.append("KW2438 : 'KW' '2438';\n"); + grammarBuilder.append("KW2439 : 'KW' '2439';\n"); + grammarBuilder.append("KW2440 : 'KW' '2440';\n"); + grammarBuilder.append("KW2441 : 'KW' '2441';\n"); + grammarBuilder.append("KW2442 : 'KW' '2442';\n"); + grammarBuilder.append("KW2443 : 'KW' '2443';\n"); + grammarBuilder.append("KW2444 : 'KW' '2444';\n"); + grammarBuilder.append("KW2445 : 'KW' '2445';\n"); + grammarBuilder.append("KW2446 : 'KW' '2446';\n"); + grammarBuilder.append("KW2447 : 'KW' '2447';\n"); + grammarBuilder.append("KW2448 : 'KW' '2448';\n"); + grammarBuilder.append("KW2449 : 'KW' '2449';\n"); + grammarBuilder.append("KW2450 : 'KW' '2450';\n"); + grammarBuilder.append("KW2451 : 'KW' '2451';\n"); + grammarBuilder.append("KW2452 : 'KW' '2452';\n"); + grammarBuilder.append("KW2453 : 'KW' '2453';\n"); + grammarBuilder.append("KW2454 : 'KW' '2454';\n"); + grammarBuilder.append("KW2455 : 'KW' '2455';\n"); + grammarBuilder.append("KW2456 : 'KW' '2456';\n"); + grammarBuilder.append("KW2457 : 'KW' '2457';\n"); + grammarBuilder.append("KW2458 : 'KW' '2458';\n"); + grammarBuilder.append("KW2459 : 'KW' '2459';\n"); + grammarBuilder.append("KW2460 : 'KW' '2460';\n"); + grammarBuilder.append("KW2461 : 'KW' '2461';\n"); + grammarBuilder.append("KW2462 : 'KW' '2462';\n"); + grammarBuilder.append("KW2463 : 'KW' '2463';\n"); + grammarBuilder.append("KW2464 : 'KW' '2464';\n"); + grammarBuilder.append("KW2465 : 'KW' '2465';\n"); + grammarBuilder.append("KW2466 : 'KW' '2466';\n"); + grammarBuilder.append("KW2467 : 'KW' '2467';\n"); + grammarBuilder.append("KW2468 : 'KW' '2468';\n"); + grammarBuilder.append("KW2469 : 'KW' '2469';\n"); + grammarBuilder.append("KW2470 : 'KW' '2470';\n"); + grammarBuilder.append("KW2471 : 'KW' '2471';\n"); + grammarBuilder.append("KW2472 : 'KW' '2472';\n"); + grammarBuilder.append("KW2473 : 'KW' '2473';\n"); + grammarBuilder.append("KW2474 : 'KW' '2474';\n"); + grammarBuilder.append("KW2475 : 'KW' '2475';\n"); + grammarBuilder.append("KW2476 : 'KW' '2476';\n"); + grammarBuilder.append("KW2477 : 'KW' '2477';\n"); + grammarBuilder.append("KW2478 : 'KW' '2478';\n"); + grammarBuilder.append("KW2479 : 'KW' '2479';\n"); + grammarBuilder.append("KW2480 : 'KW' '2480';\n"); + grammarBuilder.append("KW2481 : 'KW' '2481';\n"); + grammarBuilder.append("KW2482 : 'KW' '2482';\n"); + grammarBuilder.append("KW2483 : 'KW' '2483';\n"); + grammarBuilder.append("KW2484 : 'KW' '2484';\n"); + grammarBuilder.append("KW2485 : 'KW' '2485';\n"); + grammarBuilder.append("KW2486 : 'KW' '2486';\n"); + grammarBuilder.append("KW2487 : 'KW' '2487';\n"); + grammarBuilder.append("KW2488 : 'KW' '2488';\n"); + grammarBuilder.append("KW2489 : 'KW' '2489';\n"); + grammarBuilder.append("KW2490 : 'KW' '2490';\n"); + grammarBuilder.append("KW2491 : 'KW' '2491';\n"); + grammarBuilder.append("KW2492 : 'KW' '2492';\n"); + grammarBuilder.append("KW2493 : 'KW' '2493';\n"); + grammarBuilder.append("KW2494 : 'KW' '2494';\n"); + grammarBuilder.append("KW2495 : 'KW' '2495';\n"); + grammarBuilder.append("KW2496 : 'KW' '2496';\n"); + grammarBuilder.append("KW2497 : 'KW' '2497';\n"); + grammarBuilder.append("KW2498 : 'KW' '2498';\n"); + grammarBuilder.append("KW2499 : 'KW' '2499';\n"); + grammarBuilder.append("KW2500 : 'KW' '2500';\n"); + grammarBuilder.append("KW2501 : 'KW' '2501';\n"); + grammarBuilder.append("KW2502 : 'KW' '2502';\n"); + grammarBuilder.append("KW2503 : 'KW' '2503';\n"); + grammarBuilder.append("KW2504 : 'KW' '2504';\n"); + grammarBuilder.append("KW2505 : 'KW' '2505';\n"); + grammarBuilder.append("KW2506 : 'KW' '2506';\n"); + grammarBuilder.append("KW2507 : 'KW' '2507';\n"); + grammarBuilder.append("KW2508 : 'KW' '2508';\n"); + grammarBuilder.append("KW2509 : 'KW' '2509';\n"); + grammarBuilder.append("KW2510 : 'KW' '2510';\n"); + grammarBuilder.append("KW2511 : 'KW' '2511';\n"); + grammarBuilder.append("KW2512 : 'KW' '2512';\n"); + grammarBuilder.append("KW2513 : 'KW' '2513';\n"); + grammarBuilder.append("KW2514 : 'KW' '2514';\n"); + grammarBuilder.append("KW2515 : 'KW' '2515';\n"); + grammarBuilder.append("KW2516 : 'KW' '2516';\n"); + grammarBuilder.append("KW2517 : 'KW' '2517';\n"); + grammarBuilder.append("KW2518 : 'KW' '2518';\n"); + grammarBuilder.append("KW2519 : 'KW' '2519';\n"); + grammarBuilder.append("KW2520 : 'KW' '2520';\n"); + grammarBuilder.append("KW2521 : 'KW' '2521';\n"); + grammarBuilder.append("KW2522 : 'KW' '2522';\n"); + grammarBuilder.append("KW2523 : 'KW' '2523';\n"); + grammarBuilder.append("KW2524 : 'KW' '2524';\n"); + grammarBuilder.append("KW2525 : 'KW' '2525';\n"); + grammarBuilder.append("KW2526 : 'KW' '2526';\n"); + grammarBuilder.append("KW2527 : 'KW' '2527';\n"); + grammarBuilder.append("KW2528 : 'KW' '2528';\n"); + grammarBuilder.append("KW2529 : 'KW' '2529';\n"); + grammarBuilder.append("KW2530 : 'KW' '2530';\n"); + grammarBuilder.append("KW2531 : 'KW' '2531';\n"); + grammarBuilder.append("KW2532 : 'KW' '2532';\n"); + grammarBuilder.append("KW2533 : 'KW' '2533';\n"); + grammarBuilder.append("KW2534 : 'KW' '2534';\n"); + grammarBuilder.append("KW2535 : 'KW' '2535';\n"); + grammarBuilder.append("KW2536 : 'KW' '2536';\n"); + grammarBuilder.append("KW2537 : 'KW' '2537';\n"); + grammarBuilder.append("KW2538 : 'KW' '2538';\n"); + grammarBuilder.append("KW2539 : 'KW' '2539';\n"); + grammarBuilder.append("KW2540 : 'KW' '2540';\n"); + grammarBuilder.append("KW2541 : 'KW' '2541';\n"); + grammarBuilder.append("KW2542 : 'KW' '2542';\n"); + grammarBuilder.append("KW2543 : 'KW' '2543';\n"); + grammarBuilder.append("KW2544 : 'KW' '2544';\n"); + grammarBuilder.append("KW2545 : 'KW' '2545';\n"); + grammarBuilder.append("KW2546 : 'KW' '2546';\n"); + grammarBuilder.append("KW2547 : 'KW' '2547';\n"); + grammarBuilder.append("KW2548 : 'KW' '2548';\n"); + grammarBuilder.append("KW2549 : 'KW' '2549';\n"); + grammarBuilder.append("KW2550 : 'KW' '2550';\n"); + grammarBuilder.append("KW2551 : 'KW' '2551';\n"); + grammarBuilder.append("KW2552 : 'KW' '2552';\n"); + grammarBuilder.append("KW2553 : 'KW' '2553';\n"); + grammarBuilder.append("KW2554 : 'KW' '2554';\n"); + grammarBuilder.append("KW2555 : 'KW' '2555';\n"); + grammarBuilder.append("KW2556 : 'KW' '2556';\n"); + grammarBuilder.append("KW2557 : 'KW' '2557';\n"); + grammarBuilder.append("KW2558 : 'KW' '2558';\n"); + grammarBuilder.append("KW2559 : 'KW' '2559';\n"); + grammarBuilder.append("KW2560 : 'KW' '2560';\n"); + grammarBuilder.append("KW2561 : 'KW' '2561';\n"); + grammarBuilder.append("KW2562 : 'KW' '2562';\n"); + grammarBuilder.append("KW2563 : 'KW' '2563';\n"); + grammarBuilder.append("KW2564 : 'KW' '2564';\n"); + grammarBuilder.append("KW2565 : 'KW' '2565';\n"); + grammarBuilder.append("KW2566 : 'KW' '2566';\n"); + grammarBuilder.append("KW2567 : 'KW' '2567';\n"); + grammarBuilder.append("KW2568 : 'KW' '2568';\n"); + grammarBuilder.append("KW2569 : 'KW' '2569';\n"); + grammarBuilder.append("KW2570 : 'KW' '2570';\n"); + grammarBuilder.append("KW2571 : 'KW' '2571';\n"); + grammarBuilder.append("KW2572 : 'KW' '2572';\n"); + grammarBuilder.append("KW2573 : 'KW' '2573';\n"); + grammarBuilder.append("KW2574 : 'KW' '2574';\n"); + grammarBuilder.append("KW2575 : 'KW' '2575';\n"); + grammarBuilder.append("KW2576 : 'KW' '2576';\n"); + grammarBuilder.append("KW2577 : 'KW' '2577';\n"); + grammarBuilder.append("KW2578 : 'KW' '2578';\n"); + grammarBuilder.append("KW2579 : 'KW' '2579';\n"); + grammarBuilder.append("KW2580 : 'KW' '2580';\n"); + grammarBuilder.append("KW2581 : 'KW' '2581';\n"); + grammarBuilder.append("KW2582 : 'KW' '2582';\n"); + grammarBuilder.append("KW2583 : 'KW' '2583';\n"); + grammarBuilder.append("KW2584 : 'KW' '2584';\n"); + grammarBuilder.append("KW2585 : 'KW' '2585';\n"); + grammarBuilder.append("KW2586 : 'KW' '2586';\n"); + grammarBuilder.append("KW2587 : 'KW' '2587';\n"); + grammarBuilder.append("KW2588 : 'KW' '2588';\n"); + grammarBuilder.append("KW2589 : 'KW' '2589';\n"); + grammarBuilder.append("KW2590 : 'KW' '2590';\n"); + grammarBuilder.append("KW2591 : 'KW' '2591';\n"); + grammarBuilder.append("KW2592 : 'KW' '2592';\n"); + grammarBuilder.append("KW2593 : 'KW' '2593';\n"); + grammarBuilder.append("KW2594 : 'KW' '2594';\n"); + grammarBuilder.append("KW2595 : 'KW' '2595';\n"); + grammarBuilder.append("KW2596 : 'KW' '2596';\n"); + grammarBuilder.append("KW2597 : 'KW' '2597';\n"); + grammarBuilder.append("KW2598 : 'KW' '2598';\n"); + grammarBuilder.append("KW2599 : 'KW' '2599';\n"); + grammarBuilder.append("KW2600 : 'KW' '2600';\n"); + grammarBuilder.append("KW2601 : 'KW' '2601';\n"); + grammarBuilder.append("KW2602 : 'KW' '2602';\n"); + grammarBuilder.append("KW2603 : 'KW' '2603';\n"); + grammarBuilder.append("KW2604 : 'KW' '2604';\n"); + grammarBuilder.append("KW2605 : 'KW' '2605';\n"); + grammarBuilder.append("KW2606 : 'KW' '2606';\n"); + grammarBuilder.append("KW2607 : 'KW' '2607';\n"); + grammarBuilder.append("KW2608 : 'KW' '2608';\n"); + grammarBuilder.append("KW2609 : 'KW' '2609';\n"); + grammarBuilder.append("KW2610 : 'KW' '2610';\n"); + grammarBuilder.append("KW2611 : 'KW' '2611';\n"); + grammarBuilder.append("KW2612 : 'KW' '2612';\n"); + grammarBuilder.append("KW2613 : 'KW' '2613';\n"); + grammarBuilder.append("KW2614 : 'KW' '2614';\n"); + grammarBuilder.append("KW2615 : 'KW' '2615';\n"); + grammarBuilder.append("KW2616 : 'KW' '2616';\n"); + grammarBuilder.append("KW2617 : 'KW' '2617';\n"); + grammarBuilder.append("KW2618 : 'KW' '2618';\n"); + grammarBuilder.append("KW2619 : 'KW' '2619';\n"); + grammarBuilder.append("KW2620 : 'KW' '2620';\n"); + grammarBuilder.append("KW2621 : 'KW' '2621';\n"); + grammarBuilder.append("KW2622 : 'KW' '2622';\n"); + grammarBuilder.append("KW2623 : 'KW' '2623';\n"); + grammarBuilder.append("KW2624 : 'KW' '2624';\n"); + grammarBuilder.append("KW2625 : 'KW' '2625';\n"); + grammarBuilder.append("KW2626 : 'KW' '2626';\n"); + grammarBuilder.append("KW2627 : 'KW' '2627';\n"); + grammarBuilder.append("KW2628 : 'KW' '2628';\n"); + grammarBuilder.append("KW2629 : 'KW' '2629';\n"); + grammarBuilder.append("KW2630 : 'KW' '2630';\n"); + grammarBuilder.append("KW2631 : 'KW' '2631';\n"); + grammarBuilder.append("KW2632 : 'KW' '2632';\n"); + grammarBuilder.append("KW2633 : 'KW' '2633';\n"); + grammarBuilder.append("KW2634 : 'KW' '2634';\n"); + grammarBuilder.append("KW2635 : 'KW' '2635';\n"); + grammarBuilder.append("KW2636 : 'KW' '2636';\n"); + grammarBuilder.append("KW2637 : 'KW' '2637';\n"); + grammarBuilder.append("KW2638 : 'KW' '2638';\n"); + grammarBuilder.append("KW2639 : 'KW' '2639';\n"); + grammarBuilder.append("KW2640 : 'KW' '2640';\n"); + grammarBuilder.append("KW2641 : 'KW' '2641';\n"); + grammarBuilder.append("KW2642 : 'KW' '2642';\n"); + grammarBuilder.append("KW2643 : 'KW' '2643';\n"); + grammarBuilder.append("KW2644 : 'KW' '2644';\n"); + grammarBuilder.append("KW2645 : 'KW' '2645';\n"); + grammarBuilder.append("KW2646 : 'KW' '2646';\n"); + grammarBuilder.append("KW2647 : 'KW' '2647';\n"); + grammarBuilder.append("KW2648 : 'KW' '2648';\n"); + grammarBuilder.append("KW2649 : 'KW' '2649';\n"); + grammarBuilder.append("KW2650 : 'KW' '2650';\n"); + grammarBuilder.append("KW2651 : 'KW' '2651';\n"); + grammarBuilder.append("KW2652 : 'KW' '2652';\n"); + grammarBuilder.append("KW2653 : 'KW' '2653';\n"); + grammarBuilder.append("KW2654 : 'KW' '2654';\n"); + grammarBuilder.append("KW2655 : 'KW' '2655';\n"); + grammarBuilder.append("KW2656 : 'KW' '2656';\n"); + grammarBuilder.append("KW2657 : 'KW' '2657';\n"); + grammarBuilder.append("KW2658 : 'KW' '2658';\n"); + grammarBuilder.append("KW2659 : 'KW' '2659';\n"); + grammarBuilder.append("KW2660 : 'KW' '2660';\n"); + grammarBuilder.append("KW2661 : 'KW' '2661';\n"); + grammarBuilder.append("KW2662 : 'KW' '2662';\n"); + grammarBuilder.append("KW2663 : 'KW' '2663';\n"); + grammarBuilder.append("KW2664 : 'KW' '2664';\n"); + grammarBuilder.append("KW2665 : 'KW' '2665';\n"); + grammarBuilder.append("KW2666 : 'KW' '2666';\n"); + grammarBuilder.append("KW2667 : 'KW' '2667';\n"); + grammarBuilder.append("KW2668 : 'KW' '2668';\n"); + grammarBuilder.append("KW2669 : 'KW' '2669';\n"); + grammarBuilder.append("KW2670 : 'KW' '2670';\n"); + grammarBuilder.append("KW2671 : 'KW' '2671';\n"); + grammarBuilder.append("KW2672 : 'KW' '2672';\n"); + grammarBuilder.append("KW2673 : 'KW' '2673';\n"); + grammarBuilder.append("KW2674 : 'KW' '2674';\n"); + grammarBuilder.append("KW2675 : 'KW' '2675';\n"); + grammarBuilder.append("KW2676 : 'KW' '2676';\n"); + grammarBuilder.append("KW2677 : 'KW' '2677';\n"); + grammarBuilder.append("KW2678 : 'KW' '2678';\n"); + grammarBuilder.append("KW2679 : 'KW' '2679';\n"); + grammarBuilder.append("KW2680 : 'KW' '2680';\n"); + grammarBuilder.append("KW2681 : 'KW' '2681';\n"); + grammarBuilder.append("KW2682 : 'KW' '2682';\n"); + grammarBuilder.append("KW2683 : 'KW' '2683';\n"); + grammarBuilder.append("KW2684 : 'KW' '2684';\n"); + grammarBuilder.append("KW2685 : 'KW' '2685';\n"); + grammarBuilder.append("KW2686 : 'KW' '2686';\n"); + grammarBuilder.append("KW2687 : 'KW' '2687';\n"); + grammarBuilder.append("KW2688 : 'KW' '2688';\n"); + grammarBuilder.append("KW2689 : 'KW' '2689';\n"); + grammarBuilder.append("KW2690 : 'KW' '2690';\n"); + grammarBuilder.append("KW2691 : 'KW' '2691';\n"); + grammarBuilder.append("KW2692 : 'KW' '2692';\n"); + grammarBuilder.append("KW2693 : 'KW' '2693';\n"); + grammarBuilder.append("KW2694 : 'KW' '2694';\n"); + grammarBuilder.append("KW2695 : 'KW' '2695';\n"); + grammarBuilder.append("KW2696 : 'KW' '2696';\n"); + grammarBuilder.append("KW2697 : 'KW' '2697';\n"); + grammarBuilder.append("KW2698 : 'KW' '2698';\n"); + grammarBuilder.append("KW2699 : 'KW' '2699';\n"); + grammarBuilder.append("KW2700 : 'KW' '2700';\n"); + grammarBuilder.append("KW2701 : 'KW' '2701';\n"); + grammarBuilder.append("KW2702 : 'KW' '2702';\n"); + grammarBuilder.append("KW2703 : 'KW' '2703';\n"); + grammarBuilder.append("KW2704 : 'KW' '2704';\n"); + grammarBuilder.append("KW2705 : 'KW' '2705';\n"); + grammarBuilder.append("KW2706 : 'KW' '2706';\n"); + grammarBuilder.append("KW2707 : 'KW' '2707';\n"); + grammarBuilder.append("KW2708 : 'KW' '2708';\n"); + grammarBuilder.append("KW2709 : 'KW' '2709';\n"); + grammarBuilder.append("KW2710 : 'KW' '2710';\n"); + grammarBuilder.append("KW2711 : 'KW' '2711';\n"); + grammarBuilder.append("KW2712 : 'KW' '2712';\n"); + grammarBuilder.append("KW2713 : 'KW' '2713';\n"); + grammarBuilder.append("KW2714 : 'KW' '2714';\n"); + grammarBuilder.append("KW2715 : 'KW' '2715';\n"); + grammarBuilder.append("KW2716 : 'KW' '2716';\n"); + grammarBuilder.append("KW2717 : 'KW' '2717';\n"); + grammarBuilder.append("KW2718 : 'KW' '2718';\n"); + grammarBuilder.append("KW2719 : 'KW' '2719';\n"); + grammarBuilder.append("KW2720 : 'KW' '2720';\n"); + grammarBuilder.append("KW2721 : 'KW' '2721';\n"); + grammarBuilder.append("KW2722 : 'KW' '2722';\n"); + grammarBuilder.append("KW2723 : 'KW' '2723';\n"); + grammarBuilder.append("KW2724 : 'KW' '2724';\n"); + grammarBuilder.append("KW2725 : 'KW' '2725';\n"); + grammarBuilder.append("KW2726 : 'KW' '2726';\n"); + grammarBuilder.append("KW2727 : 'KW' '2727';\n"); + grammarBuilder.append("KW2728 : 'KW' '2728';\n"); + grammarBuilder.append("KW2729 : 'KW' '2729';\n"); + grammarBuilder.append("KW2730 : 'KW' '2730';\n"); + grammarBuilder.append("KW2731 : 'KW' '2731';\n"); + grammarBuilder.append("KW2732 : 'KW' '2732';\n"); + grammarBuilder.append("KW2733 : 'KW' '2733';\n"); + grammarBuilder.append("KW2734 : 'KW' '2734';\n"); + grammarBuilder.append("KW2735 : 'KW' '2735';\n"); + grammarBuilder.append("KW2736 : 'KW' '2736';\n"); + grammarBuilder.append("KW2737 : 'KW' '2737';\n"); + grammarBuilder.append("KW2738 : 'KW' '2738';\n"); + grammarBuilder.append("KW2739 : 'KW' '2739';\n"); + grammarBuilder.append("KW2740 : 'KW' '2740';\n"); + grammarBuilder.append("KW2741 : 'KW' '2741';\n"); + grammarBuilder.append("KW2742 : 'KW' '2742';\n"); + grammarBuilder.append("KW2743 : 'KW' '2743';\n"); + grammarBuilder.append("KW2744 : 'KW' '2744';\n"); + grammarBuilder.append("KW2745 : 'KW' '2745';\n"); + grammarBuilder.append("KW2746 : 'KW' '2746';\n"); + grammarBuilder.append("KW2747 : 'KW' '2747';\n"); + grammarBuilder.append("KW2748 : 'KW' '2748';\n"); + grammarBuilder.append("KW2749 : 'KW' '2749';\n"); + grammarBuilder.append("KW2750 : 'KW' '2750';\n"); + grammarBuilder.append("KW2751 : 'KW' '2751';\n"); + grammarBuilder.append("KW2752 : 'KW' '2752';\n"); + grammarBuilder.append("KW2753 : 'KW' '2753';\n"); + grammarBuilder.append("KW2754 : 'KW' '2754';\n"); + grammarBuilder.append("KW2755 : 'KW' '2755';\n"); + grammarBuilder.append("KW2756 : 'KW' '2756';\n"); + grammarBuilder.append("KW2757 : 'KW' '2757';\n"); + grammarBuilder.append("KW2758 : 'KW' '2758';\n"); + grammarBuilder.append("KW2759 : 'KW' '2759';\n"); + grammarBuilder.append("KW2760 : 'KW' '2760';\n"); + grammarBuilder.append("KW2761 : 'KW' '2761';\n"); + grammarBuilder.append("KW2762 : 'KW' '2762';\n"); + grammarBuilder.append("KW2763 : 'KW' '2763';\n"); + grammarBuilder.append("KW2764 : 'KW' '2764';\n"); + grammarBuilder.append("KW2765 : 'KW' '2765';\n"); + grammarBuilder.append("KW2766 : 'KW' '2766';\n"); + grammarBuilder.append("KW2767 : 'KW' '2767';\n"); + grammarBuilder.append("KW2768 : 'KW' '2768';\n"); + grammarBuilder.append("KW2769 : 'KW' '2769';\n"); + grammarBuilder.append("KW2770 : 'KW' '2770';\n"); + grammarBuilder.append("KW2771 : 'KW' '2771';\n"); + grammarBuilder.append("KW2772 : 'KW' '2772';\n"); + grammarBuilder.append("KW2773 : 'KW' '2773';\n"); + grammarBuilder.append("KW2774 : 'KW' '2774';\n"); + grammarBuilder.append("KW2775 : 'KW' '2775';\n"); + grammarBuilder.append("KW2776 : 'KW' '2776';\n"); + grammarBuilder.append("KW2777 : 'KW' '2777';\n"); + grammarBuilder.append("KW2778 : 'KW' '2778';\n"); + grammarBuilder.append("KW2779 : 'KW' '2779';\n"); + grammarBuilder.append("KW2780 : 'KW' '2780';\n"); + grammarBuilder.append("KW2781 : 'KW' '2781';\n"); + grammarBuilder.append("KW2782 : 'KW' '2782';\n"); + grammarBuilder.append("KW2783 : 'KW' '2783';\n"); + grammarBuilder.append("KW2784 : 'KW' '2784';\n"); + grammarBuilder.append("KW2785 : 'KW' '2785';\n"); + grammarBuilder.append("KW2786 : 'KW' '2786';\n"); + grammarBuilder.append("KW2787 : 'KW' '2787';\n"); + grammarBuilder.append("KW2788 : 'KW' '2788';\n"); + grammarBuilder.append("KW2789 : 'KW' '2789';\n"); + grammarBuilder.append("KW2790 : 'KW' '2790';\n"); + grammarBuilder.append("KW2791 : 'KW' '2791';\n"); + grammarBuilder.append("KW2792 : 'KW' '2792';\n"); + grammarBuilder.append("KW2793 : 'KW' '2793';\n"); + grammarBuilder.append("KW2794 : 'KW' '2794';\n"); + grammarBuilder.append("KW2795 : 'KW' '2795';\n"); + grammarBuilder.append("KW2796 : 'KW' '2796';\n"); + grammarBuilder.append("KW2797 : 'KW' '2797';\n"); + grammarBuilder.append("KW2798 : 'KW' '2798';\n"); + grammarBuilder.append("KW2799 : 'KW' '2799';\n"); + grammarBuilder.append("KW2800 : 'KW' '2800';\n"); + grammarBuilder.append("KW2801 : 'KW' '2801';\n"); + grammarBuilder.append("KW2802 : 'KW' '2802';\n"); + grammarBuilder.append("KW2803 : 'KW' '2803';\n"); + grammarBuilder.append("KW2804 : 'KW' '2804';\n"); + grammarBuilder.append("KW2805 : 'KW' '2805';\n"); + grammarBuilder.append("KW2806 : 'KW' '2806';\n"); + grammarBuilder.append("KW2807 : 'KW' '2807';\n"); + grammarBuilder.append("KW2808 : 'KW' '2808';\n"); + grammarBuilder.append("KW2809 : 'KW' '2809';\n"); + grammarBuilder.append("KW2810 : 'KW' '2810';\n"); + grammarBuilder.append("KW2811 : 'KW' '2811';\n"); + grammarBuilder.append("KW2812 : 'KW' '2812';\n"); + grammarBuilder.append("KW2813 : 'KW' '2813';\n"); + grammarBuilder.append("KW2814 : 'KW' '2814';\n"); + grammarBuilder.append("KW2815 : 'KW' '2815';\n"); + grammarBuilder.append("KW2816 : 'KW' '2816';\n"); + grammarBuilder.append("KW2817 : 'KW' '2817';\n"); + grammarBuilder.append("KW2818 : 'KW' '2818';\n"); + grammarBuilder.append("KW2819 : 'KW' '2819';\n"); + grammarBuilder.append("KW2820 : 'KW' '2820';\n"); + grammarBuilder.append("KW2821 : 'KW' '2821';\n"); + grammarBuilder.append("KW2822 : 'KW' '2822';\n"); + grammarBuilder.append("KW2823 : 'KW' '2823';\n"); + grammarBuilder.append("KW2824 : 'KW' '2824';\n"); + grammarBuilder.append("KW2825 : 'KW' '2825';\n"); + grammarBuilder.append("KW2826 : 'KW' '2826';\n"); + grammarBuilder.append("KW2827 : 'KW' '2827';\n"); + grammarBuilder.append("KW2828 : 'KW' '2828';\n"); + grammarBuilder.append("KW2829 : 'KW' '2829';\n"); + grammarBuilder.append("KW2830 : 'KW' '2830';\n"); + grammarBuilder.append("KW2831 : 'KW' '2831';\n"); + grammarBuilder.append("KW2832 : 'KW' '2832';\n"); + grammarBuilder.append("KW2833 : 'KW' '2833';\n"); + grammarBuilder.append("KW2834 : 'KW' '2834';\n"); + grammarBuilder.append("KW2835 : 'KW' '2835';\n"); + grammarBuilder.append("KW2836 : 'KW' '2836';\n"); + grammarBuilder.append("KW2837 : 'KW' '2837';\n"); + grammarBuilder.append("KW2838 : 'KW' '2838';\n"); + grammarBuilder.append("KW2839 : 'KW' '2839';\n"); + grammarBuilder.append("KW2840 : 'KW' '2840';\n"); + grammarBuilder.append("KW2841 : 'KW' '2841';\n"); + grammarBuilder.append("KW2842 : 'KW' '2842';\n"); + grammarBuilder.append("KW2843 : 'KW' '2843';\n"); + grammarBuilder.append("KW2844 : 'KW' '2844';\n"); + grammarBuilder.append("KW2845 : 'KW' '2845';\n"); + grammarBuilder.append("KW2846 : 'KW' '2846';\n"); + grammarBuilder.append("KW2847 : 'KW' '2847';\n"); + grammarBuilder.append("KW2848 : 'KW' '2848';\n"); + grammarBuilder.append("KW2849 : 'KW' '2849';\n"); + grammarBuilder.append("KW2850 : 'KW' '2850';\n"); + grammarBuilder.append("KW2851 : 'KW' '2851';\n"); + grammarBuilder.append("KW2852 : 'KW' '2852';\n"); + grammarBuilder.append("KW2853 : 'KW' '2853';\n"); + grammarBuilder.append("KW2854 : 'KW' '2854';\n"); + grammarBuilder.append("KW2855 : 'KW' '2855';\n"); + grammarBuilder.append("KW2856 : 'KW' '2856';\n"); + grammarBuilder.append("KW2857 : 'KW' '2857';\n"); + grammarBuilder.append("KW2858 : 'KW' '2858';\n"); + grammarBuilder.append("KW2859 : 'KW' '2859';\n"); + grammarBuilder.append("KW2860 : 'KW' '2860';\n"); + grammarBuilder.append("KW2861 : 'KW' '2861';\n"); + grammarBuilder.append("KW2862 : 'KW' '2862';\n"); + grammarBuilder.append("KW2863 : 'KW' '2863';\n"); + grammarBuilder.append("KW2864 : 'KW' '2864';\n"); + grammarBuilder.append("KW2865 : 'KW' '2865';\n"); + grammarBuilder.append("KW2866 : 'KW' '2866';\n"); + grammarBuilder.append("KW2867 : 'KW' '2867';\n"); + grammarBuilder.append("KW2868 : 'KW' '2868';\n"); + grammarBuilder.append("KW2869 : 'KW' '2869';\n"); + grammarBuilder.append("KW2870 : 'KW' '2870';\n"); + grammarBuilder.append("KW2871 : 'KW' '2871';\n"); + grammarBuilder.append("KW2872 : 'KW' '2872';\n"); + grammarBuilder.append("KW2873 : 'KW' '2873';\n"); + grammarBuilder.append("KW2874 : 'KW' '2874';\n"); + grammarBuilder.append("KW2875 : 'KW' '2875';\n"); + grammarBuilder.append("KW2876 : 'KW' '2876';\n"); + grammarBuilder.append("KW2877 : 'KW' '2877';\n"); + grammarBuilder.append("KW2878 : 'KW' '2878';\n"); + grammarBuilder.append("KW2879 : 'KW' '2879';\n"); + grammarBuilder.append("KW2880 : 'KW' '2880';\n"); + grammarBuilder.append("KW2881 : 'KW' '2881';\n"); + grammarBuilder.append("KW2882 : 'KW' '2882';\n"); + grammarBuilder.append("KW2883 : 'KW' '2883';\n"); + grammarBuilder.append("KW2884 : 'KW' '2884';\n"); + grammarBuilder.append("KW2885 : 'KW' '2885';\n"); + grammarBuilder.append("KW2886 : 'KW' '2886';\n"); + grammarBuilder.append("KW2887 : 'KW' '2887';\n"); + grammarBuilder.append("KW2888 : 'KW' '2888';\n"); + grammarBuilder.append("KW2889 : 'KW' '2889';\n"); + grammarBuilder.append("KW2890 : 'KW' '2890';\n"); + grammarBuilder.append("KW2891 : 'KW' '2891';\n"); + grammarBuilder.append("KW2892 : 'KW' '2892';\n"); + grammarBuilder.append("KW2893 : 'KW' '2893';\n"); + grammarBuilder.append("KW2894 : 'KW' '2894';\n"); + grammarBuilder.append("KW2895 : 'KW' '2895';\n"); + grammarBuilder.append("KW2896 : 'KW' '2896';\n"); + grammarBuilder.append("KW2897 : 'KW' '2897';\n"); + grammarBuilder.append("KW2898 : 'KW' '2898';\n"); + grammarBuilder.append("KW2899 : 'KW' '2899';\n"); + grammarBuilder.append("KW2900 : 'KW' '2900';\n"); + grammarBuilder.append("KW2901 : 'KW' '2901';\n"); + grammarBuilder.append("KW2902 : 'KW' '2902';\n"); + grammarBuilder.append("KW2903 : 'KW' '2903';\n"); + grammarBuilder.append("KW2904 : 'KW' '2904';\n"); + grammarBuilder.append("KW2905 : 'KW' '2905';\n"); + grammarBuilder.append("KW2906 : 'KW' '2906';\n"); + grammarBuilder.append("KW2907 : 'KW' '2907';\n"); + grammarBuilder.append("KW2908 : 'KW' '2908';\n"); + grammarBuilder.append("KW2909 : 'KW' '2909';\n"); + grammarBuilder.append("KW2910 : 'KW' '2910';\n"); + grammarBuilder.append("KW2911 : 'KW' '2911';\n"); + grammarBuilder.append("KW2912 : 'KW' '2912';\n"); + grammarBuilder.append("KW2913 : 'KW' '2913';\n"); + grammarBuilder.append("KW2914 : 'KW' '2914';\n"); + grammarBuilder.append("KW2915 : 'KW' '2915';\n"); + grammarBuilder.append("KW2916 : 'KW' '2916';\n"); + grammarBuilder.append("KW2917 : 'KW' '2917';\n"); + grammarBuilder.append("KW2918 : 'KW' '2918';\n"); + grammarBuilder.append("KW2919 : 'KW' '2919';\n"); + grammarBuilder.append("KW2920 : 'KW' '2920';\n"); + grammarBuilder.append("KW2921 : 'KW' '2921';\n"); + grammarBuilder.append("KW2922 : 'KW' '2922';\n"); + grammarBuilder.append("KW2923 : 'KW' '2923';\n"); + grammarBuilder.append("KW2924 : 'KW' '2924';\n"); + grammarBuilder.append("KW2925 : 'KW' '2925';\n"); + grammarBuilder.append("KW2926 : 'KW' '2926';\n"); + grammarBuilder.append("KW2927 : 'KW' '2927';\n"); + grammarBuilder.append("KW2928 : 'KW' '2928';\n"); + grammarBuilder.append("KW2929 : 'KW' '2929';\n"); + grammarBuilder.append("KW2930 : 'KW' '2930';\n"); + grammarBuilder.append("KW2931 : 'KW' '2931';\n"); + grammarBuilder.append("KW2932 : 'KW' '2932';\n"); + grammarBuilder.append("KW2933 : 'KW' '2933';\n"); + grammarBuilder.append("KW2934 : 'KW' '2934';\n"); + grammarBuilder.append("KW2935 : 'KW' '2935';\n"); + grammarBuilder.append("KW2936 : 'KW' '2936';\n"); + grammarBuilder.append("KW2937 : 'KW' '2937';\n"); + grammarBuilder.append("KW2938 : 'KW' '2938';\n"); + grammarBuilder.append("KW2939 : 'KW' '2939';\n"); + grammarBuilder.append("KW2940 : 'KW' '2940';\n"); + grammarBuilder.append("KW2941 : 'KW' '2941';\n"); + grammarBuilder.append("KW2942 : 'KW' '2942';\n"); + grammarBuilder.append("KW2943 : 'KW' '2943';\n"); + grammarBuilder.append("KW2944 : 'KW' '2944';\n"); + grammarBuilder.append("KW2945 : 'KW' '2945';\n"); + grammarBuilder.append("KW2946 : 'KW' '2946';\n"); + grammarBuilder.append("KW2947 : 'KW' '2947';\n"); + grammarBuilder.append("KW2948 : 'KW' '2948';\n"); + grammarBuilder.append("KW2949 : 'KW' '2949';\n"); + grammarBuilder.append("KW2950 : 'KW' '2950';\n"); + grammarBuilder.append("KW2951 : 'KW' '2951';\n"); + grammarBuilder.append("KW2952 : 'KW' '2952';\n"); + grammarBuilder.append("KW2953 : 'KW' '2953';\n"); + grammarBuilder.append("KW2954 : 'KW' '2954';\n"); + grammarBuilder.append("KW2955 : 'KW' '2955';\n"); + grammarBuilder.append("KW2956 : 'KW' '2956';\n"); + grammarBuilder.append("KW2957 : 'KW' '2957';\n"); + grammarBuilder.append("KW2958 : 'KW' '2958';\n"); + grammarBuilder.append("KW2959 : 'KW' '2959';\n"); + grammarBuilder.append("KW2960 : 'KW' '2960';\n"); + grammarBuilder.append("KW2961 : 'KW' '2961';\n"); + grammarBuilder.append("KW2962 : 'KW' '2962';\n"); + grammarBuilder.append("KW2963 : 'KW' '2963';\n"); + grammarBuilder.append("KW2964 : 'KW' '2964';\n"); + grammarBuilder.append("KW2965 : 'KW' '2965';\n"); + grammarBuilder.append("KW2966 : 'KW' '2966';\n"); + grammarBuilder.append("KW2967 : 'KW' '2967';\n"); + grammarBuilder.append("KW2968 : 'KW' '2968';\n"); + grammarBuilder.append("KW2969 : 'KW' '2969';\n"); + grammarBuilder.append("KW2970 : 'KW' '2970';\n"); + grammarBuilder.append("KW2971 : 'KW' '2971';\n"); + grammarBuilder.append("KW2972 : 'KW' '2972';\n"); + grammarBuilder.append("KW2973 : 'KW' '2973';\n"); + grammarBuilder.append("KW2974 : 'KW' '2974';\n"); + grammarBuilder.append("KW2975 : 'KW' '2975';\n"); + grammarBuilder.append("KW2976 : 'KW' '2976';\n"); + grammarBuilder.append("KW2977 : 'KW' '2977';\n"); + grammarBuilder.append("KW2978 : 'KW' '2978';\n"); + grammarBuilder.append("KW2979 : 'KW' '2979';\n"); + grammarBuilder.append("KW2980 : 'KW' '2980';\n"); + grammarBuilder.append("KW2981 : 'KW' '2981';\n"); + grammarBuilder.append("KW2982 : 'KW' '2982';\n"); + grammarBuilder.append("KW2983 : 'KW' '2983';\n"); + grammarBuilder.append("KW2984 : 'KW' '2984';\n"); + grammarBuilder.append("KW2985 : 'KW' '2985';\n"); + grammarBuilder.append("KW2986 : 'KW' '2986';\n"); + grammarBuilder.append("KW2987 : 'KW' '2987';\n"); + grammarBuilder.append("KW2988 : 'KW' '2988';\n"); + grammarBuilder.append("KW2989 : 'KW' '2989';\n"); + grammarBuilder.append("KW2990 : 'KW' '2990';\n"); + grammarBuilder.append("KW2991 : 'KW' '2991';\n"); + grammarBuilder.append("KW2992 : 'KW' '2992';\n"); + grammarBuilder.append("KW2993 : 'KW' '2993';\n"); + grammarBuilder.append("KW2994 : 'KW' '2994';\n"); + grammarBuilder.append("KW2995 : 'KW' '2995';\n"); + grammarBuilder.append("KW2996 : 'KW' '2996';\n"); + grammarBuilder.append("KW2997 : 'KW' '2997';\n"); + grammarBuilder.append("KW2998 : 'KW' '2998';\n"); + grammarBuilder.append("KW2999 : 'KW' '2999';\n"); + grammarBuilder.append("KW3000 : 'KW' '3000';\n"); + grammarBuilder.append("KW3001 : 'KW' '3001';\n"); + grammarBuilder.append("KW3002 : 'KW' '3002';\n"); + grammarBuilder.append("KW3003 : 'KW' '3003';\n"); + grammarBuilder.append("KW3004 : 'KW' '3004';\n"); + grammarBuilder.append("KW3005 : 'KW' '3005';\n"); + grammarBuilder.append("KW3006 : 'KW' '3006';\n"); + grammarBuilder.append("KW3007 : 'KW' '3007';\n"); + grammarBuilder.append("KW3008 : 'KW' '3008';\n"); + grammarBuilder.append("KW3009 : 'KW' '3009';\n"); + grammarBuilder.append("KW3010 : 'KW' '3010';\n"); + grammarBuilder.append("KW3011 : 'KW' '3011';\n"); + grammarBuilder.append("KW3012 : 'KW' '3012';\n"); + grammarBuilder.append("KW3013 : 'KW' '3013';\n"); + grammarBuilder.append("KW3014 : 'KW' '3014';\n"); + grammarBuilder.append("KW3015 : 'KW' '3015';\n"); + grammarBuilder.append("KW3016 : 'KW' '3016';\n"); + grammarBuilder.append("KW3017 : 'KW' '3017';\n"); + grammarBuilder.append("KW3018 : 'KW' '3018';\n"); + grammarBuilder.append("KW3019 : 'KW' '3019';\n"); + grammarBuilder.append("KW3020 : 'KW' '3020';\n"); + grammarBuilder.append("KW3021 : 'KW' '3021';\n"); + grammarBuilder.append("KW3022 : 'KW' '3022';\n"); + grammarBuilder.append("KW3023 : 'KW' '3023';\n"); + grammarBuilder.append("KW3024 : 'KW' '3024';\n"); + grammarBuilder.append("KW3025 : 'KW' '3025';\n"); + grammarBuilder.append("KW3026 : 'KW' '3026';\n"); + grammarBuilder.append("KW3027 : 'KW' '3027';\n"); + grammarBuilder.append("KW3028 : 'KW' '3028';\n"); + grammarBuilder.append("KW3029 : 'KW' '3029';\n"); + grammarBuilder.append("KW3030 : 'KW' '3030';\n"); + grammarBuilder.append("KW3031 : 'KW' '3031';\n"); + grammarBuilder.append("KW3032 : 'KW' '3032';\n"); + grammarBuilder.append("KW3033 : 'KW' '3033';\n"); + grammarBuilder.append("KW3034 : 'KW' '3034';\n"); + grammarBuilder.append("KW3035 : 'KW' '3035';\n"); + grammarBuilder.append("KW3036 : 'KW' '3036';\n"); + grammarBuilder.append("KW3037 : 'KW' '3037';\n"); + grammarBuilder.append("KW3038 : 'KW' '3038';\n"); + grammarBuilder.append("KW3039 : 'KW' '3039';\n"); + grammarBuilder.append("KW3040 : 'KW' '3040';\n"); + grammarBuilder.append("KW3041 : 'KW' '3041';\n"); + grammarBuilder.append("KW3042 : 'KW' '3042';\n"); + grammarBuilder.append("KW3043 : 'KW' '3043';\n"); + grammarBuilder.append("KW3044 : 'KW' '3044';\n"); + grammarBuilder.append("KW3045 : 'KW' '3045';\n"); + grammarBuilder.append("KW3046 : 'KW' '3046';\n"); + grammarBuilder.append("KW3047 : 'KW' '3047';\n"); + grammarBuilder.append("KW3048 : 'KW' '3048';\n"); + grammarBuilder.append("KW3049 : 'KW' '3049';\n"); + grammarBuilder.append("KW3050 : 'KW' '3050';\n"); + grammarBuilder.append("KW3051 : 'KW' '3051';\n"); + grammarBuilder.append("KW3052 : 'KW' '3052';\n"); + grammarBuilder.append("KW3053 : 'KW' '3053';\n"); + grammarBuilder.append("KW3054 : 'KW' '3054';\n"); + grammarBuilder.append("KW3055 : 'KW' '3055';\n"); + grammarBuilder.append("KW3056 : 'KW' '3056';\n"); + grammarBuilder.append("KW3057 : 'KW' '3057';\n"); + grammarBuilder.append("KW3058 : 'KW' '3058';\n"); + grammarBuilder.append("KW3059 : 'KW' '3059';\n"); + grammarBuilder.append("KW3060 : 'KW' '3060';\n"); + grammarBuilder.append("KW3061 : 'KW' '3061';\n"); + grammarBuilder.append("KW3062 : 'KW' '3062';\n"); + grammarBuilder.append("KW3063 : 'KW' '3063';\n"); + grammarBuilder.append("KW3064 : 'KW' '3064';\n"); + grammarBuilder.append("KW3065 : 'KW' '3065';\n"); + grammarBuilder.append("KW3066 : 'KW' '3066';\n"); + grammarBuilder.append("KW3067 : 'KW' '3067';\n"); + grammarBuilder.append("KW3068 : 'KW' '3068';\n"); + grammarBuilder.append("KW3069 : 'KW' '3069';\n"); + grammarBuilder.append("KW3070 : 'KW' '3070';\n"); + grammarBuilder.append("KW3071 : 'KW' '3071';\n"); + grammarBuilder.append("KW3072 : 'KW' '3072';\n"); + grammarBuilder.append("KW3073 : 'KW' '3073';\n"); + grammarBuilder.append("KW3074 : 'KW' '3074';\n"); + grammarBuilder.append("KW3075 : 'KW' '3075';\n"); + grammarBuilder.append("KW3076 : 'KW' '3076';\n"); + grammarBuilder.append("KW3077 : 'KW' '3077';\n"); + grammarBuilder.append("KW3078 : 'KW' '3078';\n"); + grammarBuilder.append("KW3079 : 'KW' '3079';\n"); + grammarBuilder.append("KW3080 : 'KW' '3080';\n"); + grammarBuilder.append("KW3081 : 'KW' '3081';\n"); + grammarBuilder.append("KW3082 : 'KW' '3082';\n"); + grammarBuilder.append("KW3083 : 'KW' '3083';\n"); + grammarBuilder.append("KW3084 : 'KW' '3084';\n"); + grammarBuilder.append("KW3085 : 'KW' '3085';\n"); + grammarBuilder.append("KW3086 : 'KW' '3086';\n"); + grammarBuilder.append("KW3087 : 'KW' '3087';\n"); + grammarBuilder.append("KW3088 : 'KW' '3088';\n"); + grammarBuilder.append("KW3089 : 'KW' '3089';\n"); + grammarBuilder.append("KW3090 : 'KW' '3090';\n"); + grammarBuilder.append("KW3091 : 'KW' '3091';\n"); + grammarBuilder.append("KW3092 : 'KW' '3092';\n"); + grammarBuilder.append("KW3093 : 'KW' '3093';\n"); + grammarBuilder.append("KW3094 : 'KW' '3094';\n"); + grammarBuilder.append("KW3095 : 'KW' '3095';\n"); + grammarBuilder.append("KW3096 : 'KW' '3096';\n"); + grammarBuilder.append("KW3097 : 'KW' '3097';\n"); + grammarBuilder.append("KW3098 : 'KW' '3098';\n"); + grammarBuilder.append("KW3099 : 'KW' '3099';\n"); + grammarBuilder.append("KW3100 : 'KW' '3100';\n"); + grammarBuilder.append("KW3101 : 'KW' '3101';\n"); + grammarBuilder.append("KW3102 : 'KW' '3102';\n"); + grammarBuilder.append("KW3103 : 'KW' '3103';\n"); + grammarBuilder.append("KW3104 : 'KW' '3104';\n"); + grammarBuilder.append("KW3105 : 'KW' '3105';\n"); + grammarBuilder.append("KW3106 : 'KW' '3106';\n"); + grammarBuilder.append("KW3107 : 'KW' '3107';\n"); + grammarBuilder.append("KW3108 : 'KW' '3108';\n"); + grammarBuilder.append("KW3109 : 'KW' '3109';\n"); + grammarBuilder.append("KW3110 : 'KW' '3110';\n"); + grammarBuilder.append("KW3111 : 'KW' '3111';\n"); + grammarBuilder.append("KW3112 : 'KW' '3112';\n"); + grammarBuilder.append("KW3113 : 'KW' '3113';\n"); + grammarBuilder.append("KW3114 : 'KW' '3114';\n"); + grammarBuilder.append("KW3115 : 'KW' '3115';\n"); + grammarBuilder.append("KW3116 : 'KW' '3116';\n"); + grammarBuilder.append("KW3117 : 'KW' '3117';\n"); + grammarBuilder.append("KW3118 : 'KW' '3118';\n"); + grammarBuilder.append("KW3119 : 'KW' '3119';\n"); + grammarBuilder.append("KW3120 : 'KW' '3120';\n"); + grammarBuilder.append("KW3121 : 'KW' '3121';\n"); + grammarBuilder.append("KW3122 : 'KW' '3122';\n"); + grammarBuilder.append("KW3123 : 'KW' '3123';\n"); + grammarBuilder.append("KW3124 : 'KW' '3124';\n"); + grammarBuilder.append("KW3125 : 'KW' '3125';\n"); + grammarBuilder.append("KW3126 : 'KW' '3126';\n"); + grammarBuilder.append("KW3127 : 'KW' '3127';\n"); + grammarBuilder.append("KW3128 : 'KW' '3128';\n"); + grammarBuilder.append("KW3129 : 'KW' '3129';\n"); + grammarBuilder.append("KW3130 : 'KW' '3130';\n"); + grammarBuilder.append("KW3131 : 'KW' '3131';\n"); + grammarBuilder.append("KW3132 : 'KW' '3132';\n"); + grammarBuilder.append("KW3133 : 'KW' '3133';\n"); + grammarBuilder.append("KW3134 : 'KW' '3134';\n"); + grammarBuilder.append("KW3135 : 'KW' '3135';\n"); + grammarBuilder.append("KW3136 : 'KW' '3136';\n"); + grammarBuilder.append("KW3137 : 'KW' '3137';\n"); + grammarBuilder.append("KW3138 : 'KW' '3138';\n"); + grammarBuilder.append("KW3139 : 'KW' '3139';\n"); + grammarBuilder.append("KW3140 : 'KW' '3140';\n"); + grammarBuilder.append("KW3141 : 'KW' '3141';\n"); + grammarBuilder.append("KW3142 : 'KW' '3142';\n"); + grammarBuilder.append("KW3143 : 'KW' '3143';\n"); + grammarBuilder.append("KW3144 : 'KW' '3144';\n"); + grammarBuilder.append("KW3145 : 'KW' '3145';\n"); + grammarBuilder.append("KW3146 : 'KW' '3146';\n"); + grammarBuilder.append("KW3147 : 'KW' '3147';\n"); + grammarBuilder.append("KW3148 : 'KW' '3148';\n"); + grammarBuilder.append("KW3149 : 'KW' '3149';\n"); + grammarBuilder.append("KW3150 : 'KW' '3150';\n"); + grammarBuilder.append("KW3151 : 'KW' '3151';\n"); + grammarBuilder.append("KW3152 : 'KW' '3152';\n"); + grammarBuilder.append("KW3153 : 'KW' '3153';\n"); + grammarBuilder.append("KW3154 : 'KW' '3154';\n"); + grammarBuilder.append("KW3155 : 'KW' '3155';\n"); + grammarBuilder.append("KW3156 : 'KW' '3156';\n"); + grammarBuilder.append("KW3157 : 'KW' '3157';\n"); + grammarBuilder.append("KW3158 : 'KW' '3158';\n"); + grammarBuilder.append("KW3159 : 'KW' '3159';\n"); + grammarBuilder.append("KW3160 : 'KW' '3160';\n"); + grammarBuilder.append("KW3161 : 'KW' '3161';\n"); + grammarBuilder.append("KW3162 : 'KW' '3162';\n"); + grammarBuilder.append("KW3163 : 'KW' '3163';\n"); + grammarBuilder.append("KW3164 : 'KW' '3164';\n"); + grammarBuilder.append("KW3165 : 'KW' '3165';\n"); + grammarBuilder.append("KW3166 : 'KW' '3166';\n"); + grammarBuilder.append("KW3167 : 'KW' '3167';\n"); + grammarBuilder.append("KW3168 : 'KW' '3168';\n"); + grammarBuilder.append("KW3169 : 'KW' '3169';\n"); + grammarBuilder.append("KW3170 : 'KW' '3170';\n"); + grammarBuilder.append("KW3171 : 'KW' '3171';\n"); + grammarBuilder.append("KW3172 : 'KW' '3172';\n"); + grammarBuilder.append("KW3173 : 'KW' '3173';\n"); + grammarBuilder.append("KW3174 : 'KW' '3174';\n"); + grammarBuilder.append("KW3175 : 'KW' '3175';\n"); + grammarBuilder.append("KW3176 : 'KW' '3176';\n"); + grammarBuilder.append("KW3177 : 'KW' '3177';\n"); + grammarBuilder.append("KW3178 : 'KW' '3178';\n"); + grammarBuilder.append("KW3179 : 'KW' '3179';\n"); + grammarBuilder.append("KW3180 : 'KW' '3180';\n"); + grammarBuilder.append("KW3181 : 'KW' '3181';\n"); + grammarBuilder.append("KW3182 : 'KW' '3182';\n"); + grammarBuilder.append("KW3183 : 'KW' '3183';\n"); + grammarBuilder.append("KW3184 : 'KW' '3184';\n"); + grammarBuilder.append("KW3185 : 'KW' '3185';\n"); + grammarBuilder.append("KW3186 : 'KW' '3186';\n"); + grammarBuilder.append("KW3187 : 'KW' '3187';\n"); + grammarBuilder.append("KW3188 : 'KW' '3188';\n"); + grammarBuilder.append("KW3189 : 'KW' '3189';\n"); + grammarBuilder.append("KW3190 : 'KW' '3190';\n"); + grammarBuilder.append("KW3191 : 'KW' '3191';\n"); + grammarBuilder.append("KW3192 : 'KW' '3192';\n"); + grammarBuilder.append("KW3193 : 'KW' '3193';\n"); + grammarBuilder.append("KW3194 : 'KW' '3194';\n"); + grammarBuilder.append("KW3195 : 'KW' '3195';\n"); + grammarBuilder.append("KW3196 : 'KW' '3196';\n"); + grammarBuilder.append("KW3197 : 'KW' '3197';\n"); + grammarBuilder.append("KW3198 : 'KW' '3198';\n"); + grammarBuilder.append("KW3199 : 'KW' '3199';\n"); + grammarBuilder.append("KW3200 : 'KW' '3200';\n"); + grammarBuilder.append("KW3201 : 'KW' '3201';\n"); + grammarBuilder.append("KW3202 : 'KW' '3202';\n"); + grammarBuilder.append("KW3203 : 'KW' '3203';\n"); + grammarBuilder.append("KW3204 : 'KW' '3204';\n"); + grammarBuilder.append("KW3205 : 'KW' '3205';\n"); + grammarBuilder.append("KW3206 : 'KW' '3206';\n"); + grammarBuilder.append("KW3207 : 'KW' '3207';\n"); + grammarBuilder.append("KW3208 : 'KW' '3208';\n"); + grammarBuilder.append("KW3209 : 'KW' '3209';\n"); + grammarBuilder.append("KW3210 : 'KW' '3210';\n"); + grammarBuilder.append("KW3211 : 'KW' '3211';\n"); + grammarBuilder.append("KW3212 : 'KW' '3212';\n"); + grammarBuilder.append("KW3213 : 'KW' '3213';\n"); + grammarBuilder.append("KW3214 : 'KW' '3214';\n"); + grammarBuilder.append("KW3215 : 'KW' '3215';\n"); + grammarBuilder.append("KW3216 : 'KW' '3216';\n"); + grammarBuilder.append("KW3217 : 'KW' '3217';\n"); + grammarBuilder.append("KW3218 : 'KW' '3218';\n"); + grammarBuilder.append("KW3219 : 'KW' '3219';\n"); + grammarBuilder.append("KW3220 : 'KW' '3220';\n"); + grammarBuilder.append("KW3221 : 'KW' '3221';\n"); + grammarBuilder.append("KW3222 : 'KW' '3222';\n"); + grammarBuilder.append("KW3223 : 'KW' '3223';\n"); + grammarBuilder.append("KW3224 : 'KW' '3224';\n"); + grammarBuilder.append("KW3225 : 'KW' '3225';\n"); + grammarBuilder.append("KW3226 : 'KW' '3226';\n"); + grammarBuilder.append("KW3227 : 'KW' '3227';\n"); + grammarBuilder.append("KW3228 : 'KW' '3228';\n"); + grammarBuilder.append("KW3229 : 'KW' '3229';\n"); + grammarBuilder.append("KW3230 : 'KW' '3230';\n"); + grammarBuilder.append("KW3231 : 'KW' '3231';\n"); + grammarBuilder.append("KW3232 : 'KW' '3232';\n"); + grammarBuilder.append("KW3233 : 'KW' '3233';\n"); + grammarBuilder.append("KW3234 : 'KW' '3234';\n"); + grammarBuilder.append("KW3235 : 'KW' '3235';\n"); + grammarBuilder.append("KW3236 : 'KW' '3236';\n"); + grammarBuilder.append("KW3237 : 'KW' '3237';\n"); + grammarBuilder.append("KW3238 : 'KW' '3238';\n"); + grammarBuilder.append("KW3239 : 'KW' '3239';\n"); + grammarBuilder.append("KW3240 : 'KW' '3240';\n"); + grammarBuilder.append("KW3241 : 'KW' '3241';\n"); + grammarBuilder.append("KW3242 : 'KW' '3242';\n"); + grammarBuilder.append("KW3243 : 'KW' '3243';\n"); + grammarBuilder.append("KW3244 : 'KW' '3244';\n"); + grammarBuilder.append("KW3245 : 'KW' '3245';\n"); + grammarBuilder.append("KW3246 : 'KW' '3246';\n"); + grammarBuilder.append("KW3247 : 'KW' '3247';\n"); + grammarBuilder.append("KW3248 : 'KW' '3248';\n"); + grammarBuilder.append("KW3249 : 'KW' '3249';\n"); + grammarBuilder.append("KW3250 : 'KW' '3250';\n"); + grammarBuilder.append("KW3251 : 'KW' '3251';\n"); + grammarBuilder.append("KW3252 : 'KW' '3252';\n"); + grammarBuilder.append("KW3253 : 'KW' '3253';\n"); + grammarBuilder.append("KW3254 : 'KW' '3254';\n"); + grammarBuilder.append("KW3255 : 'KW' '3255';\n"); + grammarBuilder.append("KW3256 : 'KW' '3256';\n"); + grammarBuilder.append("KW3257 : 'KW' '3257';\n"); + grammarBuilder.append("KW3258 : 'KW' '3258';\n"); + grammarBuilder.append("KW3259 : 'KW' '3259';\n"); + grammarBuilder.append("KW3260 : 'KW' '3260';\n"); + grammarBuilder.append("KW3261 : 'KW' '3261';\n"); + grammarBuilder.append("KW3262 : 'KW' '3262';\n"); + grammarBuilder.append("KW3263 : 'KW' '3263';\n"); + grammarBuilder.append("KW3264 : 'KW' '3264';\n"); + grammarBuilder.append("KW3265 : 'KW' '3265';\n"); + grammarBuilder.append("KW3266 : 'KW' '3266';\n"); + grammarBuilder.append("KW3267 : 'KW' '3267';\n"); + grammarBuilder.append("KW3268 : 'KW' '3268';\n"); + grammarBuilder.append("KW3269 : 'KW' '3269';\n"); + grammarBuilder.append("KW3270 : 'KW' '3270';\n"); + grammarBuilder.append("KW3271 : 'KW' '3271';\n"); + grammarBuilder.append("KW3272 : 'KW' '3272';\n"); + grammarBuilder.append("KW3273 : 'KW' '3273';\n"); + grammarBuilder.append("KW3274 : 'KW' '3274';\n"); + grammarBuilder.append("KW3275 : 'KW' '3275';\n"); + grammarBuilder.append("KW3276 : 'KW' '3276';\n"); + grammarBuilder.append("KW3277 : 'KW' '3277';\n"); + grammarBuilder.append("KW3278 : 'KW' '3278';\n"); + grammarBuilder.append("KW3279 : 'KW' '3279';\n"); + grammarBuilder.append("KW3280 : 'KW' '3280';\n"); + grammarBuilder.append("KW3281 : 'KW' '3281';\n"); + grammarBuilder.append("KW3282 : 'KW' '3282';\n"); + grammarBuilder.append("KW3283 : 'KW' '3283';\n"); + grammarBuilder.append("KW3284 : 'KW' '3284';\n"); + grammarBuilder.append("KW3285 : 'KW' '3285';\n"); + grammarBuilder.append("KW3286 : 'KW' '3286';\n"); + grammarBuilder.append("KW3287 : 'KW' '3287';\n"); + grammarBuilder.append("KW3288 : 'KW' '3288';\n"); + grammarBuilder.append("KW3289 : 'KW' '3289';\n"); + grammarBuilder.append("KW3290 : 'KW' '3290';\n"); + grammarBuilder.append("KW3291 : 'KW' '3291';\n"); + grammarBuilder.append("KW3292 : 'KW' '3292';\n"); + grammarBuilder.append("KW3293 : 'KW' '3293';\n"); + grammarBuilder.append("KW3294 : 'KW' '3294';\n"); + grammarBuilder.append("KW3295 : 'KW' '3295';\n"); + grammarBuilder.append("KW3296 : 'KW' '3296';\n"); + grammarBuilder.append("KW3297 : 'KW' '3297';\n"); + grammarBuilder.append("KW3298 : 'KW' '3298';\n"); + grammarBuilder.append("KW3299 : 'KW' '3299';\n"); + grammarBuilder.append("KW3300 : 'KW' '3300';\n"); + grammarBuilder.append("KW3301 : 'KW' '3301';\n"); + grammarBuilder.append("KW3302 : 'KW' '3302';\n"); + grammarBuilder.append("KW3303 : 'KW' '3303';\n"); + grammarBuilder.append("KW3304 : 'KW' '3304';\n"); + grammarBuilder.append("KW3305 : 'KW' '3305';\n"); + grammarBuilder.append("KW3306 : 'KW' '3306';\n"); + grammarBuilder.append("KW3307 : 'KW' '3307';\n"); + grammarBuilder.append("KW3308 : 'KW' '3308';\n"); + grammarBuilder.append("KW3309 : 'KW' '3309';\n"); + grammarBuilder.append("KW3310 : 'KW' '3310';\n"); + grammarBuilder.append("KW3311 : 'KW' '3311';\n"); + grammarBuilder.append("KW3312 : 'KW' '3312';\n"); + grammarBuilder.append("KW3313 : 'KW' '3313';\n"); + grammarBuilder.append("KW3314 : 'KW' '3314';\n"); + grammarBuilder.append("KW3315 : 'KW' '3315';\n"); + grammarBuilder.append("KW3316 : 'KW' '3316';\n"); + grammarBuilder.append("KW3317 : 'KW' '3317';\n"); + grammarBuilder.append("KW3318 : 'KW' '3318';\n"); + grammarBuilder.append("KW3319 : 'KW' '3319';\n"); + grammarBuilder.append("KW3320 : 'KW' '3320';\n"); + grammarBuilder.append("KW3321 : 'KW' '3321';\n"); + grammarBuilder.append("KW3322 : 'KW' '3322';\n"); + grammarBuilder.append("KW3323 : 'KW' '3323';\n"); + grammarBuilder.append("KW3324 : 'KW' '3324';\n"); + grammarBuilder.append("KW3325 : 'KW' '3325';\n"); + grammarBuilder.append("KW3326 : 'KW' '3326';\n"); + grammarBuilder.append("KW3327 : 'KW' '3327';\n"); + grammarBuilder.append("KW3328 : 'KW' '3328';\n"); + grammarBuilder.append("KW3329 : 'KW' '3329';\n"); + grammarBuilder.append("KW3330 : 'KW' '3330';\n"); + grammarBuilder.append("KW3331 : 'KW' '3331';\n"); + grammarBuilder.append("KW3332 : 'KW' '3332';\n"); + grammarBuilder.append("KW3333 : 'KW' '3333';\n"); + grammarBuilder.append("KW3334 : 'KW' '3334';\n"); + grammarBuilder.append("KW3335 : 'KW' '3335';\n"); + grammarBuilder.append("KW3336 : 'KW' '3336';\n"); + grammarBuilder.append("KW3337 : 'KW' '3337';\n"); + grammarBuilder.append("KW3338 : 'KW' '3338';\n"); + grammarBuilder.append("KW3339 : 'KW' '3339';\n"); + grammarBuilder.append("KW3340 : 'KW' '3340';\n"); + grammarBuilder.append("KW3341 : 'KW' '3341';\n"); + grammarBuilder.append("KW3342 : 'KW' '3342';\n"); + grammarBuilder.append("KW3343 : 'KW' '3343';\n"); + grammarBuilder.append("KW3344 : 'KW' '3344';\n"); + grammarBuilder.append("KW3345 : 'KW' '3345';\n"); + grammarBuilder.append("KW3346 : 'KW' '3346';\n"); + grammarBuilder.append("KW3347 : 'KW' '3347';\n"); + grammarBuilder.append("KW3348 : 'KW' '3348';\n"); + grammarBuilder.append("KW3349 : 'KW' '3349';\n"); + grammarBuilder.append("KW3350 : 'KW' '3350';\n"); + grammarBuilder.append("KW3351 : 'KW' '3351';\n"); + grammarBuilder.append("KW3352 : 'KW' '3352';\n"); + grammarBuilder.append("KW3353 : 'KW' '3353';\n"); + grammarBuilder.append("KW3354 : 'KW' '3354';\n"); + grammarBuilder.append("KW3355 : 'KW' '3355';\n"); + grammarBuilder.append("KW3356 : 'KW' '3356';\n"); + grammarBuilder.append("KW3357 : 'KW' '3357';\n"); + grammarBuilder.append("KW3358 : 'KW' '3358';\n"); + grammarBuilder.append("KW3359 : 'KW' '3359';\n"); + grammarBuilder.append("KW3360 : 'KW' '3360';\n"); + grammarBuilder.append("KW3361 : 'KW' '3361';\n"); + grammarBuilder.append("KW3362 : 'KW' '3362';\n"); + grammarBuilder.append("KW3363 : 'KW' '3363';\n"); + grammarBuilder.append("KW3364 : 'KW' '3364';\n"); + grammarBuilder.append("KW3365 : 'KW' '3365';\n"); + grammarBuilder.append("KW3366 : 'KW' '3366';\n"); + grammarBuilder.append("KW3367 : 'KW' '3367';\n"); + grammarBuilder.append("KW3368 : 'KW' '3368';\n"); + grammarBuilder.append("KW3369 : 'KW' '3369';\n"); + grammarBuilder.append("KW3370 : 'KW' '3370';\n"); + grammarBuilder.append("KW3371 : 'KW' '3371';\n"); + grammarBuilder.append("KW3372 : 'KW' '3372';\n"); + grammarBuilder.append("KW3373 : 'KW' '3373';\n"); + grammarBuilder.append("KW3374 : 'KW' '3374';\n"); + grammarBuilder.append("KW3375 : 'KW' '3375';\n"); + grammarBuilder.append("KW3376 : 'KW' '3376';\n"); + grammarBuilder.append("KW3377 : 'KW' '3377';\n"); + grammarBuilder.append("KW3378 : 'KW' '3378';\n"); + grammarBuilder.append("KW3379 : 'KW' '3379';\n"); + grammarBuilder.append("KW3380 : 'KW' '3380';\n"); + grammarBuilder.append("KW3381 : 'KW' '3381';\n"); + grammarBuilder.append("KW3382 : 'KW' '3382';\n"); + grammarBuilder.append("KW3383 : 'KW' '3383';\n"); + grammarBuilder.append("KW3384 : 'KW' '3384';\n"); + grammarBuilder.append("KW3385 : 'KW' '3385';\n"); + grammarBuilder.append("KW3386 : 'KW' '3386';\n"); + grammarBuilder.append("KW3387 : 'KW' '3387';\n"); + grammarBuilder.append("KW3388 : 'KW' '3388';\n"); + grammarBuilder.append("KW3389 : 'KW' '3389';\n"); + grammarBuilder.append("KW3390 : 'KW' '3390';\n"); + grammarBuilder.append("KW3391 : 'KW' '3391';\n"); + grammarBuilder.append("KW3392 : 'KW' '3392';\n"); + grammarBuilder.append("KW3393 : 'KW' '3393';\n"); + grammarBuilder.append("KW3394 : 'KW' '3394';\n"); + grammarBuilder.append("KW3395 : 'KW' '3395';\n"); + grammarBuilder.append("KW3396 : 'KW' '3396';\n"); + grammarBuilder.append("KW3397 : 'KW' '3397';\n"); + grammarBuilder.append("KW3398 : 'KW' '3398';\n"); + grammarBuilder.append("KW3399 : 'KW' '3399';\n"); + grammarBuilder.append("KW3400 : 'KW' '3400';\n"); + grammarBuilder.append("KW3401 : 'KW' '3401';\n"); + grammarBuilder.append("KW3402 : 'KW' '3402';\n"); + grammarBuilder.append("KW3403 : 'KW' '3403';\n"); + grammarBuilder.append("KW3404 : 'KW' '3404';\n"); + grammarBuilder.append("KW3405 : 'KW' '3405';\n"); + grammarBuilder.append("KW3406 : 'KW' '3406';\n"); + grammarBuilder.append("KW3407 : 'KW' '3407';\n"); + grammarBuilder.append("KW3408 : 'KW' '3408';\n"); + grammarBuilder.append("KW3409 : 'KW' '3409';\n"); + grammarBuilder.append("KW3410 : 'KW' '3410';\n"); + grammarBuilder.append("KW3411 : 'KW' '3411';\n"); + grammarBuilder.append("KW3412 : 'KW' '3412';\n"); + grammarBuilder.append("KW3413 : 'KW' '3413';\n"); + grammarBuilder.append("KW3414 : 'KW' '3414';\n"); + grammarBuilder.append("KW3415 : 'KW' '3415';\n"); + grammarBuilder.append("KW3416 : 'KW' '3416';\n"); + grammarBuilder.append("KW3417 : 'KW' '3417';\n"); + grammarBuilder.append("KW3418 : 'KW' '3418';\n"); + grammarBuilder.append("KW3419 : 'KW' '3419';\n"); + grammarBuilder.append("KW3420 : 'KW' '3420';\n"); + grammarBuilder.append("KW3421 : 'KW' '3421';\n"); + grammarBuilder.append("KW3422 : 'KW' '3422';\n"); + grammarBuilder.append("KW3423 : 'KW' '3423';\n"); + grammarBuilder.append("KW3424 : 'KW' '3424';\n"); + grammarBuilder.append("KW3425 : 'KW' '3425';\n"); + grammarBuilder.append("KW3426 : 'KW' '3426';\n"); + grammarBuilder.append("KW3427 : 'KW' '3427';\n"); + grammarBuilder.append("KW3428 : 'KW' '3428';\n"); + grammarBuilder.append("KW3429 : 'KW' '3429';\n"); + grammarBuilder.append("KW3430 : 'KW' '3430';\n"); + grammarBuilder.append("KW3431 : 'KW' '3431';\n"); + grammarBuilder.append("KW3432 : 'KW' '3432';\n"); + grammarBuilder.append("KW3433 : 'KW' '3433';\n"); + grammarBuilder.append("KW3434 : 'KW' '3434';\n"); + grammarBuilder.append("KW3435 : 'KW' '3435';\n"); + grammarBuilder.append("KW3436 : 'KW' '3436';\n"); + grammarBuilder.append("KW3437 : 'KW' '3437';\n"); + grammarBuilder.append("KW3438 : 'KW' '3438';\n"); + grammarBuilder.append("KW3439 : 'KW' '3439';\n"); + grammarBuilder.append("KW3440 : 'KW' '3440';\n"); + grammarBuilder.append("KW3441 : 'KW' '3441';\n"); + grammarBuilder.append("KW3442 : 'KW' '3442';\n"); + grammarBuilder.append("KW3443 : 'KW' '3443';\n"); + grammarBuilder.append("KW3444 : 'KW' '3444';\n"); + grammarBuilder.append("KW3445 : 'KW' '3445';\n"); + grammarBuilder.append("KW3446 : 'KW' '3446';\n"); + grammarBuilder.append("KW3447 : 'KW' '3447';\n"); + grammarBuilder.append("KW3448 : 'KW' '3448';\n"); + grammarBuilder.append("KW3449 : 'KW' '3449';\n"); + grammarBuilder.append("KW3450 : 'KW' '3450';\n"); + grammarBuilder.append("KW3451 : 'KW' '3451';\n"); + grammarBuilder.append("KW3452 : 'KW' '3452';\n"); + grammarBuilder.append("KW3453 : 'KW' '3453';\n"); + grammarBuilder.append("KW3454 : 'KW' '3454';\n"); + grammarBuilder.append("KW3455 : 'KW' '3455';\n"); + grammarBuilder.append("KW3456 : 'KW' '3456';\n"); + grammarBuilder.append("KW3457 : 'KW' '3457';\n"); + grammarBuilder.append("KW3458 : 'KW' '3458';\n"); + grammarBuilder.append("KW3459 : 'KW' '3459';\n"); + grammarBuilder.append("KW3460 : 'KW' '3460';\n"); + grammarBuilder.append("KW3461 : 'KW' '3461';\n"); + grammarBuilder.append("KW3462 : 'KW' '3462';\n"); + grammarBuilder.append("KW3463 : 'KW' '3463';\n"); + grammarBuilder.append("KW3464 : 'KW' '3464';\n"); + grammarBuilder.append("KW3465 : 'KW' '3465';\n"); + grammarBuilder.append("KW3466 : 'KW' '3466';\n"); + grammarBuilder.append("KW3467 : 'KW' '3467';\n"); + grammarBuilder.append("KW3468 : 'KW' '3468';\n"); + grammarBuilder.append("KW3469 : 'KW' '3469';\n"); + grammarBuilder.append("KW3470 : 'KW' '3470';\n"); + grammarBuilder.append("KW3471 : 'KW' '3471';\n"); + grammarBuilder.append("KW3472 : 'KW' '3472';\n"); + grammarBuilder.append("KW3473 : 'KW' '3473';\n"); + grammarBuilder.append("KW3474 : 'KW' '3474';\n"); + grammarBuilder.append("KW3475 : 'KW' '3475';\n"); + grammarBuilder.append("KW3476 : 'KW' '3476';\n"); + grammarBuilder.append("KW3477 : 'KW' '3477';\n"); + grammarBuilder.append("KW3478 : 'KW' '3478';\n"); + grammarBuilder.append("KW3479 : 'KW' '3479';\n"); + grammarBuilder.append("KW3480 : 'KW' '3480';\n"); + grammarBuilder.append("KW3481 : 'KW' '3481';\n"); + grammarBuilder.append("KW3482 : 'KW' '3482';\n"); + grammarBuilder.append("KW3483 : 'KW' '3483';\n"); + grammarBuilder.append("KW3484 : 'KW' '3484';\n"); + grammarBuilder.append("KW3485 : 'KW' '3485';\n"); + grammarBuilder.append("KW3486 : 'KW' '3486';\n"); + grammarBuilder.append("KW3487 : 'KW' '3487';\n"); + grammarBuilder.append("KW3488 : 'KW' '3488';\n"); + grammarBuilder.append("KW3489 : 'KW' '3489';\n"); + grammarBuilder.append("KW3490 : 'KW' '3490';\n"); + grammarBuilder.append("KW3491 : 'KW' '3491';\n"); + grammarBuilder.append("KW3492 : 'KW' '3492';\n"); + grammarBuilder.append("KW3493 : 'KW' '3493';\n"); + grammarBuilder.append("KW3494 : 'KW' '3494';\n"); + grammarBuilder.append("KW3495 : 'KW' '3495';\n"); + grammarBuilder.append("KW3496 : 'KW' '3496';\n"); + grammarBuilder.append("KW3497 : 'KW' '3497';\n"); + grammarBuilder.append("KW3498 : 'KW' '3498';\n"); + grammarBuilder.append("KW3499 : 'KW' '3499';\n"); + grammarBuilder.append("KW3500 : 'KW' '3500';\n"); + grammarBuilder.append("KW3501 : 'KW' '3501';\n"); + grammarBuilder.append("KW3502 : 'KW' '3502';\n"); + grammarBuilder.append("KW3503 : 'KW' '3503';\n"); + grammarBuilder.append("KW3504 : 'KW' '3504';\n"); + grammarBuilder.append("KW3505 : 'KW' '3505';\n"); + grammarBuilder.append("KW3506 : 'KW' '3506';\n"); + grammarBuilder.append("KW3507 : 'KW' '3507';\n"); + grammarBuilder.append("KW3508 : 'KW' '3508';\n"); + grammarBuilder.append("KW3509 : 'KW' '3509';\n"); + grammarBuilder.append("KW3510 : 'KW' '3510';\n"); + grammarBuilder.append("KW3511 : 'KW' '3511';\n"); + grammarBuilder.append("KW3512 : 'KW' '3512';\n"); + grammarBuilder.append("KW3513 : 'KW' '3513';\n"); + grammarBuilder.append("KW3514 : 'KW' '3514';\n"); + grammarBuilder.append("KW3515 : 'KW' '3515';\n"); + grammarBuilder.append("KW3516 : 'KW' '3516';\n"); + grammarBuilder.append("KW3517 : 'KW' '3517';\n"); + grammarBuilder.append("KW3518 : 'KW' '3518';\n"); + grammarBuilder.append("KW3519 : 'KW' '3519';\n"); + grammarBuilder.append("KW3520 : 'KW' '3520';\n"); + grammarBuilder.append("KW3521 : 'KW' '3521';\n"); + grammarBuilder.append("KW3522 : 'KW' '3522';\n"); + grammarBuilder.append("KW3523 : 'KW' '3523';\n"); + grammarBuilder.append("KW3524 : 'KW' '3524';\n"); + grammarBuilder.append("KW3525 : 'KW' '3525';\n"); + grammarBuilder.append("KW3526 : 'KW' '3526';\n"); + grammarBuilder.append("KW3527 : 'KW' '3527';\n"); + grammarBuilder.append("KW3528 : 'KW' '3528';\n"); + grammarBuilder.append("KW3529 : 'KW' '3529';\n"); + grammarBuilder.append("KW3530 : 'KW' '3530';\n"); + grammarBuilder.append("KW3531 : 'KW' '3531';\n"); + grammarBuilder.append("KW3532 : 'KW' '3532';\n"); + grammarBuilder.append("KW3533 : 'KW' '3533';\n"); + grammarBuilder.append("KW3534 : 'KW' '3534';\n"); + grammarBuilder.append("KW3535 : 'KW' '3535';\n"); + grammarBuilder.append("KW3536 : 'KW' '3536';\n"); + grammarBuilder.append("KW3537 : 'KW' '3537';\n"); + grammarBuilder.append("KW3538 : 'KW' '3538';\n"); + grammarBuilder.append("KW3539 : 'KW' '3539';\n"); + grammarBuilder.append("KW3540 : 'KW' '3540';\n"); + grammarBuilder.append("KW3541 : 'KW' '3541';\n"); + grammarBuilder.append("KW3542 : 'KW' '3542';\n"); + grammarBuilder.append("KW3543 : 'KW' '3543';\n"); + grammarBuilder.append("KW3544 : 'KW' '3544';\n"); + grammarBuilder.append("KW3545 : 'KW' '3545';\n"); + grammarBuilder.append("KW3546 : 'KW' '3546';\n"); + grammarBuilder.append("KW3547 : 'KW' '3547';\n"); + grammarBuilder.append("KW3548 : 'KW' '3548';\n"); + grammarBuilder.append("KW3549 : 'KW' '3549';\n"); + grammarBuilder.append("KW3550 : 'KW' '3550';\n"); + grammarBuilder.append("KW3551 : 'KW' '3551';\n"); + grammarBuilder.append("KW3552 : 'KW' '3552';\n"); + grammarBuilder.append("KW3553 : 'KW' '3553';\n"); + grammarBuilder.append("KW3554 : 'KW' '3554';\n"); + grammarBuilder.append("KW3555 : 'KW' '3555';\n"); + grammarBuilder.append("KW3556 : 'KW' '3556';\n"); + grammarBuilder.append("KW3557 : 'KW' '3557';\n"); + grammarBuilder.append("KW3558 : 'KW' '3558';\n"); + grammarBuilder.append("KW3559 : 'KW' '3559';\n"); + grammarBuilder.append("KW3560 : 'KW' '3560';\n"); + grammarBuilder.append("KW3561 : 'KW' '3561';\n"); + grammarBuilder.append("KW3562 : 'KW' '3562';\n"); + grammarBuilder.append("KW3563 : 'KW' '3563';\n"); + grammarBuilder.append("KW3564 : 'KW' '3564';\n"); + grammarBuilder.append("KW3565 : 'KW' '3565';\n"); + grammarBuilder.append("KW3566 : 'KW' '3566';\n"); + grammarBuilder.append("KW3567 : 'KW' '3567';\n"); + grammarBuilder.append("KW3568 : 'KW' '3568';\n"); + grammarBuilder.append("KW3569 : 'KW' '3569';\n"); + grammarBuilder.append("KW3570 : 'KW' '3570';\n"); + grammarBuilder.append("KW3571 : 'KW' '3571';\n"); + grammarBuilder.append("KW3572 : 'KW' '3572';\n"); + grammarBuilder.append("KW3573 : 'KW' '3573';\n"); + grammarBuilder.append("KW3574 : 'KW' '3574';\n"); + grammarBuilder.append("KW3575 : 'KW' '3575';\n"); + grammarBuilder.append("KW3576 : 'KW' '3576';\n"); + grammarBuilder.append("KW3577 : 'KW' '3577';\n"); + grammarBuilder.append("KW3578 : 'KW' '3578';\n"); + grammarBuilder.append("KW3579 : 'KW' '3579';\n"); + grammarBuilder.append("KW3580 : 'KW' '3580';\n"); + grammarBuilder.append("KW3581 : 'KW' '3581';\n"); + grammarBuilder.append("KW3582 : 'KW' '3582';\n"); + grammarBuilder.append("KW3583 : 'KW' '3583';\n"); + grammarBuilder.append("KW3584 : 'KW' '3584';\n"); + grammarBuilder.append("KW3585 : 'KW' '3585';\n"); + grammarBuilder.append("KW3586 : 'KW' '3586';\n"); + grammarBuilder.append("KW3587 : 'KW' '3587';\n"); + grammarBuilder.append("KW3588 : 'KW' '3588';\n"); + grammarBuilder.append("KW3589 : 'KW' '3589';\n"); + grammarBuilder.append("KW3590 : 'KW' '3590';\n"); + grammarBuilder.append("KW3591 : 'KW' '3591';\n"); + grammarBuilder.append("KW3592 : 'KW' '3592';\n"); + grammarBuilder.append("KW3593 : 'KW' '3593';\n"); + grammarBuilder.append("KW3594 : 'KW' '3594';\n"); + grammarBuilder.append("KW3595 : 'KW' '3595';\n"); + grammarBuilder.append("KW3596 : 'KW' '3596';\n"); + grammarBuilder.append("KW3597 : 'KW' '3597';\n"); + grammarBuilder.append("KW3598 : 'KW' '3598';\n"); + grammarBuilder.append("KW3599 : 'KW' '3599';\n"); + grammarBuilder.append("KW3600 : 'KW' '3600';\n"); + grammarBuilder.append("KW3601 : 'KW' '3601';\n"); + grammarBuilder.append("KW3602 : 'KW' '3602';\n"); + grammarBuilder.append("KW3603 : 'KW' '3603';\n"); + grammarBuilder.append("KW3604 : 'KW' '3604';\n"); + grammarBuilder.append("KW3605 : 'KW' '3605';\n"); + grammarBuilder.append("KW3606 : 'KW' '3606';\n"); + grammarBuilder.append("KW3607 : 'KW' '3607';\n"); + grammarBuilder.append("KW3608 : 'KW' '3608';\n"); + grammarBuilder.append("KW3609 : 'KW' '3609';\n"); + grammarBuilder.append("KW3610 : 'KW' '3610';\n"); + grammarBuilder.append("KW3611 : 'KW' '3611';\n"); + grammarBuilder.append("KW3612 : 'KW' '3612';\n"); + grammarBuilder.append("KW3613 : 'KW' '3613';\n"); + grammarBuilder.append("KW3614 : 'KW' '3614';\n"); + grammarBuilder.append("KW3615 : 'KW' '3615';\n"); + grammarBuilder.append("KW3616 : 'KW' '3616';\n"); + grammarBuilder.append("KW3617 : 'KW' '3617';\n"); + grammarBuilder.append("KW3618 : 'KW' '3618';\n"); + grammarBuilder.append("KW3619 : 'KW' '3619';\n"); + grammarBuilder.append("KW3620 : 'KW' '3620';\n"); + grammarBuilder.append("KW3621 : 'KW' '3621';\n"); + grammarBuilder.append("KW3622 : 'KW' '3622';\n"); + grammarBuilder.append("KW3623 : 'KW' '3623';\n"); + grammarBuilder.append("KW3624 : 'KW' '3624';\n"); + grammarBuilder.append("KW3625 : 'KW' '3625';\n"); + grammarBuilder.append("KW3626 : 'KW' '3626';\n"); + grammarBuilder.append("KW3627 : 'KW' '3627';\n"); + grammarBuilder.append("KW3628 : 'KW' '3628';\n"); + grammarBuilder.append("KW3629 : 'KW' '3629';\n"); + grammarBuilder.append("KW3630 : 'KW' '3630';\n"); + grammarBuilder.append("KW3631 : 'KW' '3631';\n"); + grammarBuilder.append("KW3632 : 'KW' '3632';\n"); + grammarBuilder.append("KW3633 : 'KW' '3633';\n"); + grammarBuilder.append("KW3634 : 'KW' '3634';\n"); + grammarBuilder.append("KW3635 : 'KW' '3635';\n"); + grammarBuilder.append("KW3636 : 'KW' '3636';\n"); + grammarBuilder.append("KW3637 : 'KW' '3637';\n"); + grammarBuilder.append("KW3638 : 'KW' '3638';\n"); + grammarBuilder.append("KW3639 : 'KW' '3639';\n"); + grammarBuilder.append("KW3640 : 'KW' '3640';\n"); + grammarBuilder.append("KW3641 : 'KW' '3641';\n"); + grammarBuilder.append("KW3642 : 'KW' '3642';\n"); + grammarBuilder.append("KW3643 : 'KW' '3643';\n"); + grammarBuilder.append("KW3644 : 'KW' '3644';\n"); + grammarBuilder.append("KW3645 : 'KW' '3645';\n"); + grammarBuilder.append("KW3646 : 'KW' '3646';\n"); + grammarBuilder.append("KW3647 : 'KW' '3647';\n"); + grammarBuilder.append("KW3648 : 'KW' '3648';\n"); + grammarBuilder.append("KW3649 : 'KW' '3649';\n"); + grammarBuilder.append("KW3650 : 'KW' '3650';\n"); + grammarBuilder.append("KW3651 : 'KW' '3651';\n"); + grammarBuilder.append("KW3652 : 'KW' '3652';\n"); + grammarBuilder.append("KW3653 : 'KW' '3653';\n"); + grammarBuilder.append("KW3654 : 'KW' '3654';\n"); + grammarBuilder.append("KW3655 : 'KW' '3655';\n"); + grammarBuilder.append("KW3656 : 'KW' '3656';\n"); + grammarBuilder.append("KW3657 : 'KW' '3657';\n"); + grammarBuilder.append("KW3658 : 'KW' '3658';\n"); + grammarBuilder.append("KW3659 : 'KW' '3659';\n"); + grammarBuilder.append("KW3660 : 'KW' '3660';\n"); + grammarBuilder.append("KW3661 : 'KW' '3661';\n"); + grammarBuilder.append("KW3662 : 'KW' '3662';\n"); + grammarBuilder.append("KW3663 : 'KW' '3663';\n"); + grammarBuilder.append("KW3664 : 'KW' '3664';\n"); + grammarBuilder.append("KW3665 : 'KW' '3665';\n"); + grammarBuilder.append("KW3666 : 'KW' '3666';\n"); + grammarBuilder.append("KW3667 : 'KW' '3667';\n"); + grammarBuilder.append("KW3668 : 'KW' '3668';\n"); + grammarBuilder.append("KW3669 : 'KW' '3669';\n"); + grammarBuilder.append("KW3670 : 'KW' '3670';\n"); + grammarBuilder.append("KW3671 : 'KW' '3671';\n"); + grammarBuilder.append("KW3672 : 'KW' '3672';\n"); + grammarBuilder.append("KW3673 : 'KW' '3673';\n"); + grammarBuilder.append("KW3674 : 'KW' '3674';\n"); + grammarBuilder.append("KW3675 : 'KW' '3675';\n"); + grammarBuilder.append("KW3676 : 'KW' '3676';\n"); + grammarBuilder.append("KW3677 : 'KW' '3677';\n"); + grammarBuilder.append("KW3678 : 'KW' '3678';\n"); + grammarBuilder.append("KW3679 : 'KW' '3679';\n"); + grammarBuilder.append("KW3680 : 'KW' '3680';\n"); + grammarBuilder.append("KW3681 : 'KW' '3681';\n"); + grammarBuilder.append("KW3682 : 'KW' '3682';\n"); + grammarBuilder.append("KW3683 : 'KW' '3683';\n"); + grammarBuilder.append("KW3684 : 'KW' '3684';\n"); + grammarBuilder.append("KW3685 : 'KW' '3685';\n"); + grammarBuilder.append("KW3686 : 'KW' '3686';\n"); + grammarBuilder.append("KW3687 : 'KW' '3687';\n"); + grammarBuilder.append("KW3688 : 'KW' '3688';\n"); + grammarBuilder.append("KW3689 : 'KW' '3689';\n"); + grammarBuilder.append("KW3690 : 'KW' '3690';\n"); + grammarBuilder.append("KW3691 : 'KW' '3691';\n"); + grammarBuilder.append("KW3692 : 'KW' '3692';\n"); + grammarBuilder.append("KW3693 : 'KW' '3693';\n"); + grammarBuilder.append("KW3694 : 'KW' '3694';\n"); + grammarBuilder.append("KW3695 : 'KW' '3695';\n"); + grammarBuilder.append("KW3696 : 'KW' '3696';\n"); + grammarBuilder.append("KW3697 : 'KW' '3697';\n"); + grammarBuilder.append("KW3698 : 'KW' '3698';\n"); + grammarBuilder.append("KW3699 : 'KW' '3699';\n"); + grammarBuilder.append("KW3700 : 'KW' '3700';\n"); + grammarBuilder.append("KW3701 : 'KW' '3701';\n"); + grammarBuilder.append("KW3702 : 'KW' '3702';\n"); + grammarBuilder.append("KW3703 : 'KW' '3703';\n"); + grammarBuilder.append("KW3704 : 'KW' '3704';\n"); + grammarBuilder.append("KW3705 : 'KW' '3705';\n"); + grammarBuilder.append("KW3706 : 'KW' '3706';\n"); + grammarBuilder.append("KW3707 : 'KW' '3707';\n"); + grammarBuilder.append("KW3708 : 'KW' '3708';\n"); + grammarBuilder.append("KW3709 : 'KW' '3709';\n"); + grammarBuilder.append("KW3710 : 'KW' '3710';\n"); + grammarBuilder.append("KW3711 : 'KW' '3711';\n"); + grammarBuilder.append("KW3712 : 'KW' '3712';\n"); + grammarBuilder.append("KW3713 : 'KW' '3713';\n"); + grammarBuilder.append("KW3714 : 'KW' '3714';\n"); + grammarBuilder.append("KW3715 : 'KW' '3715';\n"); + grammarBuilder.append("KW3716 : 'KW' '3716';\n"); + grammarBuilder.append("KW3717 : 'KW' '3717';\n"); + grammarBuilder.append("KW3718 : 'KW' '3718';\n"); + grammarBuilder.append("KW3719 : 'KW' '3719';\n"); + grammarBuilder.append("KW3720 : 'KW' '3720';\n"); + grammarBuilder.append("KW3721 : 'KW' '3721';\n"); + grammarBuilder.append("KW3722 : 'KW' '3722';\n"); + grammarBuilder.append("KW3723 : 'KW' '3723';\n"); + grammarBuilder.append("KW3724 : 'KW' '3724';\n"); + grammarBuilder.append("KW3725 : 'KW' '3725';\n"); + grammarBuilder.append("KW3726 : 'KW' '3726';\n"); + grammarBuilder.append("KW3727 : 'KW' '3727';\n"); + grammarBuilder.append("KW3728 : 'KW' '3728';\n"); + grammarBuilder.append("KW3729 : 'KW' '3729';\n"); + grammarBuilder.append("KW3730 : 'KW' '3730';\n"); + grammarBuilder.append("KW3731 : 'KW' '3731';\n"); + grammarBuilder.append("KW3732 : 'KW' '3732';\n"); + grammarBuilder.append("KW3733 : 'KW' '3733';\n"); + grammarBuilder.append("KW3734 : 'KW' '3734';\n"); + grammarBuilder.append("KW3735 : 'KW' '3735';\n"); + grammarBuilder.append("KW3736 : 'KW' '3736';\n"); + grammarBuilder.append("KW3737 : 'KW' '3737';\n"); + grammarBuilder.append("KW3738 : 'KW' '3738';\n"); + grammarBuilder.append("KW3739 : 'KW' '3739';\n"); + grammarBuilder.append("KW3740 : 'KW' '3740';\n"); + grammarBuilder.append("KW3741 : 'KW' '3741';\n"); + grammarBuilder.append("KW3742 : 'KW' '3742';\n"); + grammarBuilder.append("KW3743 : 'KW' '3743';\n"); + grammarBuilder.append("KW3744 : 'KW' '3744';\n"); + grammarBuilder.append("KW3745 : 'KW' '3745';\n"); + grammarBuilder.append("KW3746 : 'KW' '3746';\n"); + grammarBuilder.append("KW3747 : 'KW' '3747';\n"); + grammarBuilder.append("KW3748 : 'KW' '3748';\n"); + grammarBuilder.append("KW3749 : 'KW' '3749';\n"); + grammarBuilder.append("KW3750 : 'KW' '3750';\n"); + grammarBuilder.append("KW3751 : 'KW' '3751';\n"); + grammarBuilder.append("KW3752 : 'KW' '3752';\n"); + grammarBuilder.append("KW3753 : 'KW' '3753';\n"); + grammarBuilder.append("KW3754 : 'KW' '3754';\n"); + grammarBuilder.append("KW3755 : 'KW' '3755';\n"); + grammarBuilder.append("KW3756 : 'KW' '3756';\n"); + grammarBuilder.append("KW3757 : 'KW' '3757';\n"); + grammarBuilder.append("KW3758 : 'KW' '3758';\n"); + grammarBuilder.append("KW3759 : 'KW' '3759';\n"); + grammarBuilder.append("KW3760 : 'KW' '3760';\n"); + grammarBuilder.append("KW3761 : 'KW' '3761';\n"); + grammarBuilder.append("KW3762 : 'KW' '3762';\n"); + grammarBuilder.append("KW3763 : 'KW' '3763';\n"); + grammarBuilder.append("KW3764 : 'KW' '3764';\n"); + grammarBuilder.append("KW3765 : 'KW' '3765';\n"); + grammarBuilder.append("KW3766 : 'KW' '3766';\n"); + grammarBuilder.append("KW3767 : 'KW' '3767';\n"); + grammarBuilder.append("KW3768 : 'KW' '3768';\n"); + grammarBuilder.append("KW3769 : 'KW' '3769';\n"); + grammarBuilder.append("KW3770 : 'KW' '3770';\n"); + grammarBuilder.append("KW3771 : 'KW' '3771';\n"); + grammarBuilder.append("KW3772 : 'KW' '3772';\n"); + grammarBuilder.append("KW3773 : 'KW' '3773';\n"); + grammarBuilder.append("KW3774 : 'KW' '3774';\n"); + grammarBuilder.append("KW3775 : 'KW' '3775';\n"); + grammarBuilder.append("KW3776 : 'KW' '3776';\n"); + grammarBuilder.append("KW3777 : 'KW' '3777';\n"); + grammarBuilder.append("KW3778 : 'KW' '3778';\n"); + grammarBuilder.append("KW3779 : 'KW' '3779';\n"); + grammarBuilder.append("KW3780 : 'KW' '3780';\n"); + grammarBuilder.append("KW3781 : 'KW' '3781';\n"); + grammarBuilder.append("KW3782 : 'KW' '3782';\n"); + grammarBuilder.append("KW3783 : 'KW' '3783';\n"); + grammarBuilder.append("KW3784 : 'KW' '3784';\n"); + grammarBuilder.append("KW3785 : 'KW' '3785';\n"); + grammarBuilder.append("KW3786 : 'KW' '3786';\n"); + grammarBuilder.append("KW3787 : 'KW' '3787';\n"); + grammarBuilder.append("KW3788 : 'KW' '3788';\n"); + grammarBuilder.append("KW3789 : 'KW' '3789';\n"); + grammarBuilder.append("KW3790 : 'KW' '3790';\n"); + grammarBuilder.append("KW3791 : 'KW' '3791';\n"); + grammarBuilder.append("KW3792 : 'KW' '3792';\n"); + grammarBuilder.append("KW3793 : 'KW' '3793';\n"); + grammarBuilder.append("KW3794 : 'KW' '3794';\n"); + grammarBuilder.append("KW3795 : 'KW' '3795';\n"); + grammarBuilder.append("KW3796 : 'KW' '3796';\n"); + grammarBuilder.append("KW3797 : 'KW' '3797';\n"); + grammarBuilder.append("KW3798 : 'KW' '3798';\n"); + grammarBuilder.append("KW3799 : 'KW' '3799';\n"); + grammarBuilder.append("KW3800 : 'KW' '3800';\n"); + grammarBuilder.append("KW3801 : 'KW' '3801';\n"); + grammarBuilder.append("KW3802 : 'KW' '3802';\n"); + grammarBuilder.append("KW3803 : 'KW' '3803';\n"); + grammarBuilder.append("KW3804 : 'KW' '3804';\n"); + grammarBuilder.append("KW3805 : 'KW' '3805';\n"); + grammarBuilder.append("KW3806 : 'KW' '3806';\n"); + grammarBuilder.append("KW3807 : 'KW' '3807';\n"); + grammarBuilder.append("KW3808 : 'KW' '3808';\n"); + grammarBuilder.append("KW3809 : 'KW' '3809';\n"); + grammarBuilder.append("KW3810 : 'KW' '3810';\n"); + grammarBuilder.append("KW3811 : 'KW' '3811';\n"); + grammarBuilder.append("KW3812 : 'KW' '3812';\n"); + grammarBuilder.append("KW3813 : 'KW' '3813';\n"); + grammarBuilder.append("KW3814 : 'KW' '3814';\n"); + grammarBuilder.append("KW3815 : 'KW' '3815';\n"); + grammarBuilder.append("KW3816 : 'KW' '3816';\n"); + grammarBuilder.append("KW3817 : 'KW' '3817';\n"); + grammarBuilder.append("KW3818 : 'KW' '3818';\n"); + grammarBuilder.append("KW3819 : 'KW' '3819';\n"); + grammarBuilder.append("KW3820 : 'KW' '3820';\n"); + grammarBuilder.append("KW3821 : 'KW' '3821';\n"); + grammarBuilder.append("KW3822 : 'KW' '3822';\n"); + grammarBuilder.append("KW3823 : 'KW' '3823';\n"); + grammarBuilder.append("KW3824 : 'KW' '3824';\n"); + grammarBuilder.append("KW3825 : 'KW' '3825';\n"); + grammarBuilder.append("KW3826 : 'KW' '3826';\n"); + grammarBuilder.append("KW3827 : 'KW' '3827';\n"); + grammarBuilder.append("KW3828 : 'KW' '3828';\n"); + grammarBuilder.append("KW3829 : 'KW' '3829';\n"); + grammarBuilder.append("KW3830 : 'KW' '3830';\n"); + grammarBuilder.append("KW3831 : 'KW' '3831';\n"); + grammarBuilder.append("KW3832 : 'KW' '3832';\n"); + grammarBuilder.append("KW3833 : 'KW' '3833';\n"); + grammarBuilder.append("KW3834 : 'KW' '3834';\n"); + grammarBuilder.append("KW3835 : 'KW' '3835';\n"); + grammarBuilder.append("KW3836 : 'KW' '3836';\n"); + grammarBuilder.append("KW3837 : 'KW' '3837';\n"); + grammarBuilder.append("KW3838 : 'KW' '3838';\n"); + grammarBuilder.append("KW3839 : 'KW' '3839';\n"); + grammarBuilder.append("KW3840 : 'KW' '3840';\n"); + grammarBuilder.append("KW3841 : 'KW' '3841';\n"); + grammarBuilder.append("KW3842 : 'KW' '3842';\n"); + grammarBuilder.append("KW3843 : 'KW' '3843';\n"); + grammarBuilder.append("KW3844 : 'KW' '3844';\n"); + grammarBuilder.append("KW3845 : 'KW' '3845';\n"); + grammarBuilder.append("KW3846 : 'KW' '3846';\n"); + grammarBuilder.append("KW3847 : 'KW' '3847';\n"); + grammarBuilder.append("KW3848 : 'KW' '3848';\n"); + grammarBuilder.append("KW3849 : 'KW' '3849';\n"); + grammarBuilder.append("KW3850 : 'KW' '3850';\n"); + grammarBuilder.append("KW3851 : 'KW' '3851';\n"); + grammarBuilder.append("KW3852 : 'KW' '3852';\n"); + grammarBuilder.append("KW3853 : 'KW' '3853';\n"); + grammarBuilder.append("KW3854 : 'KW' '3854';\n"); + grammarBuilder.append("KW3855 : 'KW' '3855';\n"); + grammarBuilder.append("KW3856 : 'KW' '3856';\n"); + grammarBuilder.append("KW3857 : 'KW' '3857';\n"); + grammarBuilder.append("KW3858 : 'KW' '3858';\n"); + grammarBuilder.append("KW3859 : 'KW' '3859';\n"); + grammarBuilder.append("KW3860 : 'KW' '3860';\n"); + grammarBuilder.append("KW3861 : 'KW' '3861';\n"); + grammarBuilder.append("KW3862 : 'KW' '3862';\n"); + grammarBuilder.append("KW3863 : 'KW' '3863';\n"); + grammarBuilder.append("KW3864 : 'KW' '3864';\n"); + grammarBuilder.append("KW3865 : 'KW' '3865';\n"); + grammarBuilder.append("KW3866 : 'KW' '3866';\n"); + grammarBuilder.append("KW3867 : 'KW' '3867';\n"); + grammarBuilder.append("KW3868 : 'KW' '3868';\n"); + grammarBuilder.append("KW3869 : 'KW' '3869';\n"); + grammarBuilder.append("KW3870 : 'KW' '3870';\n"); + grammarBuilder.append("KW3871 : 'KW' '3871';\n"); + grammarBuilder.append("KW3872 : 'KW' '3872';\n"); + grammarBuilder.append("KW3873 : 'KW' '3873';\n"); + grammarBuilder.append("KW3874 : 'KW' '3874';\n"); + grammarBuilder.append("KW3875 : 'KW' '3875';\n"); + grammarBuilder.append("KW3876 : 'KW' '3876';\n"); + grammarBuilder.append("KW3877 : 'KW' '3877';\n"); + grammarBuilder.append("KW3878 : 'KW' '3878';\n"); + grammarBuilder.append("KW3879 : 'KW' '3879';\n"); + grammarBuilder.append("KW3880 : 'KW' '3880';\n"); + grammarBuilder.append("KW3881 : 'KW' '3881';\n"); + grammarBuilder.append("KW3882 : 'KW' '3882';\n"); + grammarBuilder.append("KW3883 : 'KW' '3883';\n"); + grammarBuilder.append("KW3884 : 'KW' '3884';\n"); + grammarBuilder.append("KW3885 : 'KW' '3885';\n"); + grammarBuilder.append("KW3886 : 'KW' '3886';\n"); + grammarBuilder.append("KW3887 : 'KW' '3887';\n"); + grammarBuilder.append("KW3888 : 'KW' '3888';\n"); + grammarBuilder.append("KW3889 : 'KW' '3889';\n"); + grammarBuilder.append("KW3890 : 'KW' '3890';\n"); + grammarBuilder.append("KW3891 : 'KW' '3891';\n"); + grammarBuilder.append("KW3892 : 'KW' '3892';\n"); + grammarBuilder.append("KW3893 : 'KW' '3893';\n"); + grammarBuilder.append("KW3894 : 'KW' '3894';\n"); + grammarBuilder.append("KW3895 : 'KW' '3895';\n"); + grammarBuilder.append("KW3896 : 'KW' '3896';\n"); + grammarBuilder.append("KW3897 : 'KW' '3897';\n"); + grammarBuilder.append("KW3898 : 'KW' '3898';\n"); + grammarBuilder.append("KW3899 : 'KW' '3899';\n"); + grammarBuilder.append("KW3900 : 'KW' '3900';\n"); + grammarBuilder.append("KW3901 : 'KW' '3901';\n"); + grammarBuilder.append("KW3902 : 'KW' '3902';\n"); + grammarBuilder.append("KW3903 : 'KW' '3903';\n"); + grammarBuilder.append("KW3904 : 'KW' '3904';\n"); + grammarBuilder.append("KW3905 : 'KW' '3905';\n"); + grammarBuilder.append("KW3906 : 'KW' '3906';\n"); + grammarBuilder.append("KW3907 : 'KW' '3907';\n"); + grammarBuilder.append("KW3908 : 'KW' '3908';\n"); + grammarBuilder.append("KW3909 : 'KW' '3909';\n"); + grammarBuilder.append("KW3910 : 'KW' '3910';\n"); + grammarBuilder.append("KW3911 : 'KW' '3911';\n"); + grammarBuilder.append("KW3912 : 'KW' '3912';\n"); + grammarBuilder.append("KW3913 : 'KW' '3913';\n"); + grammarBuilder.append("KW3914 : 'KW' '3914';\n"); + grammarBuilder.append("KW3915 : 'KW' '3915';\n"); + grammarBuilder.append("KW3916 : 'KW' '3916';\n"); + grammarBuilder.append("KW3917 : 'KW' '3917';\n"); + grammarBuilder.append("KW3918 : 'KW' '3918';\n"); + grammarBuilder.append("KW3919 : 'KW' '3919';\n"); + grammarBuilder.append("KW3920 : 'KW' '3920';\n"); + grammarBuilder.append("KW3921 : 'KW' '3921';\n"); + grammarBuilder.append("KW3922 : 'KW' '3922';\n"); + grammarBuilder.append("KW3923 : 'KW' '3923';\n"); + grammarBuilder.append("KW3924 : 'KW' '3924';\n"); + grammarBuilder.append("KW3925 : 'KW' '3925';\n"); + grammarBuilder.append("KW3926 : 'KW' '3926';\n"); + grammarBuilder.append("KW3927 : 'KW' '3927';\n"); + grammarBuilder.append("KW3928 : 'KW' '3928';\n"); + grammarBuilder.append("KW3929 : 'KW' '3929';\n"); + grammarBuilder.append("KW3930 : 'KW' '3930';\n"); + grammarBuilder.append("KW3931 : 'KW' '3931';\n"); + grammarBuilder.append("KW3932 : 'KW' '3932';\n"); + grammarBuilder.append("KW3933 : 'KW' '3933';\n"); + grammarBuilder.append("KW3934 : 'KW' '3934';\n"); + grammarBuilder.append("KW3935 : 'KW' '3935';\n"); + grammarBuilder.append("KW3936 : 'KW' '3936';\n"); + grammarBuilder.append("KW3937 : 'KW' '3937';\n"); + grammarBuilder.append("KW3938 : 'KW' '3938';\n"); + grammarBuilder.append("KW3939 : 'KW' '3939';\n"); + grammarBuilder.append("KW3940 : 'KW' '3940';\n"); + grammarBuilder.append("KW3941 : 'KW' '3941';\n"); + grammarBuilder.append("KW3942 : 'KW' '3942';\n"); + grammarBuilder.append("KW3943 : 'KW' '3943';\n"); + grammarBuilder.append("KW3944 : 'KW' '3944';\n"); + grammarBuilder.append("KW3945 : 'KW' '3945';\n"); + grammarBuilder.append("KW3946 : 'KW' '3946';\n"); + grammarBuilder.append("KW3947 : 'KW' '3947';\n"); + grammarBuilder.append("KW3948 : 'KW' '3948';\n"); + grammarBuilder.append("KW3949 : 'KW' '3949';\n"); + grammarBuilder.append("KW3950 : 'KW' '3950';\n"); + grammarBuilder.append("KW3951 : 'KW' '3951';\n"); + grammarBuilder.append("KW3952 : 'KW' '3952';\n"); + grammarBuilder.append("KW3953 : 'KW' '3953';\n"); + grammarBuilder.append("KW3954 : 'KW' '3954';\n"); + grammarBuilder.append("KW3955 : 'KW' '3955';\n"); + grammarBuilder.append("KW3956 : 'KW' '3956';\n"); + grammarBuilder.append("KW3957 : 'KW' '3957';\n"); + grammarBuilder.append("KW3958 : 'KW' '3958';\n"); + grammarBuilder.append("KW3959 : 'KW' '3959';\n"); + grammarBuilder.append("KW3960 : 'KW' '3960';\n"); + grammarBuilder.append("KW3961 : 'KW' '3961';\n"); + grammarBuilder.append("KW3962 : 'KW' '3962';\n"); + grammarBuilder.append("KW3963 : 'KW' '3963';\n"); + grammarBuilder.append("KW3964 : 'KW' '3964';\n"); + grammarBuilder.append("KW3965 : 'KW' '3965';\n"); + grammarBuilder.append("KW3966 : 'KW' '3966';\n"); + grammarBuilder.append("KW3967 : 'KW' '3967';\n"); + grammarBuilder.append("KW3968 : 'KW' '3968';\n"); + grammarBuilder.append("KW3969 : 'KW' '3969';\n"); + grammarBuilder.append("KW3970 : 'KW' '3970';\n"); + grammarBuilder.append("KW3971 : 'KW' '3971';\n"); + grammarBuilder.append("KW3972 : 'KW' '3972';\n"); + grammarBuilder.append("KW3973 : 'KW' '3973';\n"); + grammarBuilder.append("KW3974 : 'KW' '3974';\n"); + grammarBuilder.append("KW3975 : 'KW' '3975';\n"); + grammarBuilder.append("KW3976 : 'KW' '3976';\n"); + grammarBuilder.append("KW3977 : 'KW' '3977';\n"); + grammarBuilder.append("KW3978 : 'KW' '3978';\n"); + grammarBuilder.append("KW3979 : 'KW' '3979';\n"); + grammarBuilder.append("KW3980 : 'KW' '3980';\n"); + grammarBuilder.append("KW3981 : 'KW' '3981';\n"); + grammarBuilder.append("KW3982 : 'KW' '3982';\n"); + grammarBuilder.append("KW3983 : 'KW' '3983';\n"); + grammarBuilder.append("KW3984 : 'KW' '3984';\n"); + grammarBuilder.append("KW3985 : 'KW' '3985';\n"); + grammarBuilder.append("KW3986 : 'KW' '3986';\n"); + grammarBuilder.append("KW3987 : 'KW' '3987';\n"); + grammarBuilder.append("KW3988 : 'KW' '3988';\n"); + grammarBuilder.append("KW3989 : 'KW' '3989';\n"); + grammarBuilder.append("KW3990 : 'KW' '3990';\n"); + grammarBuilder.append("KW3991 : 'KW' '3991';\n"); + grammarBuilder.append("KW3992 : 'KW' '3992';\n"); + grammarBuilder.append("KW3993 : 'KW' '3993';\n"); + grammarBuilder.append("KW3994 : 'KW' '3994';\n"); + grammarBuilder.append("KW3995 : 'KW' '3995';\n"); + grammarBuilder.append("KW3996 : 'KW' '3996';\n"); + grammarBuilder.append("KW3997 : 'KW' '3997';\n"); + grammarBuilder.append("KW3998 : 'KW' '3998';\n"); + grammarBuilder.append("KW3999 : 'KW' '3999';"); + String grammar = grammarBuilder.toString(); + String input ="KW400"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:4='KW400',<402>,1:0]\n" + + "[@1,5:4='',<-1>,1:5]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNonGreedyClosure() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(61); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '//' .*? '\\n' CMT*?;\n"); + grammarBuilder.append("WS : (' '|'\\t')+;"); + String grammar = grammarBuilder.toString(); + String input = + "//blah\n" + + "//blah\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:6='//blah\\n',<1>,1:0]\n" + + "[@1,7:13='//blah\\n',<1>,2:0]\n" + + "[@2,14:13='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNonGreedyConfigs() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(124); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("I : .*? ('a' | 'ab') {console.log(this.text);} ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + grammarBuilder.append("J : . {console.log(this.text);};"); + String grammar = grammarBuilder.toString(); + String input ="ab"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "a\n" + + "b\n" + + "[@0,0:0='a',<1>,1:0]\n" + + "[@1,1:1='b',<3>,1:1]\n" + + "[@2,2:1='',<-1>,1:2]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNonGreedyOptional() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(61); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '//' .*? '\\n' CMT??;\n"); + grammarBuilder.append("WS : (' '|'\\t')+;"); + String grammar = grammarBuilder.toString(); + String input = + "//blah\n" + + "//blah\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:6='//blah\\n',<1>,1:0]\n" + + "[@1,7:13='//blah\\n',<1>,2:0]\n" + + "[@2,14:13='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNonGreedyPositiveClosure() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(59); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : ('//' .*? '\\n')+?;\n"); + grammarBuilder.append("WS : (' '|'\\t')+;"); + String grammar = grammarBuilder.toString(); + String input = + "//blah\n" + + "//blah\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:6='//blah\\n',<1>,1:0]\n" + + "[@1,7:13='//blah\\n',<1>,2:0]\n" + + "[@2,14:13='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNonGreedyTermination1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(47); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("STRING : '\"' ('\"\"' | .)*? '\"';"); + String grammar = grammarBuilder.toString(); + String input ="\"hi\"\"mom\""; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:3='\"hi\"',<1>,1:0]\n" + + "[@1,4:8='\"mom\"',<1>,1:4]\n" + + "[@2,9:8='',<-1>,1:9]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNonGreedyTermination2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(47); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("STRING : '\"' ('\"\"' | .)+? '\"';"); + String grammar = grammarBuilder.toString(); + String input ="\"\"\"mom\""; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:6='\"\"\"mom\"',<1>,1:0]\n" + + "[@1,7:6='',<-1>,1:7]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testParentheses() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(166); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("START_BLOCK: '-.-.-';\n"); + grammarBuilder.append("ID : (LETTER SEPARATOR) (LETTER SEPARATOR)+;\n"); + grammarBuilder.append("fragment LETTER: L_A|L_K;\n"); + grammarBuilder.append("fragment L_A: '.-';\n"); + grammarBuilder.append("fragment L_K: '-.-';\n"); + grammarBuilder.append("SEPARATOR: '!';"); + String grammar = grammarBuilder.toString(); + String input ="-.-.-!"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:4='-.-.-',<1>,1:0]\n" + + "[@1,5:5='!',<3>,1:5]\n" + + "[@2,6:5='',<-1>,1:6]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPositionAdjustingLexer() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(2231); + grammarBuilder.append("lexer grammar PositionAdjustingLexer;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@members {\n"); + grammarBuilder.append("PositionAdjustingLexer.prototype.resetAcceptPosition = function(index, line, column) {\n"); + grammarBuilder.append(" this._input.seek(index);\n"); + grammarBuilder.append(" this.line = line;\n"); + grammarBuilder.append(" this.column = column;\n"); + grammarBuilder.append(" this._interp.consume(this._input);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("PositionAdjustingLexer.prototype.nextToken = function() {\n"); + grammarBuilder.append(" if (!(\"resetAcceptPosition\" in this._interp)) {\n"); + grammarBuilder.append(" var lexer = this;\n"); + grammarBuilder.append(" this._interp.resetAcceptPosition = function(index, line, column) { lexer.resetAcceptPosition(index, line, column); };\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" return antlr4.Lexer.prototype.nextToken.call(this);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("PositionAdjustingLexer.prototype.emit = function() {\n"); + grammarBuilder.append(" switch(this._type) {\n"); + grammarBuilder.append(" case PositionAdjustingLexer.TOKENS:\n"); + grammarBuilder.append(" this.handleAcceptPositionForKeyword(\"tokens\");\n"); + grammarBuilder.append(" break;\n"); + grammarBuilder.append(" case PositionAdjustingLexer.LABEL:\n"); + grammarBuilder.append(" this.handleAcceptPositionForIdentifier();\n"); + grammarBuilder.append(" break;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" return antlr4.Lexer.prototype.emit.call(this);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("PositionAdjustingLexer.prototype.handleAcceptPositionForIdentifier = function() {\n"); + grammarBuilder.append(" var tokenText = this.text;\n"); + grammarBuilder.append(" var identifierLength = 0;\n"); + grammarBuilder.append(" while (identifierLength < tokenText.length &&\n"); + grammarBuilder.append(" PositionAdjustingLexer.isIdentifierChar(tokenText[identifierLength])\n"); + grammarBuilder.append(" ) {\n"); + grammarBuilder.append(" identifierLength += 1;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" if (this._input.index > this._tokenStartCharIndex + identifierLength) {\n"); + grammarBuilder.append(" var offset = identifierLength - 1;\n"); + grammarBuilder.append(" this._interp.resetAcceptPosition(this._tokenStartCharIndex + offset,\n"); + grammarBuilder.append(" this._tokenStartLine, this._tokenStartColumn + offset);\n"); + grammarBuilder.append(" return true;\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" return false;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("PositionAdjustingLexer.prototype.handleAcceptPositionForKeyword = function(keyword) {\n"); + grammarBuilder.append(" if (this._input.index > this._tokenStartCharIndex + keyword.length) {\n"); + grammarBuilder.append(" var offset = keyword.length - 1;\n"); + grammarBuilder.append(" this._interp.resetAcceptPosition(this._tokenStartCharIndex + offset,\n"); + grammarBuilder.append(" this._tokenStartLine, this._tokenStartColumn + offset);\n"); + grammarBuilder.append(" return true;\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" return false;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("PositionAdjustingLexer.isIdentifierChar = function(c) {\n"); + grammarBuilder.append(" return c.match(/^[0-9a-zA-Z_]+$/);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ASSIGN : '=' ;\n"); + grammarBuilder.append("PLUS_ASSIGN : '+=' ;\n"); + grammarBuilder.append("LCURLY: '{';\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("// 'tokens' followed by '{'\n"); + grammarBuilder.append("TOKENS : 'tokens' IGNORED '{';\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("// IDENTIFIER followed by '+=' or '='\n"); + grammarBuilder.append("LABEL\n"); + grammarBuilder.append(" : IDENTIFIER IGNORED '+'? '='\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("IDENTIFIER\n"); + grammarBuilder.append(" : [a-zA-Z_] [a-zA-Z0-9_]*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("fragment\n"); + grammarBuilder.append("IGNORED\n"); + grammarBuilder.append(" : [ \\t\\r\\n]*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("NEWLINE\n"); + grammarBuilder.append(" : [\\r\\n]+ -> skip\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("WS\n"); + grammarBuilder.append(" : [ \\t]+ -> skip\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input = + "tokens\n" + + "tokens {\n" + + "notLabel\n" + + "label1 =\n" + + "label2 +=\n" + + "notLabel\n"; + String found = execLexer("PositionAdjustingLexer.g4", grammar, "PositionAdjustingLexer", input, false); + assertEquals( + "[@0,0:5='tokens',<6>,1:0]\n" + + "[@1,7:12='tokens',<4>,2:0]\n" + + "[@2,14:14='{',<3>,2:7]\n" + + "[@3,16:23='notLabel',<6>,3:0]\n" + + "[@4,25:30='label1',<5>,4:0]\n" + + "[@5,32:32='=',<1>,4:7]\n" + + "[@6,34:39='label2',<5>,5:0]\n" + + "[@7,41:42='+=',<2>,5:7]\n" + + "[@8,44:51='notLabel',<6>,6:0]\n" + + "[@9,53:52='',<-1>,7:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testQuoteTranslation() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(57); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("QUOTE : '\"' ; // make sure this compiles"); + String grammar = grammarBuilder.toString(); + String input ="\""; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:0='\"',<1>,1:0]\n" + + "[@1,1:0='',<-1>,1:1]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRecursiveLexerRuleRefWithWildcardPlus_1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(64); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '/*' (CMT | .)+? '*/' ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+;"); + String grammar = grammarBuilder.toString(); + String input = + "/* ick */\n" + + "/* /* */\n" + + "/* /*nested*/ */\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:8='/* ick */',<1>,1:0]\n" + + "[@1,9:9='\\n',<2>,1:9]\n" + + "[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" + + "[@3,35:35='\\n',<2>,3:16]\n" + + "[@4,36:35='',<-1>,4:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRecursiveLexerRuleRefWithWildcardPlus_2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(64); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '/*' (CMT | .)+? '*/' ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+;"); + String grammar = grammarBuilder.toString(); + String input = + "/* ick */x\n" + + "/* /* */x\n" + + "/* /*nested*/ */x\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:8='/* ick */',<1>,1:0]\n" + + "[@1,10:10='\\n',<2>,1:10]\n" + + "[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" + + "[@3,38:38='\\n',<2>,3:17]\n" + + "[@4,39:38='',<-1>,4:0]\n", found); + + assertEquals( + "line 1:9 token recognition error at: 'x'\n" + + "line 3:16 token recognition error at: 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRecursiveLexerRuleRefWithWildcardStar_1() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(64); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '/*' (CMT | .)*? '*/' ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+;"); + String grammar = grammarBuilder.toString(); + String input = + "/* ick */\n" + + "/* /* */\n" + + "/* /*nested*/ */\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:8='/* ick */',<1>,1:0]\n" + + "[@1,9:9='\\n',<2>,1:9]\n" + + "[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n" + + "[@3,35:35='\\n',<2>,3:16]\n" + + "[@4,36:35='',<-1>,4:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRecursiveLexerRuleRefWithWildcardStar_2() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(64); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("CMT : '/*' (CMT | .)*? '*/' ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+;"); + String grammar = grammarBuilder.toString(); + String input = + "/* ick */x\n" + + "/* /* */x\n" + + "/* /*nested*/ */x\n"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:8='/* ick */',<1>,1:0]\n" + + "[@1,10:10='\\n',<2>,1:10]\n" + + "[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n" + + "[@3,38:38='\\n',<2>,3:17]\n" + + "[@4,39:38='',<-1>,4:0]\n", found); + + assertEquals( + "line 1:9 token recognition error at: 'x'\n" + + "line 3:16 token recognition error at: 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRefToRuleDoesNotSetTokenNorEmitAnother() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(70); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("A : '-' I ;\n"); + grammarBuilder.append("I : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="34 -21 3"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:1='34',<2>,1:0]\n" + + "[@1,3:5='-21',<1>,1:3]\n" + + "[@2,7:7='3',<2>,1:7]\n" + + "[@3,8:7='',<-1>,1:8]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSlashes() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(95); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("Backslash : '\\\\';\n"); + grammarBuilder.append("Slash : '/';\n"); + grammarBuilder.append("Vee : '\\\\/';\n"); + grammarBuilder.append("Wedge : '/\\\\';\n"); + grammarBuilder.append("WS : [ \\t] -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="\\ / \\/ /\\"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:0='\\',<1>,1:0]\n" + + "[@1,2:2='/',<2>,1:2]\n" + + "[@2,4:5='\\/',<3>,1:4]\n" + + "[@3,7:8='/\\',<4>,1:7]\n" + + "[@4,9:8='',<-1>,1:9]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testZeroLengthToken() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(215); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("BeginString\n"); + grammarBuilder.append(" : '\\'' -> more, pushMode(StringMode)\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("mode StringMode;\n"); + grammarBuilder.append(" StringMode_X : 'x' -> more;\n"); + grammarBuilder.append(" StringMode_Done : -> more, mode(EndStringMode);\n"); + grammarBuilder.append("mode EndStringMode; \n"); + grammarBuilder.append(" EndString : '\\'' -> popMode;"); + String grammar = grammarBuilder.toString(); + String input ="'xxx'"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "[@0,0:4=''xxx'',<1>,1:0]\n" + + "[@1,5:4='',<-1>,1:5]\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java new file mode 100644 index 000000000..79006182d --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java @@ -0,0 +1,396 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestListeners extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testBasic() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(633); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.visitTerminal = function(node) {\n"); + grammarBuilder.append(" console.log(node.symbol.text);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : INT INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1 2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(a 1 2)\n" + + "1\n" + + "2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLR() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(843); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.exitE = function(ctx) {\n"); + grammarBuilder.append(" var str;\n"); + grammarBuilder.append(" if(ctx.getChildCount()===3) {\n"); + grammarBuilder.append(" str = ctx.e(0).start.text + ' ' + ctx.e(1).start.text + ' ' + ctx.e()[0].start.text;\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" str = ctx.INT().symbol.text;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=e ;\n"); + grammarBuilder.append("e : e op='*' e\n"); + grammarBuilder.append(" | e op='+' e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1+2*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(e (e 1) + (e (e 2) * (e 3)))\n" + + "1\n" + + "2\n" + + "3\n" + + "2 3 2\n" + + "1 2 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLRWithLabels() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(833); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.exitCall = function(ctx) {\n"); + grammarBuilder.append(" var str = ctx.e().start.text + ' ' + ctx.eList();\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" this.exitInt = function(ctx) {\n"); + grammarBuilder.append(" var str = ctx.INT().symbol.text;\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=e ;\n"); + grammarBuilder.append("e : e '(' eList ')' # Call\n"); + grammarBuilder.append(" | INT # Int\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("eList : e (',' e)* ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1(2,3)"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(e (e 1) ( (eList (e 2) , (e 3)) ))\n" + + "1\n" + + "2\n" + + "3\n" + + "1 [13 6]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRuleGetters_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(868); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.exitA = function(ctx) {\n"); + grammarBuilder.append(" var str;\n"); + grammarBuilder.append(" if(ctx.getChildCount()===2) {\n"); + grammarBuilder.append(" str = ctx.b(0).start.text + ' ' + ctx.b(1).start.text + ' ' + ctx.b()[0].start.text;\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" str = ctx.b(0).start.text;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : b b // forces list\n"); + grammarBuilder.append(" | b // a list still\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("b : ID | INT;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1 2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(a (b 1) (b 2))\n" + + "1 2 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRuleGetters_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(868); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.exitA = function(ctx) {\n"); + grammarBuilder.append(" var str;\n"); + grammarBuilder.append(" if(ctx.getChildCount()===2) {\n"); + grammarBuilder.append(" str = ctx.b(0).start.text + ' ' + ctx.b(1).start.text + ' ' + ctx.b()[0].start.text;\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" str = ctx.b(0).start.text;\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : b b // forces list\n"); + grammarBuilder.append(" | b // a list still\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("b : ID | INT;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(a (b abc))\n" + + "abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTokenGetters_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(855); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.exitA = function(ctx) {\n"); + grammarBuilder.append(" var str;\n"); + grammarBuilder.append(" if(ctx.getChildCount()===2) {\n"); + grammarBuilder.append(" str = ctx.INT(0).symbol.text + ' ' + ctx.INT(1).symbol.text + ' ' + antlr4.Utils.arrayToString(ctx.INT());\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" str = ctx.ID().symbol.toString();\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : INT INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1 2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(a 1 2)\n" + + "1 2 [1, 2]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTokenGetters_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(855); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("var TListener = require('./TListener').TListener;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("this.LeafListener = function() {\n"); + grammarBuilder.append(" this.exitA = function(ctx) {\n"); + grammarBuilder.append(" var str;\n"); + grammarBuilder.append(" if(ctx.getChildCount()===2) {\n"); + grammarBuilder.append(" str = ctx.INT(0).symbol.text + ' ' + ctx.INT(1).symbol.text + ' ' + antlr4.Utils.arrayToString(ctx.INT());\n"); + grammarBuilder.append(" } else {\n"); + grammarBuilder.append(" str = ctx.ID().symbol.toString();\n"); + grammarBuilder.append(" }\n"); + grammarBuilder.append(" console.log(str);\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append(" return this;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("this.LeafListener.prototype = Object.create(TListener.prototype);\n"); + grammarBuilder.append("this.LeafListener.prototype.constructor = this.LeafListener;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.r.toStringTree(null, this));\n"); + grammarBuilder.append("var walker = new antlr4.tree.ParseTreeWalker();\n"); + grammarBuilder.append("walker.walk(new this.LeafListener(), $ctx.r);\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : INT INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "(a abc)\n" + + "[@0,0:2='abc',<4>,1:0]\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java new file mode 100644 index 000000000..c1f9afa92 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java @@ -0,0 +1,229 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestParseTrees extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void test2AltLoop() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(143); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : ('x' | 'y')* 'z'\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="xyyxyxz"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a x y y x y x z)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void test2Alts() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(136); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : 'x' | 'y'\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a y)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExtraToken() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(149); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : 'x' 'y'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("Z : 'z' \n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append(" "); + String grammar = grammarBuilder.toString(); + String input ="xzy"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a x z y)\n", found); + + assertEquals("line 1:1 extraneous input 'z' expecting 'y'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNoViableAlt() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(151); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : 'x' | 'y'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("Z : 'z' \n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append(" "); + String grammar = grammarBuilder.toString(); + String input ="z"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a z)\n", found); + + assertEquals("line 1:0 mismatched input 'z' expecting {'x', 'y'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRuleRef() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(145); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : b 'x'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("b : 'y' \n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="yx"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a (b y) x)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSync() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(152); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : 'x' 'y'* '!'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("Z : 'z' \n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="xzyy!"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a x z y y !)\n", found); + + assertEquals("line 1:1 extraneous input 'z' expecting {'y', '!'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testToken2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(134); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : 'x' 'y'\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="xy"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("(a x y)\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTokenAndRuleContextString() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(205); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@init {\n"); + grammarBuilder.append("this.buildParseTrees = true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($r.ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : 'x' { \n"); + grammarBuilder.append("console.log(antlr4.Utils.arrayToString(this.getRuleInvocationStack()));\n"); + grammarBuilder.append("} ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "[a, s]\n" + + "(a x)\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java new file mode 100644 index 000000000..ec893e13c --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java @@ -0,0 +1,624 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestParserErrors extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testConjuringUpToken() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(63); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' x='b' {console.log(\"conjured=\" + $x);} 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="ac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("conjured=[@-1,-1:-1='',<2>,1:1]\n", found); + + assertEquals("line 1:1 missing 'b' at 'c'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testConjuringUpTokenFromSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(69); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' x=('b'|'c') {console.log(\"conjured=\" + $x);} 'd' ;"); + String grammar = grammarBuilder.toString(); + String input ="ad"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("conjured=[@-1,-1:-1='',<2>,1:1]\n", found); + + assertEquals("line 1:1 missing {'b', 'c'} at 'd'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testContextListGetters() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(211); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::members{\n"); + grammarBuilder.append(" function foo() {\n"); + grammarBuilder.append(" var s = new SContext();\n"); + grammarBuilder.append(" var a = s.a();\n"); + grammarBuilder.append(" var b = s.b();\n"); + grammarBuilder.append(" };\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("s : (a | b)+;\n"); + grammarBuilder.append("a : 'a' {process.stdout.write('a');};\n"); + grammarBuilder.append("b : 'b' {process.stdout.write('b');};"); + String grammar = grammarBuilder.toString(); + String input ="abab"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals("abab\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDuplicatedLeftRecursiveCall_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(63); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : expr EOF;\n"); + grammarBuilder.append("expr : 'x'\n"); + grammarBuilder.append(" | expr expr\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDuplicatedLeftRecursiveCall_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(63); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : expr EOF;\n"); + grammarBuilder.append("expr : 'x'\n"); + grammarBuilder.append(" | expr expr\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="xx"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDuplicatedLeftRecursiveCall_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(63); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : expr EOF;\n"); + grammarBuilder.append("expr : 'x'\n"); + grammarBuilder.append(" | expr expr\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="xxx"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDuplicatedLeftRecursiveCall_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(63); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : expr EOF;\n"); + grammarBuilder.append("expr : 'x'\n"); + grammarBuilder.append(" | expr expr\n"); + grammarBuilder.append(" ;"); + String grammar = grammarBuilder.toString(); + String input ="xxxx"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testInvalidATNStateRemoval() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(98); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : ID ':' expr;\n"); + grammarBuilder.append("expr : primary expr? {} | expr '->' ID;\n"); + grammarBuilder.append("primary : ID;\n"); + grammarBuilder.append("ID : [a-z]+;"); + String grammar = grammarBuilder.toString(); + String input ="x:x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testInvalidEmptyInput() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(36); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : ID+;\n"); + grammarBuilder.append("ID : [a-z]+;"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, true); + assertEquals("", found); + + assertEquals("line 1:0 missing ID at ''\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLL1ErrorInfo() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(301); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : animal (AND acClass)? service EOF;\n"); + grammarBuilder.append("animal : (DOG | CAT );\n"); + grammarBuilder.append("service : (HARDWARE | SOFTWARE) ;\n"); + grammarBuilder.append("AND : 'and';\n"); + grammarBuilder.append("DOG : 'dog';\n"); + grammarBuilder.append("CAT : 'cat';\n"); + grammarBuilder.append("HARDWARE: 'hardware';\n"); + grammarBuilder.append("SOFTWARE: 'software';\n"); + grammarBuilder.append("WS : ' ' -> skip ;\n"); + grammarBuilder.append("acClass\n"); + grammarBuilder.append("@init\n"); + grammarBuilder.append("{console.log(this.getExpectedTokens().toString(this.literalNames));}\n"); + grammarBuilder.append(" : ;"); + String grammar = grammarBuilder.toString(); + String input ="dog and software"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals("{'hardware', 'software'}\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLL2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(46); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b'\n"); + grammarBuilder.append(" | 'a' 'c'\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("q : 'e' ;"); + String grammar = grammarBuilder.toString(); + String input ="ae"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 no viable alternative at input 'ae'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLL3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(55); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b'* 'c'\n"); + grammarBuilder.append(" | 'a' 'b' 'd'\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("q : 'e' ;"); + String grammar = grammarBuilder.toString(); + String input ="abe"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:2 no viable alternative at input 'abe'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLLStar() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(48); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a'+ 'b'\n"); + grammarBuilder.append(" | 'a'+ 'c'\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("q : 'e' ;"); + String grammar = grammarBuilder.toString(); + String input ="aaae"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:3 no viable alternative at input 'aaae'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultiTokenDeletionBeforeLoop() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(28); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b'* 'c';"); + String grammar = grammarBuilder.toString(); + String input ="aacabc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultiTokenDeletionBeforeLoop2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(36); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' ('b'|'z'{})* 'c';"); + String grammar = grammarBuilder.toString(); + String input ="aacabc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 extraneous input 'a' expecting {'b', 'z', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultiTokenDeletionDuringLoop() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(29); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b'* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="abaaababc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals( + "line 1:2 extraneous input 'a' expecting {'b', 'c'}\n" + + "line 1:6 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultiTokenDeletionDuringLoop2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(37); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' ('b'|'z'{})* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="abaaababc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals( + "line 1:2 extraneous input 'a' expecting {'b', 'z', 'c'}\n" + + "line 1:6 extraneous input 'a' expecting {'b', 'z', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNoViableAltAvoidance() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(83); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : e '!' ;\n"); + grammarBuilder.append("e : 'a' 'b'\n"); + grammarBuilder.append(" | 'a'\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("DOT : '.' ;\n"); + grammarBuilder.append("WS : [ \\t\\r\\n]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a."; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("", found); + + assertEquals("line 1:1 mismatched input '.' expecting '!'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleSetInsertion() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(34); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' ('b'|'c') 'd' ;"); + String grammar = grammarBuilder.toString(); + String input ="ad"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 missing {'b', 'c'} at 'd'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleSetInsertionConsumption() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(82); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("myset: ('b'|'c') ;\n"); + grammarBuilder.append("a: 'a' myset 'd' {console.log(\"\" + $myset.stop);} ; "); + String grammar = grammarBuilder.toString(); + String input ="ad"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("[@0,0:0='a',<3>,1:0]\n", found); + + assertEquals("line 1:1 missing {'b', 'c'} at 'd'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletion() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(24); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="aab"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 extraneous input 'a' expecting 'b'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionBeforeAlt() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(38); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ('b' | 'c')\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("q : 'a'\n"); + grammarBuilder.append(";"); + String grammar = grammarBuilder.toString(); + String input ="ac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:0 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionBeforeLoop() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(25); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b'* ;"); + String grammar = grammarBuilder.toString(); + String input ="aabc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals( + "line 1:1 extraneous input 'a' expecting {, 'b'}\n" + + "line 1:3 token recognition error at: 'c'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionBeforeLoop2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(32); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' ('b'|'z'{})*;"); + String grammar = grammarBuilder.toString(); + String input ="aabc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals( + "line 1:1 extraneous input 'a' expecting {, 'b', 'z'}\n" + + "line 1:3 token recognition error at: 'c'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionBeforePredict() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(48); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a'+ 'b'\n"); + grammarBuilder.append(" | 'a'+ 'c'\n"); + grammarBuilder.append(";\n"); + grammarBuilder.append("q : 'e' ;"); + String grammar = grammarBuilder.toString(); + String input ="caaab"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:0 extraneous input 'c' expecting 'a'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionConsumption() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(82); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("myset: ('b'|'c') ;\n"); + grammarBuilder.append("a: 'a' myset 'd' {console.log(\"\" + $myset.stop);} ; "); + String grammar = grammarBuilder.toString(); + String input ="aabd"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("[@2,2:2='b',<1>,1:2]\n", found); + + assertEquals("line 1:1 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionDuringLoop() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(29); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b'* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="ababbc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:2 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionDuringLoop2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(37); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' ('b'|'z'{})* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="ababbc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:2 extraneous input 'a' expecting {'b', 'z', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenDeletionExpectingSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(30); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' ('b'|'c') ;"); + String grammar = grammarBuilder.toString(); + String input ="aab"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSingleTokenInsertion() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(28); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b' 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="ac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 missing 'b' at 'c'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTokenMismatch() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(24); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : 'a' 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="aa"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + + assertEquals("line 1:1 mismatched input 'a' expecting 'b'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testTokenMismatch2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(165); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("stat: ( '(' expr? ')' )? EOF ;\n"); + grammarBuilder.append("expr: ID '=' STR ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ERR : '~FORCE_ERROR~' ;\n"); + grammarBuilder.append("ID : [a-zA-Z]+ ;\n"); + grammarBuilder.append("STR : '\"' ~[\"]* '\"' ;\n"); + grammarBuilder.append("WS : [ \\t\\r\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="( ~FORCE_ERROR~ "; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "stat", input, false); + assertEquals("", found); + + assertEquals("line 1:2 mismatched input '~FORCE_ERROR~' expecting ')'\n", this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java new file mode 100644 index 000000000..c466ab588 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java @@ -0,0 +1,695 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestParserExec extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAPlus() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(84); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ID+ {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a b c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAStar_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(84); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ID* {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAStar_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(84); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ID* {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a b c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorAPlus() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(89); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|ID)+ {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a b c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorAStar_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(89); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|ID)* {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorAStar_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(89); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|ID)* {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a b c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorB() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(136); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ID {\n"); + grammarBuilder.append("console.log(\"alt 1\");\n"); + grammarBuilder.append("} | INT {\n"); + grammarBuilder.append("console.log(\"alt 2\");\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="34"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("alt 2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorBPlus() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(112); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|INT{\n"); + grammarBuilder.append("})+ {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a 34 c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("a34c\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorBStar_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(112); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|INT{\n"); + grammarBuilder.append("})* {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAorBStar_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(112); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|INT{\n"); + grammarBuilder.append("})* {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a 34 c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("a34c\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testBasic() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(105); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ID INT {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="abc 34"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abc34\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEOFInClosure() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(53); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("prog : stat EOF;\n"); + grammarBuilder.append("stat : 'x' ('y' | EOF)*?;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "prog", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIfIfElseGreedyBinding1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(193); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : statement+ ;\n"); + grammarBuilder.append("statement : 'x' | ifStatement;\n"); + grammarBuilder.append("ifStatement : 'if' 'y' statement ('else' statement)? {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);"); + String grammar = grammarBuilder.toString(); + String input ="if y if y x else x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals( + "if y x else x\n" + + "if y if y x else x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIfIfElseGreedyBinding2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(193); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : statement+ ;\n"); + grammarBuilder.append("statement : 'x' | ifStatement;\n"); + grammarBuilder.append("ifStatement : 'if' 'y' statement ('else' statement|) {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);"); + String grammar = grammarBuilder.toString(); + String input ="if y if y x else x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals( + "if y x else x\n" + + "if y if y x else x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIfIfElseNonGreedyBinding1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(194); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : statement+ ;\n"); + grammarBuilder.append("statement : 'x' | ifStatement;\n"); + grammarBuilder.append("ifStatement : 'if' 'y' statement ('else' statement)?? {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);"); + String grammar = grammarBuilder.toString(); + String input ="if y if y x else x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals( + "if y x\n" + + "if y if y x else x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIfIfElseNonGreedyBinding2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(193); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : statement+ ;\n"); + grammarBuilder.append("statement : 'x' | ifStatement;\n"); + grammarBuilder.append("ifStatement : 'if' 'y' statement (|'else' statement) {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);"); + String grammar = grammarBuilder.toString(); + String input ="if y if y x else x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals( + "if y x\n" + + "if y if y x else x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLL1OptionalBlock_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(110); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|{}INT)? {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLL1OptionalBlock_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(110); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|{}INT)? {\n"); + grammarBuilder.append("console.log($text);\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("ID : 'a'..'z'+;\n"); + grammarBuilder.append("INT : '0'..'9'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("a\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLabelAliasingAcrossLabeledAlternatives() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(171); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : a* EOF;\n"); + grammarBuilder.append("a\n"); + grammarBuilder.append(" : label=subrule {console.log($label.text);} #One\n"); + grammarBuilder.append(" | label='y' {console.log($label.text);} #Two\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("subrule : 'x';\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="xy"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals( + "x\n" + + "y\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLabels() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(118); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : b1=b b2+=b* b3+=';' ;\n"); + grammarBuilder.append("b : id_=ID val+=INT*;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc 34;"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testListLabelForClosureContext() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(482); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("ifStatement\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("if ( !(v instanceof Array) ) {throw \"value is not an array\";}\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : 'if' expression\n"); + grammarBuilder.append(" ( ( 'then'\n"); + grammarBuilder.append(" executableStatement*\n"); + grammarBuilder.append(" elseIfStatement* // <--- problem is here; should yield a list not node\n"); + grammarBuilder.append(" elseStatement?\n"); + grammarBuilder.append(" 'end' 'if'\n"); + grammarBuilder.append(" ) | executableStatement )\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("elseIfStatement\n"); + grammarBuilder.append(" : 'else' 'if' expression 'then' executableStatement*\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("expression : 'a' ;\n"); + grammarBuilder.append("executableStatement : 'a' ;\n"); + grammarBuilder.append("elseStatement : 'a' ;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "expression", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testListLabelsOnSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(140); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : b b* ';' ;\n"); + grammarBuilder.append("b : ID val+=(INT | FLOAT)*;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("FLOAT : [0-9]+ '.' [0-9]+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc 34;"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testMultipleEOFHandling() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(42); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("prog : ('x' | 'x' 'y') EOF EOF;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "prog", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptional_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(90); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("stat : ifstat | 'x';\n"); + grammarBuilder.append("ifstat : 'if' stat ('else' stat)?;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "stat", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptional_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(90); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("stat : ifstat | 'x';\n"); + grammarBuilder.append("ifstat : 'if' stat ('else' stat)?;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="if x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "stat", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptional_3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(90); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("stat : ifstat | 'x';\n"); + grammarBuilder.append("ifstat : 'if' stat ('else' stat)?;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="if x else x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "stat", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptional_4() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(90); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("stat : ifstat | 'x';\n"); + grammarBuilder.append("ifstat : 'if' stat ('else' stat)?;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="if if x else x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "stat", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testParserProperty() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(171); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {\n"); + grammarBuilder.append("this.Property = function() {\n"); + grammarBuilder.append(" return true;\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("a : {$parser.Property()}? ID {console.log(\"valid\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("valid\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredicatedIfIfElse() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(175); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : stmt EOF ;\n"); + grammarBuilder.append("stmt : ifStmt | ID;\n"); + grammarBuilder.append("ifStmt : 'if' ID stmt ('else' stmt | { this._input.LA(1)!=TParser.ELSE }?);\n"); + grammarBuilder.append("ELSE : 'else';\n"); + grammarBuilder.append("ID : [a-zA-Z]+;\n"); + grammarBuilder.append("WS : [ \\n\\t]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="if x if x a else b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredictionIssue334() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(269); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("file_ @init{\n"); + grammarBuilder.append("this._errHandler = new antlr4.error.BailErrorStrategy();\n"); + grammarBuilder.append("} \n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("console.log($ctx.toStringTree(null, this));\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : item (SEMICOLON item)* SEMICOLON? EOF ;\n"); + grammarBuilder.append("item : A B?;\n"); + grammarBuilder.append("SEMICOLON: ';';\n"); + grammarBuilder.append("A : 'a'|'A';\n"); + grammarBuilder.append("B : 'b'|'B';\n"); + grammarBuilder.append("WS : [ \\r\\t\\n]+ -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "file_", input, false); + assertEquals("(file_ (item a) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReferenceToATN_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(113); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|ATN)* ATN? {console.log($text);} ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("ATN : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input =""; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testReferenceToATN_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(113); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (ID|ATN)* ATN? {console.log($text);} ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("ATN : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a 34 c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("a34c\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java new file mode 100644 index 000000000..8fe24376c --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java @@ -0,0 +1,212 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestPerformance extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressionGrammar_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(164); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("program: expr EOF;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("expr\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | 'not' expr\n"); + grammarBuilder.append(" | expr 'and' expr\n"); + grammarBuilder.append(" | expr 'or' expr\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ID: [a-zA-Z_][a-zA-Z_0-9]*;\n"); + grammarBuilder.append("WS: [ \\t\\n\\r\\f]+ -> skip;\n"); + grammarBuilder.append("ERROR: .;"); + String grammar = grammarBuilder.toString(); + String input = + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "program", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testExpressionGrammar_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(164); + grammarBuilder.append("grammar Expr;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("program: expr EOF;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("expr\n"); + grammarBuilder.append(" : ID\n"); + grammarBuilder.append(" | 'not' expr\n"); + grammarBuilder.append(" | expr 'and' expr\n"); + grammarBuilder.append(" | expr 'or' expr\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("ID: [a-zA-Z_][a-zA-Z_0-9]*;\n"); + grammarBuilder.append("WS: [ \\t\\n\\r\\f]+ -> skip;\n"); + grammarBuilder.append("ERROR: .;"); + String grammar = grammarBuilder.toString(); + String input = + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + " X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or\n" + + "not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12"; + String found = execParser("Expr.g4", grammar, "ExprParser", "ExprLexer", + "ExprListener", "ExprVisitor", + "program", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java new file mode 100644 index 000000000..055adabe8 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java @@ -0,0 +1,204 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestSemPredEvalLexer extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDisableRule() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(131); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("E1 : 'enum' { false }? ;\n"); + grammarBuilder.append("E2 : 'enum' { true }? ; // winner not E1 or ID\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="enum abc"; + String found = execLexer("L.g4", grammar, "L", input, true); + assertEquals( + "[@0,0:3='enum',<2>,1:0]\n" + + "[@1,5:7='abc',<3>,1:5]\n" + + "[@2,8:7='',<-1>,1:8]\n" + + "s0-' '->:s5=>4\n" + + "s0-'a'->:s6=>3\n" + + "s0-'e'->:s1=>3\n" + + ":s1=>3-'n'->:s2=>3\n" + + ":s2=>3-'u'->:s3=>3\n" + + ":s6=>3-'b'->:s6=>3\n" + + ":s6=>3-'c'->:s6=>3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testEnumNotID() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(97); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ENUM : [a-z]+ { this.text===\"enum\" }? ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="enum abc enum"; + String found = execLexer("L.g4", grammar, "L", input, true); + assertEquals( + "[@0,0:3='enum',<1>,1:0]\n" + + "[@1,5:7='abc',<2>,1:5]\n" + + "[@2,9:12='enum',<1>,1:9]\n" + + "[@3,13:12='',<-1>,1:13]\n" + + "s0-' '->:s3=>3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIDnotEnum() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(84); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ENUM : [a-z]+ { false }? ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="enum abc enum"; + String found = execLexer("L.g4", grammar, "L", input, true); + assertEquals( + "[@0,0:3='enum',<2>,1:0]\n" + + "[@1,5:7='abc',<2>,1:5]\n" + + "[@2,9:12='enum',<2>,1:9]\n" + + "[@3,13:12='',<-1>,1:13]\n" + + "s0-' '->:s2=>3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIDvsEnum() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(85); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ENUM : 'enum' { false }? ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input ="enum abc enum"; + String found = execLexer("L.g4", grammar, "L", input, true); + assertEquals( + "[@0,0:3='enum',<2>,1:0]\n" + + "[@1,5:7='abc',<2>,1:5]\n" + + "[@2,9:12='enum',<2>,1:9]\n" + + "[@3,13:12='',<-1>,1:13]\n" + + "s0-' '->:s5=>3\n" + + "s0-'a'->:s4=>2\n" + + "s0-'e'->:s1=>2\n" + + ":s1=>2-'n'->:s2=>2\n" + + ":s2=>2-'u'->:s3=>2\n" + + ":s4=>2-'b'->:s4=>2\n" + + ":s4=>2-'c'->:s4=>2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIndent() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(143); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("INDENT : [ \\t]+ { this._tokenStartColumn===0 }?\n"); + grammarBuilder.append(" { console.log(\"INDENT\"); } ;\n"); + grammarBuilder.append("NL : '\\n';\n"); + grammarBuilder.append("WS : [ \\t]+ ;"); + String grammar = grammarBuilder.toString(); + String input = + "abc\n" + + " def \n"; + String found = execLexer("L.g4", grammar, "L", input, true); + assertEquals( + "INDENT\n" + + "[@0,0:2='abc',<1>,1:0]\n" + + "[@1,3:3='\\n',<3>,1:3]\n" + + "[@2,4:5=' ',<2>,2:0]\n" + + "[@3,6:8='def',<1>,2:2]\n" + + "[@4,9:10=' ',<4>,2:5]\n" + + "[@5,11:11='\\n',<3>,2:7]\n" + + "[@6,12:11='',<-1>,3:0]\n" + + "s0-'\n" + + "'->:s2=>3\n" + + "s0-'a'->:s1=>1\n" + + "s0-'d'->:s1=>1\n" + + ":s1=>1-'b'->:s1=>1\n" + + ":s1=>1-'c'->:s1=>1\n" + + ":s1=>1-'e'->:s1=>1\n" + + ":s1=>1-'f'->:s1=>1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerInputPositionSensitivePredicates() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(220); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("WORD1 : ID1+ { console.log(this.text); } ;\n"); + grammarBuilder.append("WORD2 : ID2+ { console.log(this.text); } ;\n"); + grammarBuilder.append("fragment ID1 : { this.column < 2 }? [a-zA-Z];\n"); + grammarBuilder.append("fragment ID2 : { this.column >= 2 }? [a-zA-Z];\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip;"); + String grammar = grammarBuilder.toString(); + String input = + "a cde\n" + + "abcde\n"; + String found = execLexer("L.g4", grammar, "L", input, true); + assertEquals( + "a\n" + + "cde\n" + + "ab\n" + + "cde\n" + + "[@0,0:0='a',<1>,1:0]\n" + + "[@1,2:4='cde',<2>,1:2]\n" + + "[@2,6:7='ab',<1>,2:0]\n" + + "[@3,8:10='cde',<2>,2:2]\n" + + "[@4,12:11='',<-1>,3:0]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredicatedKeywords() throws Exception { + mkdir(tmpdir); + + StringBuilder grammarBuilder = new StringBuilder(157); + grammarBuilder.append("lexer grammar L;\n"); + grammarBuilder.append("ENUM : [a-z]+ { this.text===\"enum\" }? { console.log(\"enum!\"); } ;\n"); + grammarBuilder.append("ID : [a-z]+ { console.log(\"ID \" + this.text); } ;\n"); + grammarBuilder.append("WS : [ \\n] -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="enum enu a"; + String found = execLexer("L.g4", grammar, "L", input, false); + assertEquals( + "enum!\n" + + "ID enu\n" + + "ID a\n" + + "[@0,0:3='enum',<1>,1:0]\n" + + "[@1,5:7='enu',<2>,1:5]\n" + + "[@2,9:9='a',<2>,1:9]\n" + + "[@3,10:9='',<-1>,1:10]\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java new file mode 100644 index 000000000..652159bc4 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java @@ -0,0 +1,684 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestSemPredEvalParser extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void test2UnpredicatedAlts() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(308); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;} a ';' a; // do 2x: once in ATN, next in DFA\n"); + grammarBuilder.append("a : ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" | {false}? ID {console.log(\"alt 3\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x; y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "alt 1\n" + + "alt 1\n", found); + + assertEquals( + "line 1:0 reportAttemptingFullContext d=0 (a), input='x'\n" + + "line 1:0 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='x'\n" + + "line 1:3 reportAttemptingFullContext d=0 (a), input='y'\n" + + "line 1:3 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='y'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void test2UnpredicatedAltsAndOneOrthogonalAlt() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(360); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : {this._interp.predictionMode = antlr4.atn.PredictionMode.LL_EXACT_AMBIG_DETECTION;} a ';' a ';' a;\n"); + grammarBuilder.append("a : INT {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | ID {console.log(\"alt 2\");} // must pick this one for ID since pred is false\n"); + grammarBuilder.append(" | ID {console.log(\"alt 3\");}\n"); + grammarBuilder.append(" | {false}? ID {console.log(\"alt 4\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="34; x; y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, true); + assertEquals( + "alt 1\n" + + "alt 2\n" + + "alt 2\n", found); + + assertEquals( + "line 1:4 reportAttemptingFullContext d=0 (a), input='x'\n" + + "line 1:4 reportAmbiguity d=0 (a): ambigAlts={2, 3}, input='x'\n" + + "line 1:7 reportAttemptingFullContext d=0 (a), input='y'\n" + + "line 1:7 reportAmbiguity d=0 (a): ambigAlts={2, 3}, input='y'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testActionHidesPreds() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(228); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {this.i = 0;}\n"); + grammarBuilder.append("s : a+ ;\n"); + grammarBuilder.append("a : {this.i = 1;} ID {this.i === 1}? {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {this.i = 2;} ID {this.i === 2}? {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x x y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 1\n" + + "alt 1\n" + + "alt 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testActionsHidePredsInGlobalFOLLOW() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(291); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {\n"); + grammarBuilder.append("this.pred = function(v) {\n"); + grammarBuilder.append(" console.log(\"eval=\" + v.toString());\n"); + grammarBuilder.append(" return v;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("s : e {} {this.pred(true)}? {console.log(\"parse\");} '!' ;\n"); + grammarBuilder.append("t : e {} {this.pred(false)}? ID ;\n"); + grammarBuilder.append("e : ID | ; // non-LL(1) so we use ATN\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a!"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "eval=true\n" + + "parse\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testAtomWithClosureInTranslatedLRRule() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(94); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("start : e[0] EOF;\n"); + grammarBuilder.append("e[int _p]\n"); + grammarBuilder.append(" : ( 'a' | 'b'+ ) ( {3 >= $_p}? '+' e[4] )*\n"); + grammarBuilder.append(" ;\n"); + String grammar = grammarBuilder.toString(); + String input ="a+b+a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "start", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDepedentPredsInGlobalFOLLOW() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(316); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {\n"); + grammarBuilder.append("this.pred = function(v) {\n"); + grammarBuilder.append(" console.log(\"eval=\" + v.toString());\n"); + grammarBuilder.append(" return v;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("s : a[99] ;\n"); + grammarBuilder.append("a[int i] : e {this.pred($i===99)}? {console.log(\"parse\");} '!' ;\n"); + grammarBuilder.append("b[int i] : e {this.pred($i===99)}? ID ;\n"); + grammarBuilder.append("e : ID | ; // non-LL(1) so we use ATN\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a!"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "eval=true\n" + + "parse\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDependentPredNotInOuterCtxShouldBeIgnored() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(272); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : b[2] ';' | b[2] '.' ; // decision in s drills down to ctx-dependent pred in a;\n"); + grammarBuilder.append("b[int i] : a[i] ;\n"); + grammarBuilder.append("a[int i]\n"); + grammarBuilder.append(" : {$i===1}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {$i===2}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n"); + String grammar = grammarBuilder.toString(); + String input ="a;"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("alt 2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testDisabledAlternative() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(121); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("cppCompilationUnit : content+ EOF;\n"); + grammarBuilder.append("content: anything | {false}? .;\n"); + grammarBuilder.append("anything: ANY_CHAR;\n"); + grammarBuilder.append("ANY_CHAR: [_a-zA-Z0-9];"); + String grammar = grammarBuilder.toString(); + String input ="hello"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "cppCompilationUnit", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testIndependentPredNotPassedOuterCtxToAvoidCastException() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(183); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : b ';' | b '.' ;\n"); + grammarBuilder.append("b : a ;\n"); + grammarBuilder.append("a\n"); + grammarBuilder.append(" : {false}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a;"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("alt 2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNoTruePredsThrowsNoViableAlt() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(171); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a a;\n"); + grammarBuilder.append("a : {false}? ID INT {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {false}? ID INT {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="y 3 x 4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("", found); + + assertEquals("line 1:0 no viable alternative at input 'y'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOrder() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(297); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a {} a; // do 2x: once in ATN, next in DFA;\n"); + grammarBuilder.append("// action blocks lookahead from falling off of 'a'\n"); + grammarBuilder.append("// and looking into 2nd 'a' ref. !ctx dependent pred\n"); + grammarBuilder.append("a : ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 1\n" + + "alt 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredFromAltTestedInLoopBack_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(210); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("file_\n"); + grammarBuilder.append("@after {console.log($ctx.toStringTree(null, this));}\n"); + grammarBuilder.append(" : para para EOF ;\n"); + grammarBuilder.append("para: paraContent NL NL ;\n"); + grammarBuilder.append("paraContent : ('s'|'x'|{this._input.LA(2)!=TParser.NL}? NL)+ ;\n"); + grammarBuilder.append("NL : '\\n' ;\n"); + grammarBuilder.append("s : 's' ;\n"); + grammarBuilder.append("X : 'x' ;"); + String grammar = grammarBuilder.toString(); + String input = + "s\n" + + "\n" + + "\n" + + "x\n"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "file_", input, true); + assertEquals("(file_ (para (paraContent s) \\n \\n) (para (paraContent \\n x \\n)) )\n", found); + + assertEquals( + "line 5:0 mismatched input '' expecting '\n" + + "'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredFromAltTestedInLoopBack_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(210); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("file_\n"); + grammarBuilder.append("@after {console.log($ctx.toStringTree(null, this));}\n"); + grammarBuilder.append(" : para para EOF ;\n"); + grammarBuilder.append("para: paraContent NL NL ;\n"); + grammarBuilder.append("paraContent : ('s'|'x'|{this._input.LA(2)!=TParser.NL}? NL)+ ;\n"); + grammarBuilder.append("NL : '\\n' ;\n"); + grammarBuilder.append("s : 's' ;\n"); + grammarBuilder.append("X : 'x' ;"); + String grammar = grammarBuilder.toString(); + String input = + "s\n" + + "\n" + + "\n" + + "x\n" + + "\n"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "file_", input, true); + assertEquals("(file_ (para (paraContent s) \\n \\n) (para (paraContent \\n x) \\n \\n) )\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredTestedEvenWhenUnAmbig_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(201); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {this.enumKeyword = true;}\n"); + grammarBuilder.append("primary\n"); + grammarBuilder.append(" : ID {console.log(\"ID \"+$ID.text);}\n"); + grammarBuilder.append(" | {!this.enumKeyword}? 'enum' {console.log(\"enum\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n\\r]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "primary", input, false); + assertEquals("ID abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredTestedEvenWhenUnAmbig_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(201); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {this.enumKeyword = true;}\n"); + grammarBuilder.append("primary\n"); + grammarBuilder.append(" : ID {console.log(\"ID \"+$ID.text);}\n"); + grammarBuilder.append(" | {!this.enumKeyword}? 'enum' {console.log(\"enum\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n\\r]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="enum"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "primary", input, false); + assertEquals("", found); + + assertEquals("line 1:0 no viable alternative at input 'enum'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredicateDependentOnArg() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(203); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {this.i = 0;}\n"); + grammarBuilder.append("s : a[2] a[1];\n"); + grammarBuilder.append("a[int i]\n"); + grammarBuilder.append(" : {$i===1}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {$i===2}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 2\n" + + "alt 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredicateDependentOnArg2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(157); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {this.i = 0;}\n"); + grammarBuilder.append("s : a[2] a[1];\n"); + grammarBuilder.append("a[int i]\n"); + grammarBuilder.append(" : {$i===1}? ID \n"); + grammarBuilder.append(" | {$i===2}? ID \n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPredsInGlobalFOLLOW() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(285); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {\n"); + grammarBuilder.append("this.pred = function(v) {\n"); + grammarBuilder.append(" console.log(\"eval=\" + v.toString());\n"); + grammarBuilder.append(" return v;\n"); + grammarBuilder.append("};\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("s : e {this.pred(true)}? {console.log(\"parse\");} '!' ;\n"); + grammarBuilder.append("t : e {this.pred(false)}? ID ;\n"); + grammarBuilder.append("e : ID | ; // non-LL(1) so we use ATN\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="a!"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "eval=true\n" + + "parse\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRewindBeforePredEval() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(217); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a a;\n"); + grammarBuilder.append("a : {this._input.LT(1).text===\"x\"}? ID INT {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {this._input.LT(1).text===\"y\"}? ID INT {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="y 3 x 4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 2\n" + + "alt 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSimple() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(256); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a a a; // do 3x: once in ATN, next in DFA then INT in ATN\n"); + grammarBuilder.append("a : {false}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" | INT {console.log(\"alt 3\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x y 3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 2\n" + + "alt 2\n" + + "alt 3\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSimpleValidate() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(164); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a ;\n"); + grammarBuilder.append("a : {false}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? INT {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("", found); + + assertEquals("line 1:0 no viable alternative at input 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSimpleValidate2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(167); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a a a;\n"); + grammarBuilder.append("a : {false}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? INT {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="3 4 x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 2\n" + + "alt 2\n", found); + + assertEquals("line 1:4 no viable alternative at input 'x'\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testToLeft() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(164); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append(" s : a+ ;\n"); + grammarBuilder.append("a : {false}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x x y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "alt 2\n" + + "alt 2\n" + + "alt 2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testToLeftWithVaryingPredicate() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(252); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@members {this.i = 0;}\n"); + grammarBuilder.append("s : ({this.i += 1;\n"); + grammarBuilder.append("console.log(\"i=\" + this.i);} a)+ ;\n"); + grammarBuilder.append("a : {this.i % 2 === 0}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {this.i % 2 != 0}? ID {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x x y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals( + "i=1\n" + + "alt 2\n" + + "i=2\n" + + "alt 1\n" + + "i=3\n" + + "alt 2\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testUnpredicatedPathsInAlt() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(183); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | b {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("a : {false}? ID INT\n"); + grammarBuilder.append(" | ID INT\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("b : ID ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x 4"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("alt 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testValidateInDFA() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(332); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("s : a ';' a;\n"); + grammarBuilder.append("// ';' helps us to resynchronize without consuming\n"); + grammarBuilder.append("// 2nd 'a' reference. We our testing that the DFA also\n"); + grammarBuilder.append("// throws an exception if the validating predicate fails\n"); + grammarBuilder.append("a : {false}? ID {console.log(\"alt 1\");}\n"); + grammarBuilder.append(" | {true}? INT {console.log(\"alt 2\");}\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("ID : 'a'..'z'+ ;\n"); + grammarBuilder.append("INT : '0'..'9'+;\n"); + grammarBuilder.append("WS : (' '|'\\n') -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="x ; y"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "s", input, false); + assertEquals("", found); + + assertEquals( + "line 1:0 no viable alternative at input 'x'\n" + + "line 1:4 no viable alternative at input 'y'\n", this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java new file mode 100644 index 000000000..98ab83a51 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java @@ -0,0 +1,408 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.javascript.node; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +@SuppressWarnings("unused") +public class TestSets extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testCharSetLiteral() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(85); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : (A {console.log($A.text);})+ ;\n"); + grammarBuilder.append("A : [AaBb] ;\n"); + grammarBuilder.append("WS : (' '|'\\n')+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="A a B b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals( + "A\n" + + "a\n" + + "B\n" + + "b\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testComplementSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(51); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("parse : ~NEW_LINE;\n"); + grammarBuilder.append("NEW_LINE: '\\r'? '\\n';"); + String grammar = grammarBuilder.toString(); + String input ="a"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "parse", input, false); + assertEquals("", found); + + assertEquals( + "line 1:0 token recognition error at: 'a'\n" + + "line 1:1 missing {} at ''\n", this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerOptionalSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(77); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : ('a'|'b')? 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="ac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("ac\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerPlusSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(77); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : ('a'|'b')+ 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="abaac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abaac\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testLexerStarSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(77); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : ('a'|'b')* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="abaac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abaac\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNotChar() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(53); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log($A.text);} ;\n"); + grammarBuilder.append("A : ~'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNotCharSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(59); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log($A.text);} ;\n"); + grammarBuilder.append("A : ~('b'|'c') ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNotCharSetWithLabel() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(61); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log($A.text);} ;\n"); + grammarBuilder.append("A : h=~('b'|'c') ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testNotCharSetWithRuleRef3() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(125); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log($A.text);} ;\n"); + grammarBuilder.append("A : ('a'|B) ; // this doesn't collapse to set but works\n"); + grammarBuilder.append("fragment\n"); + grammarBuilder.append("B : ~('a'|'c') ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptionalLexerSingleElement() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(71); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : 'b'? 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="bc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("bc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptionalSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(69); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ('a'|'b')? 'c' {console.log(this._input.getText());} ;"); + String grammar = grammarBuilder.toString(); + String input ="ac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("ac\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testOptionalSingleElement() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(71); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A? 'c' {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : 'b' ;"); + String grammar = grammarBuilder.toString(); + String input ="bc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("bc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testParserNotSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(57); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : t=~('x'|'y') 'z' {console.log($t.text);} ;"); + String grammar = grammarBuilder.toString(); + String input ="zz"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("z\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testParserNotToken() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(63); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ~'x' 'z' {console.log(this._input.getText());} ;"); + String grammar = grammarBuilder.toString(); + String input ="zz"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("zz\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testParserNotTokenWithLabel() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(51); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : t=~'x' 'z' {console.log($t.text);} ;"); + String grammar = grammarBuilder.toString(); + String input ="zz"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("z\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testParserSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(52); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : t=('x'|'y') {console.log($t.text);} ;"); + String grammar = grammarBuilder.toString(); + String input ="x"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("x\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPlusLexerSingleElement() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(71); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : 'b'+ 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="bbbbc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("bbbbc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testPlusSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(69); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ('a'|'b')+ 'c' {console.log(this._input.getText());} ;"); + String grammar = grammarBuilder.toString(); + String input ="abaac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abaac\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testRuleAsSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(76); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a @after {console.log(this._input.getText());} : 'a' | 'b' |'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="b"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("b\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testSeqDoesNotBecomeSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(113); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : C {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("fragment A : '1' | '2';\n"); + grammarBuilder.append("fragment B : '3' '4';\n"); + grammarBuilder.append("C : A | B;"); + String grammar = grammarBuilder.toString(); + String input ="34"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("34\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testStarLexerSingleElement_1() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(71); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : 'b'* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="bbbbc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("bbbbc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testStarLexerSingleElement_2() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(71); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : A {console.log(this._input.getText());} ;\n"); + grammarBuilder.append("A : 'b'* 'c' ;"); + String grammar = grammarBuilder.toString(); + String input ="c"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("c\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + public void testStarSet() throws Exception { + mkdir(tmpdir); + StringBuilder grammarBuilder = new StringBuilder(69); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("a : ('a'|'b')* 'c' {console.log(this._input.getText());} ;"); + String grammar = grammarBuilder.toString(); + String input ="abaac"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", + "a", input, false); + assertEquals("abaac\n", found); + assertNull(this.stderrDuringParse); + + } + +}