Fix highlighting of special token sequences and script lines

This commit is contained in:
Hackerpilot 2014-05-06 16:41:19 -07:00
parent 258aa066f7
commit 3081fa86c2
3 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,8 @@ html { background-color: #fdf6e3; color: #002b36; }
writeSpan("num", t.text); writeSpan("num", t.text);
else if (isOperator(t.type)) else if (isOperator(t.type))
writeSpan("op", str(t.type)); writeSpan("op", str(t.type));
else if (t.type == tok!"specialTokenSequence" || t.type == tok!"scriptLine")
writeSpan("cons", t.text.replace("<", "&lt;"));
else else
{ {
version(Windows) version(Windows)

1
main.d
View File

@ -101,6 +101,7 @@ int main(string[] args)
config.whitespaceBehavior = WhitespaceBehavior.include; config.whitespaceBehavior = WhitespaceBehavior.include;
config.stringBehavior = StringBehavior.source; config.stringBehavior = StringBehavior.source;
config.commentBehavior = CommentBehavior.include; config.commentBehavior = CommentBehavior.include;
config.specialTokenBehavior = SpecialTokenBehavior.include;
auto tokens = byToken(bytes, config, cache); auto tokens = byToken(bytes, config, cache);
if (highlight) if (highlight)
{ {

View File

@ -41,7 +41,7 @@ private enum dynamicTokens = [
"whitespace", "doubleLiteral", "floatLiteral", "idoubleLiteral", "whitespace", "doubleLiteral", "floatLiteral", "idoubleLiteral",
"ifloatLiteral", "intLiteral", "longLiteral", "realLiteral", "ifloatLiteral", "intLiteral", "longLiteral", "realLiteral",
"irealLiteral", "uintLiteral", "ulongLiteral", "characterLiteral", "irealLiteral", "uintLiteral", "ulongLiteral", "characterLiteral",
"dstringLiteral", "stringLiteral", "wstringLiteral", "scriptLine" "dstringLiteral", "stringLiteral", "wstringLiteral"
]; ];
private enum pseudoTokenHandlers = [ private enum pseudoTokenHandlers = [