diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-07-15 07:21:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-07-15 07:21:30 -0700 |
commit | 686f2f0ca2ac577d91bbd22cac1360132bb56472 (patch) | |
tree | 2431d807363e9c4123048acba05e11312121079c | |
parent | 472f7ac7c4dd31c6cd9b1ea833d5a74c4e674311 (diff) | |
download | txr-686f2f0ca2ac577d91bbd22cac1360132bb56472.tar.gz txr-686f2f0ca2ac577d91bbd22cac1360132bb56472.tar.bz2 txr-686f2f0ca2ac577d91bbd22cac1360132bb56472.zip |
Fix old, known syntax highlighting problems between symbols,
integers and floating literals.
* genvin.txr (txr_num): The general solution is to over-match
a number by one character: a non-token constituent, and then
subtract that from the highlight region using me=e-1.
This solves the prefix ambiguities between numbers and symbols.
(txr_badnum): New match: matches floating literals with trailing
junk, which are highlighted as errors.
(txr_directive, txr_list, txr_bracket, txr_mlist, txr_mbracket):
All of these contain a txr_badnum.
* txr.vim: Regenerated.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | genvim.txr | 18 | ||||
-rw-r--r-- | txr.vim | 18 |
3 files changed, 36 insertions, 16 deletions
@@ -1,5 +1,21 @@ 2014-07-15 Kaz Kylheku <kaz@kylheku.com> + Fix old, known syntax highlighting problems between symbols, + integers and floating literals. + + * genvin.txr (txr_num): The general solution is to over-match + a number by one character: a non-token constituent, and then + subtract that from the highlight region using me=e-1. + This solves the prefix ambiguities between numbers and symbols. + (txr_badnum): New match: matches floating literals with trailing + junk, which are highlighted as errors. + (txr_directive, txr_list, txr_bracket, txr_mlist, txr_mbracket): + All of these contain a txr_badnum. + + * txr.vim: Regenerated. + +2014-07-15 Kaz Kylheku <kaz@kylheku.com> + Fix broken regex highlighting. * genvim.txr (txl_regex): Missing syntactic region added. @@ -92,13 +92,14 @@ syn match txr_dot "\." contained syn match txr_num "#x[+\-]\?[0-9A-Fa-f]\+" contained syn match txr_num "#o[+\-]\?[0-7]\+" contained syn match txr_num "#b[+\-]\?[0-1]\+" contained -syn match txr_num "[+\-]\?[0-9]\+" contained syn match txr_ident "[:@@][A-Za-z0-9!#$%&*+\-<=>?\\^_~]\+" contained syn match txr_ident "[A-Za-z0-9!$%&*+\-<=>?\\_~]*[A-Za-z!$#%&*+\-<=>?\\^_~][A-Za-z0-9!$#%&*+\-<=>?\\^_~]*" contained syn match txl_ident "[:@@][A-Za-z0-9!$%&*+\-<=>?\\\^_~/]\+" contained syn match txl_ident "[A-Za-z0-9!$%&*+\-<=>?\\_~/]*[A-Za-z!$#%&*+\-<=>?\\^_~/][A-Za-z0-9!$#%&*+\-<=>?\\^_~/]*" contained -syn match txr_num "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?" contained -syn match txr_num "[+\-]\?[0-9]\+\([eE][+\-]\?[0-9]\+\)" contained +syn match txr_num "[+\-]\?[0-9]\+[^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]"me=e-1 contained +syn match txr_badnum "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?[A-Za-z!$#%&*+\-<=>?\\^_~/]\+" contained +syn match txr_num "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?[^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]"me=e-1 contained +syn match txr_num "[+\-]\?[0-9]\+\([eE][+\-]\?[0-9]\+\)[^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]"me=e-1 contained syn match txl_ident ":" contained syn match txr_unquote "," contained @@ -109,11 +110,11 @@ syn match txr_dotdot "\.\." contained syn match txr_metaat "@@" contained syn region txr_bracevar matchgroup=Delimiter start="@@[ \t]*[*]\?{" matchgroup=Delimiter end="}" contains=txr_num,txr_ident,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_regex,txr_quasilit,txr_chr,txr_nested_error -syn region txr_directive matchgroup=Delimiter start="@@[ \t]*(" matchgroup=Delimiter end=")" contains=txr_keyword,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_num,txl_ident,txl_regex,txr_string,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,txr_ncomment,txr_nested_error -syn region txr_list contained matchgroup=Delimiter start="#\?H\?(" 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_bracket contained matchgroup=Delimiter start="\[" 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_mlist contained 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_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_directive matchgroup=Delimiter start="@@[ \t]*(" matchgroup=Delimiter end=")" contains=txr_keyword,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_num,txr_badnum,txl_ident,txl_regex,txr_string,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,txr_ncomment,txr_nested_error +syn region txr_list contained matchgroup=Delimiter start="#\?H\?(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_bracket contained matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_mlist contained matchgroup=Delimiter start="@@[ \t]*(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_mbracket matchgroup=Delimiter start="@@[ \t]*\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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 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" @@ -140,6 +141,7 @@ hi def link txr_metanum Identifier hi def link txr_ident Identifier hi def link txl_ident Identifier hi def link txr_num Number +hi def link txr_badnum Error hi def link txr_quote Special hi def link txr_unquote Special hi def link txr_splice Special @@ -207,13 +207,14 @@ syn match txr_dot "\." contained syn match txr_num "#x[+\-]\?[0-9A-Fa-f]\+" contained syn match txr_num "#o[+\-]\?[0-7]\+" contained syn match txr_num "#b[+\-]\?[0-1]\+" contained -syn match txr_num "[+\-]\?[0-9]\+" contained syn match txr_ident "[:@][A-Za-z0-9!#$%&*+\-<=>?\\^_~]\+" contained syn match txr_ident "[A-Za-z0-9!$%&*+\-<=>?\\_~]*[A-Za-z!$#%&*+\-<=>?\\^_~][A-Za-z0-9!$#%&*+\-<=>?\\^_~]*" contained syn match txl_ident "[:@][A-Za-z0-9!$%&*+\-<=>?\\\^_~/]\+" contained syn match txl_ident "[A-Za-z0-9!$%&*+\-<=>?\\_~/]*[A-Za-z!$#%&*+\-<=>?\\^_~/][A-Za-z0-9!$#%&*+\-<=>?\\^_~/]*" contained -syn match txr_num "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?" contained -syn match txr_num "[+\-]\?[0-9]\+\([eE][+\-]\?[0-9]\+\)" contained +syn match txr_num "[+\-]\?[0-9]\+[^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]"me=e-1 contained +syn match txr_badnum "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?[A-Za-z!$#%&*+\-<=>?\\^_~/]\+" contained +syn match txr_num "[+\-]\?[0-9]*[.][0-9]\+\([eE][+\-]\?[0-9]\+\)\?[^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]"me=e-1 contained +syn match txr_num "[+\-]\?[0-9]\+\([eE][+\-]\?[0-9]\+\)[^A-Za-z0-9!$#%&*+\-<=>?\\^_~/]"me=e-1 contained syn match txl_ident ":" contained syn match txr_unquote "," contained @@ -224,11 +225,11 @@ syn match txr_dotdot "\.\." contained syn match txr_metaat "@" contained syn region txr_bracevar matchgroup=Delimiter start="@[ \t]*[*]\?{" matchgroup=Delimiter end="}" contains=txr_num,txr_ident,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_regex,txr_quasilit,txr_chr,txr_nested_error -syn region txr_directive matchgroup=Delimiter start="@[ \t]*(" matchgroup=Delimiter end=")" contains=txr_keyword,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_num,txl_ident,txl_regex,txr_string,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,txr_ncomment,txr_nested_error -syn region txr_list contained matchgroup=Delimiter start="#\?H\?(" 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_bracket contained matchgroup=Delimiter start="\[" 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_mlist contained 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_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_directive matchgroup=Delimiter start="@[ \t]*(" matchgroup=Delimiter end=")" contains=txr_keyword,txr_string,txr_list,txr_bracket,txr_mlist,txr_mbracket,txr_quasilit,txr_num,txr_badnum,txl_ident,txl_regex,txr_string,txr_chr,txr_quote,txr_unquote,txr_splice,txr_dot,txr_dotdot,txr_metaat,txr_ncomment,txr_nested_error +syn region txr_list contained matchgroup=Delimiter start="#\?H\?(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_bracket contained matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_mlist contained matchgroup=Delimiter start="@[ \t]*(" matchgroup=Delimiter end=")" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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_mbracket matchgroup=Delimiter start="@[ \t]*\[" matchgroup=Delimiter end="\]" contains=txl_keyword,txr_string,txl_regex,txr_num,txr_badnum,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 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" @@ -255,6 +256,7 @@ hi def link txr_metanum Identifier hi def link txr_ident Identifier hi def link txl_ident Identifier hi def link txr_num Number +hi def link txr_badnum Error hi def link txr_quote Special hi def link txr_unquote Special hi def link txr_splice Special |