コード例 #1
0
ファイル: ParserEngine.cs プロジェクト: java66liu/VBF
        public ParserEngine(TransitionTable transitions, SyntaxErrors errorDef)
        {
            CodeContract.RequiresArgumentNotNull(transitions, "transitions");
            CodeContract.RequiresArgumentNotNull(errorDef, "errorDef");

            m_transitions = transitions;
            m_reducer = new ReduceVisitor(transitions);

            m_heads = new List<ParserHead>();
            m_shiftedHeads = new List<ParserHead>();
            m_acceptedHeads = new List<ParserHead>();
            m_errorCandidates = new List<ParserHead>();
            m_tempHeads = new List<ParserHead>();
            m_reducedHeads = new List<ParserHead>();
            m_recoverReducedHeads = new List<ParserHead>();

            m_errorDef = errorDef;

            m_cleaner = new ParserHeadCleaner();
            EnableDeletionRecovery = true;
            EnableInsertionRecovery = true;
            EnableReplacementRecovery = true;

            //init state
            m_heads.Add(new ParserHead(new StackNode(0, null, null)));
        }
コード例 #2
0
ファイル: ParserBase.cs プロジェクト: wangzhan/VBF
 protected virtual void OnDefineParserErrors(SyntaxErrors errorDefinition, CompilationErrorManager errorManager)
 {
     errorManager.DefineError(errorDefinition.LexicalErrorId, 0, CompilationStage.Scanning, "Invalid token: {0}");
     errorManager.DefineError(errorDefinition.TokenUnexpectedId, 0, CompilationStage.Parsing, "Unexpected token: {0}");
     errorManager.DefineError(errorDefinition.TokenMissingId, 0, CompilationStage.Parsing, "Missing token: {0}");
     errorManager.DefineError(errorDefinition.OtherErrorId, 0, CompilationStage.Parsing, "Syntax error");
 }
コード例 #3
0
        public ParserEngine(TransitionTable transitions, SyntaxErrors errorDef)
        {
            CodeContract.RequiresArgumentNotNull(transitions, "transitions");
            CodeContract.RequiresArgumentNotNull(errorDef, "errorDef");

            m_transitions = transitions;
            m_reducer     = new ReduceVisitor(transitions);

            m_heads               = new List <ParserHead>();
            m_shiftedHeads        = new List <ParserHead>();
            m_acceptedHeads       = new List <ParserHead>();
            m_errorCandidates     = new List <ParserHead>();
            m_tempHeads           = new List <ParserHead>();
            m_reducedHeads        = new List <ParserHead>();
            m_recoverReducedHeads = new List <ParserHead>();

            m_errorDef = errorDef;

            m_cleaner = new ParserHeadCleaner();
            EnableDeletionRecovery    = true;
            EnableInsertionRecovery   = true;
            EnableReplacementRecovery = true;

            //init state
            m_heads.Add(new ParserHead(new StackNode(0, null, null)));
        }
コード例 #4
0
ファイル: ParserBase.cs プロジェクト: wangzhan/VBF
        protected ParserBase(CompilationErrorManager errorManager)
        {
            CodeContract.RequiresArgumentNotNull(errorManager, "errorManager");

            m_errorManager    = errorManager;
            m_errorDefinition = new SyntaxErrors()
            {
                LexicalErrorId    = 101,
                TokenUnexpectedId = 201,
                TokenMissingId    = 202,
                OtherErrorId      = 203
            };

            m_triviaTokens = new List <Token>();
        }
コード例 #5
0
ファイル: ParserEngine.cs プロジェクト: jzlxiaohei/VBF
        public ParserEngine(TransitionTable transitions, SyntaxErrors errorDef)
        {
            CodeContract.RequiresArgumentNotNull(transitions, "transitions");
            CodeContract.RequiresArgumentNotNull(errorDef, "errorDef");

            m_transitions = transitions;
            m_reducer = new ReduceVisitor(transitions);

            m_heads = new List<ParserHead>();
            m_tempHeads = new List<ParserHead>();
            m_acceptedHeads = new List<ParserHead>();
            m_errorCandidates = new List<ParserHead>();
            m_errorDef = errorDef;

            //init state
            m_heads.Add(new ParserHead(new StackNode(0, null, null)));
        }
コード例 #6
0
ファイル: ParserBase.cs プロジェクト: zxs1215/VBF
        protected ParserBase(CompilationErrorManager errorManager)
        {
            CodeContract.RequiresArgumentNotNull(errorManager, "errorManager");

            m_errorManager    = errorManager;
            m_errorDefinition = new SyntaxErrors()
            {
                LexicalErrorId    = 101,
                TokenUnexpectedId = 201,
                TokenMissingId    = 202,
                TokenMistakeId    = 203,
                OtherErrorId      = 200
            };

            m_triviaTokens = new List <Token>();

            EnableReplacementRecovery = true;
            EnableInsertionRecovery   = true;
            EnableDeletionRecovery    = true;
        }