mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 20:31:59 +00:00
Parse builtin#asm expressions
This commit is contained in:
parent
50882fbfa2
commit
86658c66b4
21 changed files with 865 additions and 31 deletions
|
|
@ -391,8 +391,33 @@ Expr =
|
|||
OffsetOfExpr =
|
||||
Attr* 'builtin' '#' 'offset_of' '(' Type ',' fields:(NameRef ('.' NameRef)* ) ')'
|
||||
|
||||
// asm := "asm!(" format_string *("," format_string) *("," operand) [","] ")"
|
||||
// global_asm := "global_asm!(" format_string *("," format_string) *("," operand) [","] ")"
|
||||
// format_string := STRING_LITERAL / RAW_STRING_LITERAL
|
||||
AsmExpr =
|
||||
Attr* 'builtin' '#' 'asm' '(' Expr ')'
|
||||
Attr* 'builtin' '#' 'asm' '(' template:(Expr (',' Expr)*) (AsmOperand (',' AsmOperand)*)? ','? ')'
|
||||
|
||||
// operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
|
||||
AsmOperandExpr = in_expr:Expr ('=>' out_expr:Expr)?
|
||||
// dir_spec := "in" / "out" / "lateout" / "inout" / "inlateout"
|
||||
AsmDirSpec = 'in' | 'out' | 'lateout' | 'inout' | 'inlateout'
|
||||
// reg_spec := <register class> / "\"" <explicit register> "\""
|
||||
AsmRegSpec = '@string' | NameRef
|
||||
// reg_operand := [ident "="] dir_spec "(" reg_spec ")" operand_expr
|
||||
AsmRegOperand = (Name '=')? AsmDirSpec '(' AsmRegSpec ')' AsmOperandExpr
|
||||
// clobber_abi := "clobber_abi(" <abi> *("," <abi>) [","] ")"
|
||||
AsmClobberAbi = 'clobber_abi' '(' ('@string' (',' '@string')* ','?) ')'
|
||||
// option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax" / "raw"
|
||||
AsmOption = 'pure' | 'nomem' | 'readonly' | 'preserves_flags' | 'noreturn' | 'nostack' | 'att_syntax' | 'raw' | 'may_unwind'
|
||||
// options := "options(" option *("," option) [","] ")"
|
||||
AsmOptions = 'options' '(' AsmOption *(',' AsmOption) ','? ')'
|
||||
// operand := reg_operand / clobber_abi / options
|
||||
AsmOperand = AsmRegOperand | AsmClobberAbi | AsmOptions | AsmLabel
|
||||
AsmLabel = 'label' BlockExpr
|
||||
AsmSym = 'sym' Expr
|
||||
AsmConst = 'const' Expr
|
||||
|
||||
|
||||
|
||||
FormatArgsExpr =
|
||||
Attr* 'builtin' '#' 'format_args' '('
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue