Class Terminals
Provides factory methods for common terminal symbols.
public static class Terminals
- Inheritance
-
Terminals
Methods
Decimal(string)
Creates a terminal that matches a signed floating-point number.
public static IGrammarSymbol<decimal> Decimal(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits, separated by a dot, and optionally followed by an
exponent of the form [eE][+-]?[0-9]+. A leading minus sign is also allowed.
The set of accepted strings has changed in Farkle 7. Previously the dot, and digits either only before or only after it, were optional, which made the terminal match integer literals, but caused conflicts. Making them mandatory avoids these conflicts and improves simplicity and predictability.
Double(string)
Creates a terminal that matches a signed floating-point number.
public static IGrammarSymbol<double> Double(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits, separated by a dot, and optionally followed by an
exponent of the form [eE][+-]?[0-9]+. A leading minus sign is also allowed.
The set of accepted strings has changed in Farkle 7. Previously the dot, and digits either only before or only after it, were optional, which made the terminal match integer literals, but caused conflicts. Making them mandatory avoids these conflicts and improves simplicity and predictability.
Int32(string)
Creates a terminal that matches a signed integer.
public static IGrammarSymbol<int> Int32(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits. Leading zeroes are not prohibited. A leading minus sign is also allowed.
Int64(string)
Creates a terminal that matches a signed integer.
public static IGrammarSymbol<long> Int64(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits. Leading zeroes are not prohibited. A leading minus sign is also allowed.
SignedFloat<T>(string)
Creates a terminal that matches a signed floating-point number.
public static IGrammarSymbol<T> SignedFloat<T>(string name) where T : IFloatingPoint<T>
Parameters
namestringThe terminal's name.
Returns
Type Parameters
TThe type this terminal returns. Must implement IFloatingPoint<TSelf>.
Remarks
This terminal matches non-empty sequences of decimal digits, separated by a dot, and optionally followed by an
exponent of the form [eE][+-]?[0-9]+. A leading minus sign is also allowed.
The set of accepted strings has changed in Farkle 7. Previously the dot, and digits either only before or only after it, were optional, which made the terminal match integer literals, but caused conflicts. Making them mandatory avoids these conflicts and improves simplicity and predictability.
SignedInteger<T>(string)
Creates a terminal that matches a signed integer.
public static IGrammarSymbol<T> SignedInteger<T>(string name) where T : ISignedNumber<T>
Parameters
namestringThe terminal's name.
Returns
Type Parameters
TThe type this terminal returns. Must implement ISignedNumber<TSelf>.
Remarks
This terminal matches non-empty sequences of decimal digits. Leading zeroes are not prohibited. A leading minus sign is also allowed.
Single(string)
Creates a terminal that matches a signed floating-point number.
public static IGrammarSymbol<float> Single(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits, separated by a dot, and optionally followed by an
exponent of the form [eE][+-]?[0-9]+. A leading minus sign is also allowed.
The set of accepted strings has changed in Farkle 7. Previously the dot, and digits either only before or only after it, were optional, which made the terminal match integer literals, but caused conflicts. Making them mandatory avoids these conflicts and improves simplicity and predictability.
String(string, char)
Creates a terminal that matches a single-line C-style string.
public static IGrammarSymbol<string> String(string name, char delimiter)
Parameters
Returns
Remarks
All escape sequences described in String(string, char, string, bool) are supported.
String(string, char, string, bool)
Creates a terminal that matches a C-style string.
public static IGrammarSymbol<string> String(string name, char delimiter, string escapeChars, bool multiLine)
Parameters
namestringThe terminal's name.
delimitercharThe character that starts and ends the string.
escapeCharsstringThe characters that are allowed to be escaped with a
</code>.</code> anddelimiterare always allowed to be escaped.multiLineboolWhether new line characters are allowed.
Returns
Remarks
The following escape sequences if enabled in escapeChars have special meaning:
-
\a,\b,\f,\n,\r,\tand\vcorrespond to the same characters as in C. -
\ecorresponds to theU+001Bescape character. -
\UXXXX, whereXis a case-insensitive hexadecimal number, corresponds to theU+XXXXcharacter.
UInt32(string)
Creates a terminal that matches an unsigned integer.
public static IGrammarSymbol<uint> UInt32(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits. Leading zeroes are not prohibited.
UInt64(string)
Creates a terminal that matches an unsigned integer.
public static IGrammarSymbol<ulong> UInt64(string name)
Parameters
namestringThe terminal's name.
Returns
Remarks
This terminal matches non-empty sequences of decimal digits. Leading zeroes are not prohibited.
UnsignedFloat<T>(string)
Creates a terminal that matches an unsigned floating-point number.
public static IGrammarSymbol<T> UnsignedFloat<T>(string name) where T : IFloatingPoint<T>
Parameters
namestringThe terminal's name.
Returns
Type Parameters
TThe type this terminal returns. Must implement IFloatingPoint<TSelf>.
Remarks
This terminal matches non-empty sequences of decimal digits, separated by a dot, and optionally followed by an
exponent of the form [eE][+-]?[0-9]+.
The set of accepted strings has changed in Farkle 7. Previously the dot, and digits either only before or only after it, were optional, which made the terminal match integer literals, but caused conflicts. Making them mandatory avoids these conflicts and improves simplicity and predictability.
UnsignedInteger<T>(string)
Creates a terminal that matches an unsigned integer.
public static IGrammarSymbol<T> UnsignedInteger<T>(string name) where T : INumberBase<T>
Parameters
namestringThe terminal's name.
Returns
Type Parameters
TThe type this terminal returns. Must implement INumberBase<TSelf>.
Remarks
This terminal matches non-empty sequences of decimal digits. Leading zeroes are not prohibited.