package lexers import ( . "github.com/alecthomas/chroma" // nolint ) // Hy lexer. var Hy = Register(MustNewLexer( &Config{ Name: "Hy", Aliases: []string{"hylang"}, Filenames: []string{"*.hy"}, MimeTypes: []string{"text/x-hy", "application/x-hy"}, }, Rules{ "root": { {`;.*$`, CommentSingle, nil}, {`[,\s]+`, Text, nil}, {`-?\d+\.\d+`, LiteralNumberFloat, nil}, {`-?\d+`, LiteralNumberInteger, nil}, {`0[0-7]+j?`, LiteralNumberOct, nil}, {`0[xX][a-fA-F0-9]+`, LiteralNumberHex, nil}, {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`'(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil}, {`\\(.|[a-z]+)`, LiteralStringChar, nil}, {`^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil}, {`^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringDoc), nil}, {`::?(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil}, {"~@|[`\\'#^~&@]", Operator, nil}, Include("py-keywords"), Include("py-builtins"), {Words(``, ` `, `cond`, `for`, `->`, `->>`, `car`, `cdr`, `first`, `rest`, `let`, `when`, `unless`, `import`, `do`, `progn`, `get`, `slice`, `assoc`, `with-decorator`, `,`, `list_comp`, `kwapply`, `~`, `is`, `in`, `is-not`, `not-in`, `quasiquote`, `unquote`, `unquote-splice`, `quote`, `|`, `<<=`, `>>=`, `foreach`, `while`, `eval-and-compile`, `eval-when-compile`), Keyword, nil}, {Words(``, ` `, `def`, `defn`, `defun`, `defmacro`, `defclass`, `lambda`, `fn`, `setv`), KeywordDeclaration, nil}, {Words(``, ` `, `cycle`, `dec`, `distinct`, `drop`, `even?`, `filter`, `inc`, `instance?`, `iterable?`, `iterate`, `iterator?`, `neg?`, `none?`, `nth`, `numeric?`, `odd?`, `pos?`, `remove`, `repeat`, `repeatedly`, `take`, `take_nth`, `take_while`, `zero?`), NameBuiltin, nil}, {`(?<=\()(?!#)[\w!$%*+<=>?/.#-]+`, NameFunction, nil}, {`(?!#)[\w!$%*+<=>?/.#-]+`, NameVariable, nil}, {`(\[|\])`, Punctuation, nil}, {`(\{|\})`, Punctuation, nil}, {`(\(|\))`, Punctuation, nil}, }, "py-keywords": { {Words(``, `\b`, `assert`, `break`, `continue`, `del`, `elif`, `else`, `except`, `exec`, `finally`, `for`, `global`, `if`, `lambda`, `pass`, `print`, `raise`, `return`, `try`, `while`, `yield`, `yield from`, `as`, `with`), Keyword, nil}, }, "py-builtins": { {Words(`(?