Skip to content

Commit

Permalink
Merge pull request #3 from gbaptista/gb-fennel-110
Browse files Browse the repository at this point in the history
Adding support for Fennel 1.1.0
  • Loading branch information
gbaptista authored Mar 28, 2022
2 parents 67ef6a3 + 0610450 commit 68ee49c
Show file tree
Hide file tree
Showing 8 changed files with 536 additions and 31 deletions.
59 changes: 46 additions & 13 deletions Fennel.sublime-completions
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"scope": "source.fennel",
"completions": [
// Lua 5.4.0
// Lua 5.4.4
"_G",
"_VERSION",

Expand Down Expand Up @@ -179,29 +179,34 @@
"utf8.len",
"utf8.offset",

// Fennel 0.5.0
"not=",
// Fennel 1.1.0
":until",
":into",
"band",
"_ENV",
"bnot",
"accumulate",
"bor",
"bxor",
"doc",
"collect",
"dotimes",
"doto",
"each",
"eval-compiler",
"global",
"hashfn",
"icollect",
"import-macros",
"include",
"length",
"lshift",
"match-try",
"catch",
"macro",
"macrodebug",
"macros",
"match",
"not=",
"partial",
"pick-args",
"pick-values",
"println",
"rshift",
Expand All @@ -211,13 +216,41 @@
"values",
"var",
"when",
"with-open"
"where",
"with-open",

"fennel.comment",
"fennel.comment?",
"fennel.compile",
"fennel.compile-stream",
"fennel.compile-string",
"fennel.doc",
"fennel.dofile",
"fennel.eval",
"fennel.list",
"fennel.list?",
"fennel.load-code",
"fennel.macro-loaded",
"fennel.macro-path",
"fennel.macro-searchers",
"fennel.make-searcher",
"fennel.metadata",
"fennel.parser",
"fennel.path",
"fennel.repl",
"fennel.runtime-version",
"fennel.search-module",
"fennel.searcher",
"fennel.sequence",
"fennel.sequence?",
"fennel.sym",
"fennel.sym-char?",
"fennel.sym?",
"fennel.syntax",
"fennel.traceback",
"fennel.varg",
"fennel.varg?",
"fennel.view"
]
}







25 changes: 18 additions & 7 deletions Fennel.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ variables:
lua_string: 'string\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|packsize|pack|rep|reverse|sub|unpack|upper)'
lua_table: 'table\.(concat|insert|move|pack|remove|sort|unpack)'
lua_utf8: 'utf8\.(charpattern|char|codepoint|codes|len|offset)'
fennel_api: '(fennel)\.(comment\?|comment|compile|compile-stream|compile-string|doc|dofile|eval|list\?|list|load-code|macro-loaded|macro-path|macro-searchers|make-searcher|metadata|parser|path|repl|runtime-version|search-module|searcher|sequence\?|sequence|sym-char\?|sym\?|sym|syntax|traceback|varg\?|varg|view)'

lua_variables: '_G|_VERSION|{{lua_coroutine}}|coroutine|{{lua_debug}}|debug|{{lua_io}}|io|{{lua_math}}|math|{{lua_os}}|os|{{lua_package}}|package|{{lua_string}}|string|{{lua_table}}|table|{{lua_utf8}}|utf8'
lua_variables: '_G|_ENV|_VERSION|_V|{{lua_coroutine}}|coroutine|{{lua_debug}}|debug|{{lua_io}}|io|{{lua_math}}|math|{{lua_os}}|os|{{lua_package}}|package|{{lua_string}}|string|{{lua_table}}|table|{{lua_utf8}}|utf8'
lua_functions: 'assert|collectgarbage|dofile|error|getmetatable|ipairs|loadfile|load|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setmetatable|tonumber|tostring|type|warn|xpcall|{{lua_coroutine}}|{{lua_debug}}|{{lua_io}}|{{lua_math}}|{{lua_os}}|{{lua_package}}|{{lua_string}}|{{lua_table}}|{{lua_utf8}}'

# -------------------------------------------------

lua_constants: 'true|false|nil'
lua_keywords: 'and|if|not|or|while|do|for'
lua_operators: '\+|\-|\%|\*|\/\/|\/|\^|\.\.|\>|\<|\>=|\<=|=|\.|\:|\.\.\.'
lua_operators: '\+|\-|\%|\*|\/\/|\/|\^|\.\.|\?\.|\>|\<|\>=|\<=|=|\.|\:|\.\.\.'

# -------------------------------------------------

fennel_threading_macros: (?:->|-\?>>|-\?>|-\>\>)(?=[{{non_symbol_chars}}])
fennel_operators: 'not='
fennel_keywords: 'band|bnot|bor|bxor|doc|dotimes|doto|each|eval-compiler|global|hashfn|import-macros|include|length|lshift|macro|macrodebug|macros|match|partial|pick-args|pick-values|println|rshift|set|tset|unpack|values|var|when|with-open'
fennel_keywords: 'band|bnot|bor|bxor|dotimes|doto|each|where|icollect|collect|accumulate|eval-compiler|hashfn|import-macros|include|length|lshift|macro|macrodebug|macros|match-try|catch|match|partial|pick-values|println|rshift|set|tset|unpack|values|var|when|with-open'
# -------------------------------------------------

non_symbol_chars: \s,;\(\)\[\]{}\"`~@\^\\
Expand All @@ -45,7 +46,7 @@ variables:
keyword: (:):?[^:{{non_symbol_chars}}][^{{non_symbol_chars}}]*
constant: (?:{{lua_constants}})(?=[{{non_symbol_chars}}])
lua_support: (?:{{lua_operators}}|{{lua_keywords}}|{{lua_functions}})(?=[{{non_symbol_chars}}])
fennel_support: (?:{{fennel_operators}}|{{fennel_keywords}})(?=[{{non_symbol_chars}}])
fennel_support: (?:{{fennel_operators}}|{{fennel_keywords}}|{{fennel_api}})(?=[{{non_symbol_chars}}])
evil_octal: '[-+]?0\d+N?(?=[{{non_symbol_chars}}])'
sign: '[-+]?'
exponent: (?:[eE]{{sign}}\d+)
Expand Down Expand Up @@ -73,7 +74,9 @@ contexts:
scope: punctuation.section.brackets.end.fennel
pop: true
- include: match-expr
- match: '#?{'
- match: '(#)?{'
captures:
1: entity.name.tag.literal_shorthand.fennel
scope: punctuation.section.braces.begin.fennel
push:
- match: '}'
Expand All @@ -95,6 +98,14 @@ contexts:
- match: '\?'
scope: variable.function.optional.fennel
push: pop-expr
- match: '\$(\.\.\.)'
scope: variable.function.hash_shorthand.fennel
captures:
1: keyword.operator.varargs.fennel
- match: '\$(\.)'
scope: variable.function.hash_shorthand.fennel
captures:
1: entity.name.tag.lua_support.fennel
- match: '\$'
scope: variable.function.hash_shorthand.fennel
- match: '''|`|~|@'
Expand Down Expand Up @@ -249,7 +260,7 @@ contexts:
- match: let\*?(?=[{{non_symbol_chars}}])
scope: entity.name.tag.let.fennel
set: pop-let-list-head
- match: (local|global)\*?(?=[{{non_symbol_chars}}])
- match: (local)\*?(?=[{{non_symbol_chars}}])
scope: entity.name.tag.binding.fennel
set: pop-binding-list-head
- match: (?=\S)
Expand Down Expand Up @@ -348,7 +359,7 @@ contexts:
- include: match-expr

bind-operators:
- match: '\s(:|&)\s'
- match: '\s(:|&|&as)\s'
scope: keyword.operator.bind.fennel

pop-invoke-list-tail:
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> _"Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a lisp syntax and macro system." [fennel-lang.org](https://fennel-lang.org)_
Heavily tested against [Fennel 0.5.0](https://github.com/gbaptista/sublime-text-fennel/blob/master/tests/syntax_test_fennel_reference.fnl) and [Lua 5.4.0](https://github.com/gbaptista/sublime-text-fennel/blob/master/tests/syntax_test_lua.fnl) specifications.
Heavily tested against [Fennel 1.1.0](https://github.com/gbaptista/sublime-text-fennel/blob/master/tests/syntax_test_fennel_reference.fnl) and [Lua 5.4.4](https://github.com/gbaptista/sublime-text-fennel/blob/master/tests/syntax_test_lua.fnl) specifications.

![Screenshot of a Fennel code highlighted.](https://raw.githubusercontent.com/gbaptista/sublime-text-fennel/master/screenshots/material-theme-darker/03.png)

Expand All @@ -18,10 +18,11 @@ Heavily tested against [Fennel 0.5.0](https://github.com/gbaptista/sublime-text-
- [Solarized (Light)](#solarized-light-screenshots)
- [Completions](#completions-screenshots)
- [Snippets](#snippets-screenshots)
- [Development](#development)

## Completions

One hundred ninety-four completions are available for _Fennel 0.5.0_ and _Lua 5.4.0_.
One hundred ninety-four completions are available for _Fennel 1.1.0_ and _Lua 5.4.4_.

#### Fennel Completions

Expand All @@ -48,7 +49,7 @@ The [_Clojure Package_](https://github.com/sublimehq/Packages/tree/master/Clojur

## References
- [Fennel Language Website](https://fennel-lang.org)
- [Fennel 0.5.0 Reference](https://fennel-lang.org/reference)
- [Fennel 1.1.0 Reference](https://fennel-lang.org/reference)
- [Lua Language Website](http://www.lua.org/)
- [Lua 5.4 Reference Manual](https://www.lua.org/manual/5.4)

Expand Down
Loading

0 comments on commit 68ee49c

Please sign in to comment.