Struct init grammar
This commit is contained in:
@@ -105,15 +105,18 @@ primary = {
|
|||||||
postfix = {
|
postfix = {
|
||||||
field_px
|
field_px
|
||||||
| call_px
|
| call_px
|
||||||
|
| struct_px
|
||||||
| index_px
|
| index_px
|
||||||
| binary_px
|
| binary_px
|
||||||
}
|
}
|
||||||
|
|
||||||
field_px = { "." ~ identifier }
|
field_px = { "." ~ identifier }
|
||||||
call_px = { "(" ~ (expr ~ ("," ~ expr)*)? ~ ")" }
|
call_px = { "(" ~ (expr ~ ("," ~ expr)*)? ~ ")" }
|
||||||
index_px = { "[" ~ expr ~ "]" }
|
struct_px = { "{" ~ (struct_field_decl ~ ("," ~ struct_field_decl)*)? ~ "}" }
|
||||||
binary_px = { bin_op ~ expr }
|
index_px = { "[" ~ expr ~ "]" }
|
||||||
bin_op = { "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | ">" | "<=" | ">=" }
|
binary_px = { bin_op ~ expr }
|
||||||
|
bin_op = { "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | ">" | "<=" | ">=" }
|
||||||
|
struct_field_decl = { identifier ~ ":" ~ expr }
|
||||||
|
|
||||||
expr = {
|
expr = {
|
||||||
primary ~ postfix*
|
primary ~ postfix*
|
||||||
|
|||||||
@@ -105,15 +105,18 @@ primary = {
|
|||||||
postfix = {
|
postfix = {
|
||||||
field_px
|
field_px
|
||||||
| call_px
|
| call_px
|
||||||
|
| struct_px
|
||||||
| index_px
|
| index_px
|
||||||
| binary_px
|
| binary_px
|
||||||
}
|
}
|
||||||
|
|
||||||
field_px = { "." ~ identifier }
|
field_px = { "." ~ identifier }
|
||||||
call_px = { "(" ~ (expr ~ ("," ~ expr)*)? ~ ")" }
|
call_px = { "(" ~ (expr ~ ("," ~ expr)*)? ~ ")" }
|
||||||
index_px = { "[" ~ expr ~ "]" }
|
struct_px = { "{" ~ (struct_field_decl ~ ("," ~ struct_field_decl)*)? ~ "}" }
|
||||||
binary_px = { bin_op ~ expr }
|
index_px = { "[" ~ expr ~ "]" }
|
||||||
bin_op = { "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | ">" | "<=" | ">=" }
|
binary_px = { bin_op ~ expr }
|
||||||
|
bin_op = { "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | ">" | "<=" | ">=" }
|
||||||
|
struct_field_decl = { identifier ~ ":" ~ expr }
|
||||||
|
|
||||||
expr = {
|
expr = {
|
||||||
primary ~ postfix*
|
primary ~ postfix*
|
||||||
|
|||||||
Reference in New Issue
Block a user