Hi,

I have a sql.g grammar, and I use token NULL = 'null';

I get error NoViableAltException

Error: False
Linea: 39 Char: 48
UnexpectedType 69
Reale.Parsers.SqlOracle
[...@604,917:920='NULL',<69>,39:48]


Se produjo una excepción de tipo 'Antlr.Runtime.NoViableAltException'.
   en Reale.Parsers.SqlOracle.SQLOracleParser.columnValue() en 
e:\antlr\lexerexample\sqloracleparser.cs:línea 2335


nulo  :
         NULL // this way doesn't work !!!
        //'NULL' // this way work !!!
        ;


I show fragment of my grammar:


grammar SQLOracle;

options {
        language=CSharp2;
        backtrack=true;
        memoize=true;
        output=AST;
        //ASTLabelType=CommonTree;
        ASTLabelType=SqlOracleAST;
        
    //tokenVocab=FKVM;
        
}

...more...

constant 
:
        stringLiteral  
        | nulo
        //nonNegativeInteger 
        //| Real 
        //| intervalLiteral 
        //| HexLiteral
        // subset of ISO 8601 recommended for SQL Server 2005
        //| Iso8601DateTime 
        //| TIMESTAMP s = stringLiteral 
        // currency & system variables not supported
        ;       
        
        
// SQL 92 allows string literals broken by whitespace/comments
// (as long as it contains a newline - we're more permissive than that,
// and also allow mixing ASCII parts into Unicode strings).
stringLiteral :
        singleStringLiteral ( singleStringLiteral )*
        ;

singleStringLiteral  :
        UnicodeStringLiteral 
        | AsciiStringLiteral 
        ;
                
                
        
nulo  :
         NULL // this way doesn't work !!!
        //'NULL' // this way work !!!
        ;



...more...

NULL : 'null' ;

fragment
AsciiStringRun :
        // single-line literals only
        ( '\t' | ' ' .. '&' | '(' .. '~' )+
        ;

AsciiStringLiteral :
        '\'' { $text = ""; }
        ( s = AsciiStringRun { $text = $s.text; } )? '\''
        ( '\'' {
                        $text = $text + "\'";
                } ( s = AsciiStringRun { $text = $text + $s.text; } )? '\''
        )*
        ;

fragment
UnicodeStringRun :
        (~ '\'' )+
        ;

UnicodeStringLiteral :
        'n' '\'' { $text = ""; }
        ( s = UnicodeStringRun { $text = $s.text; } )? '\''
        ( '\'' {
                        $text = $text + "\'";
                } ( s = UnicodeStringRun { $text = $text + $s.text; } )? '\''
        )*
        ;


Any suggestions, please

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.

Reply via email to