Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions runtime/syntax/slope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
filetype: slope

detect:
filename: "\\.(?i:(slo|slope))$\\b"

rules:
- constant: "\\((PI|PHI|E|stdin|stdout|stderr|devnull|else)\\b"
- constant: "\\((sys)\\b-\\b(args)\\b"
- constant: "\\((args)\\b-\\b(list)\\b"
# XXX
- constant.number: "[\\-\\+]?[0-9]+\\.?[0-9]*"

- constant.boolean: "(?:#(t|f))"

- comment:
start: ";"
end: "$"

- constant.string:
start: "\""
end: "\""

- constant.string:
start: "`"
end: "`"

- constant.string:
start: "'"
end: "(\\s|$)"

- special: "\\((quote|if|and|or|case|cond|ns\\-define|ns\\-create|define|lambda|usage|apply|coeval)"
- special: "\\((begin|begin0|load|macro|eval|for|usage)\\b"
- special: "\\((load)\\b-\\b(mod)\\b"
- special: "\\((load)\\b-\\b(mod)\\b-\\b(file)\\b"
- special: "\\([><]=?"
- special: "\\((\\+|\\-|\\/|\\*|\\!|\\%)"
- special: "\\.\\.\\."
- special: "\\bset\\!"


# # slope commands
- statement: "\\((abs|floor|ceil|round|min|max|rand|reduce|filter|not)\\b"
- statement: "\\((sleep|%|exp|range|sin|cos|tan|atan2|sqrt)\\b"
- statement: "\\((exit|license|apply)\\b"
- statement: "\\((length|cons|car|cdr|append|list|map|ref|reverse|assoc)\\b"
- statement: "\\((mkdir|rm|mv|pwd|hostname|timestamp|date)\\b"
- statement: "\\((chmod|chdir|env|subprocess)\\b"
- statement: "\\((newline|display|write|close)\\b"
- statement: "\\((slice)\\b"


- statement: "\\((date)-(format|default-format)\\b"
- statement: "\\((assoc)-(has-key)\\b"
- statement: "\\((exception)-(mode-(pass|panic)\\b|mode-panic\\?)"
- statement: "\\((file)-(create|create-temp|open-read|open-write|append-to|stat|name)\\b"
- statement: "\\((for-each)\\b"
- statement: "\\((list)-(sort|seed|join)\\b"
- statement: "\\((mod-path)\\b"
- statement: "\\((net-conn)\\b"
- statement: "\\((path)-(abs|join|extension|base|dir|glob)\\b"
- statement: "\\((rand-seed)\\b"
- statement: "\\((read)-(line|char|all|all-lines)\\b"
- statement: "\\((regex)-(find|replace)\\b"
- statement: "\\((repl)-(flush)\\b"
- statement: "\\((signal-catch-sigint)\\b"
- statement: "\\((string)-(format|trim-space|index-of|ref|upper|lower|make|make-buf|buf-clear|fields)\\b"
- statement: "\\((term)-(size|(char|raw|cooked|sane)-mode)\\b"
- statement: "\\((write-raw)\\b"
- statenent: "\\((url)-(scheme|host|port|path|query)\\b"

- statement: "\\((date)->(timestamp)\\b"
- statement: "\\((display)-(lines)\\b"
- statement: "\\((list)->(string)\\b"
- statement: "\\((number)->(string)\\b"
- statement: "\\((rune)->(string|)\\b"
- statement: "\\((string)->(list)\\b"
- statement: "\\((string)->(md5)\\b"
- statement: "\\((string)->(number)\\b"
- statement: "\\((string)->(rune)\\b"
- statement: "\\((string)->(sha256)\\b"
- statement: "\\((timestamp)->(date)\\b"

- statement: "\\((macro\\?)"
- statement: "\\((equal\\?)"
- statement: "\\((exception\\?)"
- statement: "\\((exception-mode-panic\\?)\\b"
- statement: "\\((exception-mode-pass\\?)\\b"
- statement: "\\((member\\?)\\b"
- statement: "\\((mod-path|path-exists\\?|path-is-dir\\?)\\b"
- statement: "\\((positive|negative|zero|exists|zero|exists)\\b\\?"
- statement: "\\((qual|number|string|bool|symbol|pair|null|list|procedure|atom|bool|assoc|string-buf|io-handle|member)\\b\\?"
- statement: "\\((regex)\\b-\\b(match)\\b\\?"

- special: "(\\)|\\()"
66 changes: 66 additions & 0 deletions runtime/syntax/snobol4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
filetype: snobol4

detect:
filename: "\\.(?i:(sno|spt))$"

rules:
- constant.number: "\\b([0-9]+)\\b"

- statement: "\\b(?i:(any|apply|arb|arbno|arg|array))\\b\\("
- statement: "\\b(?i:(break))\\(\\b"
- statement: "\\b(?i:(char|clear|code|collect|convert|copy))\\b\\("
- statement: "\\b(?i:(data|datatype|date|define|detach|differ|dump|dupl))\\b\\("
- statement: "\\b(?i:(endfile|eq|eval))\\b\\("
- statement: "\\b(?i:(field))\\b\\("
- statement: "\\b(?i:(ge|gt|ident))\\b\\("
- statement: "\\b(?i:(input|integer|item))\\b\\("
- statement: "\\b(?i:(le|len|lgt|local|lpad|lt))\\b\\("
- statement: "\\b(?i:(ne|notany))\\b\\("
- statement: "\\b(?i:(opsyn|output))\\b\\("
- statement: "\\b(?i:(pos|prototype))\\b\\("
- statement: "\\b(?i:(remdr|replace|rpad|rpos|rtab|rewind))\\b\\("
- statement: "\\b(?i:(size|span|stoptr))\\(\\b"
- statement: "\\b(?i:(tab|table|time|trace|trim|terminal))\\b\\("
- statement: "\\b(?i:(unload))\\b\\("
- statement: "\\b(?i:(value))\\b\\("
- statement: "\\b(?i:(breakx))\\b\\("
- statement: "\\b(?i:(char|chop))\\b\\("
- statement: "\\b(?i:(date|delete))\\b\\("
- statement: "\\b(?i:(exp))\\b\\("
- statement: "\\b(?i:(freeze|function))\\b\\("
- statement: "\\b(?i:(host))\\b\\("
- statement: "\\b(?i:(io_findunit))\\b\\("
- statement: "\\b(?i:(label|lpad|leq|lge|lle|llt|lne|log))\\b\\("
- statement: "\\b(?i:(ord))\\b\\("
- statement: "\\b(?i:(reverse|rpad|rsort|rename))\\b\\("
- statement: "\\b(?i:(serv_listen|sset|set|sort|sqrt|substr))\\b\\("
- statement: "\\b(?i:(thaw))\\b\\("
- statement: "\\b(?i:(vdiffer))\\b\\("


- symbol: "(\\(|\\))"

- comment:
start: "(#|\\*)"
end: "($|;)"
rules: []

- constant.string:
start: "'"
end: "('|$)"
skip: "\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping " in a single-quoted string is not necessary. Maybe you meant to skip an escaped single quote instead?

rules:
- constant.specialChar: "\\\\."

- constant.string:
start: "\""
end: "(\"|$)"
skip: "'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping ' in a double-quoted string is not necessary. Maybe you meant to skip an escaped double quote instead?

rules:
- constant.specialChar: "\\\\."

- special: ":(?i:(|f|s)\\([^\\)]+\\))$"
- special: "&\\b(?i:(abort|alphabet|anchor|arb|bal|case|code|digits|dump|errlimit|errtext|errtype|fail|fence|fnclevel|ftrace|fullscan|input|lastno|lcase|maxlngth|output|parm|rem|rtntype|stcount|stfcount|stlimit|stno|succeed|trace|trim|ucase))\\b"
- special: "&\\b(?i:(gtrace|line|file|lastline|lastfile))\\b"
- special: "(^|;)[A-Za-z]\\S*\\b"