Skip to content

Commit

Permalink
Merge pull request #2670 from Kodiologist/hylex
Browse files Browse the repository at this point in the history
Improve Hy support
  • Loading branch information
Anteru authored May 4, 2024
2 parents 4d1371b + a737674 commit 338d366
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pygments/lexers/_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@
'HtmlSmartyLexer': ('pygments.lexers.templates', 'HTML+Smarty', ('html+smarty',), (), ('text/html+smarty',)),
'HttpLexer': ('pygments.lexers.textfmts', 'HTTP', ('http',), (), ()),
'HxmlLexer': ('pygments.lexers.haxe', 'Hxml', ('haxeml', 'hxml'), ('*.hxml',), ()),
'HyLexer': ('pygments.lexers.lisp', 'Hy', ('hylang',), ('*.hy',), ('text/x-hy', 'application/x-hy')),
'HybrisLexer': ('pygments.lexers.scripting', 'Hybris', ('hybris', 'hy'), ('*.hy', '*.hyb'), ('text/x-hybris', 'application/x-hybris')),
'HyLexer': ('pygments.lexers.lisp', 'Hy', ('hylang', 'hy'), ('*.hy',), ('text/x-hy', 'application/x-hy')),
'HybrisLexer': ('pygments.lexers.scripting', 'Hybris', ('hybris',), ('*.hyb',), ('text/x-hybris', 'application/x-hybris')),
'IDLLexer': ('pygments.lexers.idl', 'IDL', ('idl',), ('*.pro',), ('text/idl',)),
'IconLexer': ('pygments.lexers.unicon', 'Icon', ('icon',), ('*.icon', '*.ICON'), ()),
'IdrisLexer': ('pygments.lexers.haskell', 'Idris', ('idris', 'idr'), ('*.idr',), ('text/x-idris',)),
Expand Down
7 changes: 3 additions & 4 deletions pygments/lexers/lisp.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class HyLexer(RegexLexer):
"""
name = 'Hy'
url = 'http://hylang.org/'
aliases = ['hylang']
aliases = ['hylang', 'hy']
filenames = ['*.hy']
mimetypes = ['text/x-hy', 'application/x-hy']
version_added = '2.0'
Expand Down Expand Up @@ -519,7 +519,7 @@ class HyLexer(RegexLexer):
# valid names for identifiers
# well, names can only not consist fully of numbers
# but this should be good enough for now
valid_name = r'(?!#)[\w!$%*+<=>?/.#:-]+'
valid_name = r"[^ \t\n\r\f\v()[\]{};\"'`~]+"

def _multi_escape(entries):
return words(entries, suffix=' ')
Expand All @@ -531,8 +531,7 @@ def _multi_escape(entries):
(r';.*$', Comment.Single),

# whitespaces - usually not relevant
(r',+', Text),
(r'\s+', Whitespace),
(r'[ \t\n\r\f\v]+', Whitespace),

# numbers
(r'-?\d+\.\d+', Number.Float),
Expand Down
4 changes: 2 additions & 2 deletions pygments/lexers/scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,8 @@ class HybrisLexer(RegexLexer):
"""

name = 'Hybris'
aliases = ['hybris', 'hy']
filenames = ['*.hy', '*.hyb']
aliases = ['hybris']
filenames = ['*.hyb']
mimetypes = ['text/x-hybris', 'application/x-hybris']
url = 'https://github.com/evilsocket/hybris'
version_added = '1.4'
Expand Down
6 changes: 3 additions & 3 deletions tests/examplefiles/hylang/language.hy
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
;;;;


(defn _numeric-check [x]
(if (not (numeric? x))
(raise (TypeError (.format "{0!r} is not a number" x)))))
(defn _numeric-check []
(if (not (numeric? ))
(raise (TypeError (.format "{0!r} (↻) is not a number" )))))

(defn cycle [coll]
"Yield an infinite repetition of the items in coll"
Expand Down
8 changes: 4 additions & 4 deletions tests/examplefiles/hylang/language.hy.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 338d366

Please sign in to comment.