|
Grammatica 1.4 Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
System.Object
|
+--LookAheadSet
in LookAheadSet.csA token look-ahead set. This class contains a set of token id sequences. All sequences in the set are limited in length, so that no single sequence is longer than a maximum value. This class also filters out duplicates. Each token sequence also contains a repeat flag, allowing the look-ahead set to contain information about possible infinite repetitions of certain sequences. That information is important when conflicts arise between two look-ahead sets, as such a conflict cannot be resolved if the conflicting sequences can be repeated (would cause infinite loop).
Inner Classes, Typedefs, and Enums | |
class |
LookAheadSet.Sequence
A token sequence. |
Constructor Summary | |
LookAheadSet( int maxLength )
Creates a new look-ahead set with the specified maximum length. |
|
LookAheadSet( int maxLength, LookAheadSet set )
Creates a duplicate look-ahead set, possibly with a different maximum length. |
Method Summary | |
void |
Add( int token )
Adds a new token sequence with a single token to this set. |
void |
AddAll( LookAheadSet set )
Adds all the token sequences from a specified set. |
void |
AddEmpty()
Adds an empty token sequence to this set. |
LookAheadSet |
CreateCombination( LookAheadSet set )
Creates a new look-ahead set that is the combination of this set with another set. |
LookAheadSet |
CreateFilter( LookAheadSet set )
Creates a new look-ahead set filter. |
LookAheadSet |
CreateIntersection( LookAheadSet set )
Creates a new look-ahead set that is the intersection of this set with another set. |
LookAheadSet |
CreateNextSet( int token )
Creates a new look-ahead set that is the result of reading the specified token. |
LookAheadSet |
CreateOverlaps( LookAheadSet set )
Creates a new look-ahead set with overlaps from another. |
LookAheadSet |
CreateRepetitive()
Creates a new identical look-ahead set, except for the repeat flag being set in each token sequence. |
int[] |
GetInitialTokens()
Returns a list of the initial token id:s in this look-ahead set. |
int |
GetMaxLength()
Returns the length of the longest token sequence in this set. |
int |
GetMinLength()
Returns the length of the shortest token sequence in this set. |
bool |
Intersects( LookAheadSet set )
Checks if some token sequence is present in both this set and a specified one. |
bool |
IsNext( Parser parser )
Checks if the next token(s) in the parser match any token sequence in this set. |
bool |
IsNext( Parser parser, int length )
Checks if the next token(s) in the parser match any token sequence in this set. |
bool |
IsOverlap( LookAheadSet set )
Checks if another look-ahead set has an overlapping token sequence. |
bool |
IsRepetitive()
Checks if this look-ahead set contains a repetitive token sequence. |
void |
RemoveAll( LookAheadSet set )
Removes all the token sequences from a specified set. |
int |
Size()
Returns the size of this look-ahead set. |
override string |
ToString()
Returns a string representation of this object. |
string |
ToString( Tokenizer tokenizer )
Returns a string representation of this object. |
Constructor Detail |
public LookAheadSet( int maxLength );
maxLength
- the maximum token sequence lengthpublic LookAheadSet( int maxLength, LookAheadSet set );
maxLength
- the maximum token sequence length
set
- the look-ahead set to copyMethod Detail |
public void Add( int token );
token
- the token to addpublic void AddAll( LookAheadSet set );
set
- the set to add frompublic void AddEmpty();
public LookAheadSet CreateCombination( LookAheadSet set );
set
- the set to combine withpublic LookAheadSet CreateFilter( LookAheadSet set );
set
- the look-ahead set to trim withpublic LookAheadSet CreateIntersection( LookAheadSet set );
set
- the set to intersect withpublic LookAheadSet CreateNextSet( int token );
token
- the token to readpublic LookAheadSet CreateOverlaps( LookAheadSet set );
set
- the look-ahead set to check withpublic LookAheadSet CreateRepetitive();
public int[] GetInitialTokens();
public int GetMaxLength();
public int GetMinLength();
public bool Intersects( LookAheadSet set );
set
- the look-ahead set to compare withpublic bool IsNext( Parser parser );
parser
- the parser to checkpublic bool IsNext( Parser parser, int length );
parser
- the parser to check
length
- the maximum number of tokens to checkpublic bool IsOverlap( LookAheadSet set );
set
- the look-ahead set to checkpublic bool IsRepetitive();
public void RemoveAll( LookAheadSet set );
set
- the set to remove frompublic int Size();
public override string ToString();
public string ToString( Tokenizer tokenizer );
tokenizer
- the tokenizer containing the tokens
|
Grammatica 1.4 Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |