summaryrefslogtreecommitdiff
path: root/parser/parser.fnl
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-02-17 19:57:58 +0600
committerunwox <me@unwox.com>2025-02-17 19:57:58 +0600
commitfd807bf1952073aff866bd0961ad6929e07da80d (patch)
tree43c653276b18040da2faee088e7734a345f39df6 /parser/parser.fnl
parent35541ad02fddd7cb1d8840f47b2a203e125b0acf (diff)
add daochai parser
Diffstat (limited to 'parser/parser.fnl')
-rw-r--r--parser/parser.fnl20
1 files changed, 14 insertions, 6 deletions
diff --git a/parser/parser.fnl b/parser/parser.fnl
index 7e9469e..3a4d563 100644
--- a/parser/parser.fnl
+++ b/parser/parser.fnl
@@ -74,12 +74,20 @@
(fn [name value] (*
(^ (peg.P name) 1)
(if (~= value "")
- (* "=\""
- ;; wildcard for any value
- (if (= value "*")
- (till "\"")
- (peg.P value))
- "\"")
+ (+
+ ;; attributes may be wrapped in both " and '
+ (* "=\""
+ ;; wildcard for any value
+ (if (= value "*")
+ (till "\"")
+ (peg.P value))
+ "\"")
+ (* "='"
+ ;; wildcard for any value
+ (if (= value "*")
+ (till "'")
+ (peg.P value))
+ "'"))
(maybe (.. "=\" name \""))))))
(local attrs-peg
(accumulate [sum pegs.spaces