/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
v2.0.3-alpha
src/OneScript.Language/Sources/SourceCode.cs
45 строк
1 KB
Andrey Ovsiankin
Рефакторинг неймспейсов
30 авг 2021, 16:41
30 авг 2021, 16:41
225528b
Код
Авторство
О чём код?
/*---------------------------------------------------------- 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 OneScript.Language.LexicalAnalysis; // ReSharper disable once CheckNamespace namespace OneScript.Sources { public class SourceCode : ISourceCodeIndexer { private readonly ICodeSource _source; private ISourceCodeIndexer _indexer; internal SourceCode(string sourceName, ICodeSource source) { _source = source; Name = sourceName; } public SourceCodeIterator CreateIterator() { var newIterator = new SourceCodeIterator(this); _indexer = newIterator; return newIterator; } public string Location => _source.Location; public string Name { get; } public string GetSourceCode() => _source.GetSourceCode(); public string GetCodeLine(int index) { return _indexer?.GetCodeLine(index); } public override string ToString() => Name ?? Location; } }