Skip to content

Commit

Permalink
fix: asm strings can be concatenated
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 16, 2024
1 parent b20f858 commit bac0e89
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ module.exports = grammar({

gnu_asm_clobber_list: $ => seq(
':',
commaSep(field('register', $.string_literal)),
commaSep(field('register', $._string)),
),

gnu_asm_goto_list: $ => seq(
Expand Down
46 changes: 46 additions & 0 deletions test/corpus/declarations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1117,3 +1117,49 @@ struct __attribute__((__packed__)) foo_t {
(field_declaration
(primitive_type)
(field_identifier)))))

================================================================================
More Assembly
================================================================================

int main() {
int var;
__asm__(
"nop;"
: [var] "=r"(var)
:
: "eax", "ra" "x"
);
}

--------------------------------------------------------------------------------

(translation_unit
(function_definition
(primitive_type)
(function_declarator
(identifier)
(parameter_list))
(compound_statement
(declaration
(primitive_type)
(identifier))
(expression_statement
(gnu_asm_expression
(string_literal
(string_content))
(gnu_asm_output_operand_list
(gnu_asm_output_operand
(identifier)
(string_literal
(string_content))
(identifier)))
(gnu_asm_input_operand_list)
(gnu_asm_clobber_list
(string_literal
(string_content))
(concatenated_string
(string_literal
(string_content))
(string_literal
(string_content)))))))))

0 comments on commit bac0e89

Please sign in to comment.