edit: style Sep's based on the entire source text

This commit is contained in:
Qi Xiao 2016-02-01 00:39:10 +01:00
parent 9cbf1c2567
commit fb4472b1cf
2 changed files with 15 additions and 15 deletions

View File

@ -21,24 +21,24 @@ var styleForType = map[TokenType]string{
Sep: "",
}
var styleForSep = map[byte]string{
var styleForSep = map[string]string{
// unknown : "31",
'#': "36",
"#": "36",
'>': "32",
'<': "32",
'?': "32", // applies to both ?( and ?>
// "?(": "34;1",
'|': "32",
">": "32",
"<": "32",
"?>": "32",
"|": "32",
'(': "1",
')': "1",
'[': "1",
']': "1",
'{': "1",
'}': "1",
"?(": "1",
"(": "1",
")": "1",
"[": "1",
"]": "1",
"{": "1",
"}": "1",
'&': "1",
"&": "1",
}
// Styles for semantic coloring.

View File

@ -76,7 +76,7 @@ func produceTokens(n parse.Node, tokenCh chan<- Token) {
}
case *parse.Sep:
tokenType = Sep
moreStyle = styleForSep[n.SourceText()[0]]
moreStyle = styleForSep[n.SourceText()]
}
tokenCh <- Token{tokenType, n.SourceText(), n, moreStyle}
}