mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-14 15:46:36 +08:00
Project refactor, namespace cleanup, splitting UI/functionality.
This commit is contained in:
32
src/UI/Main/CSConsole/Lexer/Matcher.cs
Normal file
32
src/UI/Main/CSConsole/Lexer/Matcher.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using UnityExplorer.Core.Unity;
|
||||
|
||||
namespace UnityExplorer.UI.CSConsole.Lexer
|
||||
{
|
||||
public abstract class Matcher
|
||||
{
|
||||
public abstract Color HighlightColor { get; }
|
||||
|
||||
public string HexColor => htmlColor ?? (htmlColor = "<color=#" + HighlightColor.ToHex() + ">");
|
||||
private string htmlColor;
|
||||
|
||||
public virtual IEnumerable<char> StartChars => Enumerable.Empty<char>();
|
||||
public virtual IEnumerable<char> EndChars => Enumerable.Empty<char>();
|
||||
|
||||
public abstract bool IsImplicitMatch(CSLexerHighlighter lexer);
|
||||
|
||||
public bool IsMatch(CSLexerHighlighter lexer)
|
||||
{
|
||||
if (IsImplicitMatch(lexer))
|
||||
{
|
||||
lexer.Commit();
|
||||
return true;
|
||||
}
|
||||
|
||||
lexer.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user