public override object VisitConstDecl([NotNull] SLangGrammarParser.ConstDeclContext context)
        {
            var symbol = context.Id();

            return(new VariableNameTableItem {
                Name = symbol.GetText(), Column = symbol.Symbol.Column, IsConstant = true, Line = symbol.Symbol.Line, Type = Visit(context.scalarType()) as SlangType
            });
        }
예제 #2
0
        public override object VisitConstDecl([NotNull] SLangGrammarParser.ConstDeclContext context)
        {
            var type      = Visit(context.scalarType()) as SlangType;
            var nameToken = context.Id().Symbol;
            var item      = new VariableNameTableItem {
                Type = type, IsConstant = false, Column = nameToken.Column, Line = nameToken.Line, Name = nameToken.Text
            };

            PutVariableIfInBlock(item);
            TranslateDeclare(item, context.exp());
            return(null);
        }
예제 #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="SLangGrammarParser.constDecl"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitConstDecl([NotNull] SLangGrammarParser.ConstDeclContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="SLangGrammarParser.constDecl"/>.
 /// <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 VisitConstDecl([NotNull] SLangGrammarParser.ConstDeclContext context)
 {
     return(VisitChildren(context));
 }