[antlr-interest] Use of ECMA grammar: Newbie user question
Pichon, Marc
Marc.Pichon at ca.com
Tue Nov 28 05:15:48 PST 2006
Hello,
I'm facing a problem with the use of ECMA.g grammar when I'm trying to
use it:
What I am getting is as follows:
at compile time, a lot of non determinism appears (in the ECMA.zip file
associated)
js file parsed:
var __menuBar=void(0);
function menubar()
{
}
********************************
what I defined in ECMA.g to call Lexer and Parser:
class ECMAParser extends Parser;
options {
k = 8; // for token lookahead
exportVocab=ECMA; // Call its vocabulary "ECMA"
defaultErrorHandler = false; // Don't generate parser error
handlers
}
class ECMALexer extends Lexer;
options {
exportVocab=ECMA; // call the vocabulary "ECMA"
testLiterals=true; // don't automatically test for literals
caseSensitive = true;
caseSensitiveLiterals = true;
k=8; // eight characters of lookahead
// Allow any char but \uFFFF (16 bit -1)
charVocabulary='\u0000'..'\uFFFE';
}
******************************************************
> ecma_grammar; LA(1)==(SOURCE_CHAR) v [inputState.guessing 0]
> sourceElements; LA(1)==(SOURCE_CHAR) v [inputState.guessing 0]
< sourceElements; LA(1)==(SOURCE_CHAR) v [inputState.guessing 0]
< ecma_grammar; LA(1)==(SOURCE_CHAR) v [inputState.guessing 0]
and
Call ECMALexer ...
Call ECMAParser ...
Call parser.ECMA_grammar_expr ...
exception: line 1:1: unexpected token: v
v is the first character of the input file.
My understang is that no litteral are recognised and that no lexer rule
can be applied.
I've tried changing testLiterals=true; to testLiterals=false; withou
difference.
Any advice welcome, Marc
Marc Pichon
Marc.Pichon at ca.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061128/c6733b1f/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2371 bytes
Desc: Pie Charts Bkgrd.JPG
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20061128/c6733b1f/attachment-0001.jpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ECMA.zip
Type: application/x-zip-compressed
Size: 6963 bytes
Desc: ECMA.zip
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20061128/c6733b1f/attachment-0001.bin
More information about the antlr-interest
mailing list