aboutsummaryrefslogtreecommitdiff
path: root/encoder.l
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-19 10:46:20 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-19 10:46:20 +0200
commit90894c81df63c60666f3fdd6d9d3ad341deebab0 (patch)
tree415643a14635d7fdc4acedb31f7b5c1b70d40ecb /encoder.l
parentf0e252173a38da0f29566ad5650e6cd844925060 (diff)
downloadsherlock.lv2-90894c81df63c60666f3fdd6d9d3ad341deebab0.tar.xz
fix multi-line string syntax highlighting.
Diffstat (limited to 'encoder.l')
-rw-r--r--encoder.l38
1 files changed, 38 insertions, 0 deletions
diff --git a/encoder.l b/encoder.l
index 0419ccf..22ff2da 100644
--- a/encoder.l
+++ b/encoder.l
@@ -102,10 +102,14 @@ enum {
TK_STRING_IN,
TK_STRING_OUT,
TK_STRING_ERR,
+ TK_LONG_STRING_IN,
+ TK_LONG_STRING_OUT,
TK_WHITESPACE,
TK_RAW,
TK_TAB,
TK_NEWLINE,
+ TK_LT,
+ TK_GT,
TK_NAME,
TK_BADCHAR
};
@@ -122,6 +126,7 @@ number ({n}|{n}[.]{n}){exp}?
eol [\n\r]
%x XSTRING
+%x XLONG_STRING
%x XURI
%%
@@ -130,6 +135,7 @@ eol [\n\r]
"\t" return TK_TAB;
{eol} return TK_NEWLINE;
"<" BEGIN(XURI); return TK_URI_IN;
+\"\"\" BEGIN(XLONG_STRING); return TK_LONG_STRING_IN;
\" BEGIN(XSTRING); return TK_STRING_IN;
{name}: return TK_SUBJECT;
"@prefix" return TK_PREFIX;
@@ -145,11 +151,28 @@ eol [\n\r]
. return TK_RAW;
}
+<XLONG_STRING>
+{
+ \\\" return TK_RAW;
+ \"\"\" BEGIN(0); return TK_LONG_STRING_OUT;
+ {w} return TK_WHITESPACE;
+ "\t" return TK_TAB;
+ {eol} return TK_NEWLINE;
+ "<" return TK_LT;
+ ">" return TK_GT;
+ . return TK_RAW;
+}
+
<XSTRING>
{
\\\" return TK_RAW;
\" BEGIN(0); return TK_STRING_OUT;
{eol} BEGIN(0); return TK_STRING_ERR;
+ {w} return TK_WHITESPACE;
+ "\t" return TK_TAB;
+ {eol} return TK_NEWLINE;
+ "<" return TK_LT;
+ ">" return TK_GT;
. return TK_RAW;
}
@@ -219,9 +242,24 @@ ttl_to_markup(const char *utf8, FILE *f)
_add_singleton("br");
break;
+ case TK_LONG_STRING_IN:
+ _add_markup_begin(MARKUP_STRING);
+ _add_plain("\"\"\"");
+ break;
+ case TK_LONG_STRING_OUT:
+ _add_plain("\"\"\"");
+ _add_markup_end(MARKUP_STRING);
+ break;
+
case TK_NEWLINE:
_add_singleton("br");
break;
+ case TK_LT:
+ _add_plain("&lt;");
+ break;
+ case TK_GT:
+ _add_plain("&gt;");
+ break;
case TK_BADCHAR:
break;