BadScript 2
Loading...
Searching...
No Matches
BadTernaryOperator.cs
Go to the documentation of this file.
4
6
11{
15 public BadTernaryOperator() : base(16, "?", false) { }
16
18 public override BadExpression Parse(BadExpression left, BadSourceParser parser)
19 {
20 BadExpression middle = parser.ParseExpression();
21 parser.Reader.SkipNonToken();
22 parser.Reader.Eat(":");
23 parser.Reader.SkipNonToken();
24 BadExpression right = parser.ParseExpression();
25 parser.Reader.SkipNonToken();
26
27 return new BadTernaryExpression(left, middle, right, left.Position.Combine(right.Position));
28 }
29}
The Parser of the Language. It turns Source Code into an Expression Tree.
BadSourceReader Reader
The Source Reader.
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 nex...
Implements the Ternary Expression LEFT ? TRUE_RET : FALSE_RET.
Base Implementation for all Expressions used inside the Script.
BadSourcePosition Position
The source Position of the Expression.
Base class for all binary operators.
override BadExpression Parse(BadExpression left, BadSourceParser parser)
BadSourcePosition Eat(char c)
Asserts that the current character matches the specified character.
Contains the Access Expressions for the BadScript2 Language.
Contains the Expressions for the BadScript2 Language.
Contains the Binary Operators for the BadScript2 Language.
Contains the Source Reader for the BadScript2 Language.