Skip to content

Commit

Permalink
add "from" and "as" to js and ts keywords
Browse files Browse the repository at this point in the history
Also removed invalid "AS" from TypeScript lexer.
  • Loading branch information
Mesteery committed Mar 8, 2021
1 parent b483399 commit 22ca352
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pygments/lexers/javascript.py
Expand Up @@ -81,7 +81,7 @@ class JavascriptLexer(RegexLexer):
(r'[})\].]', Punctuation),
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|yield|await|async|'
r'this|of|static|export|import|debugger|extends|super)\b', Keyword, 'slashstartsregex'),
r'this|of|static|export|import|from|as|debugger|extends|super)\b', Keyword, 'slashstartsregex'),
(r'(var|let|const|with|function|class)\b', Keyword.Declaration, 'slashstartsregex'),
(r'(abstract|boolean|byte|char|double|enum|final|float|goto'
r'implements|int|interface|long|native|package|private|protected'
Expand Down Expand Up @@ -486,7 +486,7 @@ class TypeScriptLexer(RegexLexer):
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|of|'
r'this|async|await|debugger|yield|abstract|static|import|export|'
r'implements|super|extends|private|protected|public|readonly)\b',
r'from|implements|super|extends|private|protected|public|readonly)\b',
Keyword, 'slashstartsregex'),
(r'(var|let|const|with|function|class|type|enum|interface)\b',
Keyword.Declaration, 'slashstartsregex'),
Expand All @@ -504,7 +504,7 @@ class TypeScriptLexer(RegexLexer):
# Match variable type keywords
(r'\b(string|bool|number)\b', Keyword.Type),
# Match stuff like: constructor
(r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved),
(r'\b(constructor|declare|interface|as)\b', Keyword.Reserved),
# Match stuff like: super(argument, list)
(r'(super)(\s*)(\([\w,?.$\s]+\s*\))',
bygroups(Keyword.Reserved, Text), 'slashstartsregex'),
Expand Down

0 comments on commit 22ca352

Please sign in to comment.