[antlr-interest] gUnit error with NewLine

George S. Cowan cowang at comcast.net
Mon Nov 10 07:09:42 PST 2008


Is this the place to submit gUnit BUGs?
 
Using the Expr.g for the ANTLR Ref, Ch. 3 the following test doesn't work
correctly
--------
/**Expr.testsuite - for the Expr.g grammar of ANTLR Ref, Ch. 3
 *
 * This test should succeed, but gives a failure when this file has PC line
endings:
 *   1 failures found:
 *   test1 (stat, line29) - 
 *   expected: OK
 *   actual: FAIL
 *
 * For UNIX line endings it gives an exception:
 *   Exception in thread "main" java.lang.StringIndexOutOfBoundsException:
String index out of range: -1
 *    at java.lang.String.substring(Unknown Source)
 *    at org.antlr.gunit.gUnitLexer.mML_STRING(gUnitLexer.java:490)
 *    at org.antlr.gunit.gUnitLexer.mTokens(gUnitLexer.java:1338)
 *    at org.antlr.runtime.Lexer.nextToken(Lexer.java:84)
 *    at
org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java:119)
 *    at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238)
 *    at org.antlr.runtime.Parser.getCurrentInputSymbol(Parser.java:54)
 *    at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:104)
 *    at org.antlr.gunit.gUnitParser.gUnitDef(gUnitParser.java:76)
 *    at org.antlr.gunit.Interp.parse(Interp.java:75)
 *    at org.antlr.gunit.Interp.main(Interp.java:60)
 */
 
gunit Expr;
 
stat
: 
  // test newline                
  <<
>> OK
-----------------------
 
I'm using ANTLR 3.1.1, Java 1.6.0_07, MSWindows XP SP3
 
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081110/19439ca6/attachment.html 


More information about the antlr-interest mailing list