[antlr-interest] unexpected char: '''

Luke A. Guest laguest at archangeli.demon.co.uk
Mon May 7 11:15:42 PDT 2007


Hi,

I'm a newbie to antlr and am using 2.7.7. I'm attempting to just get a
basic scanner for Ada 2005. At the moment, I'm just trying to get
something very basic going, not using UCS/Unicode, just ASCII and I just
want to define a few delimeters for testing purposed.

Implementation language is C++.

If I remove the "MINUS" line from below, it compiles fine, cany anyone
tell me what it wrong here?

I'm getting the following error from antlr:

ANTLR Parser Generator   Version 2.7.7 (20070424)   1989-2005
error: Token stream error reading grammar(s):
ada2005.g:48:15: unexpected char: '''
TokenStreamException: unexpected char: 0x2013
make: *** [SpiritScanner.cpp] Error 1

>From the following file:

//
-----------------------------------------------------------------------------
// ANTLR 2.7.7 grammar for Spirit, an Ada 2005 subset.
//
-----------------------------------------------------------------------------
header {
//
-----------------------------------------------------------------------------
// Any extra headers go in here.
//
-----------------------------------------------------------------------------
}

options {
    language="Cpp";
}

//
-----------------------------------------------------------------------------
// The lexical analyser.
//
-----------------------------------------------------------------------------
{
//
-----------------------------------------------------------------------------
// Premable goes here.
//
-----------------------------------------------------------------------------
}

//
-----------------------------------------------------------------------------
//
//
-----------------------------------------------------------------------------

/**
 *
 */

class SpiritScanner extends Lexer;

options
    {
    k = 2;
    caseSensitive = false;
    filter = true; // ignore rules for missing stuff, for now.
    charVocabulary = '\3'..'\377';
    }

AMPERSAND:    '&';
TICK:         '\'';
LPAREN:       '(';
RPAREN:       ')';
ASTERISK:     '*';
PLUS:         '+';
COMMA:        ',';
MINUS:        '–';
DOT:          '.';
DIVIDE:       '/';
COLON:        ':';
SEMI_COLON:   ';';
LESS_THAN:    '<';
EQUALS:       '=';
GREATER_THAN: '>';
VERTICAL_BAR: '|';


Thanks,
Luke.



More information about the antlr-interest mailing list