This commit is contained in:
2025-10-08 09:49:37 +08:00
commit 284e764345
99 changed files with 21742 additions and 0 deletions

31
Parsing/TokenMatch.cs Normal file
View File

@@ -0,0 +1,31 @@
namespace Flee.Parsing
{
/**
* The token match status. This class contains logic to ensure that
* only the longest match is considered.
*/
internal class TokenMatch
{
private int _length = 0;
private TokenPattern _pattern = null;
public void Clear()
{
_length = 0;
_pattern = null;
}
public int Length => _length;
public TokenPattern Pattern => _pattern;
public void Update(int length, TokenPattern pattern)
{
if (this._length < length)
{
this._length = length;
this._pattern = pattern;
}
}
}
}