java - JavaCC not going to next possible token -
i have 2 tokens < import> , <\import>, , need capture data inside tag. i've tried code: < codigo_java_import_open: "<import>" > < codigo_java_import_close: "<\\import>" > void insertimportjavacode():{} { < codigo_java_import_open > insertimportjavacoderecursiva() } void insertimportjavacoderecursiva(): { token t; } { ( lookahead(2) t = < codigo_java_import_close > | t = < ~[] > { // code use information of token t } insertimportjavacoderecursiva() ) } but, javacc goes in first option of insertimportjavacoderecursiva() ex.: if have import code this: <import> import there. <\import> javacc throw error token "import there." not <\import>.