New approach, new lexer
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
function Expr* parse_expr(Parser* p);
|
||||
function Expr* parse_list_expr(Parser* p);
|
||||
function Typespec *parse_type(Parser *p);
|
||||
@@ -40,6 +41,7 @@ function Expr*
|
||||
parse_postfix_expr(Parser* p){
|
||||
Expr* result = parse_atom_expr(p);
|
||||
while (token_is(p, TK_Dot)
|
||||
|| token_is(p, TK_Arrow)
|
||||
|| token_is(p, TK_OpenParen)
|
||||
|| token_is(p, TK_OpenBracket)
|
||||
|| token_is(p, TK_Decrement)
|
||||
@@ -51,6 +53,11 @@ parse_postfix_expr(Parser* p){
|
||||
result = expr_binary(p, op, result, r);
|
||||
}
|
||||
|
||||
else if (token_match(p, TK_Arrow)){
|
||||
Expr* r = parse_atom_expr(p);
|
||||
result = expr_binary(p, op, result, r);
|
||||
}
|
||||
|
||||
else if (token_match(p, TK_OpenParen)){
|
||||
Expr* list = 0;
|
||||
if (!token_match(p, TK_CloseParen)){
|
||||
|
||||
Reference in New Issue
Block a user