diff options
| author | mitchell <unknown> | 2020-06-01 13:04:04 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2020-06-01 13:04:04 -0400 |
| commit | 6b6e98d6642b630bd04dee13ef6d8fae33c200c8 (patch) | |
| tree | 77eba49e1ce7cb09424e3a989091d809135b299e | |
| parent | d5ca0474b5e15091b94c01f878e251f4263b9192 (diff) | |
| download | scintilla-mirror-6b6e98d6642b630bd04dee13ef6d8fae33c200c8.tar.gz | |
lexlua: Added Fennel lexer.
Thanks to Momohime Honda.
| -rw-r--r-- | doc/LPegLexer.html | 2 | ||||
| -rw-r--r-- | lexlua/fennel.lua | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/doc/LPegLexer.html b/doc/LPegLexer.html index 1cb85599f..291995710 100644 --- a/doc/LPegLexer.html +++ b/doc/LPegLexer.html @@ -2566,6 +2566,7 @@ operator 30 <li>Erlang<code>*</code></li> <li>F#</li> <li>Faust</li> + <li>Fennel</li> <li>Fish<code>*</code></li> <li>Forth</li> <li>Fortran</li> @@ -2683,6 +2684,7 @@ operator 30 <li>Michael Forney</li> <li>Michael T. Richter</li> <li>Michel Martens</li> + <li>Momohime Honda</li> <li>Murray Calavera</li> <li>Neil Hodgson</li> <li>Olivier Guibé</li> diff --git a/lexlua/fennel.lua b/lexlua/fennel.lua new file mode 100644 index 000000000..19db55bea --- /dev/null +++ b/lexlua/fennel.lua @@ -0,0 +1,37 @@ +-- Copyright 2006-2020 Mitchell mitchell.att.foicica.com. See License.txt. +-- Fennel LPeg lexer. +-- Contributed by Momohime Honda. + +local lexer = require('lexer') +local token, word_match = lexer.token, lexer.word_match +local P, S = lpeg.P, lpeg.S + +local lex = lexer.new('fennel', {inherit = lexer.load('lua')}) + +-- Whitespace. +lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) + +-- Keywords. +lex:modify_rule('keyword', token(lexer.KEYWORD, word_match[[ + % * + - ->> -> -?>> -?> .. . // / : <= < = >= > ^ ~= λ + and comment do doc doto each eval-compiler fn for global hashfn if include + lambda length let local lua macro macros match not not= or partial quote + require-macros set set-forcibly! tset values var when while +]])) + +-- Identifiers. +local initial = lexer.alpha + S"|$%&#*+-./:<=>?~^_λ!" +local subsequent = initial + lexer.digit +lex:modify_rule('identifier', token(lexer.IDENTIFIER, initial * subsequent^0)) + +-- Strings. +lex:modify_rule('string', token(lexer.STRING, lexer.range('"'))) + +-- Comments. +lex:modify_rule('comment', token(lexer.COMMENT, lexer.to_eol(';'))) + +-- Ignore these rules. +lex:modify_rule('label', P(false)) +lex:modify_rule('operator', P(false)) + +return lex |
