using System.Collections.Generic; using UnityEngine; using System.Linq; using UnityExplorer.Core.Unity; namespace UnityExplorer.UI.Main.CSConsole.Lexer { public abstract class Matcher { public abstract Color HighlightColor { get; } public string HexColor => htmlColor ?? (htmlColor = ""); private string htmlColor; public virtual IEnumerable StartChars => Enumerable.Empty(); public virtual IEnumerable EndChars => Enumerable.Empty(); public abstract bool IsImplicitMatch(CSLexerHighlighter lexer); public bool IsMatch(CSLexerHighlighter lexer) { if (IsImplicitMatch(lexer)) { lexer.Commit(); return true; } lexer.Rollback(); return false; } } }