|
Mercury.Formats library
1.0
The library provides format parsers for the Mercury library components.
|
Class for parsing interpreter entities used in Mercury. Since there is a lot of tokens to scan, methods of the class work like "scanners", that is, their first parameter is always the full sequence of tokens and they only scan a subsequence specified by other parameters. More...
Classes | |
| class | AlternativeData |
Public Member Functions | |
| InterpreterEntityParser (Symbol epsilon, IReadOnlyDictionary< string, InterpreterAction< T >> actions, IReadOnlyDictionary< string, string > aliases) | |
| IElement | ParseElement (IList< Token > tokens, int start, out int end) |
| Parses the element. More... | |
| Constant | ParseConstant (IList< Token > tokens, int start, out int end) |
Parses the constant. It is of the form symbols:mask where symbols is a list of symbols separated by | and mask contains the symbolsMore... | |
| Variable | ParseVariable (IList< Token > tokens, int start, out int end) |
Parses the variable. It is of the form #name:alternative where name is a variable name and alternative has the same format as defined in ParseConstant. More... | |
| Wildcard | ParseWildcard (IList< Token > tokens, int start, out int end) |
Parses the wildcard. It is of the form *name:alternative. The same conditions hold as in ParseVariable. More... | |
| Structure | ParseStructure (IList< Token > tokens, int start, out int end) |
Parses the structure. It is of the form [Root Elements...] where Root is an Mercury.Interpreting.Alternative and Elements is a list of elements. More... | |
| IFormalParameter | ParseParameter (IList< Token > tokens, int start, out int end) |
| Parses the parameter. It might be a constant or an action call. More... | |
| ActionCall< T > | ParseActionCall (IList< Token > tokens, int start, out int end) |
Parses the action call. It is of the form (f x y z...) where f is a name of an action and x, y and z are its arguments parsed recursively. More... | |
| IFormalParameter[] | ParseParameters (IList< Token > tokens, int start, out int end) |
| Parses the parameters of an action call. More... | |
| RewriteRule< T > | ParseRewriteRule (IList< Token > tokens) |
Parses the rewrite rule. It is of the form LHS ==> RHS where LHS is a Mercury.Interpreting.Structure and RHS is an Mercury.Interpreting.ActionCall{T}. More... | |
Class for parsing interpreter entities used in Mercury. Since there is a lot of tokens to scan, methods of the class work like "scanners", that is, their first parameter is always the full sequence of tokens and they only scan a subsequence specified by other parameters.
| T | Interpreter return type |
| T | : | class |
Definition at line 149 of file EntityParser.cs.
| Mercury.Formats.Basic.InterpreterEntityParser< T >.InterpreterEntityParser | ( | Symbol | epsilon, |
| IReadOnlyDictionary< string, InterpreterAction< T >> | actions, | ||
| IReadOnlyDictionary< string, string > | aliases | ||
| ) |
Definition at line 171 of file EntityParser.cs.
| ActionCall<T> Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseActionCall | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the action call. It is of the form (f x y z...) where f is a name of an action and x, y and z are its arguments parsed recursively.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
| System.FormatException | |
| System.ArgumentException | Expected ')' at the end of action call |
Definition at line 404 of file EntityParser.cs.
| Constant Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseConstant | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the constant. It is of the form symbols:mask where symbols is a list of symbols separated by | and mask contains the symbols
N for nonterminals,T for terminals,e for epsilon.If the mask is empty, the colon must be omitted.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
Definition at line 219 of file EntityParser.cs.
| IElement Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseElement | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the element.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
Definition at line 187 of file EntityParser.cs.
| IFormalParameter Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseParameter | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the parameter. It might be a constant or an action call.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
Definition at line 369 of file EntityParser.cs.
| IFormalParameter [] Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseParameters | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the parameters of an action call.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
Definition at line 436 of file EntityParser.cs.
| RewriteRule<T> Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseRewriteRule | ( | IList< Token > | tokens | ) |
Parses the rewrite rule. It is of the form LHS ==> RHS where LHS is a Mercury.Interpreting.Structure and RHS is an Mercury.Interpreting.ActionCall{T}.
| tokens | The tokens. |
| System.ArgumentException |
Definition at line 461 of file EntityParser.cs.
| Structure Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseStructure | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the structure. It is of the form [Root Elements...] where Root is an Mercury.Interpreting.Alternative and Elements is a list of elements.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
Definition at line 343 of file EntityParser.cs.
| Variable Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseVariable | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the variable. It is of the form #name:alternative where name is a variable name and alternative has the same format as defined in ParseConstant.
In addition, #name is equivalent of #name::NTe.
| tokens | The tokens. |
| start | The start. |
| end | The end. |
Definition at line 276 of file EntityParser.cs.
| Wildcard Mercury.Formats.Basic.InterpreterEntityParser< T >.ParseWildcard | ( | IList< Token > | tokens, |
| int | start, | ||
| out int | end | ||
| ) |
Parses the wildcard. It is of the form *name:alternative. The same conditions hold as in ParseVariable.
The *name is a shorthand for *name\:\:NTe and * is a shorthand for *(random_name):NTe.
| tokens | The list of tokens. |
| start | Index of the first token of the element. |
| end | Index of token AFTER the element. |
Definition at line 309 of file EntityParser.cs.
1.8.7