[antlr-interest] ANTLR BUG
Edwards, Waverly
Waverly.Edwards at genesys.com
Fri Aug 24 15:29:44 PDT 2007
> I don> '> t know if this is an ANTLR or an Antlrworks bug 1.1.2
>
> I am using Antlrworks 1.1.2 and get the following message
> when debugging the below grammar.
>
>
> "Cannot launch the debugger.
> Time-out waiting to connect to the remote parser."
>
>
> I Googled the error and found out that if there is something
> wrong with the grammar or the code block that you can get
> this message. I've had times where something incorrect
> about my Java usage in the action code block and received
> this alert. Ok, I'm not happy about it but I've accepted that
> Antlrworks doesn> '> t tell me where the problem is, it just tosses
> up this dialog which isn't very helpful. I would consider this a
> bug BUT here is the real BUG.
>
>
> BUG ALERT:
> The below code is valid. I have tested the action code block
> using the NetBeans IDE a number of times. I just replace
> getText() with a valid string. The following two lines seem to
> be offensive.
>
> if ( txt.charAt(0) == quoteChr ) txt.deleteCharAt(0);
> if ( txt.charAt( lastCharPos ) == quoteChr ) txt.deleteCharAt( lastCharPos );
>
> If either or both of these lines are commented out the debugger works.
> If both of these lines are uncommented the debugger fails, giving the
> "Cannot launch the debugger> ...> " message. Separately they pose no
> threat but together they generate a failure. It would seem that Antlrworks
> is to blame but I don> '> t know this since I don> '> t know how the underlying
> architecture works, as the problem may really be ANTLR which is why
> I entitled the message "ANTLR BUG"
>
> Thank you for your time,
>
>
>
> W.
>
> Interesting that "Google" or "Googling" is a verb.
>
>
>
> grammar QUOTETEST;
>
>
> prog : start+ ;
>
> start : (ID | INTEGER | DBLQUOTE | SYMBOL | NEWLINE )
> ;
>
> NEWLINE : '\r'? '\n';
> WS : (' ' | '\t' | '\n' | '\r') {$channel=HIDDEN;}
> ;
> ID : Letter (Letter | Digit)*
> ;
> INTEGER
> : Digit (Digit)*
> ;
> SYMBOL : ('+' | '-' | '=')*
> ;
>
> fragment
> Letter : 'a'..'z' | 'A'..'Z'
> ;
> fragment
> Digit : '0'..'9'
> ;
>
>
> DBLQUOTE
> : '"'
> (~'"' | '""')*
> '"'
> {
>
> int where, lastCharPos;
> String quote, dblDblQuote, cont;
> StringBuffer txt;
> char quoteChr = 34;
>
> cont = "¬\r\n"; // window continuation
> //cont = "¬\r" // mac continuation
> //cont = "¬\n" // unix continuation
> dblDblQuote = "\"\"";
> quote = "\n";
> txt = new StringBuffer(getText());
> lastCharPos = txt.length( )-1;
>
> // Remove first and last double-quote
> if ( txt.charAt(0) == quoteChr ) txt.deleteCharAt(0);
> // if ( txt.charAt( lastCharPos ) == quoteChr ) txt.deleteCharAt( lastCharPos );
> System.out.println( txt.toString() );
> }
> ;
>
> > <<quotedText.txt>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070824/2c8d2592/attachment-0001.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: quotedText.txt
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20070824/2c8d2592/attachment-0001.txt
More information about the antlr-interest
mailing list