public override IValue VisitValue([NotNull] JLMLParser.ValueContext context) { ITerminalNode @string = context.STRING(); ITerminalNode identif = context.IDENTIFIER(); ITerminalNode propert = context.PROPERTY_NAME(); ITerminalNode integer = context.NUMBER(); ITerminalNode literal = context.LITERAL(); if (@string != null) { return(GetDataValueFromNode(@string, typeof(string))); } if (integer != null) { return(GetDataValueFromNode(integer, typeof(int))); } if (literal != null) { return(GetDataValueFromNode(literal, typeof(bool))); } if (identif != null) { return new VariableValue { Value = identif.GetTextValue() } } ; if (propert != null) { return new VariableValue { Value = propert.GetTextValue() } } ; return(context.Accept(this)); }
/// <summary> /// Visit a parse tree produced by <see cref="JLMLParser.value"/>. /// <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 VisitValue([NotNull] JLMLParser.ValueContext context) { return(VisitChildren(context)); }