Skip to content

Commit

Permalink
Remove conditionals from the symbol when making the hole for concrete…
Browse files Browse the repository at this point in the history
… syntax (#1878)

This fixes #1877 which unearthed that the symbolAST2SymbolConstructor behaved differently
  • Loading branch information
DavyLandman authored Oct 27, 2023
1 parent b684d0e commit b2e3e56
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public set[Production] holes(Grammar object) {
return { regular(iter(\char-class([range(48,57)]))),
prod(label("$MetaHole",getTargetSymbol(nont)),
[ \char-class([range(0,0)]),
lit("<denormalize(nont)>"),lit(":"),iter(\char-class([range(48,57)])),
lit("<removeConditionals(denormalize(nont))>"),lit(":"),iter(\char-class([range(48,57)])),
\char-class([range(0,0)])
],{Attr::\tag("holeType"(nont))}) // TODO: added qualifier to help compiler
| Symbol nont <- object.rules, quotable(nont)
Expand All @@ -64,6 +64,10 @@ private Symbol denormalize(Symbol s) = visit (s) {
case \seq(ss) => seq([t | t <- ss, !(t is layouts)])
};

private Symbol removeConditionals(Symbol sym) = visit(sym) {
case conditional(s, _) => s
};

@synopsis{This is needed such that list variables can be repeatedly used as elements of the same list}
private Symbol getTargetSymbol(Symbol sym) {
switch(sym) {
Expand Down

0 comments on commit b2e3e56

Please sign in to comment.