Mercury.Formats library 1.0 The library provides format parsers for the Mercury library components.

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Properties
Public Member Functions | Properties | List of all members
Mercury.Formats.Basic.GrammarEntityParser Class Reference

Class for parsing grammar entities used in Mercury. More...

## Public Member Functions
| GrammarEntityParser (Symbol epsilon)
| Initializes a new instance of the GrammarEntityParser class. More...
Symbol | ParseSymbol (Token token)
| Parses a symbol from a token. More...
Rule | ParseRule (IList< Token > tokens)
| Parses the rule. The rule is of the format `A -> X Y Z...` where `A` is a nonterminal symbols and `X`, `Y` and `Z` are terminals or nonterminals. If `epsilon` is used, the only format allowed is `A -> epsilon`. More...
IList< Rule > | ParseMultiRule (IList< Token > tokens)
| Parses the multi-rule. It is of the form `A -> RHS0 | RHS1 | ...` where `A -> RHS0` and `A -> RHS1` are valid rules. More...
Edge | ParseEdge (IList< Token > tokens)
| Parses the edge. It is of the form `(l, r) A -> alpha . beta` where `l <= r` and `A -> alpha beta` is a valid rule. More...

## Properties
Symbol | Epsilon`[get, set]`

## Detailed Description

Class for parsing grammar entities used in Mercury.

Definition at line 18 of file EntityParser.cs.

## Constructor & Destructor Documentation

Mercury.Formats.Basic.GrammarEntityParser.GrammarEntityParser | ( | Symbol | epsilon | ) |

Initializes a new instance of the GrammarEntityParser class.

Parameters

  epsilon | The epsilon symbol.

Exceptions

  System.ArgumentException | Required epsilon symbol for Grammar Entity Parser

Definition at line 28 of file EntityParser.cs.

## Member Function Documentation

Edge Mercury.Formats.Basic.GrammarEntityParser.ParseEdge | ( | IList< Token > | tokens | ) |

Parses the edge. It is of the form `(l, r) A -> alpha . beta` where `l <= r` and `A -> alpha beta` is a valid rule.

Parameters

  tokens | The tokens.

Returns
  The edge.

Definition at line 104 of file EntityParser.cs.

IList<Rule> Mercury.Formats.Basic.GrammarEntityParser.ParseMultiRule | ( | IList< Token > | tokens | ) |

Parses the multi-rule. It is of the form `A -> RHS0 | RHS1 | ...` where `A -> RHS0` and `A -> RHS1` are valid rules.

Parameters

  tokens | The tokens.

Returns
  List of rules.

Definition at line 76 of file EntityParser.cs.

Rule Mercury.Formats.Basic.GrammarEntityParser.ParseRule | ( | IList< Token > | tokens | ) |

Parses the rule.
The rule is of the format `A -> X Y Z...` where `A` is a nonterminal symbols and `X`, `Y` and `Z` are terminals or nonterminals. If `epsilon` is used, the only format allowed is `A -> epsilon`.

Parameters

  tokens | The tokens.

Returns

Definition at line 59 of file EntityParser.cs.

Symbol Mercury.Formats.Basic.GrammarEntityParser.ParseSymbol | ( | Token | token | ) |

Parses a symbol from a token.

Parameters

  token | The token.

Returns
  A new symbol.

Definition at line 41 of file EntityParser.cs.

## Property Documentation

Symbol Mercury.Formats.Basic.GrammarEntityParser.Epsilon
| get set

Definition at line 134 of file EntityParser.cs.

The documentation for this class was generated from the following file:

- Mercury/Mercury.Formats/Basic/EntityParser.cs