Class PatternSearch
Provides Token-pattern matching utilities
Inheritance
System.Object
PatternSearch
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Azos.dll
Syntax
public static class PatternSearch
Methods
DoUntilAny<TToken>(TToken, FSMI, Int32[])
Performs FSM instruction unless token's type is any of the specified, then advances FSM
Declaration
public static FSMI DoUntilAny<TToken>(this TToken token, FSMI instruction, params int[] types)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
FSMI |
instruction |
|
System.Int32[] |
types |
|
Returns
Type Parameters
DoUntilAny<TToken>(TToken, FSMI, String[])
Performs FSM instruction unless token's text is any of the specified, then advances FSM
Declaration
public static FSMI DoUntilAny<TToken>(this TToken token, FSMI instruction, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
FSMI |
instruction |
|
System.String[] |
texts |
|
Returns
Type Parameters
DoUntilAny<TToken>(TToken, FSMI, StringComparison, String[])
Performs FSM instruction unless token's text is any of the specified, then advances FSM
Declaration
public static FSMI DoUntilAny<TToken>(this TToken token, FSMI instruction, StringComparison comparison, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
FSMI |
instruction |
|
System.StringComparison |
comparison |
|
System.String[] |
texts |
|
Returns
Type Parameters
DoUntilAny<TToken, TTokenType>(TToken, FSMI, TTokenType[])
Performs FSM instruction unless token's type is any of the specified, then advances FSM
Declaration
public static FSMI DoUntilAny<TToken, TTokenType>(this TToken token, FSMI instruction, params TTokenType[] types)
where TToken : Token where TTokenType : struct, IConvertible
Parameters
Type |
Name |
Description |
TToken |
token |
|
FSMI |
instruction |
|
TTokenType[] |
types |
|
Returns
Type Parameters
Name |
Description |
TToken |
|
TTokenType |
|
IsAnyOrAbort<TToken>(TToken, Int32[])
Advances FSM when token's type is any of specified or aborts FSM
Declaration
public static FSMI IsAnyOrAbort<TToken>(this TToken token, params int[] types)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.Int32[] |
types |
|
Returns
Type Parameters
IsAnyOrAbort<TToken>(TToken, String[])
Advances FSM when token's text is any of specified or aborts FSM
Declaration
public static FSMI IsAnyOrAbort<TToken>(this TToken token, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.String[] |
texts |
|
Returns
Type Parameters
IsAnyOrAbort<TToken>(TToken, StringComparison, String[])
Advances FSM when token's text is any of specified or aborts FSM
Declaration
public static FSMI IsAnyOrAbort<TToken>(this TToken token, StringComparison comparison, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.StringComparison |
comparison |
|
System.String[] |
texts |
|
Returns
Type Parameters
IsAnyOrAbort<TToken, TTokenType>(TToken, TTokenType[])
Advances FSM when token's type is any of specified or aborts FSM
Declaration
public static FSMI IsAnyOrAbort<TToken, TTokenType>(this TToken token, params TTokenType[] types)
where TToken : Token where TTokenType : struct, IConvertible
Parameters
Type |
Name |
Description |
TToken |
token |
|
TTokenType[] |
types |
|
Returns
Type Parameters
Name |
Description |
TToken |
|
TTokenType |
|
LazyFSM<TToken>(IEnumerable<TToken>, LazyFSMPredicate<TToken>[])
Makes finite state machine fed from IEnumerable(Token) only considering primary language tokens
Declaration
public static TToken LazyFSM<TToken>(this IEnumerable<TToken> tokens, params LazyFSMPredicate<TToken>[] predicates)
where TToken : Token
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<TToken> |
tokens |
Token enumerable
|
LazyFSMPredicate<TToken>[] |
predicates |
Predicates that supply machine state transition instructions
|
Returns
Type |
Description |
TToken |
Resulting token fetched by FSMI.Take instruction or null
|
Type Parameters
Name |
Description |
TToken |
Concrete language-typed token
|
LazyFSM<TToken>(IEnumerable<TToken>, Boolean, LazyFSMPredicate<TToken>[])
Makes finite state machine fed from IEnumerable(Token)
Declaration
public static TToken LazyFSM<TToken>(this IEnumerable<TToken> tokens, bool onlyPrimary, params LazyFSMPredicate<TToken>[] predicates)
where TToken : Token
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<TToken> |
tokens |
Token enumerable
|
System.Boolean |
onlyPrimary |
Sets filter to consider only primary language tokens (skip comments, directives, etc.)
|
LazyFSMPredicate<TToken>[] |
predicates |
Predicates that supply machine state transition instructions
|
Returns
Type |
Description |
TToken |
Resulting token fetched by FSMI.Take instruction or null
|
Type Parameters
Name |
Description |
TToken |
Concrete language-typed token
|
LazyFSM<TToken>(IEnumerable<TToken>, Boolean, ref LazyFSMState<TToken>, LazyFSMPredicate<TToken>[])
Makes finite state machine fed from IEnumerable(Token)
Declaration
public static TToken LazyFSM<TToken>(this IEnumerable<TToken> tokens, bool onlyPrimary, ref LazyFSMState<TToken> state, params LazyFSMPredicate<TToken>[] predicates)
where TToken : Token
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<TToken> |
tokens |
Token enumerable
|
System.Boolean |
onlyPrimary |
Sets filter to consider only primary language tokens (skip comments, directives, etc.)
|
LazyFSMState<TToken> |
state |
Machine's state which will be allocated if null passed
|
LazyFSMPredicate<TToken>[] |
predicates |
Predicates that supply machine state transition instructions
|
Returns
Type |
Description |
TToken |
Resulting token fetched by FSMI.Take instruction or null
|
Type Parameters
Name |
Description |
TToken |
Concrete language-typed token
|
LoopUntilAfterMatch<TToken>(LazyFSMState<TToken>, LazyFSMPredicate<TToken>[])
Loops until token pattern match succeeds.
This method matches using the same primary token filter as the parent match.
Keeps state machine if match was found on the first token that follows the match
Declaration
public static FSMI LoopUntilAfterMatch<TToken>(this LazyFSMState<TToken> state, params LazyFSMPredicate<TToken>[] predicates)
where TToken : Token
Parameters
Returns
Type Parameters
LoopUntilAny<TToken>(TToken, Int32[])
Advances FSM when token's type is any of specified or loops FSM
Declaration
public static FSMI LoopUntilAny<TToken>(this TToken token, params int[] types)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.Int32[] |
types |
|
Returns
Type Parameters
LoopUntilAny<TToken>(TToken, String[])
Advances FSM when token's text is any of specified or loops FSM
Declaration
public static FSMI LoopUntilAny<TToken>(this TToken token, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.String[] |
texts |
|
Returns
Type Parameters
LoopUntilAny<TToken>(TToken, StringComparison, String[])
Advances FSM when token's text is any of specified or loops FSM
Declaration
public static FSMI LoopUntilAny<TToken>(this TToken token, StringComparison comparison, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.StringComparison |
comparison |
|
System.String[] |
texts |
|
Returns
Type Parameters
LoopUntilAny<TToken, TTokenType>(TToken, TTokenType[])
Advances FSM when token's type is any of specified or loops FSM
Declaration
public static FSMI LoopUntilAny<TToken, TTokenType>(this TToken token, params TTokenType[] types)
where TToken : Token where TTokenType : struct, IConvertible
Parameters
Type |
Name |
Description |
TToken |
token |
|
TTokenType[] |
types |
|
Returns
Type Parameters
Name |
Description |
TToken |
|
TTokenType |
|
LoopUntilMatch<TToken>(LazyFSMState<TToken>, LazyFSMPredicate<TToken>[])
Loops until token pattern match succeeds, considering only primary language tokens.
Keeps state machine if match was found on the first matching token
Declaration
public static FSMI LoopUntilMatch<TToken>(this LazyFSMState<TToken> state, params LazyFSMPredicate<TToken>[] predicates)
where TToken : Token
Parameters
Returns
Type Parameters
LoopUntilMatch<TToken>(LazyFSMState<TToken>, Boolean, LazyFSMPredicate<TToken>[])
Loops until token pattern match succeeds, conditionaly considering only primary language tokens.
Keeps state machine if match was found on the first matching token
Declaration
public static FSMI LoopUntilMatch<TToken>(this LazyFSMState<TToken> state, bool onlyPrimary, params LazyFSMPredicate<TToken>[] predicates)
where TToken : Token
Parameters
Returns
Type Parameters
LoopWhileAnyOrAbort<TToken>(TToken, Int32[])
Loops FSM while token's type is any of the specified or aborts
Declaration
public static FSMI LoopWhileAnyOrAbort<TToken>(this TToken token, params int[] types)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.Int32[] |
types |
|
Returns
Type Parameters
LoopWhileAnyOrAbort<TToken>(TToken, String[])
Loops FSM while token's text is any of the specified or aborts
Declaration
public static FSMI LoopWhileAnyOrAbort<TToken>(this TToken token, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.String[] |
texts |
|
Returns
Type Parameters
LoopWhileAnyOrAbort<TToken>(TToken, StringComparison, String[])
Loops FSM while token's text is any of the specified or aborts
Declaration
public static FSMI LoopWhileAnyOrAbort<TToken>(this TToken token, StringComparison comparison, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.StringComparison |
comparison |
|
System.String[] |
texts |
|
Returns
Type Parameters
LoopWhileAnyOrAbort<TToken, TTokenType>(TToken, TTokenType[])
Loops FSM while token's type is any of the specified or aborts
Declaration
public static FSMI LoopWhileAnyOrAbort<TToken, TTokenType>(this TToken token, params TTokenType[] types)
where TToken : Token where TTokenType : struct, IConvertible
Parameters
Type |
Name |
Description |
TToken |
token |
|
TTokenType[] |
types |
|
Returns
Type Parameters
Name |
Description |
TToken |
|
TTokenType |
|
Skip<TToken>(LazyFSMState<TToken>, Int32)
Skips specified number of tokens by returning FSMI.Loop count times
Declaration
public static FSMI Skip<TToken>(this LazyFSMState<TToken> state, int count)
where TToken : Token
Parameters
Type |
Name |
Description |
LazyFSMState<TToken> |
state |
|
System.Int32 |
count |
|
Returns
Type Parameters
TextIsAnyOf<TToken>(TToken, String[])
Returns true when token's text is any of specified
Declaration
public static bool TextIsAnyOf<TToken>(this TToken token, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.String[] |
texts |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
TextIsAnyOf<TToken>(TToken, StringComparison, String[])
Returns true when token's text is any of specified
Declaration
public static bool TextIsAnyOf<TToken>(this TToken token, StringComparison comparison, params string[] texts)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.StringComparison |
comparison |
|
System.String[] |
texts |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
TypeIsAnyOf<TToken>(TToken, Int32[])
Returns true when token's type is any of the specified
Declaration
public static bool TypeIsAnyOf<TToken>(this TToken token, params int[] types)
where TToken : Token
Parameters
Type |
Name |
Description |
TToken |
token |
|
System.Int32[] |
types |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
TypeIsAnyOf<TToken, TTokenType>(TToken, TTokenType[])
Returns true when token's type is any of the specified
Declaration
public static bool TypeIsAnyOf<TToken, TTokenType>(this TToken token, params TTokenType[] types)
where TToken : Token where TTokenType : struct, IConvertible
Parameters
Type |
Name |
Description |
TToken |
token |
|
TTokenType[] |
types |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Name |
Description |
TToken |
|
TTokenType |
|