syntax file for vs code lisp extension

This commit is contained in:
VaclavT 2021-09-20 18:26:01 +02:00
parent 22eedabe58
commit 48f46289d6
2 changed files with 200 additions and 1 deletions

View File

@ -23,6 +23,10 @@ EOT
ml -f /tmp/qs.lsp ml -f /tmp/qs.lsp
``` ```
or
```
ml -f tests/test.lsp
```
#### Interactive mode #### Interactive mode
``` ```
ml ml
@ -65,12 +69,13 @@ utils/local_install.sh
#### Code #### Code
- add documentation - add documentation
- add more unit test, mainly for usql
- rename constants in ml_profiler.h - rename constants in ml_profiler.h
- replace to_string macro in ml.cpp - replace to_string macro in ml.cpp
- add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc) - add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)
#### Language #### Language
- support for "t" symbol as a true - support for "#t" or "t" symbol as a true and "#f" for false
- support for exceptions - support for exceptions
- string functions - string functions
- compare - needed for sorting, cmp ignore case - compare - needed for sorting, cmp ignore case

194
utils/Lisp.tmLanguage Normal file
View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string></string>
<key>fileTypes</key>
<array>
<string>lisp</string>
<string>cl</string>
<string>l</string>
<string>mud</string>
<string>el</string>
</array>
<key>foldingStartMarker</key>
<string>\(</string>
<key>foldingStopMarker</key>
<string>\)</string>
<key>keyEquivalent</key>
<string>^~L</string>
<key>name</key>
<string>Lisp</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.lisp</string>
</dict>
</dict>
<key>match</key>
<string>(;).*$\n?</string>
<key>name</key>
<string>comment.line.semicolon.lisp</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function-type.lisp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.lisp</string>
</dict>
</dict>
<key>match</key>
<string>(?:\()((?i:defun|define|lambda)+)</string>
<key>name</key>
<string>meta.function.lisp</string>
</dict>
<!-- <dict>
<key>match</key>
<string>(?<=\s)(?i:&allow-other-keys|&aux|&body|&environment|&key|&optional|&rest|&whole)(?=\s+)</string>
<key>name</key>
<string>meta.function-parameters.lisp</string>
</dict> -->
<!-- <dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function-type.lisp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.type.lisp</string>
</dict>
</dict>
<key>match</key>
<string>(?:\()((?i:deftype|defstruct|define-condition|defpackage|defclass))\s+((?:\w|[+\-<>/*&amp;=.?!$%:@\[\]^{}~#|])+)</string>
</dict> -->
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function-type.lisp</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.variable.lisp</string>
</dict>
</dict>
<key>match</key>
<string>(?:\()((?i:string|int|float))\s+((?:\w|[+\-<>/*&amp;=.?!$%:@\[\]^{}~#|])+)</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.constant.lisp</string>
</dict>
</dict>
<key>match</key>
<string>(#)(\w|[\\+-=&lt;&gt;'"&amp;#])+</string>
<key>name</key>
<string>constant.character.lisp</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.lisp</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.lisp</string>
</dict>
</dict>
<key>match</key>
<string>(?<=^|\s|[()])(\*)(\S*)(\*)(?=$|\s|[()])</string>
<key>name</key>
<string>variable.other.global.lisp</string>
</dict>
<dict>
<key>match</key>
<string>(?<=^|\s|[()]):(\w|[+\-<>/*&amp;=.?!$%:@\[\]^{}~#|])*</string>
<key>name</key>
<string>keyword.constant.lisp</string>
</dict>
<dict>
<key>match</key>
<string>(?<=\()(?i:\*|\*\*|\*\*\*|\+|\+\+|\+\+\+|\-|/|//|///|/=|1\+|1\-|<|<=|=|>|>=|if|do|for|while|scope|quote|defun|and|or|set!|eval|type|parse|list|insert|index|remove|len|push|pop|head|tail|first|last|range|map|filter|reduce|exit|quit|print|input|random|include|read-file|read-file-lines|write-file|read-url|system-cmd|ls-dir|is-file?|is-dir?|parse-csv|parse-json|get-universal-time|date-to-str|str-to-date|date-add|debug|sprintf|display|string-replace|string-regex?|string-split|string-pad|string-rltrim|string-case|string-len|string-substr|string-find|benchmark|thread-create|thread-under-lock|thread-sleep|threads-join|try|throw|usql|first|second|third|fourth|fifth|sixth|seventh|eight|nth|print|get-universal-time)(?=\s+)</string>
<key>name</key>
<string>keyword.control.lisp</string>
</dict>
<dict>
<key>match</key>
<string>(?<=^|\s|[()])(?i:nil|t)(?=$|\s|[()])</string>
<key>name</key>
<string>constant.language.lisp</string>
</dict>
<dict>
<key>match</key>
<string>\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b</string>
<key>name</key>
<string>constant.numeric.lisp</string>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.lisp</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.lisp</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.lisp</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.lisp</string>
</dict>
</array>
</dict>
</array>
<key>scopeName</key>
<string>source.lisp</string>
<key>uuid</key>
<string>00D451C9-6B1D-11D9-8DFA-000D93589AF6</string>
</dict>
</plist>