![]() |
BadScript 2
|
The Parser of the Language. It turns Source Code into an Expression Tree. More...
Public Member Functions | |
BadSourceParser (BadSourceReader sourceReader, BadOperatorTable operators) | |
Constructor of the Parser. | |
List< BadExpression > | ParseGenericArguments () |
BadExpression | ParseExpression (BadExpression? left=null, int precedence=int.MaxValue) |
Parses an Expression with a precedence greater than the given precedence. Moves the reader to the next token. | |
IEnumerable< BadExpression > | Parse () |
Parses the File from start to end. | |
Static Public Member Functions | |
static BadSourceParser | Create (string fileName, string source) |
Creates a BadSourceParser Instance based on the source and filename provided. | |
static BadSourceParser | Create (string fileName, string source, int start, int end) |
Creates a BadSourceParser Instance based on the source and filename provided. | |
static IEnumerable< BadExpression > | Parse (string fileName, string source) |
Parses a BadExpression from the Source Reader. | |
Properties | |
BadSourceReader | Reader [get] |
The Source Reader. | |
Private Member Functions | |
BadExpression? | ParsePrefix (int precedence) |
Parses a Prefix Expression that has precedence greater than the provided precedence. Moves the Reader to the next Token. | |
BadExpression | ParseSwitch () |
BadExpression | ParseIf () |
Parses an If Expression. Moves the Reader to the Next Token. | |
BadExpression | ParseForEach () |
Parses a For Each Expression. Moves the Reader to the Next Token. | |
BadExpression | ParseLock () |
Parses a Lock Expression. Moves the Reader to the Next Token. | |
BadExpression | ParseFor () |
Parses a For Loop Expression. Moves the Reader to the Next Token. | |
void | ParseMeta () |
Parses the MetaData of the current expression. | |
BadExpression | ParseValue (int precedence) |
Parses a Value Expression or a Prefix Function with precedence greater than the provided precedence. Moves the Reader to the Next Token. | |
BadStringExpression | ParseMultiLineFormatString () |
Parses a Multiline Format string expression. Moves the reader to the next token. | |
BadStringExpression | ParseFormatString () |
Parses a Format Expression. Moves the reader to the next token. | |
BadWhileExpression | ParseWhile () |
Parses a While Loop. Moves the reader to the next token. | |
List< BadExpression > | ParseBlock (out bool isSingleLine) |
Parses a Block Expression. Moves the reader to the next token. | |
List< BadExpression > | ParseFunctionBlock (int start, out bool isSingleLine) |
Parses a Block. Moves the reader to the next token. | |
BadExpression | ParseUsingStatement (int start) |
Parses a Using Statement Expression. Moves the reader to the next token. | |
BadExpression | ParseUsing () |
Parses a Using Block or Statement. Moves the reader to the next token. | |
BadExpression | ParseTry () |
Parses a Try Catch Block. Moves the reader to the next token. | |
BadNewExpression | ParseNew () |
Parses a New Expression. Moves the reader to the next token. | |
BadInterfaceConstraint | ParseInterfaceConstraint () |
Parses an Interface Constraint. Moves the reader to the next token. | |
List< BadWordToken > | ParseGenericParameters () |
BadInterfacePrototypeExpression | ParseInterface () |
Parses an Interface prototype. Moves the reader to the next token. | |
BadClassPrototypeExpression | ParseClass () |
Parses a Class Structure. Moves the reader to the next token. | |
BadFunctionParameter | ParseParameter () |
Parses a Function Parameter. Moves the reader to the next token. | |
List< BadFunctionParameter > | ParseParameters (int start) |
Parses a Function Parameter List. Moves the reader to the next token. | |
BadFunctionExpression | ParseFunction (int start, string? functionName, BadExpression? functionReturn, bool isConstant, bool isStatic, BadFunctionCompileLevel compileLevel, List< BadFunctionParameter > parameters) |
Parses a Function Definition. Moves the reader to the next token. | |
BadFunctionExpression | ParseFunction (bool isConstant, bool isStatic, BadFunctionCompileLevel compileLevel) |
Parses a function definition. Moves the reader to the next token. | |
Static Private Member Functions | |
static bool | RequireSemicolon (BadExpression expr) |
Returns true if the given expression requires a semicolon. | |
Private Attributes | |
readonly BadOperatorTable | m_Operators |
The Operator Table that is used to parse the Source Code. | |
BadMetaData? | m_MetaData |
The Meta Data of the current expression. | |
The Parser of the Language. It turns Source Code into an Expression Tree.
Definition at line 32 of file BadSourceParser.cs.
BadScript2.Parser.BadSourceParser.BadSourceParser | ( | BadSourceReader | sourceReader, |
BadOperatorTable | operators | ||
) |
Constructor of the Parser.
sourceReader | The Source Reader |
operators | The Operator Table that is used to parse the Source Code |
Definition at line 49 of file BadSourceParser.cs.
|
static |
Creates a BadSourceParser Instance based on the source and filename provided.
fileName | File Name of the Source File |
source | Contents of the Source File |
Definition at line 66 of file BadSourceParser.cs.
|
static |
Creates a BadSourceParser Instance based on the source and filename provided.
fileName | File Name of the Source File |
source | Contents of the Source File |
start | Start Index of the Source File |
end | End Index of the Source File |
Definition at line 79 of file BadSourceParser.cs.
IEnumerable< BadExpression > BadScript2.Parser.BadSourceParser.Parse | ( | ) |
Parses the File from start to end.
Definition at line 2432 of file BadSourceParser.cs.
|
static |
Parses a BadExpression from the Source Reader.
fileName | File Name of the Source File |
source | Contents of the Source File |
Definition at line 90 of file BadSourceParser.cs.
|
private |
Parses a Block Expression. Moves the reader to the next token.
isSingleLine | Indicates if the Block is in single line format. |
Definition at line 1436 of file BadSourceParser.cs.
|
private |
Parses a Class Structure. Moves the reader to the next token.
Definition at line 1900 of file BadSourceParser.cs.
BadExpression BadScript2.Parser.BadSourceParser.ParseExpression | ( | BadExpression? | left = null , |
int | precedence = int::MaxValue |
||
) |
Parses an Expression with a precedence greater than the given precedence. Moves the reader to the next token.
left | The (optional) Left side of the expression |
precedence | The Minimum Precedence |
Definition at line 1047 of file BadSourceParser.cs.
|
private |
Parses a For Loop Expression. Moves the Reader to the Next Token.
Definition at line 286 of file BadSourceParser.cs.
|
private |
Parses a For Each Expression. Moves the Reader to the Next Token.
Definition at line 230 of file BadSourceParser.cs.
|
private |
Parses a Format Expression. Moves the reader to the next token.
BadSourceReaderException | Gets Raised if the First Character sequence is not BadStaticKeys.FormatStringKey |
BadParserException | Gets Raised if the string is not properly Terminated. |
Definition at line 1303 of file BadSourceParser.cs.
|
private |
Parses a function definition. Moves the reader to the next token.
isConstant | Indicates that the function is declared as a constant. I.e. it is readonly inside the scope it is executed in |
isStatic | Is the Function Static |
compileLevel | The Compile level of the Function |
BadParserException | Gets raised if the function header is invalid. |
Definition at line 2339 of file BadSourceParser.cs.
|
private |
Parses a Function Definition. Moves the reader to the next token.
start | The Start index of parent expression |
functionName | The Name of the Function |
functionReturn | The Return Expression of the Function |
isConstant | Indicates that the function is declared as a constant. I.e. the result will be cached |
isStatic | Indicates that the function is declared as static. I.e. it can be called without an instance |
compileLevel | The Compile level of the Function |
parameters | The Parameters of the Function |
Definition at line 2280 of file BadSourceParser.cs.
|
private |
Parses a Block. Moves the reader to the next token.
start | The Start index of the loop |
isSingleLine | Indicates if the Block is in single line format. |
BadParserException | Gets Raised if there is no block start character and no single-line block start sequence. |
Definition at line 1495 of file BadSourceParser.cs.
List< BadExpression > BadScript2.Parser.BadSourceParser.ParseGenericArguments | ( | ) |
Definition at line 1004 of file BadSourceParser.cs.
|
private |
Definition at line 1807 of file BadSourceParser.cs.
|
private |
Parses an If Expression. Moves the Reader to the Next Token.
Definition at line 175 of file BadSourceParser.cs.
|
private |
Parses an Interface prototype. Moves the reader to the next token.
Definition at line 1837 of file BadSourceParser.cs.
|
private |
Parses an Interface Constraint. Moves the reader to the next token.
BadParserException | Gets raised if the interface constraint is malformed. |
Definition at line 1734 of file BadSourceParser.cs.
|
private |
Parses a Lock Expression. Moves the Reader to the Next Token.
Definition at line 261 of file BadSourceParser.cs.
|
private |
Parses the MetaData of the current expression.
Definition at line 320 of file BadSourceParser.cs.
|
private |
Parses a Multiline Format string expression. Moves the reader to the next token.
BadSourceReaderException | Gets raised if the string is not properly terminated. |
Definition at line 1200 of file BadSourceParser.cs.
|
private |
Parses a New Expression. Moves the reader to the next token.
BadParserException | Gets Raised if the Expression after the new key is not an invocation expression. |
Definition at line 1714 of file BadSourceParser.cs.
|
private |
Parses a Function Parameter. Moves the reader to the next token.
BadParserException | Gets raised if the parameter is malformed. |
Definition at line 2109 of file BadSourceParser.cs.
|
private |
Parses a Function Parameter List. Moves the reader to the next token.
start | The Start index of parent expression |
BadParserException | Gets raised if the parameter list is malformed. |
Definition at line 2203 of file BadSourceParser.cs.
|
private |
Parses a Prefix Expression that has precedence greater than the provided precedence. Moves the Reader to the next Token.
precedence | The Precedence |
Definition at line 101 of file BadSourceParser.cs.
|
private |
Definition at line 124 of file BadSourceParser.cs.
|
private |
Parses a Try Catch Block. Moves the reader to the next token.
Definition at line 1651 of file BadSourceParser.cs.
|
private |
Parses a Using Block or Statement. Moves the reader to the next token.
BadParserException | Gets raised if the using statement is malformed. |
Definition at line 1592 of file BadSourceParser.cs.
|
private |
Parses a Using Statement Expression. Moves the reader to the next token.
start | The Start index of the expression |
BadParserException | Gets raised if the using statement is malformed. |
Definition at line 1550 of file BadSourceParser.cs.
|
private |
Parses a Value Expression or a Prefix Function with precedence greater than the provided precedence. Moves the Reader to the Next Token.
precedence | The Precedence |
BadRuntimeException | Gets raised if a Variable Expression is malformed. |
Definition at line 475 of file BadSourceParser.cs.
|
private |
Parses a While Loop. Moves the reader to the next token.
Definition at line 1413 of file BadSourceParser.cs.
|
staticprivate |
Returns true if the given expression requires a semicolon.
expr | The Expression to check |
Definition at line 2398 of file BadSourceParser.cs.
|
private |
The Meta Data of the current expression.
Definition at line 42 of file BadSourceParser.cs.
|
private |
The Operator Table that is used to parse the Source Code.
Definition at line 37 of file BadSourceParser.cs.
|
get |