You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
656 B

  1. package i
  2. import (
  3. . "github.com/alecthomas/chroma" // nolint
  4. "github.com/alecthomas/chroma/lexers/internal"
  5. )
  6. // Ini lexer.
  7. var Ini = internal.Register(MustNewLexer(
  8. &Config{
  9. Name: "INI",
  10. Aliases: []string{"ini", "cfg", "dosini"},
  11. Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig", ".editorconfig"},
  12. MimeTypes: []string{"text/x-ini", "text/inf"},
  13. },
  14. Rules{
  15. "root": {
  16. {`\s+`, Text, nil},
  17. {`[;#].*`, CommentSingle, nil},
  18. {`\[.*?\]$`, Keyword, nil},
  19. {`(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Text, Operator, Text, LiteralString), nil},
  20. {`(.+?)$`, NameAttribute, nil},
  21. },
  22. },
  23. ))