summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-15 16:28:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-15 16:28:50 -0700
commit610aaad39b888898003dbcc057055c95883918b3 (patch)
tree09358b3f985f42029cc5cba7252b0148e541078d
parent122b39ad1a2404987157f78ff39a23a4ebb9bbad (diff)
downloadtxr-610aaad39b888898003dbcc057055c95883918b3.tar.gz
txr-610aaad39b888898003dbcc057055c95883918b3.tar.bz2
txr-610aaad39b888898003dbcc057055c95883918b3.zip
* parser.l: Bugfix. When handling a backslash-newline continuation
in the SPECIAL, NESTED and BRACED states, do not pop the state in all three, only in SPECIAL (to terminate the @\ continuation). * txr.1: Eliminate wrong claim that string literals do not split across lines, which is directly contradicted two paragraphs later. Document that quasiliterals also split. * genvim.txr (txr_regex, txl_regex): These definitions change from "syn match" to "syn region" so that the backslash-newline continuation can be properly handled. (txr_string, txr_quasilit): Correctly handle split literals. * txr.vim: Regenerated.
-rw-r--r--ChangeLog17
-rw-r--r--genvim.txr10
-rw-r--r--parser.l3
-rw-r--r--txr.17
-rw-r--r--txr.vim10
5 files changed, 36 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 491b7884..2bd7511f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2014-03-15 Kaz Kylheku <kaz@kylheku.com>
+ * parser.l: Bugfix. When handling a backslash-newline continuation
+ in the SPECIAL, NESTED and BRACED states, do not pop the state in all
+ three, only in SPECIAL (to terminate the @\ continuation).
+
+ * txr.1: Eliminate wrong claim that string literals do not split across lines,
+ which is directly contradicted two paragraphs later. Document that
+ quasiliterals also split.
+
+ * genvim.txr (txr_regex, txl_regex): These definitions change from "syn match"
+ to "syn region" so that the backslash-newline continuation can be properly
+ handled.
+ (txr_string, txr_quasilit): Correctly handle split literals.
+
+ * txr.vim: Regenerated.
+
+2014-03-15 Kaz Kylheku <kaz@kylheku.com>
+
* parser.y (text): Allow the EMPTY token (the @(empty) syntax)
to be a text.
diff --git a/genvim.txr b/genvim.txr
index 1fabcb91..44261bc6 100644
--- a/genvim.txr
+++ b/genvim.txr
@@ -86,8 +86,8 @@ syn match txr_chr "#\\x[A-Fa-f0-9]\+" contained
syn match txr_chr "#\\o[0-9]\+" contained
syn match txr_chr "#\\[^ \t\nA-Za-z0-9_]" contained
syn match txr_chr "#\\[A-Za-z0-9_]\+" contained
-syn match txr_regex "/\(\\/\|[^/]\|\\\n\)*/" contained
-syn match txl_regex "#/\(\\/\|[^/]\|\\\n\)*/" contained
+"syn match txr_regex "/\(\\/\|[^/]\|\\\n\)*/" contained
+"syn match txl_regex "#/\(\\/\|[^/]\|\\\n\)*/" contained
syn match txr_ncomment ";.*" contained
syn match txr_dot "\." contained
@@ -122,8 +122,10 @@ syn region txr_mlist contained matchgroup=Delimiter start="@@[ \t]*(" matchgroup
syn region txr_mbracket matchgroup=Delimiter start="@@[ \t]*\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txl_ident,txr_metanum,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,txr_ncomment,txr_nested_error
-syn region txr_string contained oneline start=+"+ skip=+\\\\\|\\"+ end=+"+
-syn region txr_quasilit contained oneline start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=txr_variable,txr_metanum,txr_bracevar,txr_mlist,txr_mbracket
+syn region txr_string contained start=+"+ skip=+\\\\\|\\"\|\\\n+ end=+"\|\n+
+syn region txr_quasilit contained start=+`+ skip=+\\\\\|\\`\|\\\n+ end=+`\|\n+ contains=txr_variable,txr_metanum,txr_bracevar,txr_mlist,txr_mbracket
+syn region txr_regex contained start="/" skip="\\\\\|\\/\|\\\n" end="/\|\n"
+syn region txl_regex contained start="#/" skip="\\\\\|\\/\|\\\n" end="/\|\n"
hi def link txr_at Special
hi def link txr_atstar Special
diff --git a/parser.l b/parser.l
index f8d08454..335650b5 100644
--- a/parser.l
+++ b/parser.l
@@ -609,7 +609,8 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
}
<SPECIAL,NESTED,BRACED>[\\]\n{WS} {
- yy_pop_state();
+ if (YYSTATE == SPECIAL)
+ yy_pop_state(); /* @\ continuation */
lineno++;
}
diff --git a/txr.1 b/txr.1
index 0c86dd5d..08806828 100644
--- a/txr.1
+++ b/txr.1
@@ -1097,8 +1097,8 @@ Scheme language. Note that #\elinefeed and #\enewline are the same character.
.SS String Literals
-String literals are delimited by double quote respectively, and may not span
-multiple lines. A double quote within a string literal is encoded using \e"
+String literals are delimited by double quote respectively.
+A double quote within a string literal is encoded using \e"
and a backslash is encoded as \e\e. Backslash escapes like \en and \et
are recognized, as are hexadecimal escapes like \exFF or \exxabc and octal
escapes like \e123. Ambiguity between an escape and subsequent
@@ -1130,6 +1130,9 @@ syntax. Expressions within variables substitutions follow the evaluation rules
of TXR Lisp when the quasiliteral occurs in TXR Lisp, and the rules of
the TXR pattern language when the quasiliteral occurs in the pattern language.
+Quasliterals can be split into multiple lines in the same way as ordinary
+string literals.
+
.SS Numbers
TXR supports integers and floating-point numbers.
diff --git a/txr.vim b/txr.vim
index 1f3bbb26..d2e7eb32 100644
--- a/txr.vim
+++ b/txr.vim
@@ -187,8 +187,8 @@ syn match txr_chr "#\\x[A-Fa-f0-9]\+" contained
syn match txr_chr "#\\o[0-9]\+" contained
syn match txr_chr "#\\[^ \t\nA-Za-z0-9_]" contained
syn match txr_chr "#\\[A-Za-z0-9_]\+" contained
-syn match txr_regex "/\(\\/\|[^/]\|\\\n\)*/" contained
-syn match txl_regex "#/\(\\/\|[^/]\|\\\n\)*/" contained
+"syn match txr_regex "/\(\\/\|[^/]\|\\\n\)*/" contained
+"syn match txl_regex "#/\(\\/\|[^/]\|\\\n\)*/" contained
syn match txr_ncomment ";.*" contained
syn match txr_dot "\." contained
@@ -223,8 +223,10 @@ syn region txr_mlist contained matchgroup=Delimiter start="@[ \t]*(" matchgroup=
syn region txr_mbracket matchgroup=Delimiter start="@[ \t]*\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txl_ident,txr_metanum,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,txr_ncomment,txr_nested_error
-syn region txr_string contained oneline start=+"+ skip=+\\\\\|\\"+ end=+"+
-syn region txr_quasilit contained oneline start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=txr_variable,txr_metanum,txr_bracevar,txr_mlist,txr_mbracket
+syn region txr_string contained start=+"+ skip=+\\\\\|\\"\|\\\n+ end=+"\|\n+
+syn region txr_quasilit contained start=+`+ skip=+\\\\\|\\`\|\\\n+ end=+`\|\n+ contains=txr_variable,txr_metanum,txr_bracevar,txr_mlist,txr_mbracket
+syn region txr_regex contained start="/" skip="\\\\\|\\/\|\\\n" end="/\|\n"
+syn region txl_regex contained start="#/" skip="\\\\\|\\/\|\\\n" end="/\|\n"
hi def link txr_at Special
hi def link txr_atstar Special