Reimplement -collection; remove static from Odin tokenizer/parser in core library

This commit is contained in:
gingerBill
2019-02-23 23:30:03 +00:00
parent 989cc893ef
commit cdfaa643cc
5 changed files with 67 additions and 36 deletions
-1
View File
@@ -365,7 +365,6 @@ Value_Decl :: struct {
type: ^Expr,
values: []^Expr,
comment: ^Comment_Group,
is_static: bool,
is_using: bool,
is_mutable: bool,
}
-31
View File
@@ -1033,37 +1033,6 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
expect_semicolon(p, s);
return s;
case token.Static:
docs := p.lead_comment;
tok := expect_token(p, token.Static);
list := parse_lhs_expr_list(p);
if len(list) == 0 {
error(p, tok.pos, "illegal use of 'static' statement");
expect_semicolon(p, nil);
return ast.new(ast.Bad_Stmt, tok.pos, end_pos(p.prev_tok));
}
expect_token_after(p, token.Colon, "identifier list");
decl := parse_value_decl(p, list, docs);
if decl != nil do switch d in &decl.derived {
case ast.Value_Decl:
if d.is_mutable {
d.is_static = true;
} else {
error(p, tok.pos, "'static' may only be currently used with variable declarations");
}
case:
error(p, tok.pos, "illegal use of 'static' statement");
}
error(p, tok.pos, "illegal use of 'static' statement");
if decl != nil {
return decl;
}
return ast.new(ast.Bad_Stmt, tok.pos, end_pos(p.prev_tok));
case token.Using:
docs := p.lead_comment;
tok := expect_token(p, token.Using);
-2
View File
@@ -139,7 +139,6 @@ using Kind :: enum u16 {
Bit_Field,
Bit_Set,
Map,
Static,
Dynamic,
Auto_Cast,
Cast,
@@ -274,7 +273,6 @@ tokens := [Kind.COUNT]string {
"bit_field",
"bit_set",
"map",
"static",
"dynamic",
"auto_cast",
"cast",