public Token NextToken() { Token result = _lookahead ?? GetNextToken(); _lookahead = null; return result; }
private Exception InvalidTokenError(Token token) { return new TestSelectionParserException(string.Format( "Unexpected token '{0}' at position {1} in selection expression.", token.Text, token.Pos)); }
private static string EmitPropertyElement(Token lhs, Token op, Token rhs) { string fmt = null; if (op == EQ_OP1 || op == EQ_OP2) fmt = "<prop name='{0}'>{1}</prop>"; else if (op == NE_OP) fmt = "<not><prop name='{0}'>{1}</prop></not>"; else if (op == MATCH_OP) fmt = "<prop name='{0}' re='1'>{1}</prop>"; else if (op == NOMATCH_OP) fmt = "<not><prop name='{0}' re='1'>{1}</prop></not>"; else fmt = "<prop name='{0}' op='" + op.Text + "'>{1}</prop>"; return EmitElement(fmt, lhs, rhs); }
private static string EmitElement(string fmt, Token lhs, Token rhs) { return string.Format(fmt, lhs.Text, XmlEscape(rhs.Text)); }
private static string EmitFilterElement(Token lhs, Token op, Token rhs) { string fmt = null; if (op == EQ_OP1 || op == EQ_OP2) fmt = "<{0}>{1}</{0}>"; else if (op == NE_OP) fmt = "<not><{0}>{1}</{0}></not>"; else if (op == MATCH_OP) fmt = "<{0} re='1'>{1}</{0}>"; else if (op == NOMATCH_OP) fmt = "<not><{0} re='1'>{1}</{0}></not>"; else fmt = "<{0} op='" + op.Text + "'>{1}</{0}>"; return EmitElement(fmt, lhs, rhs); }