-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f11b86e
commit f41bcf2
Showing
16 changed files
with
772 additions
and
152 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,78 @@ | ||
Prism.languages.haxe = Prism.languages.extend('clike', { | ||
// Strings can be multi-line | ||
'string': { | ||
pattern: /(["'])(?:(?!\1)[^\\]|\\[\s\S])*\1/, | ||
// Strings can be multi-line | ||
pattern: /"(?:[^"\\]|\\[\s\S])*"/, | ||
greedy: true | ||
}, | ||
'class-name': [ | ||
{ | ||
pattern: /(\b(?:abstract|class|enum|extends|implements|interface|new|typedef)\s+)[A-Z_]\w*/, | ||
lookbehind: true, | ||
}, | ||
// based on naming convention | ||
/\b[A-Z]\w*/ | ||
], | ||
// The final look-ahead prevents highlighting of keywords if expressions such as "haxe.macro.Expr" | ||
'keyword': /\bthis\b|\b(?:abstract|as|break|case|cast|catch|class|continue|default|do|dynamic|else|enum|extends|extern|final|for|from|function|if|implements|import|in|inline|interface|macro|new|null|operator|overload|override|package|private|public|return|static|super|switch|throw|to|try|typedef|untyped|using|var|while)(?!\.)\b/, | ||
'function': { | ||
pattern: /\b[a-z_]\w*(?=\s*(?:<[^<>]*>\s*)?\()/i, | ||
greedy: true | ||
}, | ||
'operator': /\.{3}|\+\+|--|&&|\|\||->|=>|(?:<<?|>{1,3}|[-+*/%!=&|^])=?|[?:~]/ | ||
}); | ||
|
||
Prism.languages.insertBefore('haxe', 'string', { | ||
'string-interpolation': { | ||
pattern: /'(?:[^'\\]|\\[\s\S])*'/, | ||
greedy: true, | ||
inside: { | ||
'interpolation': { | ||
pattern: /(^|[^\\])\$(?:\w+|\{[^}]+\})/, | ||
pattern: /(^|[^\\])\$(?:\w+|\{[^{}]+\})/, | ||
lookbehind: true, | ||
inside: { | ||
'interpolation': { | ||
pattern: /^\$\w*/, | ||
alias: 'variable' | ||
} | ||
// See rest below | ||
'interpolation-punctuation': { | ||
pattern: /^\$\{?|\}$/, | ||
alias: 'punctuation' | ||
}, | ||
'expression': { | ||
pattern: /[\s\S]+/, | ||
inside: Prism.languages.haxe | ||
}, | ||
} | ||
} | ||
}, | ||
'string': /[\s\S]+/ | ||
} | ||
}, | ||
// The final look-ahead prevents highlighting of keywords if expressions such as "haxe.macro.Expr" | ||
'keyword': /\bthis\b|\b(?:abstract|as|break|case|cast|catch|class|continue|default|do|dynamic|else|enum|extends|extern|for|from|function|if|implements|import|in|inline|interface|macro|new|null|override|private|public|return|static|super|switch|throw|to|try|typedef|using|var|while)(?!\.)\b/, | ||
'operator': /\.{3}|\+\+?|-[->]?|[=!]=?|&&?|\|\|?|<[<=]?|>[>=]?|[*\/%~^]/ | ||
} | ||
}); | ||
|
||
Prism.languages.insertBefore('haxe', 'class-name', { | ||
'regex': { | ||
pattern: /~\/(?:[^\/\\\r\n]|\\.)+\/[igmsu]*/, | ||
greedy: true | ||
pattern: /~\/(?:[^\/\\\r\n]|\\.)+\/[a-z]*/, | ||
greedy: true, | ||
inside: { | ||
'regex-flags': /\b[a-z]+$/, | ||
'regex-source': { | ||
pattern: /^(~\/)[\s\S]+(?=\/$)/, | ||
lookbehind: true, | ||
alias: 'language-regex', | ||
inside: Prism.languages.regex | ||
}, | ||
'regex-delimiter': /^~\/|\/$/, | ||
} | ||
} | ||
}); | ||
|
||
Prism.languages.insertBefore('haxe', 'keyword', { | ||
'preprocessor': { | ||
pattern: /#\w+/, | ||
alias: 'builtin' | ||
pattern: /#(?:else|elseif|end|if)\b.*/, | ||
alias: 'property' | ||
}, | ||
'metadata': { | ||
pattern: /@:?\w+/, | ||
pattern: /@:?[\w.]+/, | ||
alias: 'symbol' | ||
}, | ||
'reification': { | ||
pattern: /\$(?:\w+|(?=\{))/, | ||
alias: 'variable' | ||
alias: 'important' | ||
} | ||
}); | ||
Prism.languages.haxe['string'].inside['interpolation'].inside.rest = Prism.languages.haxe; | ||
delete Prism.languages.haxe['class-name']; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
~/ha\/xe/i | ||
~/[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z][A-Z][A-Z]?/i | ||
~/(dog|fox)/igmsu | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["regex", [ | ||
["regex-delimiter", "~/"], | ||
["regex-source", [ | ||
"ha", | ||
["escape", "\\/"], | ||
"xe" | ||
]], | ||
["regex-delimiter", "/"], | ||
["regex-flags", "i"] | ||
]], | ||
["regex", [ | ||
["regex-delimiter", "~/"], | ||
["regex-source", [ | ||
["char-class", [ | ||
["char-class-punctuation", "["], | ||
["range", [ | ||
"A", | ||
["range-punctuation", "-"], | ||
"Z" | ||
]], | ||
["range", [ | ||
"0", | ||
["range-punctuation", "-"], | ||
"9" | ||
]], | ||
"._%-", | ||
["char-class-punctuation", "]"] | ||
]], | ||
["quantifier", "+"], | ||
"@", | ||
["char-class", [ | ||
["char-class-punctuation", "["], | ||
["range", [ | ||
"A", | ||
["range-punctuation", "-"], | ||
"Z" | ||
]], | ||
["range", [ | ||
"0", | ||
["range-punctuation", "-"], | ||
"9" | ||
]], | ||
".-", | ||
["char-class-punctuation", "]"] | ||
]], | ||
["quantifier", "+"], | ||
["char-set", "."], | ||
["char-class", [ | ||
["char-class-punctuation", "["], | ||
["range", [ | ||
"A", | ||
["range-punctuation", "-"], | ||
"Z" | ||
]], | ||
["char-class-punctuation", "]"] | ||
]], | ||
["char-class", [ | ||
["char-class-punctuation", "["], | ||
["range", [ | ||
"A", | ||
["range-punctuation", "-"], | ||
"Z" | ||
]], | ||
["char-class-punctuation", "]"] | ||
]], | ||
["char-class", [ | ||
["char-class-punctuation", "["], | ||
["range", [ | ||
"A", | ||
["range-punctuation", "-"], | ||
"Z" | ||
]], | ||
["char-class-punctuation", "]"] | ||
]], | ||
["quantifier", "?"] | ||
]], | ||
["regex-delimiter", "/"], | ||
["regex-flags", "i"] | ||
]], | ||
["regex", [ | ||
["regex-delimiter", "~/"], | ||
["regex-source", [ | ||
["group", ["("]], | ||
"dog", | ||
["alternation", "|"], | ||
"fox", | ||
["group", ")"] | ||
]], | ||
["regex-delimiter", "/"], | ||
["regex-flags", "igmsu"] | ||
]] | ||
] |
Oops, something went wrong.