Skip to content

Commit

Permalink
feat: improve comment handling
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma-s1n committed May 30, 2024
1 parent e96706c commit 47cf861
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/strace/parser/peg.pest
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ argument = {
#in = in_argument
}
in_argument = { expression }
in_out_argument = { expression ~ " => " ~ expression}
in_out_argument = {
("[" ~ expression ~ " => " ~ expression ~ "]" ) |
(expression ~ " => " ~ expression)
}

expression = {
#macro = macro |
#int = int |
#struct = struct |
#buf = buffer |
#set = set |
#array = array
(
#macro = macro |
#int = int |
#struct = struct |
#buf = buffer |
#set = set |
#array = array
) ~
comment?
}

symbol_name = { (ASCII_ALPHA | ASCII_DIGIT | "_")+ }
Expand All @@ -59,19 +65,13 @@ literal_int = {
}
or = { named_constant ~ ("|" ~ int)+ }
multiplication = { literal_int ~ ("*" ~ int)+ }
named_constant = { symbol_name ~ int_metadata? }
named_constant = { symbol_name ~ metadata? }

literal_int_oct = { "0" ~ ASCII_OCT_DIGIT+ }
literal_int_hex = { "0x" ~ ASCII_HEX_DIGIT+ }
literal_int_dec = {
literal_int_dec_val ~
(
#mdata = int_metadata |
#com = comment
)?
}
literal_int_dec = { literal_int_dec_val ~ metadata? }
literal_int_dec_val = { "-"? ~ ASCII_DIGIT+ }
int_metadata = { "<" ~ buffer_byte+ ~ ">" }
metadata = { "<" ~ buffer_byte+ ~ ">" }

struct = {
"{" ~
Expand Down

0 comments on commit 47cf861

Please sign in to comment.