/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/OneScript.Language/LexicalAnalysis/LexerDetectorBuilder.cs
33 строки
1 KB
Andrei Ovsiankin
Переработка директив препроцессора.
10 ноя 2020, 16:05
10 ноя 2020, 16:05
29d2525
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; using System.Linq.Expressions; namespace OneScript.Language.LexicalAnalysis { public class LexerDetectorBuilder { public Expression<Func<char, SourceCodeIterator, bool>> DetectExpression { get; } public Expression HandlerExpression { get; private set; } public LexerDetectorBuilder(Expression<Func<char, SourceCodeIterator, bool>> detectExpression) { DetectExpression = detectExpression; } public void HandleWith(LexerState state) { HandlerExpression = Expression.Constant(state); } public void HandleWith(Expression<Func<SourceCodeIterator, LexerState>> selector) { HandlerExpression = Expression.Invoke(selector); } } }