summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/web.py7
-rw-r--r--tests/examplefiles/example.hx7
2 files changed, 13 insertions, 1 deletions
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py
index cd619596..0188508f 100644
--- a/pygments/lexers/web.py
+++ b/pygments/lexers/web.py
@@ -1611,13 +1611,18 @@ class HaxeLexer(ExtendedRegexLexer):
(r'(?:extern|private)\b', Keyword.Declaration),
(r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')),
- (r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'class')),
+ (r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'macro-class')),
(r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')),
(r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')),
default(('#pop', 'expr')),
],
+ 'macro-class': [
+ (r'\{', Punctuation, ('#pop', 'class-body')),
+ include('class')
+ ],
+
# cast can be written as "cast expr" or "cast(expr, type)"
'cast': [
include('spaces'),
diff --git a/tests/examplefiles/example.hx b/tests/examplefiles/example.hx
index 381cf825..7584fc81 100644
--- a/tests/examplefiles/example.hx
+++ b/tests/examplefiles/example.hx
@@ -181,5 +181,12 @@ var c = macro class MyClass {
var c = macro interface IClass {};
+//macro class could have no name...
+var def = macro class {
+ private inline function new(loader) this = loader;
+ private var loader(get,never) : $loaderType;
+ inline private function get_loader() : $loaderType return this;
+};
+
//ECheckType
var f = (123:Float); \ No newline at end of file