diff options
author | Eduardo Julian | 2018-08-23 01:24:29 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-08-23 01:24:29 -0400 |
commit | 7e312258b13c5fc9c80079fede0e41d479a8a327 (patch) | |
tree | 6d3158b42c007a3b481e24d31806b7d03cd7d2b0 /luxc/src | |
parent | bc251026c21590da76085bc0bc9abeaa5ec242b6 (diff) |
No more escaping of back-slash.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/lexer.clj | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index fc572790b..8ed75b940 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -26,31 +26,12 @@ ) ;; [Utils] -(defn- clean-line - "(-> Text Text)" - [^String raw-line] - (let [line-length (.length raw-line) - buffer (new StringBuffer line-length)] - (loop [idx 0] - (if (< idx line-length) - (let [current-char (.charAt raw-line idx)] - (if (= \\ current-char) - (do (assert (< (+ 1 idx) line-length) (str "[Lexer Error] Text is too short for escaping: " raw-line " " idx)) - (case (.charAt raw-line (+ 1 idx)) - \\ (do (.append buffer "\\") - (recur (+ 2 idx))) - ;; else - (assert false (str "[Lexer Error] Invalid escaping syntax: " raw-line " " idx)))) - (do (.append buffer current-char) - (recur (+ 1 idx))))) - (.toString buffer))))) - (def lex-text (|do [[meta _ _] (&reader/read-text "\"") :let [[_ _ _column] meta] [_ _ ^String content] (&reader/read-regex #"^([^\"]*)") _ (&reader/read-text "\"")] - (return (&/T [meta ($Text (clean-line content))])))) + (return (&/T [meta ($Text content)])))) (def +ident-re+ #"^([^0-9\[\]\{\}\(\)\s\"#.][^\[\]\{\}\(\)\s\"#.]*)") |