Repository navigation
Add Verse language support - #5555
Open
Simon GAY (simnJS) wants to merge 1 commit into
Open
Simon GAY (simnJS) wants to merge 1 commit into
Simon GAY (simnJS) wants to merge 1 commit into
Conversation
Adds a Monarch tokenizer, language configuration, tokenization tests and a website sample for Verse (*.verse), the programming language of Unreal Editor for Fortnite.
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Monarch tokenizer for Verse, the programming language Epic Games created for Unreal Editor for Fortnite (UEFN), for
*.versefiles.Relevance
*.verse), and Chroma has a Verse lexer (feat(lexers): add Verse lexer alecthomas/chroma#1412).Changes
src/languages/definitions/verse/:register.ts,verse.ts(tokenizer and language configuration) andverse.test.ts.src/languages/definitions/register.all.ts: registers the language.website/src/website/data/home-samples/sample.verse.txt: sample from simnJS/verse-grammar, plus an indented comment.The token rules follow the Verse grammar that Epic Games publishes under CC0 in verselang/book, like the Verse lexers I contributed to Pygments (pygments/pygments#3422) and Chroma.
Tokens
#line comments, nested<# ... #>block comments, and<#>indented comments. An indented comment covers the following lines that are indented deeper than the<#>line; the tokenizer keeps that indentation in the state name and matches it with$S2."ab<#x#>cd" = "abcd").{...}interpolation (nested braces, strings inside the interpolation, interpolation that continues on the next line), the escapes\t \n \r \" \' \\ \{ \} \< \> \& \# \~, invalid escapes and unterminated strings.'a','\n','😀',0o61,0u1F600.12.34f64, and ranges like0..9.<public>,<decides>,<scoped{...}>,<getter(...)>) and attributes (@editable) asannotation. Comparisons such asA<B, B>Cstay operators.keyword.type), operators, and paths inusing { /Verse.org/Simulation },import(...)and(/Verse.org/Random:)qualifiers (constant.path).The language configuration sets
#and<# #>for comment toggling, indents after a line ending in:or=, and uses off-side folding.Testing
npm test: all tokenization tests pass, including the newversecases (each comment form, interpolation with nested braces, a comment inside a string, specifiers next to identifiers, comparisons that are not specifiers, paths), and the sample check passes.npm run build,npm run compile --prefix webpack-pluginandnpm run package-for-smoketestpass; Verse is in the webpack, esbuild and Vite bundles. I did not run the Playwright smoke tests locally.out/monaco-editor, with thevsandvs-darkthemes: Enter after a line ending in:or=indents, and the comment commands insert#and<# ... #>.