From 48f46289d62e3fb3982aeaad6419073371534ba5 Mon Sep 17 00:00:00 2001 From: VaclavT Date: Mon, 20 Sep 2021 18:26:01 +0200 Subject: [PATCH] syntax file for vs code lisp extension --- Readme.md | 7 +- utils/Lisp.tmLanguage | 194 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 utils/Lisp.tmLanguage diff --git a/Readme.md b/Readme.md index 5782d70..701d1c2 100644 --- a/Readme.md +++ b/Readme.md @@ -23,6 +23,10 @@ EOT ml -f /tmp/qs.lsp ``` +or +``` +ml -f tests/test.lsp +``` #### Interactive mode ``` ml @@ -65,12 +69,13 @@ utils/local_install.sh #### Code - add documentation +- add more unit test, mainly for usql - rename constants in ml_profiler.h - replace to_string macro in ml.cpp - add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc) #### Language -- support for "t" symbol as a true +- support for "#t" or "t" symbol as a true and "#f" for false - support for exceptions - string functions - compare - needed for sorting, cmp ignore case diff --git a/utils/Lisp.tmLanguage b/utils/Lisp.tmLanguage new file mode 100644 index 0000000..ed12aad --- /dev/null +++ b/utils/Lisp.tmLanguage @@ -0,0 +1,194 @@ + + + + + comment + + fileTypes + + lisp + cl + l + mud + el + + foldingStartMarker + \( + foldingStopMarker + \) + keyEquivalent + ^~L + name + Lisp + patterns + + + captures + + 1 + + name + punctuation.definition.comment.lisp + + + match + (;).*$\n? + name + comment.line.semicolon.lisp + + + captures + + 1 + + name + storage.type.function-type.lisp + + 2 + + name + entity.name.function.lisp + + + match + (?:\()((?i:defun|define|lambda)+) + name + meta.function.lisp + + + + + captures + + 1 + + name + storage.type.function-type.lisp + + 2 + + name + entity.name.variable.lisp + + + match + (?:\()((?i:string|int|float))\s+((?:\w|[+\-<>/*&=.?!$%:@\[\]^{}~#|])+) + + + captures + + 1 + + name + punctuation.definition.constant.lisp + + + match + (#)(\w|[\\+-=<>'"&#])+ + name + constant.character.lisp + + + captures + + 1 + + name + punctuation.definition.variable.lisp + + 3 + + name + punctuation.definition.variable.lisp + + + match + (?<=^|\s|[()])(\*)(\S*)(\*)(?=$|\s|[()]) + name + variable.other.global.lisp + + + match + (?<=^|\s|[()]):(\w|[+\-<>/*&=.?!$%:@\[\]^{}~#|])* + name + keyword.constant.lisp + + + match + (?<=\()(?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+) + name + keyword.control.lisp + + + match + (?<=^|\s|[()])(?i:nil|t)(?=$|\s|[()]) + name + constant.language.lisp + + + match + \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b + name + constant.numeric.lisp + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.lisp + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.lisp + + + name + string.quoted.double.lisp + patterns + + + match + \\. + name + constant.character.escape.lisp + + + + + scopeName + source.lisp + uuid + 00D451C9-6B1D-11D9-8DFA-000D93589AF6 + +