[antlr-interest] Need help to show error line numbers

Rama Devi ramadevi.java at gmail.com
Thu Feb 2 04:37:45 PST 2012


Hi,


My .g file contains the following code, but it is not returning the error
line number and always shows as 1.  Please find below code and help me out
in finding the bug and generate correct line number.


Regards
Rama.

.g file code
========

@lexer::members {
    public boolean success = true;
    public Vector<ValidationError> errors = new Vector<ValidationError>();

    @Override
    public void reportError(RecognitionException exc) {
        success = false;
        String[] tokenNames = this.getTokenNames();
        String errorMessage = this.getErrorMessage(exc, tokenNames);

        ValidationError _valError = new ValidationError();
        _valError.setDescription(errorMessage);
        _valError.setCharacterPosition(exc.charPositionInLine == 0 ?
exc.charPositionInLine + 1 : exc.charPositionInLine);
        _valError.setLineNumber(exc.line == 0 ? exc.line + 1 :
exc.line);
        errors.add(_valError);
    }
}

@members {
    public boolean success = true;
    public Vector<ValidationError> errors = new Vector<ValidationError>();

    protected void AddError(RecognitionException exc)
    {
        success = false;
        String[] tokenNames = this.getTokenNames();
        String errorMessage = this.getErrorMessage(exc, tokenNames);

        ValidationError _valError = new ValidationError();
        _valError.setDescription(errorMessage);
        _valError.setCharacterPosition(exc.charPositionInLine == 0 ?
exc.charPositionInLine + 1 : exc.charPositionInLine);
        _valError.setLineNumber(exc.line == 0 ? exc.line + 1 :
exc.line);
        errors.add(_valError);
    }

    public void displayRecognitionError(String[] tokenNames,
RecognitionException exc)
    {
        success = false;
        String errorMessage = this.getErrorMessage(exc, tokenNames);

        ValidationError _valError = new ValidationError();
        _valError.setDescription(errorMessage);
        _valError.setCharacterPosition(exc.charPositionInLine == 0 ?
exc.charPositionInLine + 1 : exc.charPositionInLine);
        _valError.setLineNumber(exc.line == 0 ? exc.line + 1 : exc.line);
        errors.add(_valError);
    }

    protected void Evaluate(Evaluator eval, int line, int pos, String text)
    {
        try
        {
            ValidationError _valError = eval.evaluate();
            String _errDescription = _valError.getDescription();
              if (_errDescription.length() > 0) {
                  success = false;
                  _valError.setLineNumber(line);
                  _valError.setCharacterPosition(pos);
                  _valError.setExcerpt(text);
                  errors.add(_valError);
              }
        }
        catch (Exception exc)
        {
            success = false;
            ValidationError _valError = new ValidationError();
            _valError.setDescription(exc.getMessage());
            errors.add(_valError);
        }
    }
}

callingProtocol
    :    (connectBlock | messageBlock)+
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

connectBlock
    :    CONNECT
            protocolBlock*
        ENDCONNECT
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

messageBlock
    :    MESSAGE messageOptions (',' messageOptions)*
            (OUTGOING | BACKLOGGED)?
            protocolBlock*
        ENDMESSAGE
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

protocolBlock
    :    protocolStatement |
        commandStatement |
        getStatement |
        greetingStatement |
        listenStatement |
        menuStatement |
        setAnalysisStatement |
        logStatement |
        waitStatement
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

messageOptions
    :    ACKED |
        ALL |
        ALL SERVICE |
        SERVICE i1=INTEGER |
        ARRIVAL '>' |
        ARRIVED |
        CLEAR '>' |
        CLOSED '>' |
        TICKET '>' |
        INITIAL |
        TIMER i2=INTEGER
        {
            Evaluator eval = new RangeEvaluator("Message Service",
$i1.text, "2", "8");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);

            eval = new RangeEvaluator("Message Timer", $i2.text, "1", "9");
            Evaluate(eval, $i2.line, $i2.pos, $i2.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

commandStatement
    :    dialStatement |
        sayStatement |
        sendStatement |
        sharedDirectoryOptions
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

dialStatement
    :    DIAL dialOptions
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

dialOptions
    :    STRING_LITERAL |
        CONTACTID contactIdOptions |
        DISPATCHERPHONE |
        extensionStatement |
        ID i1=INTEGER |
        PHONE |
        PREFIX |
        STATUSCODE |
        SUFFIX |
        TICKET |
        WORKREQ STRING_LITERAL
        {
            Evaluator eval = new RangeEvaluator("Dial ID", $i1.text, "1",
"4");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

contactIdOptions
    :    CALLED |
        REFERENCED |
        STRING_LITERAL
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

waitParm
    :    WAIT '=' w1=WAITPARM
        {
            Evaluator eval = new WaitTicksEvaluator($w1.text);
            Evaluate(eval, $w1.line, $w1.pos, $w1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

getStatement
    :    GET getOptions ','
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

getOptions
    :    CONTACTLOGIN |
        PASSWORD |
        STRING_LITERAL
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

greetingStatement
    :    GREETING waitParm
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

listenStatement
    :    LISTEN
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

menuStatement
    :    MENU
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

protocolStatement
    :    PROTOCOL INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

sayStatement
    :    SAY sayOptions
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

sayOptions
    :    ADDRESS |
        BACKLOGGED |
        STRING_LITERAL |
        COMMON INTEGER |
        CONDITION |
        CONTACT (contactIdOptions)? |
        CUSTOM INTEGER |
        extensionStatement |
        ID i1=INTEGER |
        phoneStatement |
        REFERENCE |
        START |
        STATUS |
        TICKET
        {
            Evaluator eval = new RangeEvaluator("Say ID", $i1.text, "1",
"4");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

sendStatement
    :    SEND sendOptions
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

sendOptions
    :    STRING_LITERAL |
        ADDRESS i1=INTEGER |
        CONTACT contactIdOptions |
        CONTACTID contactIdOptions |
        DISPATCHERPHONE |
        extensionStatement |
        i2=ID INTEGER |
        phoneStatement |
        STATUS |
        STATUSCODE |
        TICKET |
        WORKREQ STRING_LITERAL |
        WORKREQDESC
        {
            Evaluator eval = new RangeEvaluator("Send Address", $i1.text,
"1", "2");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);

            eval = new RangeEvaluator("Send ID", $i2.text, "1", "4");
            Evaluate(eval, $i2.line, $i2.pos, $i2.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

extensionStatement
    :    EXTENSION (i1=INTEGER)? (',' CONTACT '=' contactIdOptions)?
        {
            Evaluator eval = new RangeEvaluator("Say Extension", $i1.text,
"1", "3");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

phoneStatement
    :    PHONE i1=INTEGER (',' CONTACT '=' contactIdOptions)?
        {
            Evaluator eval = new RangeEvaluator("Say Phone", $i1.text, "1",
"3");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

setAnalysisStatement
    :    SET ANALYSIS (CONTACT | INTEGER)
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

logStatement
    :    LOG INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

waitStatement
    :    WAIT waitParm
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

numIdent
    :    (INTEGER | IDENT)+
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

relation
    : ('=' | '!=' | '<' | '<=' | '>=' | '>')
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

sharedDirectoryOptions
    :    ifStatement |
        whileLoop |
        fileCloseStatement |
        fileCreateStatement |
        fileDeleteStatement |
        fileMoveStatement |
        fileNameRetrieveStatement |
        fileOpenFirstStatement |
        fileOpenNextStatement |
        fileReadDecalStatement |
        fileReadRemoteStatement |
        fileWriteStatement |
        fileWriteDataStatement |
        fileWriteDecalStatement |
        logDispatchStatement |
        logFailureStatement |
        logSuccessStatement |
        setFilepathStatement |
        readStatement |
        recformStatement |
        generateStatusStatement
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

recformStatement
    :    RECFORM INTEGER (',' PARM '=' p1=INTEGER)? (',' USE '=' PARMS)?
        {
            Evaluator eval = new ParmEvaluator($p1.text);
            Evaluate(eval, $p1.line, $p1.pos, $p1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

readStatement
    :    READ PARM '=' p1=INTEGER ',' ROW '=' r1=INTEGER ',' COL '='
c1=INTEGER ',' LEN '=' l1=INTEGER
        {
            Evaluator eval = new ParmEvaluator($p1.text);
            Evaluate(eval, $p1.line, $p1.pos, $p1.text);

            eval = new RangeEvaluator("Row", $r1.text, "1", "255");
            Evaluate(eval, $r1.line, $r1.pos, $r1.text);

            eval = new RangeEvaluator("Col", $c1.text, "1", "255");
            Evaluate(eval, $c1.line, $c1.pos, $c1.text);

            eval = new RangeEvaluator("Len", $l1.text, "1", "255");
            Evaluate(eval, $l1.line, $l1.pos, $l1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileCreateStatement
    :    FILECREATE UNIQUE i1=INTEGER
        {
            Evaluator eval = new RangeEvaluator("FileCreate Unique",
$i1.text, "1", "5");
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileCloseStatement
    :    FILECLOSE
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileDeleteStatement
    :    FILEDELETE
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileMoveStatement
    :    f=FILEMOVE i1=STRING_LITERAL
        {
            Evaluator eval = new FilepathEvaluator($i1.text);
            Evaluate(eval, $f.line, $f.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileNameRetrieveStatement
    :    FILENAMERETRIEVE PARM '=' i1=INTEGER
        {
            Evaluator eval = new ParmEvaluator($i1.text);
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileOpenFirstStatement
    :    FILEOPENFIRST STRING_LITERAL
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileOpenNextStatement
    :    FILEOPENNEXT
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileReadDecalStatement
    :    FILEREADDECAL
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileReadRemoteStatement
    :    FILEREADREMOTE
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileWriteStatement
    :    FILEWRITE STRING_LITERAL
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileWriteDataStatement
    :    f1=FILEWRITEDATA '\"' s1=numIdent? '\"'
        {
            Evaluator eval = new ParmSubstitutionEvaluator($s1.text);
            Evaluate(eval, $f1.line, $f1.pos, $s1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileWriteDecalStatement
    :    FILEWRITEDECAL
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

generateStatusStatement
    :    GENERATESTATUS STRING_LITERAL (',' ID '=' STRING_LITERAL)?
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

logDispatchStatement
    :    LOGDISPATCH
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

logFailureStatement
    :    LOGFAILURE
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

logSuccessStatement
    :    LOGSUCCESS
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

setFilepathStatement
    :    SET FILEPATH i1=STRING_LITERAL
        {
            Evaluator eval = new FilepathEvaluator($i1.text);
            Evaluate(eval, $i1.line, $i1.pos, $i1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

expression
    :    fileDateTime |
        fileResult |
        fileSize |
        recformResult |
        strcmpResult |
        systemDateTime |
        valcmpResult
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

conditionalStatement
    :    '('? expression (mathematical expression)* ')'?
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

ifStatement
    :    IF conditionalStatement
            protocolBlock*
        (ELSEIF
            protocolBlock*)*
        (ELSE
            protocolBlock*)?
        ENDIF
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

mathematical
    :    AND |
        OR |
        '*' |
        '/' |
        '+' |
        '-'
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

whileLoop
    :    LOOP WHILE conditionalStatement+ ',' MAXTIME '=' t1=WAITPARM
            protocolBlock*
        ENDLOOP
        {
            Evaluator eval = new MaxTimeEvaluator($t1.text);
            Evaluate(eval, $t1.line, $t1.pos, $t1.text);
        }
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileDateTime
    :    FILEDATETIME relation INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileResult
    :    FILERESULT relation INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

fileSize
    :    FILESIZE relation INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

recformResult
    :    RECFORMRESULT relation INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

strcmpResult
    :    STRCMPRESULT relation (TRUE | FALSE)
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

systemDateTime
    :    SYSTEMDATETIME relation INTEGER
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

valcmpResult
    :    VALCMPRESULT relation (TRUE | FALSE)
    ;
    catch [RecognitionException ex] {
        AddError(ex);
    }

SET: ('s' | 'S')('e' | 'E')('t'| 'T');
ANALYSIS: ('a' | 'A')('n' | 'N')('a' | 'A')('l' | 'L')('y' | 'Y')('s' |
'S')('i' | 'I')('s' | 'S');
SEND: ('s' | 'S')('e' | 'E')('n' | 'N')('d' | 'D');
START: ('s' | 'S')('t'| 'T')('a' | 'A')('r' | 'R')('t'| 'T');
CUSTOM: ('c' | 'C')('u' | 'U')('s' | 'S')('t'| 'T')('o' | 'O')('m' | 'M');
CONDITION: ('c' | 'C')('o' | 'O')('n' | 'N')('d' | 'D')('i' | 'I')('t'|
'T')('i' | 'I')('o' | 'O')('n' | 'N');
COMMON: ('c' | 'C')('o' | 'O')('m' | 'M')('m' | 'M')('o' | 'O')('n' | 'N');
ADDRESS: ('a' | 'A')('d' | 'D')('d' | 'D')('r' | 'R')('e' | 'E')('s' |
'S')('s' | 'S');
SAY: ('s' | 'S')('a' | 'A')('y' | 'Y');
PROTOCOL: ('p' | 'P')('r' | 'R')('o' | 'O')('t'| 'T')('o' | 'O')('c' |
'C')('o' | 'O')('l' | 'L');
MENU: ('m' | 'M')('e' | 'E')('n' | 'N')('u' | 'U');
LISTEN: ('l' | 'L')('i' | 'I')('s' | 'S')('t'| 'T')('e' | 'E')('n' | 'N');
GREETING: ('g' | 'G')('r' | 'R')('e' | 'E')('e' | 'E')('t'| 'T')('i' |
'I')('n' | 'N')('g' | 'G');
RETRIESPARM: '/' INTEGER;
PASSWORD: ('p' | 'P')('a' | 'A')('s' | 'S')('s' | 'S')('w' | 'W')('o' |
'O')('r' | 'R')('d' | 'D');
WAITPARM: INTEGER ':' INTEGER ('.' INTEGER)? (RETRIESPARM)?;
WAIT: ('w' | 'W')('a' | 'A')('i' | 'I')('t' | 'T');
CONTACT: ('c' | 'C')('o' | 'O')('n' | 'N')('t' |'T')('a' | 'A')('c' |
'C')('t'| 'T');
LOGIN: ('l' | 'L')('o' | 'O')('g' | 'G')('i' | 'I')('n' | 'N');
CONTACTLOGIN: CONTACT LOGIN;
GET: ('g' | 'G')('e' | 'E')('t' | 'T');
WORKREQ: ('w' | 'W')('o' | 'O')('r' | 'R')('k' | 'K')('r' | 'R')('e' |
'E')('q' | 'Q');
WORKREQDESC: ('w' | 'W')('o' | 'O')('r' | 'R')('k' | 'K')('r' | 'R')('e' |
'E')('q' | 'Q')('d' | 'D')('e' | 'E')('s' | 'S')('c' | 'C');
SUFFIX: ('s' | 'S')('u' | 'U')('f' | 'F')('f' | 'F')('i' | 'I')('x' | 'X');
STATUS: ('s' | 'S')('t' | 'T')('a' | 'A')('t' | 'T')('u' | 'U')('s' | 'S');
STATUSCODE: STATUS ('c' | 'C')('o' | 'O')('d' | 'D')('e' | 'E');
PREFIX: ('p' | 'P')('r' | 'R')('e' | 'E')('f' | 'F')('i' | 'I')('x' | 'X');
ID: ('i' | 'I')('d' | 'D');
EXTENSION: ('e' | 'E')('x' | 'X')('t' | 'T')('e' | 'E')('n' | 'N')('s' |
'S')('i' | 'I')('o' | 'O')('n' | 'N');
PHONE: ('p' | 'P')('h' | 'H')('o' | 'O')('n' | 'N')('e' | 'E');
DISPATCHERPHONE: ('d' | 'D')('i' | 'I')('s' | 'S')('p' | 'P')('a' |'A')('t'
| 'T')('c' | 'C')('h' | 'H')('e' | 'E')('r' |'R')PHONE;
REFERENCE: ('r' | 'R')('e' | 'E')('f' | 'F')('e' | 'E')('r' | 'R')('e' |
'E')('n' | 'N')('c' | 'C')('e' | 'E');
REFERENCED: ('r' | 'R')('e' | 'E')('f' | 'F')('e' | 'E')('r' | 'R')('e' |
'E')('n' | 'N')('c' | 'C')('e' | 'E')('d' | 'D');
CALLED: ('c' | 'C')('a' |'A')('l' | 'L')('l' | 'L')('e' | 'E')('d' | 'D');
CONTACTID: ('c' | 'C')('o' | 'O')('n' | 'N')('t' | 'T')('a' |'A')('c' |
'C')('t' | 'T')('i' | 'I')('d' | 'D');
DIAL: ('d' | 'D')('i' | 'I')('a' |'A')('l' | 'L');
ACKED: ('a' |'A')('c' | 'C')('k' | 'K')('e' | 'E')('d' | 'D');
ALL: ('a' |'A')('l' | 'L')('l' | 'L');
SERVICE: ('s' | 'S')('e' | 'E')('r' | 'R')('v' | 'V')('i' | 'I')('c' |
'C')('e' | 'E');
ARRIVAL: ('a' |'A')('r' | 'R')('r' | 'R')('i' | 'I')('v' | 'V')('a'
|'A')('l' | 'L');
ARRIVED: ('a' |'A')('r' | 'R')('r' | 'R')('i' | 'I')('v' | 'V')('e' |
'E')('d' | 'D');
CLEAR: ('c' | 'C')('l' | 'L')('e' | 'E')('a' |'A')('r' | 'R');
CLOSED: ('c' | 'C')('l' | 'L')('o' | 'O')('s' | 'S')('e' | 'E')('d' | 'D');
TICKET: ('t' | 'T')('i' | 'I')('c' | 'C')('k' | 'K')('e' | 'E')('t' | 'T');
INITIAL: ('i' | 'I')('n' | 'N')('i' | 'I')('t' | 'T')('i' | 'I')('a'
|'A')('l' | 'L');
TIMER: ('t' | 'T')('i' | 'I')('m' | 'M')('e' | 'E')('r' | 'R');
OUTGOING: ('o' | 'O')('u' | 'U')('t' | 'T')('g' | 'G')('o' | 'O')('i' |
'I')('n' | 'N')('g' | 'G');
BACKLOGGED: ('b' | 'B')('a' | 'A')('c' | 'C')('k' | 'K')('l' | 'L')('o' |
'O')('g' | 'G')('g' | 'G')('e' | 'E')('d' | 'D');
MESSAGE: ('m' | 'M')('e' | 'E')('s' | 'S')('s' | 'S')('a' | 'A')('g' |
'G')('e' | 'E');
ENDMESSAGE: END MESSAGE;
CONNECT: ('c' | 'C')('o' | 'O')('n' | 'N')('n' | 'N')('e' | 'E')('c' |
'C')('t' | 'T');
ENDCONNECT: END CONNECT;
END: ('e' | 'E')('n' | 'N')('d' | 'D');
LOG: ('l' | 'L')('o' | 'O')('g' | 'G');
FILE: ('f' | 'F')('i' | 'I')('l' | 'L')('e' | 'E');
CREATE: ('c' | 'C')('r' | 'R')('e' | 'E')('a' | 'A')('t' | 'T')('e' | 'E');
UNIQUE: ('u' | 'U')('n' | 'N')('i' | 'I')('q' | 'Q')('u' | 'U')('e' | 'E');
DATETIME: ('d' | 'D')('a' | 'A')('t' | 'T')('e' | 'E')('t' | 'T')('i' |
'I')('m' | 'M')('e' | 'E');
FILEDATETIME: FILE '.' DATETIME;
FILECREATE: FILE CREATE;
IF: ('i' | 'I')('f' | 'F');
ELSE: ('e' | 'E')('l' | 'L')('s' | 'S')('e' | 'E');
ELSEIF: ELSE IF;
ENDIF: END IF;
LOOP: ('l' | 'L')('o' | 'O')('o' | 'O')('p' | 'P');
WHILE: ('w' | 'W')('h' | 'H')('i' | 'I')('l' | 'L')('e' | 'E');
ENDLOOP: END LOOP;
MAXTIME: ('m' | 'M')('a' | 'A')('x' | 'X')('t' | 'T')('i' | 'I')('m' |
'M')('e' | 'E');
RESULT: ('r' | 'R')('e' | 'E')('s' | 'S')('u' | 'U')('l' | 'L')('t' | 'T');
FILERESULT: FILE '.' RESULT;
SIZE: ('s' | 'S')('i' | 'I')('z' | 'Z')('e' | 'E');
FILESIZE: FILE '.' SIZE;
RECFORM: ('r' | 'R')('e' | 'E')('c' | 'C')('f' | 'F')('o' | 'O')('r' |
'R')('m' | 'M');
RECFORMRESULT: RECFORM '.' RESULT;
STRCMP: ('s' | 'S')('t' | 'T')('r' | 'R')('c' | 'C')('m' | 'M')('p' | 'P');
STRCMPRESULT: STRCMP '.' RESULT;
SYSTEM: ('s' | 'S')('y' | 'Y')('s' | 'S')('t' | 'T')('e' | 'E')('m' | 'M');
SYSTEMDATETIME: SYSTEM '.' DATETIME;
TRUE: ('t' | 'T')('r' | 'R')('u' | 'U')('e' | 'E');
FALSE: ('f' | 'F')('a' | 'A')('l' | 'L')('s' | 'S')('e' | 'E');
VALCMP: ('v' | 'V')('a' | 'A')('l' | 'L')('c' | 'C')('m' | 'M')('p' | 'P');
VAL1: ('v' | 'V')('a' | 'A')('l' | 'L') '1';
VAL2: ('v' | 'V')('a' | 'A')('l' | 'L') '2';
VALCMPRESULT: VALCMP '.' RESULT;
PING: ('p' | 'P')('i' | 'I')('n' | 'N')('g' | 'G');
PINGRESULT: PING '.' RESULT;
CLOSE: ('c' | 'C')('l' | 'L')('o' | 'O')('s' | 'S')('e' | 'E');
FILECLOSE: FILE CLOSE;
DELETE: ('d' | 'D')('e' | 'E')('l' | 'L')('e' | 'E')('t' | 'T')('e' | 'E');
FILEDELETE: FILE DELETE;
READ: ('r' | 'R')('e' | 'E')('a' | 'A')('d' | 'D');
WRITE: ('w' | 'W')('r' | 'R')('i' | 'I')('t' | 'T')('e' | 'E');
MOVE: ('m' | 'M')('o' | 'O')('v' | 'V')('e' | 'E');
FILEMOVE: FILE MOVE;
NAME: ('n' | 'N')('a' | 'A')('m' | 'M')('e' | 'E');
RETRIEVE: ('r' | 'R')('e' | 'E')('t' | 'T')('r' | 'R')('i' | 'I')('e' |
'E')('v' | 'V')('e' | 'E');
FILENAMERETRIEVE: FILE NAME RETRIEVE;
OPEN: ('o' | 'O')('p' | 'P')('e' | 'E')('n' | 'N');
FIRST: ('f' | 'F')('i' | 'I')('r' | 'R')('s' | 'S')('t' | 'T');
FILEOPENFIRST: FILE OPEN FIRST;
NEXT: ('n' | 'N')('e' | 'E')('x' | 'X')('t' | 'T');
FILEOPENNEXT: FILE OPEN NEXT;
DECAL: ('d' | 'D')('e' | 'E')('c' | 'C')('a' | 'A')('l' | 'L');
FILEREADDECAL: FILE READ DECAL;
REMOTE: ('r' | 'R')('e' | 'E')('m' | 'M')('o' | 'O')('t' | 'T')('e' | 'E');
FILEREADREMOTE: FILE READ REMOTE;
FILEWRITE: FILE WRITE;
FILEWRITEDECAL: FILE WRITE DECAL;
DATA: ('d' | 'D')('a' | 'A')('t' | 'T')('a' | 'A');
FILEWRITEDATA: FILE WRITE DATA;
GENERATE: ('g' | 'G')('e' | 'E')('n' | 'N')('e' | 'E')('r' | 'R')('a' |
'A')('t' | 'T')('e' | 'E');
GENERATESTATUS: GENERATE STATUS;
DISPATCH: ('d' | 'D')('i' | 'I')('s' | 'S')('p' | 'P')('a' | 'A')('t' |
'T')('c' | 'C')('h' | 'H');
LOGDISPATCH: LOG DISPATCH;
FAILURE: ('f' | 'F')('a' | 'A')('i' | 'I')('l' | 'L')('u' | 'U')('r' |
'R')('e' | 'E');
LOGFAILURE: LOG FAILURE;
SUCCESS: ('s' | 'S')('u' | 'U')('c' | 'C')('c' | 'C')('e' | 'E')('s' |
'S')('s' | 'S');
LOGSUCCESS: LOG SUCCESS;
PATH: ('p' | 'P')('a' | 'A')('t' | 'T')('h' | 'H');
FILEPATH: FILE PATH;
PARM: ('p' | 'P')('a' | 'A')('r' | 'R')('m' | 'M');
PARMS: ('p' | 'P')('a' | 'A')('r' | 'R')('m' | 'M')('s' | 'S');
ROW: ('r' | 'R')('o' | 'O')('w' | 'W');
COL: ('c' | 'C')('o' | 'O')('l' | 'L');
LEN: ('l' | 'L')('e' | 'E')('n' | 'N');
USE: ('u' | 'U')('s' | 'S')('e' | 'E');
AND: ('a' | 'A')('n' | 'N')('d' | 'D');
OR: ('o' | 'O')('r' | 'R');

INTEGER : '0'..'9'+ ;
IDENT: (('0'..'9') | ('A'..'Z') | ('a'..'z') | '*' | '#' | '_' | '.' | '\\'
| '@' | ':')+;
STRING_LITERAL: '"' ~('"' | '\r' | '\n')* '"';
WS : (' ' | '\t' | '\n' | '\r' | '\f')+ {$channel = HIDDEN;};
COMMENT : '\'' .* ('\n' | '\r') {$channel = HIDDEN;};


More information about the antlr-interest mailing list