aboutsummaryrefslogtreecommitdiff
path: root/lua/lexers/typescript.lua
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-08-11 01:27:32 +0200
committerRandy Palamar <randy@rnpnr.xyz>2024-03-27 06:04:21 -0600
commit4c4392d29df777ff702dfe99b4f3c23142976e05 (patch)
tree5355324abe18952f7d19d6cfc5dbeb5d6cb72b84 /lua/lexers/typescript.lua
parent95bf9f59f8a9a37148bdc0787db378d62c7cd032 (diff)
downloadvis-4c4392d29df777ff702dfe99b4f3c23142976e05.tar.gz
vis-4c4392d29df777ff702dfe99b4f3c23142976e05.tar.xz
update lexers to orbitalquark/scintillua@b789dde
Rather than cherry pick patches from after 6.2 we will just grab everything as is.
Diffstat (limited to 'lua/lexers/typescript.lua')
-rw-r--r--lua/lexers/typescript.lua23
1 files changed, 9 insertions, 14 deletions
diff --git a/lua/lexers/typescript.lua b/lua/lexers/typescript.lua
index 414acf1..b1ee619 100644
--- a/lua/lexers/typescript.lua
+++ b/lua/lexers/typescript.lua
@@ -1,23 +1,18 @@
--- Copyright 2021-2022 Mitchell. See LICENSE.
+-- Copyright 2021-2024 Mitchell. See LICENSE.
-- TypeScript LPeg lexer.
-local lexer = require('lexer')
-local token, word_match = lexer.token, lexer.word_match
+local lexer = lexer
local P, S = lpeg.P, lpeg.S
-local lex = lexer.new('typescript', {inherit = lexer.load('javascript')})
+local lex = lexer.new(..., {inherit = lexer.load('javascript')})
--- Whitespace
-lex:modify_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))
+-- Word lists.
+lex:set_word_list(lexer.KEYWORD, 'abstract as constructor declare is module namespace require type',
+ true)
--- Keywords.
-lex:modify_rule('keyword', token(lexer.KEYWORD, word_match[[
- abstract as constructor declare is module namespace require type
-]]) + lex:get_rule('keyword'))
+lex:set_word_list(lexer.TYPE, 'boolean number bigint string unknown any void never symbol object',
+ true)
--- Types.
-lex:modify_rule('type', token(lexer.TYPE, word_match[[
- boolean number bigint string unknown any void never symbol object
-]]) + lex:get_rule('type'))
+lexer.property['scintillua.comment'] = '//'
return lex