diff options
Diffstat (limited to 'stdlib/source/lux/compiler/default/syntax.lux')
-rw-r--r-- | stdlib/source/lux/compiler/default/syntax.lux | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux index faa072d88..92f223940 100644 --- a/stdlib/source/lux/compiler/default/syntax.lux +++ b/stdlib/source/lux/compiler/default/syntax.lux @@ -59,7 +59,6 @@ (def: digits+ (format "_" ..digits)) (def: white-space " ") -(def: new-line "\n") ## (def: new-line^ (l.this new-line)) (def: #export text-delimiter text.double-quote) @@ -128,7 +127,7 @@ ## (:: p.Monad<Parser> wrap where))) ## Escaped character sequences follow the usual syntax of -## back-slash followed by a letter (e.g. \n). +## back-slash followed by a letter. ## Escaped characters may show up in Char and Text literals. (def: escaped-char^ (Lexer [Nat Text]) @@ -137,7 +136,6 @@ [code l.any] (case code ## Handle special cases. - "n" (wrap [2 ..new-line]) (^ (static ..escape)) (wrap [2 ..escape]) _ @@ -255,7 +253,7 @@ ## ($_ p.either ## ## Normal text characters. ## (do @ -## [normal (l.slice (l.many! (l.none-of! (format ..escape ..text-delimiter ..new-line))))] +## [normal (l.slice (l.many! (l.none-of! (format ..escape ..text-delimiter text.new-line))))] ## (recur (format text-read normal) ## (update@ #.column (n/+ (text.size normal)) where) ## #0)) @@ -373,7 +371,7 @@ ## ..sigil ## ..text-delimiter ## ..name-separator) -## space (format ..white-space ..new-line) +## space (format ..white-space text.new-line) ## head (l.none-of! (format ..digits delimiters space)) ## tail (l.some! (l.none-of! (format delimiters space)))] ## (l.slice (l.and! head tail)))) @@ -585,7 +583,7 @@ (#error.Success [("lux text size" source-code) (!inc end) <finish-text>]))))) (template: (!guarantee-no-new-lines content body) - (case ("lux text index" content (static ..new-line) 0) + (case ("lux text index" content (static text.new-line) 0) (#.Some g!_) (ex.throw ..text-cannot-contain-new-lines content) @@ -604,8 +602,7 @@ (^template [<input> <output>] (^ (char <input>)) (!find-next-escape 2 next-escape end source-code total <output>)) - (["n" (static ..new-line)] - [(~~ (static ..escape)) (static ..escape)]) + ([(~~ (static ..escape)) (static ..escape)]) _ (ex.throw invalid-escape-syntax [])))))) @@ -666,7 +663,7 @@ (`` (template: (!strict-name-char? char) (not (or ("lux i64 =" (.char (~~ (static ..white-space))) char) - ("lux i64 =" (.char (~~ (static ..new-line))) char) + ("lux i64 =" (.char (~~ (static text.new-line))) char) ("lux i64 =" (.char (~~ (static ..name-separator))) char) @@ -836,7 +833,7 @@ ([(~~ (static ..white-space)) #.column] [(~~ (static text.carriage-return)) #.column]) - (^ (char (~~ (static ..new-line)))) + (^ (char (~~ (static text.new-line)))) (recur tracker [(!new-line where) (!inc offset) source-code]) ## Form @@ -868,7 +865,7 @@ ## Single-line comment (^ (char (~~ (static ..sigil)))) - (case ("lux text index" source-code (static ..new-line) offset') + (case ("lux text index" source-code (static text.new-line) offset') (#.Some end) (recur tracker [(!new-line where) (!inc end) source-code]) |