Skip to content

Commit

Permalink
Allow unlimited splice since it gives a little better readability (al…
Browse files Browse the repository at this point in the history
…though 6 more lines in total).
  • Loading branch information
rickardlindberg committed May 3, 2020
1 parent e3e7dd5 commit 0d29337
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 75 deletions.
6 changes: 2 additions & 4 deletions writing/rlmeta-vm-poster/codegenerator.rlmeta
Expand Up @@ -47,7 +47,8 @@ CodeGenerator {
x
"I('POP_STREAM')\n" }
String = py
List = astListItem*:xs -> { "(" xs "[])" }
List = astItems:x -> { "concat([" x "])" }
ListItem = py:x ast:y -> { "splice(" x ", " y ")" }
Format = astItems:x -> { "join([" x "])" }
Indent = ast:x -> { "indent(" x ")" }
FnCall = .:x astItems:y -> { x "(" y ")" }
Expand All @@ -57,8 +58,5 @@ CodeGenerator {
| ast:x astItem*:xs -> { x xs }
| -> { }
astItem = ast:x -> { ", " x }
astListItem =
| ["ListItemSplice" ast:x] -> { x "+" }
| ast:x -> { "[" x "]+" }
py = .:x -> repr(x)
}
3 changes: 1 addition & 2 deletions writing/rlmeta-vm-poster/parser.rlmeta
Expand Up @@ -34,8 +34,7 @@ Parser {
| name:x space '(' hostExpr*:ys space ')' -> ["FnCall" x ~ys]
| name:x -> ["VarLookup" x]
hostExprListItem =
| space '~' hostExpr:x -> ["ListItemSplice" x]
| hostExpr
| space '~'*:ys hostExpr:x -> ["ListItem" len(ys) x]
formatExpr =
| space '>' formatExpr*:xs space '<' -> ["Indent" ["Format" ~xs]]
| hostExpr
Expand Down

0 comments on commit 0d29337

Please sign in to comment.