From d966702d63b1819d57d56b83c5233d9449f84bc2 Mon Sep 17 00:00:00 2001 From: parrt Date: Wed, 15 Mar 2017 09:33:15 -0700 Subject: [PATCH] add wildcard test. --- .../descriptors/ParserExecDescriptors.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java index e1af2492d..3319c28ba 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java @@ -240,8 +240,30 @@ public class ParserExecDescriptors { } + /** Match assignments, ignore other tokens with wildcard. */ + public static class Wildcard extends BaseParserTestDescriptor { + public String input = "x=10; abc;;;; y=99;"; + public String output = "x=10;\ny=99;\n"; + public String errors = null; + public String startRule = "a"; + public String grammarName = "T"; + + /** + grammar T; + a : (assign|.)+ EOF ; + assign : ID '=' INT ';' { + + } ; + ID : 'a'..'z'+ ; + INT : '0'..'9'+; + WS : (' '|'\n') -> skip; + */ + @CommentHasStringValue + public String grammar; + } + /** - * This test ensures that {@link ParserATNSimulator} does not produce a + * This test ensures that {@link org.antlr.v4.runtime.atn.ParserATNSimulator} does not produce a * {@link StackOverflowError} when it encounters an {@code EOF} transition * inside a closure. */