public override object?VisitDecl_startup([NotNull] LogicScriptParser.Decl_startupContext context)
        {
            var blockCtx = new BlockContext(Context, false);
            var body     = new StatementVisitor(blockCtx).Visit(context.block());

            Script.Blocks.Add(new StartupBlock(context.Span(), body));
            return(null);
        }
        public override object?VisitDecl_when([NotNull] LogicScriptParser.Decl_whenContext context)
        {
            var        blockCtx = new BlockContext(Context, false);
            Expression?cond;

            if (context.any != null)
            {
                cond = null;
            }
            else if (context.cond != null)
            {
                cond = new ExpressionVisitor(blockCtx).Visit(context.cond);
            }
            else
            {
                Context.Errors.AddError("Missing 'when' condition", context.Span());
                return(null);
            }

            var body = new StatementVisitor(blockCtx).Visit(context.block());

            Script.Blocks.Add(new WhenBlock(context.Span(), cond, body));
            return(null);
        }
 public ReferenceVisitor(BlockContext context)
 {
     this.Context = context;
 }
 public StatementVisitor(BlockContext context)
 {
     this.Context = context;
 }
Exemple #5
0
 public ExpressionVisitor(BlockContext context, int maxBitSize = 0)
 {
     this.Context    = context;
     this.MaxBitSize = maxBitSize;
 }