aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source
diff options
context:
space:
mode:
authorEduardo Julian2017-04-15 19:41:38 -0400
committerEduardo Julian2017-04-15 19:41:38 -0400
commit4295ff3a08dae2d1a31284d752c2e955456d9a32 (patch)
tree0ddc8fded7c209f940d8fde50d29226926955391 /new-luxc/source
parentd458ffd3e769fd1e1582f607091fd15e94e93cdf (diff)
- Fixed a bug with multi-line comments.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/parser.lux50
1 files changed, 26 insertions, 24 deletions
diff --git a/new-luxc/source/luxc/parser.lux b/new-luxc/source/luxc/parser.lux
index 7670d72c7..25f9af46a 100644
--- a/new-luxc/source/luxc/parser.lux
+++ b/new-luxc/source/luxc/parser.lux
@@ -46,30 +46,32 @@
(def: (multi-line-comment^ where)
(-> Cursor (Lexer [Text Cursor]))
(do Monad<Lexer>
- [_ (l;text "#(")
- [comment end] (loop [comment ""
- where (|> where
- (update@ #;column (n.+ +2)))]
- ($_ l;either
- (do @
- [_ (l;one-of "\n")]
- (recur (format comment "\n")
- (|> where
- (update@ #;line n.inc)
- (set@ #;column +0))))
- (do @
- [chunk (l;some' (l;not comment-bound^))]
- (recur (format comment chunk)
- (|> where
- (update@ #;column (n.+ (text;size chunk))))))
- (do @
- [[sub-comment sub-where] (multi-line-comment^ where)]
- (wrap [(format comment "#(" sub-comment ")#")
- sub-where]))))
- _ (l;text ")#")]
- (wrap [comment
- (|> end
- (update@ #;column (n.+ +2)))])))
+ [_ (l;text "#(")]
+ (loop [comment ""
+ where (|> where
+ (update@ #;column (n.+ +2)))]
+ ($_ l;either
+ (do @
+ [chunk (l;many' (l;not comment-bound^))]
+ (recur (format comment chunk)
+ (|> where
+ (update@ #;column (n.+ (text;size chunk))))))
+ (do @
+ [_ (l;one-of "\n")]
+ (recur (format comment "\n")
+ (|> where
+ (update@ #;line n.inc)
+ (set@ #;column +0))))
+ (do @
+ [[sub-comment sub-where] (multi-line-comment^ where)]
+ (recur (format comment "#(" sub-comment ")#")
+ sub-where))
+ (do @
+ [_ (l;text ")#")]
+ (wrap [comment
+ (|> where
+ (update@ #;column (n.+ +2)))]))
+ ))))
(def: (comment^ where)
(-> Cursor (Lexer [Text Cursor]))