Add the webapp launcher and syntax highlighter

This commit is contained in:
2025-11-16 11:48:56 -06:00
parent 946cd7c554
commit e5ca42be84
28 changed files with 879 additions and 7 deletions

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@ bin-tmp
obj
shell_archive
tmp
*.crvm
*.crvm
*.vsix

View File

@@ -8,6 +8,17 @@ jobs:
withLfs: true
withSubmodules: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Build VSCode Extension
runInContainer: true
image: node:latest
interpreter: !DefaultInterpreter
commands: |
cd vscode-extension
npm install -g @@vscode/vsce
vsce package
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Build everything
runInContainer: true

View File

@@ -0,0 +1,15 @@
{
"dependencies": [
],
"info": {
"license": "MIT",
"short_name": "crosslang",
"short_name_pretty": "CrossLang",
"type": "webapp"
},
"name": "Tesses.CrossLang.App",
"project_dependencies": [
"..\/Tesses.CrossLang.BuildEssentials"
],
"version": "1.0.0.0-prod"
}

1
Tesses.CrossLang.App/res/beer.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1
Tesses.CrossLang.App/res/beer.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

1
Tesses.CrossLang.App/res/htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,78 @@
:root,
body.light {
--primary:#785900;
--on-primary:#ffffff;
--primary-container:#ffdf9e;
--on-primary-container:#261a00;
--secondary:#6b5d3f;
--on-secondary:#ffffff;
--secondary-container:#f5e0bb;
--on-secondary-container:#241a04;
--tertiary:#4a6547;
--on-tertiary:#ffffff;
--tertiary-container:#ccebc4;
--on-tertiary-container:#072109;
--error:#ba1a1a;
--on-error:#ffffff;
--error-container:#ffdad6;
--on-error-container:#410002;
--background:#fffbff;
--on-background:#1e1b16;
--surface:#fff8f2;
--on-surface:#1e1b16;
--surface-variant:#ede1cf;
--on-surface-variant:#4d4639;
--outline:#7f7667;
--outline-variant:#d0c5b4;
--shadow:#000000;
--scrim:#000000;
--inverse-surface:#33302a;
--inverse-on-surface:#f7efe7;
--inverse-primary:#fabd00;
--surface-dim:#e0d9d0;
--surface-bright:#fff8f2;
--surface-container-lowest:#ffffff;
--surface-container-low:#faf2e9;
--surface-container:#f5ede4;
--surface-container-high:#efe7de;
--surface-container-highest:#e9e1d8;
}
body.dark {
--primary:#fabd00;
--on-primary:#3f2e00;
--primary-container:#5b4300;
--on-primary-container:#ffdf9e;
--secondary:#d8c4a0;
--on-secondary:#3a2f15;
--secondary-container:#52452a;
--on-secondary-container:#f5e0bb;
--tertiary:#b0cfaa;
--on-tertiary:#1d361c;
--tertiary-container:#334d31;
--on-tertiary-container:#ccebc4;
--error:#ffb4ab;
--on-error:#690005;
--error-container:#93000a;
--on-error-container:#ffb4ab;
--background:#1e1b16;
--on-background:#e9e1d8;
--surface:#16130e;
--on-surface:#e9e1d8;
--surface-variant:#4d4639;
--on-surface-variant:#d0c5b4;
--outline:#998f80;
--outline-variant:#4d4639;
--shadow:#000000;
--scrim:#000000;
--inverse-surface:#e9e1d8;
--inverse-on-surface:#33302a;
--inverse-primary:#785900;
--surface-dim:#16130e;
--surface-bright:#3c3933;
--surface-container-lowest:#100e09;
--surface-container-low:#1e1b16;
--surface-container:#221f1a;
--surface-container-high:#2d2924;
--surface-container-highest:#38342e;
}

View File

@@ -0,0 +1,96 @@
func Components.PackageItem(tytd,item)
{
var html = <div class="row">
<div class="min">
<img width="64" height="64" src={item.thumb} alt="Package thumbnail">
</div>
<div class="max">
<div class="col">
<div class="min">
<span>{item.name}</span>
</div>
<div class="min">
<span>{item.version}</span>
</div>
</div>
</div>
<div class="min">
<raw(Components.InstallButton(tytd,item.name,item.version))>
</div>
</div>;
return html;
}
/^
Get whether package is installed
version must be the current version as a Version not string
returns 0 if not, 1 if installed or 2 if can update
^/
func PackageState(packages,name, version)
{
each(var item : packages)
{
if(item.Name == name) {
if(item.Version < version) return 2;
return 1;
}
}
return 0;
}
func Components.InstallButton(packages, name, version, $confirm)
{
var id = Crypto.Base64Encode(new ByteArray($"{name}-{version}")).Replace("=","");
var version = Version.Parse(version);
if(version != null)
{
var state = PackageState(packages,name,version);
return <div id={id}>
<if(state == 0)>
<true>
<button hx-post="./package-manage" hx-vals={Json.Encode({action="install",name=name,version=version.ToString()})} hx-target={$"#{id}"} hx-swap="outerHTML">Install</button>
</true>
<false>
<if(confirm)>
<true>
<div class="row">
<div class="min">
<button hx-post="./package-manage" hx-vals={Json.Encode({action="confirm",name=name,version=version.ToString()})} hx-target={$"#{id}"} hx-swap="outerHTML">Yes Uninstall</button>
</div>
<div class="min">
<button hx-post="./package-manage" hx-vals={Json.Encode({action="cancel",name=name,version=version.ToString()})} hx-target={$"#{id}"} hx-swap="outerHTML">Cancel</button>
</div>
</div>
</true>
<false>
<if(state == 1)>
<true>
<button hx-post="./package-manage" hx-vals={Json.Encode({action="uninstall",name=name,version=version.ToString()})} hx-target={$"#{id}"} hx-swap="outerHTML">Uninstall</button>
</true>
<false>
<nav class="group split">
<button hx-post="./package-manage" hx-vals={Json.Encode({action="install",name=name,version=version.ToString()})} hx-target={$"#{id}"} hx-swap="outerHTML" class="left-round">
<i>update</i>
<span>Update</span>
</button>
<button hx-post="./package-manage" hx-vals={Json.Encode({action="uninstall",name=name,version=version.ToString()})} hx-target={$"#{id}"} hx-swap="outerHTML" class="right-round square">
<i>delete</i>
</button>
</nav>
</false>
</if>
</false>
</if>
</false>
</if>
</div>;
}
return "";
}

View File

@@ -0,0 +1,53 @@
func Components.Shell(title, html,idx)
{
var pages = [
{
url="./",
label = "Home",
icon = "home",
classStr=""
},
{
url="./get-more-apps",
label = "More Apps",
icon = "deployed_code_update",
classStr=""
},
{
url="./settings",
label = "Settings",
icon = "settings",
classStr=""
}
];
pages[idx].classStr = "active";
return
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CrossLang - {title}</title>
<link rel="stylesheet" href={(/"beer.min.css").MakeRelative(mypage).ToString()}>
<link rel="stylesheet" href={(/"theme.css").MakeRelative(mypage).ToString()}>
<script src="htmx.min.js" defer></script>
<script type="module" src={(/"beer.min.js").MakeRelative(mypage).ToString()} defer></script>
</head>
<body>
<nav class="left max">
<each(var page : pages)>
<a hx-get={page.url} hx-target="body" hx-push-url="true" class={page.classStr}>
<i>{page.icon}</i>
<span>{page.label}</span>
</a>
</each>
</nav>
<main class="responsive">
<raw(html)>
</main>
</body>
</html>;
}

View File

@@ -0,0 +1,114 @@
var AppResources = [
{path="/beer.min.css",value=embed("beer.min.css")},
{path="/beer.min.js",value=embed("beer.min.js")},
{path="/htmx.min.js",value=embed("htmx.min.js")},
{path="/material-symbols-outlined.woff2",value=embed("material-symbols-outlined.woff2")},
{path="/material-symbols-rounded.woff2",value=embed("material-symbols-rounded.woff2")},
{path="/material-symbols-sharp.woff2",value=embed("material-symbols-sharp.woff2")},
{path="/material-symbols-subset.woff2",value=embed("material-symbols-subset.woff2")},
{path="/favicon.ico",value=embed("favicon.ico")},
{path="/theme.css",value=embed("theme.css")}
];
var SERVER = (ctx)=>{
if(ctx.Path == "/")
{
ctx.WithMimeType("text/html").SendText(Pages.Home());
return true;
}
else if(ctx.Path == "/get-more-apps")
{
ctx.WithMimeType("text/html").SendText(Pages.GetMoreApps(ctx));
return true;
}
else if(ctx.Path == "/package-manage" && ctx.Method == "POST")
{
var data = {
name = ctx.QueryParams.TryGetFirst("name"),
version = ctx.QueryParams.TryGetFirst("version"),
action = ctx.QueryParams.TryGetFirst("action")
};
var mustConfirm = false;
switch(data.action)
{
case "install":
{
var v = Version.Parse(data.version);
if(v != null)
PackageInstall(data.name,v);
}
break;
case "uninstall":
{
mustConfirm = true;
}
break;
case "confirm":
{
PackageUninstall(data.name);
}
break;
}
ctx.WithMimeType("text/html").SendText(Components.InstallButton(GetPackages(), data.name, data.version, mustConfirm));
return true;
}
else if(ctx.Path == "/settings")
{
ctx.WithMimeType("text/html").SendText(Pages.Settings(ctx));
return true;
}
else if(ctx.Path == "/launch")
{
var app = ctx.QueryParams.TryGetFirst("app");
if(app != null)
{
var path = GetWebAppsDir() / app / $"{app}.crvm";
if(FS.Local.FileExists(path))
{
var env = VM.CreateEnvironment({});
env.RegisterEverything();
env.LockRegister();
env.LoadFileWithDependencies(FS.Local,path);
var myArgs = [path.ToString()];
SERVER = env.GetDictionary().WebAppMain(myArgs);
}
}
ctx.StatusCode=302;
ctx.WithLocationHeader("/");
ctx.WithMimeType("text/html").SendText(<a href="./">Go Home</a>);
return true;
}
else {
each(var file : AppResources)
{
if(ctx.Path == file.path)
{
ctx.WithMimeType(Net.Http.MimeType(file.path)).SendBytes(file.value);
return true;
}
}
}
return false;
};
func WebAppMain(args)
{
return {Handle = (ctx)=>{
if(TypeIsCallable(SERVER)) return SERVER(ctx);
else return SERVER.Handle(ctx);
}, Close = ()=>{
if(TypeIsCallable(SERVER)) return;
SERVER.Close();
}};
}
func main(args)
{
Console.WriteLine("use crosslang webapp-test to test");
}

View File

@@ -0,0 +1,60 @@
func GetWebAppsDir()
Env.CrossLangConfig / "WebApps";
enumerable func QueryApps()
{
var wad = GetWebAppsDir();
if(FS.Local.DirectoryExists(wad))
{
each(var item : FS.Local.EnumeratePaths(wad))
{
if(FS.Local.DirectoryExists(item) && item.GetFileName() != "crosslang")
{
var path = item/item.GetFileName() + ".crvm";
var strm = FS.Local.OpenFile(path, "rb");
var vmFile = VM.LoadExecutable(strm);
var info={};
try {
info = Json.Decode(vmFile.Info);
} catch(ex) {
}
var em = embed("icon.png");
var fullName = info.short_name_pretty ?? info.short_name ?? item.GetFileName();
yield {
href = $"./launch?app={Net.Http.UrlEncode(item.GetFileName())}",
name = fullName,
icon = $"data:image/png;base64,{Crypto.Base64Encode(vmFile.Icon ?? em)}"
};
}
}
}
};
func Pages.Home()
{
var html = <div class="list">
<each(var app : QueryApps())>
<div class="row">
<div class="min">
<img src={app.icon} alt="Icon">
</div>
<div class="max">
<a href={app.href}>{app.name}</a>
</div>
</div>
</each>
</div>;
return Components.Shell("Home",html,0);
}

View File

@@ -0,0 +1,65 @@
var pm = new Tesses.CrossLang.PackageManager();
func Pages.GetMoreApps(ctx)
{
var installed=GetPackages();
var q = ctx.QueryParams.TryGetFirst("q");
if(TypeOf(q) != "String")
{
q = "";
}
var server = ctx.QueryParams.TryGetFirst("server");
if(TypeOf(server) != "String") server = "https://cpkg.tesseslanguage.com/";
var items=[];
var items2 = [];
each(var item : pm.Search(q,{server,type="webapp"}))
{
items2.Add({
name = item.packageName,
version = item.version,
url = $"{server}/package?name={Net.Http.UrlEncode(item.packageName)}",
thumb = $"{server}/api/v1/package_icon.png?name={Net.Http.UrlEncode(item.packageName)}&version={Net.Http.UrlEncode(item.version)}"
});
}
each(var item : pm.GetPackageServers())
{
items.Add({
active = items.Count == 0,
url = item
});
}
var html = <null>
<form hx-get="./get-more-apps" hx-target="body" hx-push-url="true">
<div class="field suffix border round">
<select name="server">
<each(var item : items)>
<if(item.active)>
<true>
<option value={item.url} selected>{item.url}</option>
</true>
<false>
<option value={item.url}>{item.url}</option>
</false>
</if>
</each>
</select>
<i>arrow_drop_down</i>
</div>
<div class="row no-space">
<div class="field border left-round max">
<input type="text" name="q" value={q}>
</div>
<button type="submit" class="large right-round min">Search</button>
</div>
</form>
<each(var item : items2)>
<raw(Components.PackageItem(installed,item))>
</each>
</null>;
return Components.Shell("More Apps",html,1);
}

View File

@@ -0,0 +1,90 @@
func Pages.Settings(ctx)
{
var darkmode = null;
var f = Env.CrossLangConfig / "prefs.json";
var o = {};
if(FS.Local.FileExists(f))
{
o = Json.Decode(FS.ReadAllText(FS.Local, f));
darkmode = o.darkmode ?? null;
}
if(ctx.Method == "POST")
{
var action = ctx.QueryParams.TryGetFirst("action");
var darkMode = ctx.QueryParams.TryGetFirst("darkmode");
if(action == "darkmode")
{
o = o ?? {};
switch(darkMode)
{
case "default":
darkmode = null;
o.darkmode = null;
break;
case "light":
darkmode = false;
o.darkmode = false;
break;
case "dark":
darkmode = true;
o.darkmode = true;
break;
}
}
FS.WriteAllText(FS.Local,f, Json.Encode(o,true));
}
var html =
<null>
<form hx-post="./settings" hx-target="body">
<input type="hidden" name="action" value="darkmode">
<fieldset>
<legend>Light/Dark Preference (Needs a restart)</legend>
<nav class="vertical">
<label class="radio">
<if(darkmode == null)>
<true>
<input type="radio" name="darkmode" value="default" checked>
</true>
<false>
<input type="radio" name="darkmode" value="default">
</false>
</if>
<span>System Default</span>
</label>
<label class="radio">
<if(darkmode == false)>
<true>
<input type="radio" name="darkmode" value="light" checked>
</true>
<false>
<input type="radio" name="darkmode" value="light">
</false>
</if>
<span>Light Mode</span>
</label>
<label class="radio">
<if(darkmode == true)>
<true>
<input type="radio" name="darkmode" value="dark" checked>
</true>
<false>
<input type="radio" name="darkmode" value="dark">
</false>
</if>
<span>Dark Mode</span>
</label>
<button>Save</button>
</nav>
</fieldset>
</form>
</null>;
return Components.Shell("Settings", html,2);
}

View File

@@ -0,0 +1,53 @@
func GetPackages()
{
var packages=[];
var dir = Env.CrossLangConfig / "WebApps";
if(FS.Local.DirectoryExists(dir))
each(var path : FS.Local.EnumeratePaths(dir))
{
var name = path.GetFileName();
var crvm=path / name + ".crvm";
if(FS.Local.FileExists(crvm))
{
var strm = FS.Local.OpenFile(crvm,"rb");
packages.Add(VM.LoadExecutable(strm));
strm.Close();
}
}
return packages;
}
func PackageInstall(name,version)
{
each(var item : GetPackages())
{
if(item.Name == name)
{
if(item.Version >= version)
{
return;
}
}
}
var dir = new SubdirFilesystem(FS.Local,Env.CrossLangConfig / "WebApps");
pm.DownloadPlugin(dir,name,version);
}
func PackageUninstall(name)
{
each(var item : GetPackages())
{
if(item.Name == name)
{
var info = Json.Decode(item.Info);
var pn = TypeOf(info.short_name) == "String" ? info.short_name : name;
var pp = Env.CrossLangConfig / "WebApps" / pn;
if(FS.Local.DirectoryExists(pp))
FS.Local.DeleteDirectoryRecurse(pp);
break;
}
}
}

View File

@@ -99,6 +99,13 @@ class Tesses.CrossLang.Publisher
CopyCRVM(src.GetParent()/name, dest.GetParent()/name);
}
}
each(var item : FS.Local.EnumeratePaths(destPath.GetParent()))
{
if(item.GetExtension() == ".crvm" && FS.Local.FileExists(item))
{
FS.Local.DeleteFile(item);
}
}
CopyCRVM(this.Build(), destPath);
}

View File

@@ -35,6 +35,7 @@ func main(args)
cmd("crossvm",["./Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm","build","Templates/compiletool"]);
cmd("crossvm",["./Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm","build","Templates/tool"]);
cmd("crossvm",["./Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm","build","Templates/webapp"]);
/*
cmd("crossvm",["./Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm","build","Tesses.CrossLang.PackageServer"]);
cmd("crossvm",["./Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm","build","Tesses.CrossLang.PackageServer"]);

View File

@@ -1,7 +1,10 @@
{
"info": {
"type": "console"
},
"version": "1.0.0.0-prod",
"name": "crosslang_shell_archive_maker"
"info": {
"type": "console"
},
"name": "crosslang_shell_archive_maker",
"project_dependencies": [
"..\/Tesses.CrossLang.BuildEssentials"
],
"version": "1.0.0.0-prod"
}

View File

@@ -45,10 +45,27 @@ func create_archive()
copyFile("Tesses.CrossLang.Shell/bin/Tesses.CrossLang.BuildEssentials-1.0.0.0-prod.crvm", shell / "Tesses.CrossLang.BuildEssentials-1.0.0.0-prod.crvm");
copyFile("Tesses.CrossLang.Shell/bin/Tesses.CrossLang.Shell-1.0.0.0-prod.crvm", shell / "Shell.crvm");
copyFile("Tesses.CrossLang.Reference/bin/Tesses.CrossLang.Reference-1.0.0.0-dev.crvm", "Reference.crvm");
var devStudio = r / "DevStudio";
tmpFS.CreateDirectory(devStudio);
copyFile("vscode-extension/syntaxes/crosslang.tmLanguage.json", devStudio / "grammar.json");
copyFile("vscode-extension/crosslang-1.0.0.vsix", r / "crosslang-vscode-1.0.0.vsix");
var webAppsCrossLang = r / "WebApps" / "crosslang";
tmpFS.CreateDirectory(webAppsCrossLang);
var pm = new Tesses.CrossLang.PackageManager();
pm.Offline = false;
var bt = new Tesses.CrossLang.BuildTool(pm);
var publisher= new Tesses.CrossLang.Publisher(bt, FS.MakeFull("Tesses.CrossLang.App"));
publisher.OutputDirectory = FS.MakeFull("crosslang_shell_archive_maker/tmp/WebApps/crosslang");
publisher.RuntimeIdentifier = "copy";
publisher.Publish();
var templates = r / "Templates";
tmpFS.CreateDirectory(templates);
copyFile("Templates/compiletool/bin/Tesses.CrossLang.Template.CompileTool-1.0.0.0-prod.crvm", templates / "compiletool.crvm");
copyFile("Templates/console/bin/Tesses.CrossLang.Template.Console-1.0.0.0-prod.crvm", templates / "console.crvm");
copyFile("Templates/lib/bin/Tesses.CrossLang.Template.Library-1.0.0.0-prod.crvm", templates / "lib.crvm");

View File

@@ -0,0 +1,10 @@
MIT LICENSE
===========
Copyright 2025 Mike Nolan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,31 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}

View File

@@ -0,0 +1,27 @@
{
"name": "crosslang",
"displayName": "Crosslang",
"description": "CrossLang Language Support",
"version": "1.0.0",
"engines": {
"vscode": "^1.0.0"
},
"publisher": "tesses50",
"repository": "https://onedev.site.tesses.net/crosslang/crosslangextras",
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "crosslang",
"aliases": ["CrossLang", "crosslang"],
"extensions": [".tcross"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "crosslang",
"scopeName": "source.crosslang",
"path": "./syntaxes/crosslang.tmLanguage.json"
}]
}
}

View File

@@ -0,0 +1,137 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "CrossLang",
"patterns": [
{
"include": "#comment"
},
{
"include": "#keywords"
},
{
"include": "#chars"
},
{
"include": "#operators"
},
{
"include": "#function"
},
{
"include": "#identifier"
},
{
"include": "#consts"
},
{
"include": "#double"
},
{
"include": "#long"
},
{
"include": "#strings"
}
],
"repository": {
"comment": {
"patterns": [{
"name": "comment.line.double-slash.crosslang",
"begin": "//",
"end": "\\n"
},
{
"name": "comment.block.crosslang",
"begin": "\\/\\*",
"end": "\\*\\/"
},
{
"name": "comment.line.crosslang",
"begin": "#",
"end": "\\n"
},
{
"name":"comment.block.documentation.crosslang",
"begin": "\\/\\^",
"end": "\\^\\/"
}
]
},
"strings": {
"name": "string.quoted.double.crosslang",
"begin": "\\\"",
"end": "\\\"",
"patterns": [
{
"name": "constant.character.escape.crosslang",
"match": "\\\\."
}
]
},
"operators": {
"patterns": [{
"name": "keyword.operator",
"match": "(\\+|\\-|\\*|\\\/|\\%|\\!|\\||\\&|\\^|\\<\\<|\\>\\>|\\<|\\>|\\=)"
}]
},
"function": {
"patterns": [{
"name": "entity.name.function.crosslang",
"match": "\\b[_a-zA-Z\\x80-\\xFF\\$][_a-zA-Z0-9\\x80-\\xFF\\$]*\\("
}]
},
"identifier": {
"patterns": [{
"name": "entity.name.crosslang",
"match": "\\b[_a-zA-Z\\x80-\\xFF\\$][_a-zA-Z0-9\\x80-\\xFF\\$]*"
}]
},
"double": {
"name": "constant.numeric.crosslang",
"match": "\\b[0-9][0-9]*\\.[0-9]*\\b"
},
"long": {
"patterns": [
{
"name": "constant.numeric.crosslang",
"match": "\\b[0-9][0-9]*\\b"
}
]
},
"keywords": {
"patterns": [
{
"name": "constant.language.crosslang",
"match": "\\b(true|false|null|undefined|this)\\b"
},
{
"name": "keyword.operator.new.crosslang",
"match": "\\bnew\\b"
},
{
"name": "keyword.control.crosslang",
"match": "\\b(if|else|while|for|do|return|each|break|try|catch|finally|defer|enumerable|yield|switch|case|default|await)\\b"
},
{
"name": "keyword.crosslang",
"match": "\\b(var|const|func|class|public|private|protected|static|operator|embed|async)\\b"
}
]
},
"chars": {
"name": "constant.character.crosslang",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.crosslang",
"match": "\\\\."
}
]
}
},
"scopeName": "source.crosslang"
}