Thanks again folks... sorry for wasting your bandwidth. -rb
On 7/27/2011 2:28 PM, Jim Idle wrote: > Your literal string consists of just 1 double quote, hence the error > message is correct: > > http://msdn.microsoft.com/en-us/library/aa691090(v=vs.71).aspx > > > Jim > > > >> -----Original Message----- >> From: [email protected] [mailto:antlr-interest- >> [email protected]] On Behalf Of G. Richard Bellamy >> Sent: Wednesday, July 27, 2011 2:01 PM >> To: [email protected] >> Subject: [antlr-interest] Empty Quoted String Literal >> >> Sam, Bart& Jim, I really appreciate your help on this. >> >> Here's a more complete example, without the greedy confusion. I'm >> including the combined grammar and a test rig. >> >> I get: CombinedLexer:line 1:2 mismatched character '<EOF>' expecting >> '"' >> just before a NullReferenceException. >> >> GRAMMAR: >> ---------------------------- >> grammar Combined; >> >> options { >> language=CSharp3; >> TokenLabelType=CommonToken; >> output=AST; >> ASTLabelType=CommonTree; >> } >> >> @lexer::namespace{StringLiteralLexerTest} >> @parser::namespace{StringLiteralLexerTest} >> >> /* >> * Parser Rules >> */ >> >> public >> compileUnit >> : STRING >> ; >> >> /* >> * Lexer Rules >> */ >> STRING : '"' ('""' | ~'"')* '"'; >> >> TEST RIG: >> ------------------------------ >> static void Main() >> { >> CombinedLexer lexer = new CombinedLexer(new ANTLRStringStream(@"""")); >> //lexer.TraceDestination = new >> ConsoleTextWriter(typeof(CombinedLexer)); >> >> CommonTokenStream tokenStream = new CommonTokenStream(lexer); >> >> CombinedParser parser = new CombinedParser(tokenStream); >> //parser.TraceDestination = new >> ConsoleTextWriter(typeof(CombinedParser)); >> >> CommonTree parseTree = parser.compileUnit().Tree; >> Console.WriteLine(parseTree.ToStringTree()); >> } >> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest >> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- >> email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
