[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debug Lexer [Was: ParserException: [1,1] expecting: EOF]



Hi Lola,

You should first make sure that your lexer behaves as you expect it to do. Often, errors in the lexer specification lead to syntax errors. Try a custom debug lexer such as:
class PrintLexer extends Lexer
{
  PrintLexer(PushbackReader reader)
  {
    super(reader);
  }

  protected void filter()
  {
    System.out.println(token.getClass() +
                       ", state : " + state.id() +
                       ", text : [" + token.getText() + "]");
  }
}

Have fun!

Etienne

Lola Oluyomi a écrit :
Thanks. It works for me as well from command prompt. i.e the parser and other files are generated.

However, when I try to parse an _expression_  (from netbeans or command prompt), I get the error:
[...]

-- 
Etienne M. Gagnon, Ph.D.
SableCC:                                            http://sablecc.org
SableVM:                                            http://sablevm.org

Attachment: signature.asc
Description: OpenPGP digital signature