public virtual void EnterInsertCompilerStatement(Token insertToken, Token sequenceNumber)
        {
            InsertDirective insertDirective = (InsertDirective)CompilerDirective;

            System.Diagnostics.Debug.Assert(sequenceNumber.TokenType == TokenType.IntegerLiteral);

            insertDirective.SequenceNumber = (int)((IntegerLiteralTokenValue)sequenceNumber.LiteralValue).Number;
            if (insertDirective.SequenceNumber < 0)
            {
                Token      errorToken = sequenceNumber;
                Diagnostic error      = new Diagnostic(
                    MessageCode.InvalidNumericLiteralFormat,
                    errorToken.Column, errorToken.EndColumn,
                    errorToken.Line, "TODO");
                CompilerDirective.AddDiagnostic(error);//TODO proper diagnostic error
            }
        }
示例#2
0
        public override void EnterInsertCompilerStatement(CobolCompilerDirectivesParser.InsertCompilerStatementContext context)
        {
            InsertDirective insertDirective = new InsertDirective();

            CompilerDirective = insertDirective;

            if (context.sequenceNumber() != null && context.sequenceNumber().IntegerLiteral() != null)
            {
                insertDirective.SequenceNumber = (int)ParseTreeUtils.GetIntegerLiteral(context.sequenceNumber().IntegerLiteral());
                if (insertDirective.SequenceNumber < 0)
                {
                    Token      errorToken = ParseTreeUtils.GetTokenFromTerminalNode(context.sequenceNumber().IntegerLiteral());
                    Diagnostic error      = new Diagnostic(
                        MessageCode.InvalidNumericLiteralFormat,
                        errorToken.Column, errorToken.EndColumn,
                        errorToken.Line, "TODO");
                    CompilerDirective.AddDiagnostic(error);//TODO proper diagnostic error
                }
            }
        }
        public virtual void StartInsertCompilerStatement()
        {
            InsertDirective insertDirective = new InsertDirective();

            CompilerDirective = insertDirective;
        }