mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-13 23:36:35 +08:00
Finished scene explorer, lots of cleanups. Inspector and Search left now.
This commit is contained in:
31
src/UI/Main/Console/Lexer/MatchLexer.cs
Normal file
31
src/UI/Main/Console/Lexer/MatchLexer.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using ExplorerBeta.Unstrip.ColorUtility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ExplorerBeta.UI.Main.Console.Lexer
|
||||
{
|
||||
public abstract class MatchLexer
|
||||
{
|
||||
public abstract Color HighlightColor { get; }
|
||||
|
||||
public string HexColor => htmlColor ?? (htmlColor = "<#" + HighlightColor.ToHex() + ">");
|
||||
private string htmlColor = null;
|
||||
|
||||
public virtual IEnumerable<char> StartChars { get { yield break; } }
|
||||
public virtual IEnumerable<char> EndChars { get { yield break; } }
|
||||
|
||||
public abstract bool IsImplicitMatch(ILexer lexer);
|
||||
|
||||
public bool IsMatch(ILexer lexer)
|
||||
{
|
||||
if (IsImplicitMatch(lexer))
|
||||
{
|
||||
lexer.Commit();
|
||||
return true;
|
||||
}
|
||||
|
||||
lexer.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user