diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-09-15 00:53:00 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-09-15 00:53:00 +0100 |
| commit | b6cb4f4d145bdc87aecf8edd678d025b22faff57 (patch) | |
| tree | 887b01bc5628b8f5bb642667dcd92bb800c1eb33 /src/parser.cpp | |
| parent | bd365e5176f3bc5f5e249d1a0763520e2973c2ec (diff) | |
#file #line directives
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index c13fc774c..3190698fd 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1258,6 +1258,18 @@ AstNode *parse_operand(AstFile *f, b32 lhs) { expect_token(f, Token_String); } operand = parse_operand(f, lhs); + } else if (are_strings_equal(name, make_string("file"))) { + Token token = operand->TagExpr.name; + token.kind = Token_String; + token.string = token.pos.file; + return make_basic_lit(f, token); + } else if (are_strings_equal(name, make_string("line"))) { + Token token = operand->TagExpr.name; + token.kind = Token_Integer; + char *str = gb_alloc_array(gb_arena_allocator(&f->arena), char, 20); + gb_i64_to_str(token.pos.line, str, 10); + token.string = make_string(str); + return make_basic_lit(f, token); } else { operand->TagExpr.expr = parse_expr(f, false); } |