Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update lexers to Scintillua 5.3 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
vendor:
-rm -r tmp
mkdir tmp
cd tmp; curl -O https://foicica.com/textadept/download/textadept_NIGHTLY.x86_64.tgz
cd tmp; tar xzf textadept_NIGHTLY.x86_64.tgz
cd tmp; curl -L -O https://github.com/orbitalquark/scintillua/releases/download/scintillua_5.3/scintillua_5.3.zip
cd tmp; unzip scintillua_5.3.zip
mkdir -p syntaxhighlight/textadept
cp tmp/textadept_NIGHTLY*/lexers/*.lua syntaxhighlight/textadept
cp tmp/scintillua_5.3*/lexers/*.lua syntaxhighlight/textadept
sed -i -e "s/require('lexer')/require('syntaxhighlight.textadept.lexer')/" syntaxhighlight/textadept/*.lua
sed -i -e "1ilocal lpeg = require('lpeg')" $$(find syntaxhighlight/textadept/*.lua | grep -v '/lexer.lua')
cp tmp/textadept_NIGHTLY*/LICENSE syntaxhighlight/textadept
cp tmp/scintillua_5.3*/LICENSE syntaxhighlight/textadept

local: build
luarocks make --lua-version=5.1 --local syntaxhighlight-dev-1.rockspec
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

![test](https://github.com/leafo/lua-syntaxhighlight/workflows/test/badge.svg)

Highlights code into HTML using lexers from [Textadept](https://foicica.com/textadept/).
Highlights code into HTML using lexers from [Scintillua](https://github.com/orbitalquark/scintillua) (a component of Textadept/Scintilla).


```lua
Expand Down Expand Up @@ -55,7 +55,7 @@ Options:

The MIT License

Copyright (c) 2007-2019 Mitchell
Copyright (c) 2006-2021 Mitchell

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 18 additions & 0 deletions syntaxhighlight-dev-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ build = {
["syntaxhighlight.textadept.boo"] = "syntaxhighlight/textadept/boo.lua",
["syntaxhighlight.textadept.caml"] = "syntaxhighlight/textadept/caml.lua",
["syntaxhighlight.textadept.chuck"] = "syntaxhighlight/textadept/chuck.lua",
["syntaxhighlight.textadept.clojure"] = "syntaxhighlight/textadept/clojure.lua",
["syntaxhighlight.textadept.cmake"] = "syntaxhighlight/textadept/cmake.lua",
["syntaxhighlight.textadept.coffeescript"] = "syntaxhighlight/textadept/coffeescript.lua",
["syntaxhighlight.textadept.container"] = "syntaxhighlight/textadept/container.lua",
Expand All @@ -53,15 +54,20 @@ build = {
["syntaxhighlight.textadept.dot"] = "syntaxhighlight/textadept/dot.lua",
["syntaxhighlight.textadept.eiffel"] = "syntaxhighlight/textadept/eiffel.lua",
["syntaxhighlight.textadept.elixir"] = "syntaxhighlight/textadept/elixir.lua",
["syntaxhighlight.textadept.elm"] = "syntaxhighlight/textadept/elm.lua",
["syntaxhighlight.textadept.erlang"] = "syntaxhighlight/textadept/erlang.lua",
["syntaxhighlight.textadept.fantom"] = "syntaxhighlight/textadept/fantom.lua",
["syntaxhighlight.textadept.faust"] = "syntaxhighlight/textadept/faust.lua",
["syntaxhighlight.textadept.fennel"] = "syntaxhighlight/textadept/fennel.lua",
["syntaxhighlight.textadept.fish"] = "syntaxhighlight/textadept/fish.lua",
["syntaxhighlight.textadept.forth"] = "syntaxhighlight/textadept/forth.lua",
["syntaxhighlight.textadept.fortran"] = "syntaxhighlight/textadept/fortran.lua",
["syntaxhighlight.textadept.fsharp"] = "syntaxhighlight/textadept/fsharp.lua",
["syntaxhighlight.textadept.fstab"] = "syntaxhighlight/textadept/fstab.lua",
["syntaxhighlight.textadept.gap"] = "syntaxhighlight/textadept/gap.lua",
["syntaxhighlight.textadept.gettext"] = "syntaxhighlight/textadept/gettext.lua",
["syntaxhighlight.textadept.gherkin"] = "syntaxhighlight/textadept/gherkin.lua",
["syntaxhighlight.textadept.gleam"] = "syntaxhighlight/textadept/gleam.lua",
["syntaxhighlight.textadept.glsl"] = "syntaxhighlight/textadept/glsl.lua",
["syntaxhighlight.textadept.gnuplot"] = "syntaxhighlight/textadept/gnuplot.lua",
["syntaxhighlight.textadept.go"] = "syntaxhighlight/textadept/go.lua",
Expand All @@ -76,8 +82,10 @@ build = {
["syntaxhighlight.textadept.io_lang"] = "syntaxhighlight/textadept/io_lang.lua",
["syntaxhighlight.textadept.java"] = "syntaxhighlight/textadept/java.lua",
["syntaxhighlight.textadept.javascript"] = "syntaxhighlight/textadept/javascript.lua",
["syntaxhighlight.textadept.jq"] = "syntaxhighlight/textadept/jq.lua",
["syntaxhighlight.textadept.json"] = "syntaxhighlight/textadept/json.lua",
["syntaxhighlight.textadept.jsp"] = "syntaxhighlight/textadept/jsp.lua",
["syntaxhighlight.textadept.julia"] = "syntaxhighlight/textadept/julia.lua",
["syntaxhighlight.textadept.latex"] = "syntaxhighlight/textadept/latex.lua",
["syntaxhighlight.textadept.ledger"] = "syntaxhighlight/textadept/ledger.lua",
["syntaxhighlight.textadept.less"] = "syntaxhighlight/textadept/less.lua",
Expand All @@ -92,9 +100,11 @@ build = {
["syntaxhighlight.textadept.markdown"] = "syntaxhighlight/textadept/markdown.lua",
["syntaxhighlight.textadept.matlab"] = "syntaxhighlight/textadept/matlab.lua",
["syntaxhighlight.textadept.mediawiki"] = "syntaxhighlight/textadept/mediawiki.lua",
["syntaxhighlight.textadept.meson"] = "syntaxhighlight/textadept/meson.lua",
["syntaxhighlight.textadept.moonscript"] = "syntaxhighlight/textadept/moonscript.lua",
["syntaxhighlight.textadept.myrddin"] = "syntaxhighlight/textadept/myrddin.lua",
["syntaxhighlight.textadept.nemerle"] = "syntaxhighlight/textadept/nemerle.lua",
["syntaxhighlight.textadept.networkd"] = "syntaxhighlight/textadept/networkd.lua",
["syntaxhighlight.textadept.nim"] = "syntaxhighlight/textadept/nim.lua",
["syntaxhighlight.textadept.nsis"] = "syntaxhighlight/textadept/nsis.lua",
["syntaxhighlight.textadept.null"] = "syntaxhighlight/textadept/null.lua",
Expand All @@ -105,6 +115,7 @@ build = {
["syntaxhighlight.textadept.pico8"] = "syntaxhighlight/textadept/pico8.lua",
["syntaxhighlight.textadept.pike"] = "syntaxhighlight/textadept/pike.lua",
["syntaxhighlight.textadept.pkgbuild"] = "syntaxhighlight/textadept/pkgbuild.lua",
["syntaxhighlight.textadept.pony"] = "syntaxhighlight/textadept/pony.lua",
["syntaxhighlight.textadept.powershell"] = "syntaxhighlight/textadept/powershell.lua",
["syntaxhighlight.textadept.prolog"] = "syntaxhighlight/textadept/prolog.lua",
["syntaxhighlight.textadept.props"] = "syntaxhighlight/textadept/props.lua",
Expand All @@ -114,10 +125,12 @@ build = {
["syntaxhighlight.textadept.python"] = "syntaxhighlight/textadept/python.lua",
["syntaxhighlight.textadept.rails"] = "syntaxhighlight/textadept/rails.lua",
["syntaxhighlight.textadept.rc"] = "syntaxhighlight/textadept/rc.lua",
["syntaxhighlight.textadept.reason"] = "syntaxhighlight/textadept/reason.lua",
["syntaxhighlight.textadept.rebol"] = "syntaxhighlight/textadept/rebol.lua",
["syntaxhighlight.textadept.rest"] = "syntaxhighlight/textadept/rest.lua",
["syntaxhighlight.textadept.rexx"] = "syntaxhighlight/textadept/rexx.lua",
["syntaxhighlight.textadept.rhtml"] = "syntaxhighlight/textadept/rhtml.lua",
["syntaxhighlight.textadept.routeros"] = "syntaxhighlight/textadept/routeros.lua",
["syntaxhighlight.textadept.rstats"] = "syntaxhighlight/textadept/rstats.lua",
["syntaxhighlight.textadept.ruby"] = "syntaxhighlight/textadept/ruby.lua",
["syntaxhighlight.textadept.rust"] = "syntaxhighlight/textadept/rust.lua",
Expand All @@ -127,14 +140,17 @@ build = {
["syntaxhighlight.textadept.smalltalk"] = "syntaxhighlight/textadept/smalltalk.lua",
["syntaxhighlight.textadept.sml"] = "syntaxhighlight/textadept/sml.lua",
["syntaxhighlight.textadept.snobol4"] = "syntaxhighlight/textadept/snobol4.lua",
["syntaxhighlight.textadept.spin"] = "syntaxhighlight/textadept/spin.lua",
["syntaxhighlight.textadept.sql"] = "syntaxhighlight/textadept/sql.lua",
["syntaxhighlight.textadept.systemd"] = "syntaxhighlight/textadept/systemd.lua",
["syntaxhighlight.textadept.taskpaper"] = "syntaxhighlight/textadept/taskpaper.lua",
["syntaxhighlight.textadept.tcl"] = "syntaxhighlight/textadept/tcl.lua",
["syntaxhighlight.textadept.tex"] = "syntaxhighlight/textadept/tex.lua",
["syntaxhighlight.textadept.texinfo"] = "syntaxhighlight/textadept/texinfo.lua",
["syntaxhighlight.textadept.text"] = "syntaxhighlight/textadept/text.lua",
["syntaxhighlight.textadept.toml"] = "syntaxhighlight/textadept/toml.lua",
["syntaxhighlight.textadept.txt2tags"] = "syntaxhighlight/textadept/txt2tags.lua",
["syntaxhighlight.textadept.typescript"] = "syntaxhighlight/textadept/typescript.lua",
["syntaxhighlight.textadept.vala"] = "syntaxhighlight/textadept/vala.lua",
["syntaxhighlight.textadept.vb"] = "syntaxhighlight/textadept/vb.lua",
["syntaxhighlight.textadept.vbscript"] = "syntaxhighlight/textadept/vbscript.lua",
Expand All @@ -144,6 +160,8 @@ build = {
["syntaxhighlight.textadept.wsf"] = "syntaxhighlight/textadept/wsf.lua",
["syntaxhighlight.textadept.xml"] = "syntaxhighlight/textadept/xml.lua",
["syntaxhighlight.textadept.xtend"] = "syntaxhighlight/textadept/xtend.lua",
["syntaxhighlight.textadept.xs"] = "syntaxhighlight/textadept/xs.lua",
["syntaxhighlight.textadept.yaml"] = "syntaxhighlight/textadept/yaml.lua",
["syntaxhighlight.textadept.zig"] = "syntaxhighlight/textadept/zig.lua",
}
}
2 changes: 1 addition & 1 deletion syntaxhighlight/textadept/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2007-2019 Mitchell
Copyright (c) 2007-2021 Mitchell

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 17 additions & 16 deletions syntaxhighlight/textadept/actionscript.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
local lpeg = require('lpeg')
-- Copyright 2006-2020 Mitchell mitchell.att.foicica.com. See License.txt.
-- Copyright 2006-2021 Mitchell. See LICENSE.
-- Actionscript LPeg lexer.

local lexer = require('syntaxhighlight.textadept.lexer')
local token, word_match = lexer.token, lexer.word_match
local P, R, S = lpeg.P, lpeg.R, lpeg.S
local P, S = lpeg.P, lpeg.S

local lex = lexer.new('actionscript')

-- Whitespace.
lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))

-- Keywords.
lex:add_rule('keyword', token(lexer.KEYWORD, word_match[[
break continue delete do else for function if in new on return this typeof var
void while with NaN Infinity false null true undefined
lex:add_rule('keyword', token(lexer.KEYWORD, word_match{
'break', 'continue', 'delete', 'do', 'else', 'for', 'function', 'if', 'in', 'new', 'on', 'return',
'this', 'typeof', 'var', 'void', 'while', 'with', 'NaN', 'Infinity', 'false', 'null', 'true',
'undefined',
-- Reserved for future use.
abstract case catch class const debugger default export extends final finally
goto implements import instanceof interface native package private Void
protected public dynamic static super switch synchonized throw throws
transient try volatile
]]))
'abstract', 'case', 'catch', 'class', 'const', 'debugger', 'default', 'export', 'extends',
'final', 'finally', 'goto', 'implements', 'import', 'instanceof', 'interface', 'native',
'package', 'private', 'Void', 'protected', 'public', 'dynamic', 'static', 'super', 'switch',
'synchonized', 'throw', 'throws', 'transient', 'try', 'volatile'
}))

-- Types.
lex:add_rule('type', token(lexer.TYPE, word_match[[
Array Boolean Color Date Function Key MovieClip Math Mouse Number Object
Selection Sound String XML XMLNode XMLSocket
lex:add_rule('type', token(lexer.TYPE, word_match{
'Array', 'Boolean', 'Color', 'Date', 'Function', 'Key', 'MovieClip', 'Math', 'Mouse', 'Number',
'Object', 'Selection', 'Sound', 'String', 'XML', 'XMLNode', 'XMLSocket',
-- Reserved for future use.
boolean byte char double enum float int long short
]]))
'boolean', 'byte', 'char', 'double', 'enum', 'float', 'int', 'long', 'short'
}))

-- Identifiers.
lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word))
Expand All @@ -53,7 +54,7 @@ lex:add_rule('operator', token(lexer.OPERATOR, S('=!<>+-/*%&|^~.,;?()[]{}')))
-- Fold points.
lex:add_fold_point(lexer.OPERATOR, '{', '}')
lex:add_fold_point(lexer.COMMENT, '/*', '*/')
lex:add_fold_point(lexer.COMMENT, '//', lexer.fold_line_comments('//'))
lex:add_fold_point(lexer.COMMENT, lexer.fold_consecutive_lines('//'))
lex:add_fold_point(lexer.STRING, '<![CDATA[', ']]>')

return lex
35 changes: 18 additions & 17 deletions syntaxhighlight/textadept/ada.lua
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
local lpeg = require('lpeg')
-- Copyright 2006-2020 Mitchell mitchell.att.foicica.com. See License.txt.
-- Copyright 2006-2021 Mitchell. See LICENSE.
-- Ada LPeg lexer.

local lexer = require('syntaxhighlight.textadept.lexer')
local token, word_match = lexer.token, lexer.word_match
local P, R, S = lpeg.P, lpeg.R, lpeg.S
local P, S = lpeg.P, lpeg.S

local lex = lexer.new('ada')

-- Whitespace.
lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))

-- Keywords.
lex:add_rule('keyword', token(lexer.KEYWORD, word_match[[
abort abs accept all and begin body case declare delay do else elsif end entry
exception exit for generic goto if in is loop mod new not null or others out
protected raise record rem renames requeue reverse select separate subtype
task terminate then type until when while xor
lex:add_rule('keyword', token(lexer.KEYWORD, word_match{
'abort', 'abs', 'accept', 'all', 'and', 'begin', 'body', 'case', 'declare', 'delay', 'do', 'else',
'elsif', 'end', 'entry', 'exception', 'exit', 'for', 'generic', 'goto', 'if', 'in', 'is', 'loop',
'mod', 'new', 'not', 'null', 'or', 'others', 'out', 'protected', 'raise', 'record', 'rem',
'renames', 'requeue', 'reverse', 'select', 'separate', 'subtype', 'task', 'terminate', 'then',
'type', 'until', 'when', 'while', 'xor',
-- Preprocessor.
package pragma use with
'package', 'pragma', 'use', 'with',
-- Function.
function procedure return
'function', 'procedure', 'return',
-- Storage class.
abstract access aliased array at constant delta digits interface limited of
private range tagged synchronized
'abstract', 'access', 'aliased', 'array', 'at', 'constant', 'delta', 'digits', 'interface',
'limited', 'of', 'private', 'range', 'tagged', 'synchronized',
-- Boolean.
true false
]]))
'true', 'false'
}))

-- Types.
lex:add_rule('type', token(lexer.TYPE, word_match[[
boolean character count duration float integer long_float long_integer
priority short_float short_integer string
]]))
lex:add_rule('type', token(lexer.TYPE, word_match{
'boolean', 'character', 'count', 'duration', 'float', 'integer', 'long_float', 'long_integer',
'priority', 'short_float', 'short_integer', 'string'
}))

-- Identifiers.
lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word))
Expand Down
Loading