public override AstNode VisitPrimary_expression([NotNull] GLSL_ES300Parser.Primary_expressionContext context) { var varId = context.variable_identifier(); if (varId != null) { return(new ExpressionVariableIdentifier() { Identifier = new Identifier() { Name = varId.Identifier().Symbol.Text } }); } var intLiteral = context.IntegerLiteral(); if (intLiteral != null) { return(new IntegerLiteral() { LiteralValue = intLiteral.GetText() }); } var floatLiteral = context.FloatingLiteral(); if (floatLiteral != null) { return(new FloatLiteral() { LiteralValue = floatLiteral.GetText() }); } var boolLiteral = context.BoolLiteral(); if (boolLiteral != null) { return(new BooleanLiteral() { LiteralValue = boolLiteral.GetText() }); } var result = new ExpressionParenGroup(); result.Content = (Expression)this.Visit(context.expression()); return(result); }
/// <summary> /// Visit a parse tree produced by <see cref="GLSL_ES300Parser.primary_expression"/>. /// <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 VisitPrimary_expression([NotNull] GLSL_ES300Parser.Primary_expressionContext context) { return(VisitChildren(context)); }