diff options
Diffstat (limited to 'new-luxc/source/luxc')
-rw-r--r-- | new-luxc/source/luxc/parser.lux | 50 |
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])) |