Switching between lexical states in javaCC

I am trying to create a javaCC parser that will behave differently in two code blocks for custom NetBeans plugin, however I cant even recognize two states. I don't know what I am doing wrong.

SKIP : {
  " " 
| "\t"
| "\n"   
| "\r"
  < A1: "a"> : STATE1  
< STATE1 > TOKEN : {
  < B2: "b" > : DEFAULT

This simple parser does not parse string "abab..".


There is no rule for "."; so, after parsing "abab", the lexer is stuck. This is why the error message says 'Lexical error at line 1, column 5. Encountered: "." (46), after : ""' If you add

| "."

to the first rule, it will work.

Need Your Help

MySQL not updating using prepare

php mysql

I have a database named records with a table named records. That table has 3 columns named id, firstname, lastname.

Get Classic ASP variable from posted JSON

jquery json asp-classic

I'm trying to post JSON via AJAX to a Classic ASP page, which retrieves the value, checks a database and returns JSON to the original page.