I am working on a netbeans module to parse html
markups by following this tutorial.
For the keyword html
, I wrote following javacc file.
options {
JAVA_UNICODE_ESCAPE = true;
ERROR_REPORTING = false;
STATIC = false;
COMMON_TOKEN_ACTION = false;
TOKEN_FACTORY = "Token";
JDK_VERSION = "1.8";
BUILD_PARSER = false;
}
PARSER_BEGIN(HTMLParser)
package org.html.jcclexer;
import java.io.*;
/**
* Grammar to parse Java version 1.5
* @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5
*/
public class HTMLParser {}
PARSER_END(HTMLParser)
/* WHITE SPACE */
TOKEN :
{
< WHITESPACE:
" "
| "\t"
| "\n"
| "\r"
| "\f">
}
TOKEN : { < HTML : "html" > }
It colors my html
word perfectly but then it gives error:
java.lang.IllegalArgumentException: Token id must not be null. Fix lexer org.html.lexer.HTMLexer@1e6bbd25
test.html contains following word only:
html
I am not sure it's error due to my .jj
file or something else.