Fix identifier & literal source locations in parser
This commit is contained in:
parent
b25400ad65
commit
bcdcc9e752
1 changed files with 15 additions and 15 deletions
|
|
@ -330,7 +330,7 @@ postfix_expression
|
|||
|
||||
base_expression
|
||||
: literal
|
||||
| name { $$ = ast::identifier{$1, ctx.location}; }
|
||||
| name { $$ = ast::identifier{$1, @$}; }
|
||||
| lparen expression rparen { $$ = $2; }
|
||||
| lbracket nonempty_comma_separated_expression_list rbracket { $$ = ast::array{$2, @$}; }
|
||||
;
|
||||
|
|
@ -346,20 +346,20 @@ nonempty_comma_separated_expression_list
|
|||
;
|
||||
|
||||
literal
|
||||
: true { $$ = ast::literal(ast::bool_literal{true, ctx.location}); }
|
||||
| false { $$ = ast::literal(ast::bool_literal{false, ctx.location}); }
|
||||
| lit_i8 { $$ = parse_primitive_literal<std::int8_t>($1, ctx.location); }
|
||||
| lit_u8 { $$ = parse_primitive_literal<std::uint8_t>($1, ctx.location); }
|
||||
| lit_i16 { $$ = parse_primitive_literal<std::int16_t>($1, ctx.location); }
|
||||
| lit_u16 { $$ = parse_primitive_literal<std::uint16_t>($1, ctx.location); }
|
||||
| lit_i32 { $$ = parse_primitive_literal<std::int32_t>($1, ctx.location); }
|
||||
| lit_u32 { $$ = parse_primitive_literal<std::uint32_t>($1, ctx.location); }
|
||||
| lit_i64 { $$ = parse_primitive_literal<std::int64_t>($1, ctx.location); }
|
||||
| lit_u64 { $$ = parse_primitive_literal<std::uint64_t>($1, ctx.location); }
|
||||
| lit_f16 { $$ = parse_primitive_literal<types::half_float>($1, ctx.location); }
|
||||
| lit_f32 { $$ = parse_primitive_literal<float>($1, ctx.location); }
|
||||
| lit_f64 { $$ = parse_primitive_literal<double>($1, ctx.location); }
|
||||
| lit_char8 { $$ = ast::u8_literal{static_cast<std::uint8_t>($1), ctx.location}; }
|
||||
: true { $$ = ast::literal(ast::bool_literal{true, @$}); }
|
||||
| false { $$ = ast::literal(ast::bool_literal{false, @$}); }
|
||||
| lit_i8 { $$ = parse_primitive_literal<std::int8_t>($1, @$); }
|
||||
| lit_u8 { $$ = parse_primitive_literal<std::uint8_t>($1, @$); }
|
||||
| lit_i16 { $$ = parse_primitive_literal<std::int16_t>($1, @$); }
|
||||
| lit_u16 { $$ = parse_primitive_literal<std::uint16_t>($1, @$); }
|
||||
| lit_i32 { $$ = parse_primitive_literal<std::int32_t>($1, @$); }
|
||||
| lit_u32 { $$ = parse_primitive_literal<std::uint32_t>($1, @$); }
|
||||
| lit_i64 { $$ = parse_primitive_literal<std::int64_t>($1, @$); }
|
||||
| lit_u64 { $$ = parse_primitive_literal<std::uint64_t>($1, @$); }
|
||||
| lit_f16 { $$ = parse_primitive_literal<types::half_float>($1, @$); }
|
||||
| lit_f32 { $$ = parse_primitive_literal<float>($1, @$); }
|
||||
| lit_f64 { $$ = parse_primitive_literal<double>($1, @$); }
|
||||
| lit_char8 { $$ = ast::u8_literal{static_cast<std::uint8_t>($1), @$}; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue