token_match_pound
This commit is contained in:
14
parsing.cpp
14
parsing.cpp
@@ -79,6 +79,17 @@ token_is_keyword(Intern_String keyword, S64 lookahead = 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
function Token *
|
||||
token_match_pound(String string){
|
||||
Token *token = token_get();
|
||||
if(token->kind == TK_Pound){
|
||||
if(string_compare(token->intern_val.s, string)){
|
||||
return token_next();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function Token *
|
||||
token_match(Token_Kind kind){
|
||||
Token *token = token_get();
|
||||
@@ -329,7 +340,8 @@ parse_lambda(Token *token){
|
||||
}
|
||||
token_expect(TK_CloseParen);
|
||||
Ast_Expr *ret = parse_optional_type();
|
||||
Token *foreign = token_match(TK_FOREIGN);
|
||||
|
||||
Token *foreign = token_match_pound("foreign"_s);
|
||||
Ast_Scope *scope = token_is(OPEN_SCOPE) ? parse_stmt_scope() : 0;
|
||||
Ast_Lambda *result = ast_lambda(token, params, ret, scope);
|
||||
if(foreign) set_flag(result->flags, AST_FOREIGN);
|
||||
|
||||
Reference in New Issue
Block a user