Пример #1
0
        public PeekableScanner(ScannerInfo scannerInfo)
        {
            CodeContract.RequiresArgumentNotNull(scannerInfo, "scannerInfo");

            m_lookAheadQueue = new CacheQueue<Lexeme>();
            m_masterScanner = new Scanner(scannerInfo);
        }
Пример #2
0
        public ForkableScannerBuilder(ScannerInfo info)
        {
            CodeContract.RequiresArgumentNotNull(info, "info");

            m_info = info;
            m_triviaTokens = new int[0];
        }
Пример #3
0
        public ForkableScannerBuilder(ScannerInfo info)
        {
            CodeContract.RequiresArgumentNotNull(info, "info");

            m_info         = info;
            m_triviaTokens = new int[0];
        }
Пример #4
0
        public PeekableScanner(ScannerInfo scannerInfo)
        {
            CodeContract.RequiresArgumentNotNull(scannerInfo, "scannerInfo");

            m_lookAheadQueue = new CacheQueue <Lexeme>();
            m_masterScanner  = new Scanner(scannerInfo);
        }
Пример #5
0
        internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string content)
        {
            m_scannerInfo = scannerInfo;
            m_stateIndex  = state;
            Value         = new LexemeValue(content, span);

            m_trivia = s_emptyTrivia;
        }
Пример #6
0
 internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string value, int skippedTokenCount)
 {
     m_scannerInfo = scannerInfo;
     m_stateIndex = state;
     Span = span;
     Value = value;
     SkippedTokenCount = skippedTokenCount;
 }
Пример #7
0
        internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string content)
        {
            m_scannerInfo = scannerInfo;
            m_stateIndex = state;
            Value = new LexemeValue(content, span);

            m_trivia = s_emptyTrivia;
        }
Пример #8
0
        public Scanner(ScannerInfo scannerInfo)
        {
            m_scannerInfo = scannerInfo;

            m_engine = new FiniteAutomationEngine(m_scannerInfo.TransitionTable, m_scannerInfo.CharClassTable);
            m_lexemeValueBuilder = new StringBuilder(32);
            m_tokenAttributes = new int[scannerInfo.TokenCount];

            Initialize();
        }
Пример #9
0
Файл: Scanner.cs Проект: zgf/VBF
        public Scanner(ScannerInfo scannerInfo)
        {
            m_scannerInfo = scannerInfo;

            m_engine             = new FiniteAutomationEngine(m_scannerInfo.TransitionTable, m_scannerInfo.CharClassTable);
            m_lexemeValueBuilder = new StringBuilder(32);
            m_tokenAttributes    = new int[scannerInfo.TokenCount];

            Initialize();
        }
Пример #10
0
        private void SetUpScanner()
        {
            var lexcion = new Lexicon();

            var lexer = lexcion.Lexer;

            PLUS = lexer.DefineToken(RE.Symbol('+'));
            ASTERISK = lexer.DefineToken(RE.Symbol('*'));
            LEFT_PARENTHESIS = lexer.DefineToken(RE.Symbol('('));
            RIGHT_PARENTHESIS = lexer.DefineToken(RE.Symbol(')'));
            NUMBER = lexer.DefineToken(RE.Range('0', '9').Many1(), "number");
            SPACE = lexer.DefineToken(RE.Symbol(' ').Many1());

            m_scannerInfo = lexcion.CreateScannerInfo();
        }
Пример #11
0
        internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string content, List <Lexeme> trivia)
        {
            m_scannerInfo = scannerInfo;
            m_stateIndex  = state;
            Value         = new LexemeValue(content, span);

            if (trivia != null)
            {
                m_triviaArray = trivia.ToArray();
                m_trivia      = new ReadOnlyCollection <Lexeme>(m_triviaArray);
            }
            else
            {
                m_triviaArray = null;
                m_trivia      = new ReadOnlyCollection <Lexeme>(s_emptyTrivia);
            }
        }
Пример #12
0
        internal Lexeme(ScannerInfo scannerInfo, int state, SourceSpan span, string content, List<Lexeme> trivia)
        {
            m_scannerInfo = scannerInfo;
            m_stateIndex = state;
            Value = new LexemeValue(content, span);

            if (trivia != null)
            {
                m_triviaArray = trivia.ToArray();
                m_trivia = new ReadOnlyCollection<Lexeme>(m_triviaArray);

            }
            else
            {
                m_triviaArray = null;
                m_trivia = new ReadOnlyCollection<Lexeme>(s_emptyTrivia);
            }
        }