public override void EnterStringLiteralValue(DaedalusParser.StringLiteralValueContext context) { if (!_assemblyBuilder.IsInsideConstDef) { DatSymbolLocation location = GetLocation(context); string value = context.GetText().Replace("\"", ""); DatSymbol symbol = SymbolBuilder.BuildStringConst(value, location); _assemblyBuilder.AddInstruction(new PushVar(symbol)); } }
/// <summary> /// Visit a parse tree produced by the <c>stringLiteralValue</c> /// labeled alternative in <see cref="DaedalusParser.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 VisitStringLiteralValue([NotNull] DaedalusParser.StringLiteralValueContext context) { return(VisitChildren(context)); }
public override ASTNode VisitStringLiteralValue([NotNull] DaedalusParser.StringLiteralValueContext context) { return(new StringLiteralNode(GetLocation(context), context.GetText().Replace("\"", ""))); }
/// <summary> /// Exit a parse tree produced by the <c>stringLiteralValue</c> /// labeled alternative in <see cref="DaedalusParser.value"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitStringLiteralValue([NotNull] DaedalusParser.StringLiteralValueContext context) { }