/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
v2.0.0
src/OneScript.Language/Extensions/AstNodesExtensions.cs
40 строк
1 KB
Andrey Ovsiankin
Расширения классов Language перенесены в сборку Language
11 июн 2021, 11:19
11 июн 2021, 11:19
4d13039
Код
Авторство
О чём код?
/*---------------------------------------------------------- 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.Runtime.CompilerServices; using OneScript.Language.LexicalAnalysis; using OneScript.Language.SyntaxAnalysis.AstNodes; namespace OneScript.Language.Extensions { public static class AstNodesExtensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string GetIdentifier(this BslSyntaxNode node) { return GetIdentifier((TerminalNode) node); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string GetIdentifier(this TerminalNode node) { return node.Lexem.Content; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Lexem GetLexem(this TerminalNode node) { return node.Lexem; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TerminalNode AsTerminal(this BslSyntaxNode node) { return node as TerminalNode; } } }