diff options
| author | Georgi Kirilov <in.the@repo> | 2020-01-31 18:16:32 +0200 |
|---|---|---|
| committer | Georgi Kirilov <in.the@repo> | 2020-01-31 18:23:16 +0200 |
| commit | 7e9e0a2ca868aaa214fb38a79fe71da34d6e00da (patch) | |
| tree | b1f874a31780b259929de6ed03bc477595939dbc /lua/lexers | |
| parent | 24630d2d33fc76dbde5d37051667c7176ad5de93 (diff) | |
| download | vis-7e9e0a2ca868aaa214fb38a79fe71da34d6e00da.tar.gz vis-7e9e0a2ca868aaa214fb38a79fe71da34d6e00da.tar.xz | |
lexers: XML performance improvement
the new pattern does more or less the same thing, but forward
instead of backward.
Diffstat (limited to 'lua/lexers')
| -rw-r--r-- | lua/lexers/xml.lua | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lua/lexers/xml.lua b/lua/lexers/xml.lua index d429ebb..7702444 100644 --- a/lua/lexers/xml.lua +++ b/lua/lexers/xml.lua @@ -20,13 +20,7 @@ local dq_str = l.delimited_range('"', false, true) local string = #S('\'"') * l.last_char_includes('=') * token(l.STRING, sq_str + dq_str) -local in_tag = P(function(input, index) - local before = input:sub(1, index - 1) - local s, e = before:find('<[^>]-$'), before:find('>[^<]-$') - if s and e then return s > e and index or nil end - if s then return index end - return input:find('^[^<]->', index) and index or nil -end) +local in_tag = #P((1 - S"><")^0 * ">") -- Numbers. local number = #l.digit * l.last_char_includes('=') * |
