Repository navigation
Add Skript and Skip languages with .sk extension disambiguation - #8054
RohanDaCoder wants to merge 6 commits into
Conversation
Adds support for the Skript language (Minecraft server scripting) and
Skip language (general-purpose reactive programming) to Linguist.
- Skript: Minecraft server scripting language with English-like syntax
Grammar: SkriptLang/skript-grammar (MIT license)
Samples: chest menus, text formatting, variables
- Skip: A general-purpose programming language tracking side effects
Samples: skipComment.sk from the Skip compiler source
- Heuristic: Skript detected by curly-brace variable syntax ({var}, {list::key});
Skip detected by module/fun/val declarations
Closes github-linguist#6857
|
Wow! Thank you, Rohan! |
|
This PR will not be reviewed until you have correctly filled in our PR template. It's there for a reason and needs to be completed accordingly. |
- Replace the bundled Skript example scripts with MIT-licensed real-world scripts - Add Skip prelude samples so both .sk languages have at least two samples - Add test_sk_by_heuristics covering both languages - Move the .sk heuristic block into alphabetical order
|
@lildude I've updated this PR to fully comply with the What changed since the initial review:
The (Note: CI is currently Thanks for the guidance and for your time reviewing! |
lildude
left a comment
There was a problem hiding this comment.
samples/Skip/Array.sk and samples/Skip/String.sk are too big - if they're suppressed in the diff, they're too big for our needs. Please replace these with representative samples.
This also appears to be a very generic and commonly used extension that is used by many other languages. As such, please also add this extension to the generic.yml file and update tests etc. See one of the PRs used to add other extensions to that file to see what else needs to be done.
Address review feedback from lildude: - Replace the 826-line Array.sk and 532-line String.sk Skip samples with smaller representative samples (Bool.sk, Math.sk) from the same upstream source so the diff renders without collapsing. - Add .sk to generic.yml as the extension is very widely used by many other formats, move the Skript and Skip samples into test/fixtures/Generic/sk/, and add nil fixtures for .sk files matching neither heuristic, following the .sol and .sd pattern. - Update test_sk_by_heuristics to cover the Generic fixtures and the nil case. - Remove a stray trailing blank line in .gitmodules so script/sort-submodules passes.
|
@lildude Thanks for the review! Pushed 7c33855 with both requested changes:
|
Description
Adds Skript and Skip to
languages.yml— both use the.skextension — plus a disambiguation heuristic inheuristics.yml.Skript is a scripting language for Minecraft servers (a Paper/Bukkit plugin) that lets server owners modify their servers without writing Java. Skip is a general-purpose language with reactive caching; its compiler and standard library are written in
.skfiles..skis not currently claimed by any other language inlanguages.yml, so.skfiles fall through unclassified today. This addresses the requirements in #6559 (a second.sklanguage plus a heuristic), supersedes #7659, and closes #6857. Credit to @Camden-png for the original grammar and colour work.Heuristic
Skript is matched first on its curly-brace variable syntax (
{var},{list::key}), then Skip on line-leading declaration keywords. Both rules are specific, so a.skfile that matches neither is not forced into one language. As.skis a very generic extension that is also widely used by many other formats, it is additionally listed ingeneric.yml, so a.skfile is only identified as Skript or Skip when the heuristic matches and everything else is left unclassified.I checked every sample: each matches its own rule and does not match the other language's rule.
script/check-regex-compatibilitypasses locally with Ruby, Go, and Rust, and the fulltest/test_heuristics.rbpasses on an LF checkout (179 runs, 3079 assertions, 0 failures). GitHub Actions is currently showingaction_requiredfor this fork, so CI needs approval before it can run.#6559 suggested Skip or Skew; this adds Skip. Skew can follow separately.
Checklist:
I am adding a new language.
.sk, excluding forks: https://github.com/search?type=code&q=NOT+is%3Afork+path%3A*.sk — 93.8k files.skdistribution, excluding the Skip and Skript upstream repositories: https://github.com/search?type=code&q=NOT+is%3Afork+-repo%3Askiplang%2Fskip+-repo%3ASkriptLang%2FSkript+path%3A*.sk — 92.8k files.skcontaining Skript'sbroadcastkeyword, excluding Skip's repository: https://github.com/search?type=code&q=NOT+is%3Afork+-repo%3Askiplang%2Fskip+path%3A*.sk+broadcast — 2.4k files.skcontaining Skip'smoduleandfunkeywords: https://github.com/search?type=code&q=NOT+is%3Afork+path%3A*.sk+module+fun — 2.4k filestest/fixtures/Generic/sk/Skript/chat.sk: written for this PR (no upstream source)test/fixtures/Generic/sk/Skript/teleport.sk: written for this PR (no upstream source)test/fixtures/Generic/sk/Skip/skipComment.sk: https://github.com/skiplang/skip/blob/b63d2de7ed50a20519ba22b63b0a8a3d95728a65/src/frontend/skipComment.sktest/fixtures/Generic/sk/Skip/Bool.sk: https://github.com/skiplang/skip/blob/b63d2de7ed50a20519ba22b63b0a8a3d95728a65/src/runtime/prelude/core/primitives/Bool.sktest/fixtures/Generic/sk/Skip/Math.sk: https://github.com/skiplang/skip/blob/b63d2de7ed50a20519ba22b63b0a8a3d95728a65/src/runtime/prelude/stdlib/other/Math.skchat.sk,teleport.sk: MIT (original work, contributed under Linguist's MIT license)skipComment.sk,Bool.sk,Math.sk: MIT (skiplang/skipLICENSE)source.skript)tm_scopeisnone.#FF9800#9b278fI am adding new or changing current functionality
test/test_heuristics.rb:test_sk_by_heuristicscovers every.sksample for both languages plus thenilcase for files matching neither rule, using thetest/fixtures/Generic/sk/{Skript,Skip,nil}/fixtures required for generic extensions.