aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-02-23 22:17:27 +0000
committergingerBill <bill@gingerbill.org>2019-02-23 22:17:27 +0000
commita9ab90bd2488783c3523fa30315f9754937fd52e (patch)
tree17c7e5398a7b95f106ccece88f709c0887750837 /src/parser.cpp
parente551d2b25ea39afb95f7b8ee4309ef0cc8b502b8 (diff)
Make `static` an attribute rather than a keyword prefix
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp55
1 files changed, 27 insertions, 28 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 9d42b3828..a5526fd73 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1208,7 +1208,6 @@ void fix_advance_to_next_stmt(AstFile *f) {
case Token_defer:
case Token_asm:
case Token_using:
- case Token_static:
case Token_break:
case Token_continue:
@@ -3751,33 +3750,33 @@ Ast *parse_stmt(AstFile *f) {
return s;
}
- case Token_static: {
- CommentGroup *docs = f->lead_comment;
- Token token = expect_token(f, Token_static);
-
- Ast *decl = nullptr;
- Array<Ast *> list = parse_lhs_expr_list(f);
- if (list.count == 0) {
- syntax_error(token, "Illegal use of 'static' statement");
- expect_semicolon(f, nullptr);
- return ast_bad_stmt(f, token, f->curr_token);
- }
-
- expect_token_after(f, Token_Colon, "identifier list");
- decl = parse_value_decl(f, list, docs);
-
- if (decl != nullptr && decl->kind == Ast_ValueDecl) {
- if (decl->ValueDecl.is_mutable) {
- decl->ValueDecl.is_static = true;
- } else {
- error(token, "'static' may only be currently used with variable declaration");
- }
- return decl;
- }
-
- syntax_error(token, "Illegal use of 'static' statement");
- return ast_bad_stmt(f, token, f->curr_token);
- } break;
+ // case Token_static: {
+ // CommentGroup *docs = f->lead_comment;
+ // Token token = expect_token(f, Token_static);
+
+ // Ast *decl = nullptr;
+ // Array<Ast *> list = parse_lhs_expr_list(f);
+ // if (list.count == 0) {
+ // syntax_error(token, "Illegal use of 'static' statement");
+ // expect_semicolon(f, nullptr);
+ // return ast_bad_stmt(f, token, f->curr_token);
+ // }
+
+ // expect_token_after(f, Token_Colon, "identifier list");
+ // decl = parse_value_decl(f, list, docs);
+
+ // if (decl != nullptr && decl->kind == Ast_ValueDecl) {
+ // if (decl->ValueDecl.is_mutable) {
+ // decl->ValueDecl.is_static = true;
+ // } else {
+ // error(token, "'static' may only be currently used with variable declaration");
+ // }
+ // return decl;
+ // }
+
+ // syntax_error(token, "Illegal use of 'static' statement");
+ // return ast_bad_stmt(f, token, f->curr_token);
+ // } break;
case Token_using: {
CommentGroup *docs = f->lead_comment;