diff options
author | Eduardo Julian | 2016-02-20 00:29:39 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-02-20 00:29:39 -0400 |
commit | 56a986a1bcc084c66b194e3d90db1417bfa90321 (patch) | |
tree | 736b5529a3dbb70e40f0d5f116c20edbc9cf8755 /src | |
parent | 6f9e28be65fdb38e460a7952393ddb7d497a016f (diff) |
- Fixed a bug when lexing text that contains escaped characters.
Diffstat (limited to 'src')
-rw-r--r-- | src/lux/lexer.clj | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lux/lexer.clj b/src/lux/lexer.clj index cbb351703..90b1f2bf1 100644 --- a/src/lux/lexer.clj +++ b/src/lux/lexer.clj @@ -65,9 +65,12 @@ post-quotes (if (.endsWith pre-quotes "\\") (if eol? (fail "[Lexer Error] Can't leave dangling back-slash \\") - (|do [_ (&reader/read-regex #"^([\"])") - next-part (lex-text-body offset)] - (return (str "\"" next-part)))) + (if (if-let [^String back-slashes (re-find #"\\+$" pre-quotes)] + (odd? (.length back-slashes))) + (|do [_ (&reader/read-regex #"^([\"])") + next-part (lex-text-body offset)] + (return (str "\"" next-part))) + (lex-text-body offset))) (if eol? (|do [[_ _ ^String line-prefix] (&reader/read-regex #"^( +|$)") :let [empty-line? (= "" line-prefix)] |