Skip to content

Commit

Permalink
core: Support + escaping like . escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Jun 14, 2024
1 parent c2fcb02 commit 5f33ff6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/yamlscript/resolver.clj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@
(case style
:= (let [node
;; Remove leading escape character from value
(if (re-find #"^\.[\`\!\@\#\%\&\*\-\{\[\|\:\'\"\,\>\?]" val)
(if (re-find
#"^[\.\+][\`\!\@\#\%\&\*\-\{\[\|\:\'\"\,\>\?]" val)
(assoc node := (subs val 1))
node)]
(set/rename-keys node {:= :exp}))
Expand Down
16 changes: 16 additions & 0 deletions core/test/compiler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,22 @@
(foo || bar)
- name: Plus escaping of YAML syntax
yamlscript: |
!yamlscript/v0
=>: +'foo' * 3
=>: +"foo" * 3
=>: +[foo] + [bar]
=>: +{foo 1} + {bar 2}
foo: +|| bar
clojure: |
(*_ "foo" 3)
(*_ "foo" 3)
(+_ [foo] [bar])
(+_ {foo 1} {bar 2})
(foo || bar)
- name: Star in the middle
yamlscript: |
!yamlscript/v0
Expand Down

0 comments on commit 5f33ff6

Please sign in to comment.