Skip to content

Instantly share code, notes, and snippets.

@davisp
Created October 2, 2020 17:53
Show Gist options
  • Save davisp/a29488edf493a0a7a9fdc80ee814d6c5 to your computer and use it in GitHub Desktop.
Save davisp/a29488edf493a0a7a9fdc80ee814d6c5 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<syntax name="lisp">
<meta>
<name>Lisp</name>
<type>script</type>
<preferred-file-extension>lisp</preferred-file-extension>
</meta>
<detectors>
<extension priority="1.0">cl</extension>
</detectors>
<comments>
<single>;</single>
<multiline>
<starts-with>
<expression>#|</expression>
</starts-with>
<ends-with>
<expression>|#</expression>
</ends-with>
</multiline>
</comments>
<brackets>
<pair open="(" close=")" />
</brackets>
<surrounding-pairs>
<pair open="(" close=")" />
</surrounding-pairs>
<scopes>
<include style="self" collection="comments" />
<include style="self" collection="sexpr" />
</scopes>
<scopes>
<scope name="lisp.comment.single">
<expression>(^[ \t]+)?(;)(.*)</expression>
<capture group="1" name="lisp.punctuation.comment.whitespace.leading" />
<capture group="2" name="lisp.punctuation.comment" />
<capture group="3" name="lisp.punctuation.comment" />
</scope>
<scope name="lisp.function.meta">
<expression>(\b(?i:(defun|defgeneric|defmethod|defmacro|defclass|defstruct|defconstant|defvar|defparameter))\b)(\s+)((\w|\-|\!|\?)*)</expression>
<capture group="2" name="lisp.function.storage.type" />
<capture group="4" name="lisp.function.name" />
</scope>
<scope name="lisp.value.character">
<expression>(#|\?)(\w|[\\+-=&lt;&gt;'"&amp;#])+</expression>
<capture group="1" name="lisp.punctuation.definition.constant" />
</scope>
<scope name="lisp.variable.global">
<expression>(\*)(\S*)(\*)</expression>
<capture group="2" name="lisp.variable.definition" />
</scope>
<scope name="lisp.keyword.control">
<expression>\b(?i:case|ecase|ccase|typecase|etypecase|ctypecase|do|dolist|dotimes|let|let\*|labels|flet|loop|if|else|when|unless)\b</expression>
</scope>
<scope name="lisp.keyword.operator">
<expression>\b(?i:eq|neq|and|or|not)\b</expression>
</scope>
<scope name="lisp.value.constant">
<expression>\b(?i:null|nil)\b</expression>
</scope>
<scope name="lisp.function.support">
<expression>(?&lt;![-\w])(?i:cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn)(?![-\w])</expression>
</scope>
<scope name="lisp.value.number">
<expression>\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b</expression>
</scope>
<scope name="lisp.value.string.quoted.double">
<starts-with>
<expression>"</expression>
<capture group="0" name="lisp.punctuation.string.begin" />
</starts-with>
<ends-with>
<expression>"</expression>
<capture group="0" name="lisp.punctuation.string.end" />
</ends-with>
<subscopes>
<scope name="lisp.punctuation.string.escape">
<expression>\\.</expression>
</scope>
</subscopes>
</scope>
</scopes>
</syntax>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment