JavaCC: Placement of token definition

The order of placing token definitions matters. example: TOKEN: { <AAA : "aaa"> | <MORE_A : (["a"'>)*> } token AAA is more specific comparing to MORE_A, so must place before MORE_A. When token manager looks for the type of a token, it will match the regular expressions (tokens) from top to bottom (or left to right). If we don't follow this rule, u may get unexpected result. exmple: "aaa" will actually match MORE_A when u have AAA after MORE_A. Share Link:
Bookmark Google Yahoo MyWeb Del.icio.us Digg Facebook Myspace Reddit Ma.gnolia Technorati Stumble Upon