|
Mercury library
1.0
Translation of CFG grammars into an object model (Bachelor's thesis).
|
Represents a single symbol of the grammar. This is an immutable class.
For a symbol name to be valid it must NOT contain control or separator characters, must not be empty and must meet these conditions:
More...
Public Member Functions | |
| Symbol () | |
| Creates an epsilon symbol. More... | |
| Symbol (string name) | |
| Creates a new symbol and infers its type. If the constructor does not throw any exception, the symbol is guaranteed to be valid. More... | |
| Symbol (string name, SymbolType type) | |
| Creates a new symbol with desired type. If the constructor does not throw any exception, the symbol is guaranteed to be valid. More... | |
| Symbol (Token token) | |
| Creates a new terminal symbol from a token. If the constructor does not throw any exception, the symbol is guaranteed to be valid. More... | |
| override bool | Equals (object obj) |
| override int | GetHashCode () |
| override string | ToString () |
| bool | Equals (Symbol other) |
| int | CompareTo (Symbol other) |
Static Public Member Functions | |
| static SymbolType | InferType (string name) |
| Infers the type of symbol according to conditions described in the constructor documentation. More... | |
Properties | |
| string | Name [get, set] |
| Symbol name More... | |
| SymbolType | Type [get, set] |
| Symbol type More... | |
| bool | IsEpsilon [get] |
| Indicates whether the symbol is an epsilon symbol More... | |
| Token | Token [get, set] |
| A token that created this symbol or null if other constructor was used More... | |
Represents a single symbol of the grammar. This is an immutable class.
For a symbol name to be valid it must NOT contain control or separator characters, must not be empty and must meet these conditions:
| Mercury.Syntax.Symbol.Symbol | ( | ) |
| Mercury.Syntax.Symbol.Symbol | ( | string | name | ) |
| Mercury.Syntax.Symbol.Symbol | ( | string | name, |
| SymbolType | type | ||
| ) |
Creates a new symbol with desired type. If the constructor does not throw any exception, the symbol is guaranteed to be valid.
| name | Symbol name |
| type | Desired symbol type |
| System.ArgumentNullException | name |
| Mercury.Exceptions.InvalidSymbolException | When the symbol is not valid. |
| Mercury.Syntax.Symbol.Symbol | ( | Token | token | ) |
Creates a new terminal symbol from a token. If the constructor does not throw any exception, the symbol is guaranteed to be valid.
| token | Input token |
| System.ArgumentNullException | token |
| Mercury.Exceptions.InvalidSymbolException | When the symbol is not valid. |
|
static |
Infers the type of symbol according to conditions described in the constructor documentation.
If input meets terminal a) condition (= terminal or epsilon), this method returns SymbolType.Terminal | SymbolType.Epsilon.
| name | Symbol name |
|
get |
|
getset |
|
getset |
|
getset |
1.8.7