Skip to content
← Back

src/syntax/parsers/definitions/super_call.ghul

1
namespace Syntax.Parsers.Definitions is
2
use Source;
3
4
class SUPER_CALL(expression_parser: Parser[Trees.Expressions.Expression]): Base[Trees.Definitions.SUPER_CALL] is
5
super();
6
7
parse(context: CONTEXT) -> Trees.Definitions.SUPER_CALL is
8
let start = context.location;
9
let args = Collections.LIST[Trees.Expressions.Expression]();
10
let is_poisoned mut = false;
11
12
is_poisoned = !context.next_token(Lexical.TOKEN.SUPER) \/ is_poisoned;
13
is_poisoned = !context.next_token(Lexical.TOKEN.PAREN_OPEN) \/ is_poisoned;
14
15
if context.current.token != Lexical.TOKEN.PAREN_CLOSE then
16
do
17
let arg = expression_parser.parse(context);
18
19
if arg? then
20
args.add(arg);
21
else
22
is_poisoned = true;
23
break;
24
fi
25
26
if context.current.token == Lexical.TOKEN.COMMA then
27
context.next_token();
28
else
29
break;
30
fi
31
od
32
fi
33
34
is_poisoned = !context.next_token(Lexical.TOKEN.PAREN_CLOSE) \/ is_poisoned;
35
36
let end = context.location;
37
38
is_poisoned = !context.next_token(Lexical.TOKEN.SEMICOLON) \/ is_poisoned;
39
40
let result = Trees.Definitions.SUPER_CALL(start::end, args);
41
result.poison(is_poisoned);
42
43
return result;
44
si
45
si
46
si