Appearance
| 1 | namespace Syntax.Parsers.Expressions is | |
| 2 | use IO.Std; | |
| 3 | ||
| 4 | ||
| 5 | use Source; | |
| 6 | ||
| 7 | class TERTIARY(expression_secondary_parser: Parser[Trees.Expressions.Expression]): Base[Trees.Expressions.Expression] is | |
| 8 | description: string => "tertiary expression"; | |
| 9 | ||
| 10 | super(); | |
| 11 | ||
| 12 | parse(context: CONTEXT) -> Trees.Expressions.Expression? => | |
| 13 | if context.current.token == Lexical.TOKEN.OPERATOR then | |
| 14 | let name = Trees.Identifiers.Identifier(context.location, context.current_string!); | |
| 15 | context.next_token(); | |
| 16 | let right = parse(context)!; | |
| 17 | ||
| 18 | Trees.Expressions.UNARY(name.location::right.location, name, right); | |
| 19 | elif context.current.token == Lexical.TOKEN.AWAIT then | |
| 20 | let start = context.location; | |
| 21 | context.next_token(); | |
| 22 | let right = parse(context)!; | |
| 23 | ||
| 24 | Trees.Expressions.AWAIT(start::right.location, right); | |
| 25 | else | |
| 26 | expression_secondary_parser.parse(context); | |
| 27 | fi; | |
| 28 | si | |
| 29 | si |