// May be called for the following tokens: Name, String, Eof, Comma, LParens, RParens, LBracket, RBracket, RBrace private string LexKindToString(LexKind t) { if (!(LexKind.FirstStringable <= t)) { throw new Exception("XPath error: Unexpected xpathExpr = null"); } if (LexKind.LastNonChar < t) { if (!("()[].@,*/$}".IndexOf((char)t) >= 0)) { throw new Exception("XPath error: missing last non char ()[].@,*/$} : " + (char)t); } return(new string((char)t, 1)); } switch (t) { case LexKind.Name: return("<name>"); case LexKind.String: return("<string literal>"); case LexKind.Eof: return("<eof>"); default: Debug.Fail("Unexpected LexKind: " + t.ToString()); return(string.Empty); } }
// May be called for the following tokens: Name, String, Eof, Comma, LParens, RParens, LBracket, RBracket, RBrace private string LexKindToString(LexKind t) { Debug.Assert(LexKind.FirstStringable <= t); if (LexKind.LastNonChar < t) { Debug.Assert("()[].@,*/$}".IndexOf((char)t) >= 0); return(new string((char)t, 1)); } switch (t) { case LexKind.Name: return("<name>"); case LexKind.String: return("<string literal>"); case LexKind.Eof: return("<eof>"); default: throw new Exception("Unexpected LexKind: " + t.ToString()); } }
// May be called for the following tokens: Name, String, Eof, Comma, LParens, RParens, LBracket, RBracket, RBrace private string LexKindToString(LexKind t) { Debug.Assert(LexKind.FirstStringable <= t); if (LexKind.LastNonChar < t) { Debug.Assert("()[].@,*/$}".Contains((char)t)); return(char.ToString((char)t)); } switch (t) { case LexKind.Name: return("<name>"); case LexKind.String: return("<string literal>"); case LexKind.Eof: return("<eof>"); default: Debug.Fail("Unexpected LexKind: " + t.ToString()); return(string.Empty); } }
// May be called for the following tokens: Name, String, Eof, Comma, LParens, RParens, LBracket, RBracket, RBrace private string LexKindToString(LexKind t) { Debug.Assert(LexKind.FirstStringable <= t); if (LexKind.LastNonChar < t) { Debug.Assert("()[].@,*/$}".IndexOf((char)t) >= 0); return new string((char)t, 1); } switch (t) { case LexKind.Name : return "<name>"; case LexKind.String : return "<string literal>"; case LexKind.Eof : return "<eof>"; default: Debug.Fail("Unexpected LexKind: " + t.ToString()); return string.Empty; } }
public override string ToString() { return("'" + Str + "' " + Kind.ToString()); }