Skip to content

Commit

Permalink
Update grammar to support complex indices for macros (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
siefkenj authored Nov 28, 2023
1 parent 079bcb2 commit a03aa89
Show file tree
Hide file tree
Showing 4 changed files with 428 additions and 217 deletions.
2 changes: 1 addition & 1 deletion packages/parser/src/macros/macros.peggy
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ BalancedParenText
PropAttrs = "{" _? @(@Attr _?)* "}"

PropIndex
= "[" _? value:(Macro / TextWithoutClosingSquareBrace) _? "]" {
= "[" _? value:(@(FunctionMacro / Macro / TextWithoutClosingSquareBrace) _?)* "]" {
return withPosition({ type: "index", value });
}

Expand Down
2 changes: 1 addition & 1 deletion packages/parser/src/macros/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export type PropIndex = {
start: { offset: number; line: number; column: number };
end: { offset: number; line: number; column: number };
};
} & { type: "index"; value: Macro | TextWithoutClosingSquareBrace };
} & { type: "index"; value: (FunctionMacro | Macro | TextWithoutClosingSquareBrace)[] };
export type Attr =
| ({
position: {
Expand Down
Loading

0 comments on commit a03aa89

Please sign in to comment.