Flee
This commit is contained in:
31
Parsing/TokenMatch.cs
Normal file
31
Parsing/TokenMatch.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user