Skip to content

Commit

Permalink
[Lisp] Scope predicate function names special
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Feb 10, 2024
1 parent afb64ae commit 9ea3e0f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Lisp/Lisp.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -643,13 +643,20 @@ contexts:
1: punctuation.definition.symbol.begin.lisp
2: punctuation.definition.symbol.end.lisp
pop: 1
# special functions mutating data in-place end with !
# mutating functions changing data in-place end with !
- match: (?![+*#`'&]\S){{identifier}}\!{{break}}
scope: meta.function-call.lisp variable.function.mutating.lisp
captures:
1: punctuation.definition.symbol.begin.lisp
2: punctuation.definition.symbol.end.lisp
pop: 1
# predicate functions returning boolean values end with ? or -p
- match: (?![+*#`'&]\S){{identifier}}(?:\?|-p){{break}}
scope: meta.function-call.lisp variable.function.predicate.lisp
captures:
1: punctuation.definition.symbol.begin.lisp
2: punctuation.definition.symbol.end.lisp
pop: 1
# anything not looking like global variable, constant or macro
- match: (?![+*#`'&]\S|{{builtin_constants}}|{{builtin_types}}){{identifier}}
scope: meta.function-call.lisp variable.function.lisp
Expand Down
28 changes: 28 additions & 0 deletions Lisp/tests/syntax_test_lisp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,34 @@
; ^ variable.other.lisp
; ^ variable.other.lisp
(predicate? a b c)
;^^^^^^^^^^ meta.function-call.lisp variable.function.predicate.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
(pkg:predicate? a b c)
;^^^ variable.namespace.lisp
; ^ punctuation.accessor.lisp
; ^^^^^^^^^^ meta.function-call.lisp variable.function.predicate.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
(fun-p a b c)
;^^^^^ meta.function-call.lisp variable.function.predicate.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
(pkg:fun-p a b c)
;^^^ variable.namespace.lisp
; ^ punctuation.accessor.lisp
; ^^^^^ meta.function-call.lisp variable.function.predicate.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
; ^ variable.other.lisp
;########
; LISTS #
;########
Expand Down

0 comments on commit 9ea3e0f

Please sign in to comment.