Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

747 lines (735 sloc) 18.7 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>
The foldings do not currently work the way I want them to. This
may be a limitation of the way they are applied rather than the
regexps in use. Nonetheless, the foldings will end on the last
identically indented blank line following an s-expression. Not
ideal perhaps, but it works. Also, the #illegal pattern never
matches an unpaired ( as being illegal. Why?! -- Rob Rix
Ok, hopefully this grammar works better on quoted stuff now. It
may break for fancy macros, but should generally work pretty
smoothly. -- Jacob Rus
I have attempted to get this under control but because of the way folding
and indentation interact in Textmate, I am not sure if it is possible. In the
meantime, I have implemented Python-style folding anchored at newlines.
Additionally, I have made some minor improvements to the numeric constant
highlighting. Next up is square bracket expressions, I guess, but that
should be trivial. -- ozy`
</string>
<key>fileTypes</key>
<array>
<string>scm</string>
<string>sch</string>
</array>
<key>foldingStartMarker</key>
<string>(?x)^ [ \t]* \(
(?&lt;par&gt;
( [^()\n]++ | \( \g&lt;par&gt; \)? )*+
)
$</string>
<key>foldingStopMarker</key>
<string>^\s*$</string>
<key>keyEquivalent</key>
<string>^~S</string>
<key>name</key>
<string>Scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>include</key>
<string>#sexp</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#language-functions</string>
</dict>
<dict>
<key>include</key>
<string>#quote</string>
</dict>
<dict>
<key>include</key>
<string>#illegal</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>comment</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.scheme</string>
</dict>
</dict>
<key>match</key>
<string>(;).*$\n?</string>
<key>name</key>
<string>comment.line.semicolon.scheme</string>
</dict>
<key>constants</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>#[t|f]</string>
<key>name</key>
<string>constant.language.boolean.scheme</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[\(\s])((#e|#i)?[0-9]+(\.[0-9]+)?|(#x)[0-9a-fA-F]+|(#o)[0-7]+|(#b)[01]+)(?=[\s;()'",\[\]])</string>
<key>name</key>
<string>constant.numeric.scheme</string>
</dict>
</array>
</dict>
<key>illegal</key>
<dict>
<key>match</key>
<string>[()\[\]]</string>
<key>name</key>
<string>invalid.illegal.parenthesis.scheme</string>
</dict>
<key>language-functions</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?x)
(?&lt;=(\s|\(|\[)) # preceded by space or (
( do|or|and|else|quasiquote|begin|if|case|set!|
cond|let|unquote|define|let\*|unquote-splicing|delay|
letrec)
(?=(\s|\())</string>
<key>name</key>
<string>keyword.control.scheme</string>
</dict>
<dict>
<key>comment</key>
<string>
These functions run a test, and return a boolean
answer.
</string>
<key>match</key>
<string>(?x)
(?&lt;=(\s|\()) # preceded by space or (
( char-alphabetic|char-lower-case|char-numeric|
char-ready|char-upper-case|char-whitespace|
(?:char|string)(?:-ci)?(?:=|&lt;=?|&gt;=?)|
atom|boolean|bound-identifier=|char|complex|
identifier|integer|symbol|free-identifier=|inexact|
eof-object|exact|list|(?:input|output)-port|pair|
real|rational|zero|vector|negative|odd|null|string|
eq|equal|eqv|even|number|positive|procedure
)
(\?) # name ends with ? sign
(?=(\s|\()) # followed by space or (
</string>
<key>name</key>
<string>support.function.boolean-test.scheme</string>
</dict>
<dict>
<key>comment</key>
<string>
These functions change one type into another.
</string>
<key>match</key>
<string>(?x)
(?&lt;=(\s|\()) # preceded by space or (
( char-&gt;integer|exact-&gt;inexact|inexact-&gt;exact|
integer-&gt;char|symbol-&gt;string|list-&gt;vector|
list-&gt;string|identifier-&gt;symbol|vector-&gt;list|
string-&gt;list|string-&gt;number|string-&gt;symbol|
number-&gt;string
)
(?=(\s|\()) # followed by space or (
</string>
<key>name</key>
<string>support.function.convert-type.scheme</string>
</dict>
<dict>
<key>comment</key>
<string>
These functions are potentially dangerous because
they have side-effects which could affect other
parts of the program.
</string>
<key>match</key>
<string>(?x)
(?&lt;=(\s|\()) # preceded by space or (
( set-(?:car|cdr)| # set car/cdr
(?:vector|string)-(?:fill|set) # fill/set string/vector
)
(!) # name ends with ! sign
(?=(\s|\()) # followed by space or (
</string>
<key>name</key>
<string>support.function.with-side-effects.scheme</string>
</dict>
<dict>
<key>comment</key>
<string>
+, -, *, /, =, &gt;, etc.
</string>
<key>match</key>
<string>(?x)
(?&lt;=(\s|\()) # preceded by space or (
( &gt;=?|&lt;=?|=|[*/+-])
(?=(\s|\()) # followed by space or (
</string>
<key>name</key>
<string>keyword.operator.arithmetic.scheme</string>
</dict>
<dict>
<key>match</key>
<string>(?x)
(?&lt;=(\s|\()) # preceded by space or (
( append|apply|approximate|
call-with-current-continuation|call/cc|catch|
construct-identifier|define-syntax|display|foo|
for-each|force|cd|gen-counter|gen-loser|
generate-identifier|last-pair|length|let-syntax|
letrec-syntax|list|list-ref|list-tail|load|log|
macro|magnitude|map|map-streams|max|member|memq|
memv|min|newline|nil|not|peek-char|rationalize|
read|read-char|return|reverse|sequence|substring|
syntax|syntax-rules|transcript-off|transcript-on|
truncate|unwrap-syntax|values-list|write|write-char|
# cons, car, cdr, etc
cons|c(a|d){1,4}r|
# unary math operators
abs|acos|angle|asin|assoc|assq|assv|atan|ceiling|
cos|floor|round|sin|sqrt|tan|
(?:real|imag)-part|numerator|denominator
# other math operators
modulo|exp|expt|remainder|quotient|lcm|
# ports / files
call-with-(?:input|output)-file|
(?:close|current)-(?:input|output)-port|
with-(?:input|output)-from-file|
open-(?:input|output)-file|
# char-«foo»
char-(?:downcase|upcase|ready)|
# make-«foo»
make-(?:polar|promise|rectangular|string|vector)
# string-«foo», vector-«foo»
string(?:-(?:append|copy|length|ref))?|
vector(?:-length|-ref)
)
(?=(\s|\()) # followed by space or (
</string>
<key>name</key>
<string>support.function.general.scheme</string>
</dict>
<dict>
<key>match</key>
<string>(?x)
(?&lt;=(\()) # preceded by (
(
# nullary operators
list|newline
)
(?=(\))) # followed by )
</string>
<key>name</key>
<string>support.function.general.scheme.nullary</string>
</dict>
</array>
</dict>
<key>quote</key>
<dict>
<key>comment</key>
<string>
We need to be able to quote any kind of item, which creates
a tiny bit of complexity in our grammar. It is hopefully
not overwhelming complexity.
Note: the first two matches are special cases. quoted
symbols, and quoted empty lists are considered constant.other
</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.quoted.symbol.scheme</string>
</dict>
</dict>
<key>match</key>
<string>(?x)
(')\s*
([[:alnum:]][[:alnum:]!$%&amp;*+-./:&lt;=&gt;?@^_~]*)
</string>
<key>name</key>
<string>constant.other.symbol.scheme</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.quoted.empty-list.scheme</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>meta.expression.scheme</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.section.expression.begin.scheme</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.section.expression.end.scheme</string>
</dict>
</dict>
<key>match</key>
<string>(?x)
(')\s*
((\()\s*(\)))
</string>
<key>name</key>
<string>constant.other.empty-list.schem</string>
</dict>
<dict>
<key>begin</key>
<string>(')\s*</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.quoted.scheme</string>
</dict>
</dict>
<key>comment</key>
<string>quoted double-quoted string or s-expression</string>
<key>end</key>
<string>(?=[\s()])|(?&lt;=\n)</string>
<key>name</key>
<string>string.other.quoted-object.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#quoted</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>quote-sexp</key>
<dict>
<key>begin</key>
<string>(?&lt;=\()\s*(quote)\b\s*</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.quote.scheme</string>
</dict>
</dict>
<key>comment</key>
<string>
Something quoted with (quote «thing»). In this case «thing»
will not be evaluated, so we are considering it a string.
</string>
<key>contentName</key>
<string>string.other.quote.scheme</string>
<key>end</key>
<string>(?=[\s)])|(?&lt;=\n)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#quoted</string>
</dict>
</array>
</dict>
<key>quoted</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>begin</key>
<string>(\()</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.expression.begin.scheme</string>
</dict>
</dict>
<key>end</key>
<string>(\))</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.expression.end.scheme</string>
</dict>
</dict>
<key>name</key>
<string>meta.expression.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#quoted</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#quote</string>
</dict>
<dict>
<key>include</key>
<string>#illegal</string>
</dict>
</array>
</dict>
<key>sexp</key>
<dict>
<key>begin</key>
<string>(\()</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.expression.begin.scheme</string>
</dict>
</dict>
<key>end</key>
<string>(\))(\n)?</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.expression.end.scheme</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>meta.after-expression.scheme</string>
</dict>
</dict>
<key>name</key>
<string>meta.expression.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
<dict>
<key>begin</key>
<string>(?x)
(?&lt;=\() # preceded by (
(define)\s+ # define
(\() # list of parameters
([[:alnum:]][[:alnum:]!$%&amp;*+-./:&lt;=&gt;?@^_~]*)
((\s+
([[:alnum:]][[:alnum:]!$%&amp;*+-./:&lt;=&gt;?@^_~]*|[._])
)*
)\s*
(\))
</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.scheme</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.function.scheme</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function.scheme</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>variable.parameter.function.scheme</string>
</dict>
<key>7</key>
<dict>
<key>name</key>
<string>punctuation.definition.function.scheme</string>
</dict>
</dict>
<key>end</key>
<string>(?=\))</string>
<key>name</key>
<string>meta.declaration.procedure.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
<dict>
<key>include</key>
<string>#sexp</string>
</dict>
<dict>
<key>include</key>
<string>#illegal</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?x)
(?&lt;=\() # preceded by (
(lambda)\s+
(\() # opening paren
((?:
([[:alnum:]][[:alnum:]!$%&amp;*+-./:&lt;=&gt;?@^_~]*|[._])
\s+
)*(?:
([[:alnum:]][[:alnum:]!$%&amp;*+-./:&lt;=&gt;?@^_~]*|[._])
)?)
(\)) # closing paren
</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.scheme</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.scheme</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>variable.parameter.scheme</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.scheme</string>
</dict>
</dict>
<key>comment</key>
<string>
Not sure this one is quite correct. That \s* is
particularly troubling
</string>
<key>end</key>
<string>(?=\))</string>
<key>name</key>
<string>meta.declaration.procedure.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
<dict>
<key>include</key>
<string>#sexp</string>
</dict>
<dict>
<key>include</key>
<string>#illegal</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;=\()(define)\s([[:alnum:]][[:alnum:]!$%&amp;*+-./:&lt;=&gt;?@^_~]*)\s*.*?</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.scheme</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.scheme</string>
</dict>
</dict>
<key>end</key>
<string>(?=\))</string>
<key>name</key>
<string>meta.declaration.variable.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
<dict>
<key>include</key>
<string>#sexp</string>
</dict>
<dict>
<key>include</key>
<string>#illegal</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#quote-sexp</string>
</dict>
<dict>
<key>include</key>
<string>#quote</string>
</dict>
<dict>
<key>include</key>
<string>#language-functions</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#constants</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[\(\s])(#\\)(space|newline|tab)(?=[\s\)])</string>
<key>name</key>
<string>constant.character.named.scheme</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[\(\s])(#\\)x[0-9A-F]{2,4}(?=[\s\)])</string>
<key>name</key>
<string>constant.character.hex-literal.scheme</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[\(\s])(#\\).(?=[\s\)])</string>
<key>name</key>
<string>constant.character.escape.scheme</string>
</dict>
<dict>
<key>comment</key>
<string>
the . in (a . b) which conses together two elements
a and b. (a b c) == (a . (b . (c . nil)))
</string>
<key>match</key>
<string>(?&lt;=[ ()])\.(?=[ ()])</string>
<key>name</key>
<string>punctuation.separator.cons.scheme</string>
</dict>
<dict>
<key>include</key>
<string>#sexp</string>
</dict>
<dict>
<key>include</key>
<string>#illegal</string>
</dict>
</array>
</dict>
<key>string</key>
<dict>
<key>begin</key>
<string>(")</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.scheme</string>
</dict>
</dict>
<key>end</key>
<string>(")</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.scheme</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.scheme</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.scheme</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.scheme</string>
<key>uuid</key>
<string>3EC2CFD0-909C-4692-AC29-1A60ADBC161E</string>
</dict>
</plist>
You can’t perform that action at this time.