Ejemplo n.º 1
0
        public override object VisitPair(SPDGrammarParser.PairContext context)
        {
            SPDGrammarParser.ValueContext valueContext = context.value();
            string @string = context.STRING().GetText();

            if (status == 0 && @string.Equals("\"status\"", StringComparison.CurrentCultureIgnoreCase))
            {
                status = valueContext.GetText().Equals("\"ok\"", StringComparison.CurrentCultureIgnoreCase) ? OK_STATUS : ERROR_STATUS;
            }
            else if (status == ERROR_STATUS)
            {
                if (@string.Equals("\"result\"", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (valueContext is SPDGrammarParser.ArrayValueContext || valueContext is SPDGrammarParser.ObjectValueContext)
                    {
                        return(VisitChildren(context));
                    }
                    else
                    {
                        errors += Trim(valueContext.GetText());
                    }
                }
                else if (@string.Equals("\"error\"", StringComparison.CurrentCultureIgnoreCase))
                {
                    errors += Trim(valueContext.GetText());
                }
            }
            else if (status == OK_STATUS)
            {
                if (@string.Equals("\"name\"", StringComparison.CurrentCultureIgnoreCase))
                {
                    actions.StoreAction(Trim(valueContext.GetText()));
                }
                else if (@string.Equals("\"plan\"", StringComparison.CurrentCultureIgnoreCase) || @string.Equals("\"result\"", StringComparison.CurrentCultureIgnoreCase))
                {
                    return(VisitChildren(context));
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="SPDGrammarParser.pair"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitPair([NotNull] SPDGrammarParser.PairContext context)
 {
     return(VisitChildren(context));
 }