22 namespace Lucene.Net.Demo.Html
36 public override System.String Message
49 internal const int LEXICAL_ERROR = 0;
52 internal const int STATIC_LEXER_ERROR = 1;
55 internal const int INVALID_LEXICAL_STATE = 2;
58 internal const int LOOP_DETECTED = 3;
63 internal int errorCode;
68 protected internal static System.String addEscapes(System.String str)
70 System.Text.StringBuilder retval =
new System.Text.StringBuilder();
72 for (
int i = 0; i < str.Length; i++)
101 retval.Append(
"\\\"");
105 retval.Append(
"\\\'");
109 retval.Append(
"\\\\");
113 if ((ch = str[i]) < 0x20 || ch > 0x7e)
115 System.String s =
"0000" + System.Convert.ToString(ch, 16);
116 retval.Append(
"\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
126 return retval.ToString();
140 protected internal static System.String LexicalError(
bool EOFSeen,
int lexState,
int errorLine,
int errorColumn, System.String errorAfter,
char curChar)
142 return (
"Lexical error at line " + errorLine +
", column " + errorColumn +
". Encountered: " + (EOFSeen?
"<EOF> ":(
"\"" + addEscapes(System.Convert.ToString(curChar)) +
"\"") +
" (" + (int) curChar +
"), ") +
"after : \"" + addEscapes(errorAfter) +
"\"");
158 public TokenMgrError(
bool EOFSeen,
int lexState,
int errorLine,
int errorColumn, System.String errorAfter,
char curChar,
int reason):this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason)