[antlr-interest] Stumped! Nondeterminism between...

Paul Snow paul.snow at conformative.com
Tue May 31 17:41:33 PDT 2005


I don't see this nondeterminism...

Here is my lex grammer, which is supposed to parse out columns, and 
respect comments:

*class Column_Lexer extends Lexer;
options { k=6;  charVocabulary = '\3'..'\377'; filter=JUNK;}

{
    public boolean done = false;
    public void uponEOF() throws TokenStreamException, CharStreamException
    {
        done=true;
    }
}

protected
STRING2 : ('\'' (~('\''))* '\'');

STRING : ('"' (~('"'))* '"') | STRING2 ;
 
 
protected
COMMENTBODY : '/' '*' (~'*'|('*' ~'/'))* '*' '/' ;

protected
COMMENTLINE : "//" (~'\n')* ;

protected
TCL_COMMENT : '#' (~'\n')*;

COMMENT: COMMENTBODY | COMMENTLINE | TCL_COMMENT;

NEWLINE :(('\r' '\n') | '\n' | '\r'){newline(); /**/};

WS :((' '| '\t')+) ;

protected
COLUMN_CHARS: (~( '#' | '\'' | '"' | ' ' | '\t' | '\r' | '\n') )+ ;

COLUMN:  COLUMN_CHARS ;

protected JUNK :  (~('\n'|'\r')) *
    { _ttype = Token.SKIP;
        String x = $getText +"";
        System.out.flush();
        System.err.println("Unable to lex '" + x + "'");
        byte b[] = x.getBytes();
        for(int i=0;i<b.length;i++){ System.err.print((int) b[i]+"."); }
        System.err.flush();
        consume();
    };   
*
Here are my errors:

    Severity    Description    Resource    In Folder    Location   
    Creation Time
    1    lexical nondeterminism between rules COMMENT and COLUMN upon
    k==1:'#'
    k==2:'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==3:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==4:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==5:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==6:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff' 


    Severity    Description    Resource    In Folder    Location  
     Creation Time
    1    lexical nondeterminism between rules STRING and COLUMN upon
    k==1:'"','\''
    k==2:'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==3:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==4:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==5:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'
    k==6:<end-of-token>,'\u0003'..'\u0008','\u000b','\u000c','\u000e'..'\u001f','!','$'..'&','('..'\u00ff'  


Your help is appreciated!

Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050531/1c996807/attachment.html


More information about the antlr-interest mailing list