예제 #1
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)));
        }
예제 #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
        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;
        }