SetTrivia() 개인적인 메소드

private SetTrivia ( IReadOnlyList trivia ) : void
trivia IReadOnlyList
리턴 void
예제 #1
0
파일: Scanner.cs 프로젝트: zgf/VBF
        private void AddHistory(Lexeme lexeme, bool setTrivia = true)
        {
            Debug.Assert(m_valuableCursor == m_valuableHistory.Count);

            m_fullHistory.Add(lexeme);
            int fullCursor = m_fullHistory.Count();

            if (setTrivia)
            {
                int lastTriviaStartIndex = m_lastNotSkippedLexemeIndex + 1;
                int lastTriviaLength     = fullCursor - 1 - lastTriviaStartIndex;

                if (lastTriviaLength < 0)
                {
                    lastTriviaLength = 0;
                }

                lexeme.SetTrivia(new LexemeRange(m_fullHistory, lastTriviaStartIndex, lastTriviaLength));
                m_lastNotSkippedLexemeIndex = fullCursor - 1;

                m_valuableHistory.Add(fullCursor - 1);
                m_valuableCursor = m_valuableHistory.Count;
            }
        }
예제 #2
0
파일: Scanner.cs 프로젝트: rkc100/VBF
        private void AddHistory(Lexeme lexeme, bool setTrivia = true)
        {
            Debug.Assert(m_valuableCursor == m_valuableHistory.Count);

            m_fullHistory.Add(lexeme);
            int fullCursor = m_fullHistory.Count();

            if (setTrivia)
            {
                int lastTriviaStartIndex = m_lastNotSkippedLexemeIndex + 1;
                int lastTriviaLength = fullCursor - 1 - lastTriviaStartIndex;

                if (lastTriviaLength < 0)
                {
                    lastTriviaLength = 0;
                }

                lexeme.SetTrivia(new LexemeRange(m_fullHistory, lastTriviaStartIndex, lastTriviaLength));
                m_lastNotSkippedLexemeIndex = fullCursor - 1;

                m_valuableHistory.Add(fullCursor - 1);
                m_valuableCursor = m_valuableHistory.Count;
            }
        }