[antlr-interest] Out of Memory in antlr.CharScanner.match
Yury Serdyuk
Yury at serdyuk.botik.ru
Mon Jul 23 15:05:49 PDT 2007
Hi !
I have a (C#) grammar with the rule
COMMENT1
: "//" ( ~ ( '\n' | '\r' ) )* {$setType ( Token.SKIP ); }
;
If "//" are two last symbols in the input text, lexer failed with
> Unhandled Exception: System.OutOfMemoryException: Out of memory
> at <0x00000> <unknown method>
> at (wrapper managed-to-native) System.String:InternalAllocateStr (int)
> at System.Text.StringBuilder.InternalEnsureCapacity (Int32 size)
> [0x00000]
> at System.Text.StringBuilder.Append (Char value) [0x00000]
> at antlr.CharScanner.append (Char c) [0x00000]
> at antlr.CharScanner.consume () [0x00000]
> at antlr.CharScanner.match (antlr.collections.impl.BitSet b) [0x00000]
> at MCSlexer.mCOMMENT1 (Boolean _createToken) [0x00000]
for C#-runtime.
For Java-runtime, the log is
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
> at antlr.ANTLRStringBuffer.append(ANTLRStringBuffer.java:36)
> at antlr.CharScanner.append(CharScanner.java:66)
> at antlr.CharScanner.consume(CharScanner.java:84)
> at antlr.CharScanner.match(CharScanner.java:207)
> at MCSlexer.mCOMMENT1(MCSlexer.java:432)
But if I form a grammar from the one simple rule in the parser and from
the same lexer the error is disappeared.
Any help ?
With best wishes,
Yury Serdyuk.
More information about the antlr-interest
mailing list