Namespace cleanup, move some categories out of UI namespace

This commit is contained in:
Sinai
2021-06-30 07:49:58 +10:00
parent 65c4d49274
commit f815a13d9a
55 changed files with 174 additions and 150 deletions

View File

@ -0,0 +1,32 @@
using UnityEngine;
namespace UnityExplorer.CSConsole.Lexers
{
public class NumberLexer : Lexer
{
// Maroon
protected override Color HighlightColor => new Color(0.58f, 0.33f, 0.33f, 1.0f);
private bool IsNumeric(char c) => char.IsNumber(c) || c == '.';
public override bool TryMatchCurrent(LexerBuilder lexer)
{
// previous character must be whitespace or delimiter
if (!lexer.IsDelimiter(lexer.Previous, true))
return false;
if (!IsNumeric(lexer.Current))
return false;
while (!lexer.EndOfInput)
{
lexer.Commit();
if (!IsNumeric(lexer.PeekNext()))
break;
}
return true;
}
}
}