forked from u-root/u-root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.go
41 lines (33 loc) · 841 Bytes
/
style.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package highlight
import (
"github.com/u-root/u-root/cmds/core/elvish/edit/ui"
"github.com/u-root/u-root/cmds/core/elvish/parse"
)
// Semantically applied styles.
var (
styleForGoodCommand = ui.Styles{"green"}
styleForBadCommand = ui.Styles{"red"}
styleForGoodVariable = ui.Styles{"magenta"}
)
// Lexically applied styles.
// ui.Styles for Primary nodes.
var styleForPrimary = map[parse.PrimaryType]ui.Styles{
parse.Bareword: {},
parse.SingleQuoted: {"yellow"},
parse.DoubleQuoted: {"yellow"},
parse.Variable: styleForGoodVariable,
parse.Wildcard: {},
parse.Tilde: {},
}
var styleForComment = ui.Styles{"cyan"}
// ui.Styles for Sep nodes.
var styleForSep = map[string]string{
">": "green",
">>": "green",
"<": "green",
"?>": "green",
"|": "green",
"(": "bold",
")": "bold",
"&": "bold",
}