github.com/ladydascalie/elvish@v0.0.0-20170703214355-2964dd3ece7f/edit/highlight/style.go (about)

     1  package highlight
     2  
     3  import (
     4  	"github.com/elves/elvish/edit/ui"
     5  	"github.com/elves/elvish/parse"
     6  )
     7  
     8  // Semantically applied styles.
     9  var (
    10  	styleForGoodCommand  = ui.Styles{"green"}
    11  	styleForBadCommand   = ui.Styles{"red"}
    12  	styleForGoodVariable = ui.Styles{"magenta"}
    13  	styleForBadVariable  = ui.Styles{"white", "bg-red"}
    14  )
    15  
    16  // Lexically applied styles.
    17  
    18  // ui.Styles for Primary nodes.
    19  var styleForPrimary = map[parse.PrimaryType]ui.Styles{
    20  	parse.Bareword:     {},
    21  	parse.SingleQuoted: {"yellow"},
    22  	parse.DoubleQuoted: {"yellow"},
    23  	parse.Variable:     styleForGoodVariable,
    24  	parse.Wildcard:     {},
    25  	parse.Tilde:        {},
    26  }
    27  
    28  var styleForComment = ui.Styles{"cyan"}
    29  
    30  // ui.Styles for Sep nodes.
    31  var styleForSep = map[string]string{
    32  	">":  "green",
    33  	">>": "green",
    34  	"<":  "green",
    35  	"?>": "green",
    36  	"|":  "green",
    37  
    38  	"?(": "bold",
    39  	"(":  "bold",
    40  	")":  "bold",
    41  	"[":  "bold",
    42  	"]":  "bold",
    43  	"{":  "bold",
    44  	"}":  "bold",
    45  
    46  	"&": "bold",
    47  
    48  	"if":   "yellow",
    49  	"then": "yellow",
    50  	"elif": "yellow",
    51  	"else": "yellow",
    52  	"fi":   "yellow",
    53  
    54  	"while": "yellow",
    55  	"do":    "yellow",
    56  	"done":  "yellow",
    57  
    58  	"for": "yellow",
    59  	"in":  "yellow",
    60  
    61  	"try":     "yellow",
    62  	"except":  "yellow",
    63  	"finally": "yellow",
    64  	"tried":   "yellow",
    65  
    66  	"begin": "yellow",
    67  	"end":   "yellow",
    68  }