
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Hi!
I've encountered some strange behaviour of javacc and i can't explain
why the generated parser produces this error message. I am using
javacc-3.2 and the compiled program generates the following error
message when run on a sample HTML file:
---------
Encountered "center" at line 3, column 8.
Was expecting one of:
"A" ...
"a" ...
{...}
"caption" ...
"CENTER" ...
"center" ...
"CITE" ...
{...}
"cite" ...
{...}
"VAR" ...
"var" ...
---------
This message confuses me because the parser finds something it
expected but generates the error message anyway. This is the
.jj-source:
---------
PARSER_BEGIN(IndexList)
package IndexUpdater;
import java.util.*;
public class IndexList {
public static void main(String args[]) throws ParseException {
IndexList parser = new IndexList(System.in);
parser.Input();
}
}
PARSER_END(IndexList)
SKIP :
{
" "
| "\t"
| "\n"
| "\r"
}
TOKEN [IGNORE_CASE]:
{
< HTML : "<html>" >
| < TITLE : "<title>" >
| < HEAD : "<head>" >
| < BODY : "<body>" >
| < _BODY : "</body>" >
| < _HTML : "</html>" >
| < _TITLE : "</title>" >
| < _HEAD : "</head>" >
| < LT : "<" >
| < GT : ">" >
| <PCDATA: ( ~["<",">"] )+ >
}
void Input() :
{}
{
<HTML> <HEAD> <TITLE> Bla() <_TITLE> Bla() <_HEAD>
<BODY> Bla()
<_BODY>
<EOF>
}
void Bla() :
{}
{
<LT> BlaTag() Bla() <GT> Bla() <LT> "/" BlaTag() <GT>
| (<PCDATA>)*
}
void BlaTag() :
{}
{
"A" | "a"
| "ADDRESS" | "address"
| "APPLET" | "applet"
| "AREA" | "area"
| "B" | "b"
| "BASE" | "base"
| "BASEFONT" | "basefont"
| "BIG" | "big"
| "BLOCKQUOTE" | "blockquote"
| "BODY" | "body"
| "BR" | "br"
| "CAPTION" | "caption"
| "CENTER" | "center"
| "CITE" | "cite"
| "CODE" | "code"
| "DD" | "dd"
| "DFN" | "dfn"
| "DIR" | "dir"
| "DIV" | "div"
| "DL" | "dl"
| "DT" | "dt"
| "EM" | "em"
| "FONT" | "font"
| "FORM" | "form"
| "H1" | "h1"
| "H2" | "h2"
| "H3" | "h3"
| "H4" | "h4"
| "H5" | "h5"
| "H6" | "h6"
| "HEAD" | "head"
| "HR" | "hr"
| "HTML" | "html"
| "I" | "i"
| "IMG" | "img"
| "INPUT" | "input"
| "ISINDEX" | "isindex"
| "KBD" | "kbd"
| "LI" | "li"
| "LINK" | "link"
| "MAP" | "map"
| "MENU" | "menu"
| "META" | "meta"
| "OL" | "ol"
| "OPTION" | "option"
| "P" | "p"
| "PARAM" | "param"
| "PRE" | "pre"
| "PROMPT" | "prompt"
| "SAMP" | "samp"
| "SCRIPT" | "script"
| "SELECT" | "select"
| "SMALL" | "small"
| "STRIKE" | "strike"
| "STRONG" | "strong"
| "STYLE" | "style"
| "SUB" | "sub"
| "SUP" | "sup"
| "TABLE" | "table"
| "TD" | "td"
| "TEXTAREA" | "textarea"
| "TH" | "th"
| "TITLE" | "title"
| "TR" | "tr"
| "TT" | "tt"
| "U" | "u"
| "UL" | "ul"
| "VAR" | "var"
}
--------------
As sample input i use: "<HTML><HEAD><TITLE>Doesn't
matter</TITLE></HEAD><BODY><CENTER>"
Could somebody please be so kind to help me? This error drives me mad.
Thank you!
| <-- __Chronological__ --> | <-- __Thread__ --> |