23 namespace Lucene.Net.QueryParsers
38 public override System.String Message
52 internal const int LEXICAL_ERROR = 0;
55 internal const int STATIC_LEXER_ERROR = 1;
58 internal const int INVALID_LEXICAL_STATE = 2;
61 internal const int LOOP_DETECTED = 3;
66 internal int errorCode;
71 protected internal static System.String addEscapes(System.String str)
73 System.Text.StringBuilder retval =
new System.Text.StringBuilder();
75 for (
int i = 0; i < str.Length; i++)
100 retval.Append(
"\\r");
104 retval.Append(
"\\\"");
108 retval.Append(
"\\\'");
112 retval.Append(
"\\\\");
116 if ((ch = str[i]) < 0x20 || ch > 0x7e)
118 System.String s =
"0000" + System.Convert.ToString(ch, 16);
119 retval.Append(
"\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
129 return retval.ToString();
143 protected internal static System.String LexicalError(
bool EOFSeen,
int lexState,
int errorLine,
int errorColumn, System.String errorAfter,
char curChar)
145 return (
"Lexical error at line " + errorLine +
", column " + errorColumn +
". Encountered: " + (EOFSeen?
"<EOF> ":(
"\"" + addEscapes(System.Convert.ToString(curChar)) +
"\"") +
" (" + (int) curChar +
"), ") +
"after : \"" + addEscapes(errorAfter) +
"\"");
164 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)