firefly-compiler 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.firefly-workspace +1 -0
- package/.vscode/settings.json +5 -0
- package/LICENSE.txt +21 -0
- package/README.md +96 -0
- package/bin/firefly.mjs +2 -0
- package/compiler/.firefly/package.ff +1 -0
- package/compiler/Builder.ff +218 -0
- package/compiler/Compiler.ff +241 -0
- package/compiler/Dependencies.ff +179 -0
- package/compiler/Deriver.ff +647 -0
- package/compiler/Dictionaries.ff +205 -0
- package/compiler/Environment.ff +166 -0
- package/compiler/Inference.ff +1117 -0
- package/compiler/JsEmitter.ff +861 -0
- package/compiler/JsImporter.ff +56 -0
- package/compiler/LspHook.ff +188 -0
- package/compiler/Main.ff +237 -0
- package/compiler/Parser.ff +1383 -0
- package/compiler/Patterns.ff +111 -0
- package/compiler/Resolver.ff +620 -0
- package/compiler/Substitution.ff +178 -0
- package/compiler/Syntax.ff +299 -0
- package/compiler/Token.ff +180 -0
- package/compiler/Tokenizer.ff +278 -0
- package/compiler/Unification.ff +220 -0
- package/compiler/Wildcards.ff +50 -0
- package/compiler/Workspace.ff +88 -0
- package/core/.firefly/package.ff +2 -0
- package/core/Any.ff +30 -0
- package/core/Array.ff +249 -0
- package/core/AssetSystem.ff +61 -0
- package/core/Atomic.ff +64 -0
- package/core/Bool.ff +13 -0
- package/core/BrowserSystem.ff +14 -0
- package/core/Buffer.ff +211 -0
- package/core/BuildSystem.ff +144 -0
- package/core/Channel.ff +131 -0
- package/core/Char.ff +18 -0
- package/core/Core.ff +58 -0
- package/core/Duration.ff +15 -0
- package/core/Equal.ff +52 -0
- package/core/Error.ff +20 -0
- package/core/FileHandle.ff +41 -0
- package/core/Float.ff +41 -0
- package/core/HttpClient.ff +84 -0
- package/core/Instant.ff +9 -0
- package/core/Int.ff +61 -0
- package/core/IntMap.ff +85 -0
- package/core/JsSystem.ff +66 -0
- package/core/JsValue.ff +240 -0
- package/core/List.ff +440 -0
- package/core/Lock.ff +144 -0
- package/core/Log.ff +24 -0
- package/core/Map.ff +126 -0
- package/core/NodeSystem.ff +88 -0
- package/core/Nothing.ff +1 -0
- package/core/Option.ff +133 -0
- package/core/Ordering.ff +157 -0
- package/core/Pair.ff +55 -0
- package/core/Path.ff +393 -0
- package/core/RbMap.ff +216 -0
- package/core/Serializable.ff +173 -0
- package/core/Set.ff +38 -0
- package/core/Show.ff +43 -0
- package/core/Stack.ff +263 -0
- package/core/Stream.ff +406 -0
- package/core/String.ff +175 -0
- package/core/StringMap.ff +85 -0
- package/core/Task.ff +138 -0
- package/core/Try.ff +81 -0
- package/core/Unit.ff +3 -0
- package/experimental/random/AltGeneric.ff +44 -0
- package/experimental/random/Async.ff +68 -0
- package/experimental/random/Buffer2.ff +77 -0
- package/experimental/random/Cat.ff +12 -0
- package/experimental/random/Dictionary.ff +52 -0
- package/experimental/random/Example.ff +46 -0
- package/experimental/random/Generic.ff +102 -0
- package/experimental/random/HappyEyeballs.ff +40 -0
- package/experimental/random/HashMap.ff +72 -0
- package/experimental/random/IfElseUnit.ff +9 -0
- package/experimental/random/InputOutput.ff +23 -0
- package/experimental/random/ListVsArray.ff +45 -0
- package/experimental/random/Main.ff +44 -0
- package/experimental/random/MapTest.ff +67 -0
- package/experimental/random/OldTaskSystem.ff +210 -0
- package/experimental/random/PatternTest.ff +39 -0
- package/experimental/random/Patterns.ff +226 -0
- package/experimental/random/ReadBytesTest.ff +10 -0
- package/experimental/random/RunLength.ff +65 -0
- package/experimental/random/Scrape.ff +51 -0
- package/experimental/random/Serialization.ff +217 -0
- package/experimental/random/SerializationTest.ff +46 -0
- package/experimental/random/Serializer.ff +36 -0
- package/experimental/random/StdInOutErr.ff +4 -0
- package/experimental/random/Symbols.ff +74 -0
- package/experimental/random/Tag.ff +49 -0
- package/experimental/random/Tensor.ff +52 -0
- package/experimental/random/Try.ff +56 -0
- package/experimental/random/Tsv.ff +9 -0
- package/experimental/random/TypesAreModules.ff +87 -0
- package/experimental/random/blueprints/Blueprint.ff +52 -0
- package/experimental/random/blueprints/Main.ff +11 -0
- package/experimental/random/blueprints/Pretty.ff +58 -0
- package/experimental/random/blueprints/User.ff +64 -0
- package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
- package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
- package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
- package/experimental/random/blueprintsystem/User.ff +2 -0
- package/experimental/random/kahrs/Kahrs.ff +112 -0
- package/experimental/random/kahrs/TestKahrs.ff +22 -0
- package/experimental/random/kahrs/TestMap.ff +18 -0
- package/experimental/random/streaming/Gzip.ff +3 -0
- package/experimental/random/streaming/Main.ff +34 -0
- package/experimental/random/streaming/S3Bucket.ff +11 -0
- package/experimental/random/streaming/Tar.ff +5 -0
- package/experimental/rhymeapp/Main.ff +81 -0
- package/experimental/rhymeapp/index.html +14 -0
- package/firefly.sh +5 -0
- package/fireflysite/Main.ff +13 -0
- package/httpserver/.firefly/package.ff +1 -0
- package/httpserver/HttpServer.ff +184 -0
- package/lsp/.firefly/package.ff +1 -0
- package/lsp/CompletionHandler.ff +814 -0
- package/lsp/Handler.ff +551 -0
- package/lsp/HoverHandler.ff +82 -0
- package/lsp/LanguageServer.ff +229 -0
- package/lsp/SignatureHelpHandler.ff +55 -0
- package/lsp/SymbolHandler.ff +167 -0
- package/output/js/ff/compiler/Builder.mjs +483 -0
- package/output/js/ff/compiler/Compiler.mjs +410 -0
- package/output/js/ff/compiler/Dependencies.mjs +388 -0
- package/output/js/ff/compiler/Deriver.mjs +1166 -0
- package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
- package/output/js/ff/compiler/Environment.mjs +1005 -0
- package/output/js/ff/compiler/Inference.mjs +4264 -0
- package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
- package/output/js/ff/compiler/JsImporter.mjs +262 -0
- package/output/js/ff/compiler/LspHook.mjs +789 -0
- package/output/js/ff/compiler/Main.mjs +1695 -0
- package/output/js/ff/compiler/Parser.mjs +4004 -0
- package/output/js/ff/compiler/Patterns.mjs +923 -0
- package/output/js/ff/compiler/Resolver.mjs +2303 -0
- package/output/js/ff/compiler/Substitution.mjs +1146 -0
- package/output/js/ff/compiler/Syntax.mjs +12430 -0
- package/output/js/ff/compiler/Token.mjs +3092 -0
- package/output/js/ff/compiler/Tokenizer.mjs +589 -0
- package/output/js/ff/compiler/Unification.mjs +1748 -0
- package/output/js/ff/compiler/Wildcards.mjs +604 -0
- package/output/js/ff/compiler/Workspace.mjs +683 -0
- package/output/js/ff/core/Any.mjs +139 -0
- package/output/js/ff/core/Array.mjs +594 -0
- package/output/js/ff/core/AssetSystem.mjs +270 -0
- package/output/js/ff/core/Atomic.mjs +186 -0
- package/output/js/ff/core/Bool.mjs +141 -0
- package/output/js/ff/core/BrowserSystem.mjs +122 -0
- package/output/js/ff/core/Buffer.mjs +467 -0
- package/output/js/ff/core/BuildSystem.mjs +320 -0
- package/output/js/ff/core/Channel.mjs +268 -0
- package/output/js/ff/core/Char.mjs +145 -0
- package/output/js/ff/core/Core.mjs +300 -0
- package/output/js/ff/core/Duration.mjs +112 -0
- package/output/js/ff/core/Equal.mjs +175 -0
- package/output/js/ff/core/Error.mjs +138 -0
- package/output/js/ff/core/FileHandle.mjs +164 -0
- package/output/js/ff/core/Float.mjs +214 -0
- package/output/js/ff/core/HttpClient.mjs +210 -0
- package/output/js/ff/core/Instant.mjs +105 -0
- package/output/js/ff/core/Int.mjs +254 -0
- package/output/js/ff/core/IntMap.mjs +282 -0
- package/output/js/ff/core/JsSystem.mjs +234 -0
- package/output/js/ff/core/JsValue.mjs +678 -0
- package/output/js/ff/core/List.mjs +2335 -0
- package/output/js/ff/core/Lock.mjs +322 -0
- package/output/js/ff/core/Log.mjs +159 -0
- package/output/js/ff/core/Map.mjs +358 -0
- package/output/js/ff/core/NodeSystem.mjs +288 -0
- package/output/js/ff/core/Nothing.mjs +100 -0
- package/output/js/ff/core/Option.mjs +1002 -0
- package/output/js/ff/core/Ordering.mjs +734 -0
- package/output/js/ff/core/Pair.mjs +318 -0
- package/output/js/ff/core/Path.mjs +768 -0
- package/output/js/ff/core/RbMap.mjs +1936 -0
- package/output/js/ff/core/Serializable.mjs +434 -0
- package/output/js/ff/core/Set.mjs +250 -0
- package/output/js/ff/core/Show.mjs +201 -0
- package/output/js/ff/core/Stack.mjs +595 -0
- package/output/js/ff/core/Stream.mjs +1300 -0
- package/output/js/ff/core/String.mjs +433 -0
- package/output/js/ff/core/StringMap.mjs +282 -0
- package/output/js/ff/core/Task.mjs +345 -0
- package/output/js/ff/core/Try.mjs +503 -0
- package/output/js/ff/core/Unit.mjs +103 -0
- package/package.json +29 -0
- package/postgresql/.firefly/include/package-lock.json +250 -0
- package/postgresql/.firefly/include/package.json +5 -0
- package/postgresql/.firefly/include/prepare.sh +2 -0
- package/postgresql/.firefly/package.ff +3 -0
- package/postgresql/Pg.ff +530 -0
- package/unsafejs/.firefly/package.ff +1 -0
- package/unsafejs/UnsafeJs.ff +19 -0
- package/vscode/.vscode/launch.json +18 -0
- package/vscode/.vscode/tasks.json +33 -0
- package/vscode/LICENSE.txt +21 -0
- package/vscode/Prepublish.ff +15 -0
- package/vscode/README.md +17 -0
- package/vscode/client/package-lock.json +544 -0
- package/vscode/client/package.json +22 -0
- package/vscode/client/src/extension.ts +64 -0
- package/vscode/client/tsconfig.json +12 -0
- package/vscode/icons/firefly-icon.png +0 -0
- package/vscode/icons/firefly-icon.svg +10 -0
- package/vscode/icons/firefly-logo-notext.png +0 -0
- package/vscode/icons/firefly-logo.png +0 -0
- package/vscode/language-configuration.json +39 -0
- package/vscode/package-lock.json +3623 -0
- package/vscode/package.json +144 -0
- package/vscode/snippets-none.json +1 -0
- package/vscode/snippets.json +241 -0
- package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
- package/vscode/tsconfig.json +20 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "firefly-lang",
|
|
3
|
+
"displayName": "Firefly Language",
|
|
4
|
+
"description": "Firefly language support",
|
|
5
|
+
"author": "Firefly team",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"version": "0.4.4",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Ahnfelt/firefly-boot"
|
|
11
|
+
},
|
|
12
|
+
"publisher": "firefly-team",
|
|
13
|
+
"categories": [
|
|
14
|
+
"Programming Languages"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"multi-root ready"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"vscode": "^1.82.0"
|
|
21
|
+
},
|
|
22
|
+
"main": "./client/out/extension",
|
|
23
|
+
"icon": "./icons/firefly-logo.png",
|
|
24
|
+
"contributes": {
|
|
25
|
+
"languages": [
|
|
26
|
+
{
|
|
27
|
+
"id": "firefly",
|
|
28
|
+
"extensions": [
|
|
29
|
+
".ff"
|
|
30
|
+
],
|
|
31
|
+
"aliases": [
|
|
32
|
+
"Firefly",
|
|
33
|
+
"ff"
|
|
34
|
+
],
|
|
35
|
+
"configuration": "./language-configuration.json",
|
|
36
|
+
"icon": {
|
|
37
|
+
"light": "./icons/firefly-icon.svg",
|
|
38
|
+
"dark": "./icons/firefly-icon.svg"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"grammars": [
|
|
43
|
+
{
|
|
44
|
+
"language": "firefly",
|
|
45
|
+
"scopeName": "source.firefly",
|
|
46
|
+
"path": "./syntaxes/firefly.tmLanguage.json",
|
|
47
|
+
"embeddedLanguages": {
|
|
48
|
+
"meta.embedded.block.javascript": "javascript"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"problemMatchers": [
|
|
53
|
+
{
|
|
54
|
+
"name": "firefly-problem",
|
|
55
|
+
"owner": "firefly",
|
|
56
|
+
"fileLocation": [
|
|
57
|
+
"relative",
|
|
58
|
+
"${workspaceRoot}"
|
|
59
|
+
],
|
|
60
|
+
"pattern": [
|
|
61
|
+
{
|
|
62
|
+
"regexp": "^(.*)\\r?\\n at (.*)[:]([0-9]+)[:]([0-9]+)$",
|
|
63
|
+
"message": 1,
|
|
64
|
+
"file": 2,
|
|
65
|
+
"line": 3,
|
|
66
|
+
"column": 4
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"snippets": [
|
|
72
|
+
{
|
|
73
|
+
"language": "firefly",
|
|
74
|
+
"path": "./snippets-none.json"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"commands": [
|
|
78
|
+
{
|
|
79
|
+
"command": "extension.firefly-lang.getFireflyPath",
|
|
80
|
+
"title": "Get the Firefly path"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"command": "extension.firefly-lang.getFireflyCompiler",
|
|
84
|
+
"title": "Get the Firefly compiler main"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"configuration": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"title": "Firefly language support configuration",
|
|
90
|
+
"properties": {
|
|
91
|
+
"firefly.trace.server": {
|
|
92
|
+
"scope": "window",
|
|
93
|
+
"type": "string",
|
|
94
|
+
"enum": [
|
|
95
|
+
"off",
|
|
96
|
+
"messages",
|
|
97
|
+
"verbose"
|
|
98
|
+
],
|
|
99
|
+
"default": "verbose",
|
|
100
|
+
"description": "Traces the communication between VS Code and the language server."
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"debuggers": [
|
|
105
|
+
{
|
|
106
|
+
"type": "firefly",
|
|
107
|
+
"runtime": "node",
|
|
108
|
+
"languages": [
|
|
109
|
+
"firefly"
|
|
110
|
+
],
|
|
111
|
+
"initialConfigurations": [
|
|
112
|
+
{
|
|
113
|
+
"type": "node",
|
|
114
|
+
"request": "launch",
|
|
115
|
+
"name": "Launch Firefly",
|
|
116
|
+
"args": [
|
|
117
|
+
"${command:extension.firefly-lang.getFireflyCompiler}",
|
|
118
|
+
"${file}"
|
|
119
|
+
],
|
|
120
|
+
"outFiles": [
|
|
121
|
+
"${workspaceFolder}/.firefly/**/*.mjs"
|
|
122
|
+
],
|
|
123
|
+
"outputCapture": "std"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"scripts": {
|
|
130
|
+
"vscode:prepublish": "node ../output/js/ff/compiler/Main.mjs Prepublish.ff && npm run compile",
|
|
131
|
+
"compile": "tsc -b",
|
|
132
|
+
"watch": "tsc -b -w",
|
|
133
|
+
"postinstall": "cd client && npm install && cd .."
|
|
134
|
+
},
|
|
135
|
+
"devDependencies": {
|
|
136
|
+
"@types/mocha": "^9.1.0",
|
|
137
|
+
"@types/node": "^16.11.7",
|
|
138
|
+
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
|
139
|
+
"@typescript-eslint/parser": "^5.54.0",
|
|
140
|
+
"eslint": "^8.35.0",
|
|
141
|
+
"mocha": "^9.2.1",
|
|
142
|
+
"typescript": "^4.9.5"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": {
|
|
3
|
+
"prefix": "_main",
|
|
4
|
+
"body": [
|
|
5
|
+
"main(system: NodeSystem) {",
|
|
6
|
+
" $0",
|
|
7
|
+
"}"
|
|
8
|
+
],
|
|
9
|
+
"description": "Main function"
|
|
10
|
+
},
|
|
11
|
+
"nodeMain": {
|
|
12
|
+
"prefix": "_nodeMain",
|
|
13
|
+
"body": [
|
|
14
|
+
"nodeMain(system: NodeSystem) {",
|
|
15
|
+
" $0",
|
|
16
|
+
"}"
|
|
17
|
+
],
|
|
18
|
+
"description": "Node main function"
|
|
19
|
+
},
|
|
20
|
+
"browserMain": {
|
|
21
|
+
"prefix": "_browserMain",
|
|
22
|
+
"body": [
|
|
23
|
+
"browserMain(system: BrowserSystem) {",
|
|
24
|
+
" $0",
|
|
25
|
+
"}"
|
|
26
|
+
],
|
|
27
|
+
"description": "Browser main function"
|
|
28
|
+
},
|
|
29
|
+
"buildMain": {
|
|
30
|
+
"prefix": "_buildMain",
|
|
31
|
+
"body": [
|
|
32
|
+
"buildMain(system: BuildSystem) {",
|
|
33
|
+
" $0",
|
|
34
|
+
"}"
|
|
35
|
+
],
|
|
36
|
+
"description": "Build main function"
|
|
37
|
+
},
|
|
38
|
+
"webapp": {
|
|
39
|
+
"prefix": "_webapp",
|
|
40
|
+
"body": [
|
|
41
|
+
"dependency ff:httpserver:0.0.0",
|
|
42
|
+
"import HttpServer from ff:httpserver",
|
|
43
|
+
"",
|
|
44
|
+
"browserMain(system: BrowserSystem): Unit {",
|
|
45
|
+
" let response = system.httpClient().fetch(\"http://localhost:8080/hello\")",
|
|
46
|
+
" let window = system.js().global().get(\"window\")",
|
|
47
|
+
" window.call1(\"alert\", response.readText())",
|
|
48
|
+
"}",
|
|
49
|
+
"",
|
|
50
|
+
"nodeMain(system: NodeSystem): Unit {",
|
|
51
|
+
" HttpServer.listen(system, \"localhost\", 8080) {request, response =>",
|
|
52
|
+
" if(request.path() == \"/\") {",
|
|
53
|
+
" response.setHeader(\"Content-Type\", [\"text/html; charset=UTF-8\"])",
|
|
54
|
+
" response.writeText(\"<!doctype html>\")",
|
|
55
|
+
" response.writeText(\"<script type='module' src='/js/script/script/WebApp.mjs'></script>\")",
|
|
56
|
+
" } elseIf {request.path() == \"/hello\"} {",
|
|
57
|
+
" response.setHeader(\"Content-Type\", [\"text/plain; charset=UTF-8\"])",
|
|
58
|
+
" response.writeText(\"Hello from server!\")",
|
|
59
|
+
" } elseIf {request.path().startsWith(\"/js/\") && !request.path().contains(\"..\")} {",
|
|
60
|
+
" response.setHeader(\"Content-Type\", [\"text/javascript; charset=UTF-8\"])",
|
|
61
|
+
" response.writeText(system.assets().readText(request.path()))",
|
|
62
|
+
" } else {",
|
|
63
|
+
" response.writeStatus(404, Some(\"Not found\"))",
|
|
64
|
+
" }",
|
|
65
|
+
" }",
|
|
66
|
+
"}",
|
|
67
|
+
"",
|
|
68
|
+
"buildMain(system: BuildSystem) {",
|
|
69
|
+
" let browser = system.compileForBrowser(\"WebApp.ff\")",
|
|
70
|
+
" let assets = AssetSystem.create().addAssets(\"/js\", browser.assets())",
|
|
71
|
+
" system.setAssets(assets)",
|
|
72
|
+
"}",
|
|
73
|
+
"",
|
|
74
|
+
"// To run this, name your file WebApp.ff and type:",
|
|
75
|
+
"// firefly WebApp.ff"
|
|
76
|
+
],
|
|
77
|
+
"description": "A tiny client + server webapp"
|
|
78
|
+
},
|
|
79
|
+
"extend": {
|
|
80
|
+
"prefix": "_extend",
|
|
81
|
+
"body": [
|
|
82
|
+
"extend ${1:self}: $2 {",
|
|
83
|
+
" $0",
|
|
84
|
+
"}"
|
|
85
|
+
],
|
|
86
|
+
"description": "Extend a type with methods"
|
|
87
|
+
},
|
|
88
|
+
"data": {
|
|
89
|
+
"prefix": "_data",
|
|
90
|
+
"body": [
|
|
91
|
+
"data ${1}($2) {$0}"
|
|
92
|
+
],
|
|
93
|
+
"description": "Data type declaration"
|
|
94
|
+
},
|
|
95
|
+
"class": {
|
|
96
|
+
"prefix": "_class",
|
|
97
|
+
"body": [
|
|
98
|
+
"class ${1}($2) {$0}"
|
|
99
|
+
],
|
|
100
|
+
"description": "Class type declaration"
|
|
101
|
+
},
|
|
102
|
+
"capability": {
|
|
103
|
+
"prefix": "_capability",
|
|
104
|
+
"body": [
|
|
105
|
+
"capability ${1}($2) {$0}"
|
|
106
|
+
],
|
|
107
|
+
"description": "Capability type declaration"
|
|
108
|
+
},
|
|
109
|
+
"package": {
|
|
110
|
+
"prefix": "_package",
|
|
111
|
+
"body": [
|
|
112
|
+
"package $1:$2:$3"
|
|
113
|
+
],
|
|
114
|
+
"description": "Package declaration"
|
|
115
|
+
},
|
|
116
|
+
"dependency": {
|
|
117
|
+
"prefix": "_dependency",
|
|
118
|
+
"body": [
|
|
119
|
+
"dependency $1:$2:$3"
|
|
120
|
+
],
|
|
121
|
+
"description": "Dependency declaration"
|
|
122
|
+
},
|
|
123
|
+
"import": {
|
|
124
|
+
"prefix": "_import",
|
|
125
|
+
"body": [
|
|
126
|
+
"import $1 from $2:$3"
|
|
127
|
+
],
|
|
128
|
+
"description": "Import declaration"
|
|
129
|
+
},
|
|
130
|
+
"function": {
|
|
131
|
+
"prefix": "_function",
|
|
132
|
+
"body": [
|
|
133
|
+
"function $1($2): $3 {",
|
|
134
|
+
" $0",
|
|
135
|
+
"}"
|
|
136
|
+
],
|
|
137
|
+
"description": "Function definition"
|
|
138
|
+
},
|
|
139
|
+
"let": {
|
|
140
|
+
"prefix": "_let",
|
|
141
|
+
"body": [
|
|
142
|
+
"let $1 = $0"
|
|
143
|
+
],
|
|
144
|
+
"description": "Immutable variable definition"
|
|
145
|
+
},
|
|
146
|
+
"mutable": {
|
|
147
|
+
"prefix": "_mutable",
|
|
148
|
+
"body": [
|
|
149
|
+
"mutable $1 = $0"
|
|
150
|
+
],
|
|
151
|
+
"description": "Mutable variable definition"
|
|
152
|
+
},
|
|
153
|
+
"if": {
|
|
154
|
+
"prefix": "_if",
|
|
155
|
+
"body": [
|
|
156
|
+
"if($1) {",
|
|
157
|
+
" $0",
|
|
158
|
+
"}"
|
|
159
|
+
],
|
|
160
|
+
"description": "If expression"
|
|
161
|
+
},
|
|
162
|
+
"else": {
|
|
163
|
+
"prefix": "_else",
|
|
164
|
+
"body": [
|
|
165
|
+
"else {",
|
|
166
|
+
" $0",
|
|
167
|
+
"}"
|
|
168
|
+
],
|
|
169
|
+
"description": "Else expression part"
|
|
170
|
+
},
|
|
171
|
+
"elseif": {
|
|
172
|
+
"prefix": "_elseif",
|
|
173
|
+
"body": [
|
|
174
|
+
"elseIf {$1} {",
|
|
175
|
+
" $0",
|
|
176
|
+
"}"
|
|
177
|
+
],
|
|
178
|
+
"description": "ElseIf expression part"
|
|
179
|
+
},
|
|
180
|
+
"try": {
|
|
181
|
+
"prefix": "_try",
|
|
182
|
+
"body": [
|
|
183
|
+
"try {",
|
|
184
|
+
" $1",
|
|
185
|
+
"} catch {| ${2:MyException e}, error =>",
|
|
186
|
+
" $3",
|
|
187
|
+
"} finally {",
|
|
188
|
+
" $0",
|
|
189
|
+
"} grab()"
|
|
190
|
+
],
|
|
191
|
+
"description": "Try catch finanlly expression"
|
|
192
|
+
},
|
|
193
|
+
"throw": {
|
|
194
|
+
"prefix": "_throw",
|
|
195
|
+
"body": [
|
|
196
|
+
"throw(${1:MyException()})"
|
|
197
|
+
],
|
|
198
|
+
"description": "Throw expression"
|
|
199
|
+
},
|
|
200
|
+
"while": {
|
|
201
|
+
"prefix": "_while",
|
|
202
|
+
"body": [
|
|
203
|
+
"while {$1} {",
|
|
204
|
+
" $0",
|
|
205
|
+
"}"
|
|
206
|
+
],
|
|
207
|
+
"description": "While expression"
|
|
208
|
+
},
|
|
209
|
+
"do": {
|
|
210
|
+
"prefix": "_do",
|
|
211
|
+
"body": [
|
|
212
|
+
"do {",
|
|
213
|
+
" $0",
|
|
214
|
+
"}"
|
|
215
|
+
],
|
|
216
|
+
"description": "Do expression"
|
|
217
|
+
},
|
|
218
|
+
"dowhile": {
|
|
219
|
+
"prefix": "_dowhile",
|
|
220
|
+
"body": [
|
|
221
|
+
"doWhile {",
|
|
222
|
+
" $0",
|
|
223
|
+
"}"
|
|
224
|
+
],
|
|
225
|
+
"description": "Do while expression"
|
|
226
|
+
},
|
|
227
|
+
"log": {
|
|
228
|
+
"prefix": "_log",
|
|
229
|
+
"body": [
|
|
230
|
+
"Log.trace(\"$1: \" + $1)"
|
|
231
|
+
],
|
|
232
|
+
"description": "Trace expression"
|
|
233
|
+
},
|
|
234
|
+
"logg": {
|
|
235
|
+
"prefix": "_logg",
|
|
236
|
+
"body": [
|
|
237
|
+
"Log.trace(\"$TM_FILENAME_BASE $RANDOM_HEX\")"
|
|
238
|
+
],
|
|
239
|
+
"description": "Trace location"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Firefly",
|
|
3
|
+
"scopeName": "source.firefly",
|
|
4
|
+
"fileTypes": [".ff"],
|
|
5
|
+
"uuid": "4f8c685b-2623-4a57-9ef6-51445872c8d4",
|
|
6
|
+
"patterns": [{"include": "#all"}],
|
|
7
|
+
"repository": {
|
|
8
|
+
"all": {"patterns": [
|
|
9
|
+
{"include": "#comment"},
|
|
10
|
+
{"include": "#char"},
|
|
11
|
+
{"include": "#target-js"},
|
|
12
|
+
{"include": "#target-js-singleline"},
|
|
13
|
+
{"include": "#target-js-multiline"},
|
|
14
|
+
{"include": "#string"},
|
|
15
|
+
{"include": "#string-multiline"},
|
|
16
|
+
{"include": "#number"},
|
|
17
|
+
{"include": "#keyword"},
|
|
18
|
+
{"include": "#spread"},
|
|
19
|
+
{"include": "#field-or-call"},
|
|
20
|
+
{"include": "#upper-dot"},
|
|
21
|
+
{"include": "#upper"},
|
|
22
|
+
{"include": "#lower"},
|
|
23
|
+
{"include": "#ugly-colon"},
|
|
24
|
+
{"include": "#ugly-comma"},
|
|
25
|
+
{"include": "#ugly-arrow"},
|
|
26
|
+
{"include": "#ugly-pipe"},
|
|
27
|
+
{"include": "#ugly-round"},
|
|
28
|
+
{"include": "#ugly-square"},
|
|
29
|
+
{"include": "#ugly-curly"}
|
|
30
|
+
]},
|
|
31
|
+
"keyword": {
|
|
32
|
+
"name": "keyword.declaration.firefly",
|
|
33
|
+
"match": "\\b(data|class|capability|import|from|dependency|package|include|extend|tailcall|function|let|mutable|firefly|trait|instance|newtype|private|safe|unsafe|trust|target)\\b(?=[ ]*[A-Za-z0-9\"'])"
|
|
34
|
+
},
|
|
35
|
+
"spread": {
|
|
36
|
+
"name": "punctuation.spread.firefly",
|
|
37
|
+
"match": "[.][.][.]"
|
|
38
|
+
},
|
|
39
|
+
"field-or-call": {
|
|
40
|
+
"name": "entity.name.function.member.firefly",
|
|
41
|
+
"match": "(?<=[^.][.}][ ]*)[a-z][A-Za-z0-9]*\\b|(?<!\\bextend[ \\t]+|@[ \\t]*|\\b[A-Z][A-Za-z0-9]+[ \\t]+)\\b[a-z][A-Za-z0-9]*(?=[ ]*[({\\[])"
|
|
42
|
+
},
|
|
43
|
+
"upper-dot": {
|
|
44
|
+
"name": "entity.name.namespace.firefly",
|
|
45
|
+
"match": "\\b[A-Z][A-Za-z0-9]*(?=[.])"
|
|
46
|
+
},
|
|
47
|
+
"upper": {
|
|
48
|
+
"name": "entity.name.type.firefly",
|
|
49
|
+
"match": "\\b[A-Z][A-Za-z0-9]*\\b"
|
|
50
|
+
},
|
|
51
|
+
"lower": {
|
|
52
|
+
"name": "entity.name.variable.firefly",
|
|
53
|
+
"match": "\\b[a-z_][A-Za-z0-9_]*\\b"
|
|
54
|
+
},
|
|
55
|
+
"char": {
|
|
56
|
+
"name": "string.quoted.single.firefly",
|
|
57
|
+
"begin": "'",
|
|
58
|
+
"beginCaptures": {
|
|
59
|
+
"0": {
|
|
60
|
+
"name": "punctuation.definition.string.begin.firefly"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"end": "(')|((?:[^\\\\\\n])$)",
|
|
64
|
+
"endCaptures": {
|
|
65
|
+
"1": {
|
|
66
|
+
"name": "punctuation.definition.string.end.firefly"
|
|
67
|
+
},
|
|
68
|
+
"2": {
|
|
69
|
+
"name": "invalid.illegal.newline.firefly"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"patterns": [
|
|
73
|
+
{
|
|
74
|
+
"include": "#string-character-escape"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"target-js": {
|
|
79
|
+
"contentName": "meta.embedded.block.javascript",
|
|
80
|
+
"begin": "\\b(js|node|browser)[ ]+(sync|async)[ ]+(\")(?!\"\")",
|
|
81
|
+
"beginCaptures": {
|
|
82
|
+
"1": {
|
|
83
|
+
"name": "keyword.declaration.firefly"
|
|
84
|
+
},
|
|
85
|
+
"2": {
|
|
86
|
+
"name": "keyword.declaration.firefly"
|
|
87
|
+
},
|
|
88
|
+
"3": {
|
|
89
|
+
"name": "punctuation.definition.string.begin.firefly"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"end": "(\")|((?:[^\\\\\\n])$)",
|
|
93
|
+
"endCaptures": {
|
|
94
|
+
"1": {
|
|
95
|
+
"name": "punctuation.definition.string.end.firefly"
|
|
96
|
+
},
|
|
97
|
+
"2": {
|
|
98
|
+
"name": "invalid.illegal.newline.firefly"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"patterns": [
|
|
102
|
+
{
|
|
103
|
+
"include": "#string-character-escape"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"target-js-singleline": {
|
|
108
|
+
"contentName": "meta.embedded.block.javascript",
|
|
109
|
+
"begin": "\\b(js|node|browser)[ ]+(sync|async)[ ]+(\"\"\")(?![ \t\r]*$)",
|
|
110
|
+
"beginCaptures": {
|
|
111
|
+
"1": {
|
|
112
|
+
"name": "keyword.declaration.firefly"
|
|
113
|
+
},
|
|
114
|
+
"2": {
|
|
115
|
+
"name": "keyword.declaration.firefly"
|
|
116
|
+
},
|
|
117
|
+
"3": {
|
|
118
|
+
"name": "punctuation.definition.string.begin.firefly"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"end": "\"\"\"(?!\")",
|
|
122
|
+
"endCaptures": {
|
|
123
|
+
"0": {
|
|
124
|
+
"name": "punctuation.definition.string.end.firefly"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"patterns": [
|
|
128
|
+
{
|
|
129
|
+
"include": "#string-character-escape"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"target-js-multiline": {
|
|
134
|
+
"contentName": "meta.embedded.block.javascript",
|
|
135
|
+
"begin": "\\b(js|node|browser)[ ]+(sync|async)[ ]+(\"\"\")",
|
|
136
|
+
"beginCaptures": {
|
|
137
|
+
"1": {
|
|
138
|
+
"name": "keyword.declaration.firefly"
|
|
139
|
+
},
|
|
140
|
+
"2": {
|
|
141
|
+
"name": "keyword.declaration.firefly"
|
|
142
|
+
},
|
|
143
|
+
"3": {
|
|
144
|
+
"name": "punctuation.definition.string.begin.firefly"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"end": "\"\"\"(?!\")",
|
|
148
|
+
"endCaptures": {
|
|
149
|
+
"0": {
|
|
150
|
+
"name": "punctuation.definition.string.end.firefly"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"patterns": [
|
|
154
|
+
{
|
|
155
|
+
"include": "#string-character-escape"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"include": "source.js"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"string": {
|
|
163
|
+
"name": "string.quoted.double.firefly",
|
|
164
|
+
"begin": "\"(?!\"\")",
|
|
165
|
+
"beginCaptures": {
|
|
166
|
+
"0": {
|
|
167
|
+
"name": "punctuation.definition.string.begin.firefly"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"end": "(\")|((?:[^\\\\\\n])$)",
|
|
171
|
+
"endCaptures": {
|
|
172
|
+
"1": {
|
|
173
|
+
"name": "punctuation.definition.string.end.firefly"
|
|
174
|
+
},
|
|
175
|
+
"2": {
|
|
176
|
+
"name": "invalid.illegal.newline.firefly"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"patterns": [
|
|
180
|
+
{
|
|
181
|
+
"include": "#string-character-escape"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
"string-multiline": {
|
|
186
|
+
"name": "string.quoted.multiline.firefly",
|
|
187
|
+
"begin": "\"\"\"",
|
|
188
|
+
"beginCaptures": {
|
|
189
|
+
"0": {
|
|
190
|
+
"name": "punctuation.definition.string.begin.firefly"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"end": "\"\"\"(?!\")",
|
|
194
|
+
"endCaptures": {
|
|
195
|
+
"0": {
|
|
196
|
+
"name": "punctuation.definition.string.end.firefly"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"patterns": [
|
|
200
|
+
{
|
|
201
|
+
"include": "#string-character-escape"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"string-character-escape": {
|
|
206
|
+
"name": "constant.character.escape.firefly",
|
|
207
|
+
"match": "\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)"
|
|
208
|
+
},
|
|
209
|
+
"number": {
|
|
210
|
+
"patterns": [
|
|
211
|
+
{
|
|
212
|
+
"name": "constant.numeric.hex.firefly",
|
|
213
|
+
"match": "\\b0(x|X)[0-9a-fA-F]+\\b"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "constant.numeric.binary.firefly",
|
|
217
|
+
"match": "\\b0(b|B)[01]+\\b"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "constant.numeric.decimal.firefly",
|
|
221
|
+
"match": "\\b[0-9]+([.][0-9]+)?([eE][+-]?[0-9]+)?\\b"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"comment": {
|
|
226
|
+
"patterns": [
|
|
227
|
+
{
|
|
228
|
+
"name": "comment.block.firefly",
|
|
229
|
+
"begin": "/\\*",
|
|
230
|
+
"beginCaptures": {
|
|
231
|
+
"0": {
|
|
232
|
+
"name": "punctuation.definition.comment.firefly"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"end": "\\*/",
|
|
236
|
+
"endCaptures": {
|
|
237
|
+
"0": {
|
|
238
|
+
"name": "punctuation.definition.comment.firefly"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"begin": "(^[ \\t]+)?(?=//)",
|
|
244
|
+
"beginCaptures": {
|
|
245
|
+
"1": {
|
|
246
|
+
"name": "punctuation.whitespace.comment.leading.firefly"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"end": "(?=$)",
|
|
250
|
+
"patterns": [
|
|
251
|
+
{
|
|
252
|
+
"name": "comment.line.double-slash.firefly",
|
|
253
|
+
"begin": "//",
|
|
254
|
+
"beginCaptures": {
|
|
255
|
+
"0": {
|
|
256
|
+
"name": "punctuation.definition.comment.firefly"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"end": "(?=$)"
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
"ugly-colon": {
|
|
266
|
+
"name": "invalid.ugly.colon.firefly",
|
|
267
|
+
"match": "(?<=[ ])[:]"
|
|
268
|
+
},
|
|
269
|
+
"ugly-comma": {
|
|
270
|
+
"name": "invalid.ugly.comma.firefly",
|
|
271
|
+
"match": "(?<=[ ])[,]|[,](?![ ])"
|
|
272
|
+
},
|
|
273
|
+
"ugly-arrow": {
|
|
274
|
+
"name": "invalid.ugly.arrow.firefly",
|
|
275
|
+
"match": "(?<=[A-Za-z0-9])[=][>]|[=][>](?![ ]|$)"
|
|
276
|
+
},
|
|
277
|
+
"ugly-pipe": {
|
|
278
|
+
"name": "invalid.ugly.pipe.firefly",
|
|
279
|
+
"match": "(?<=[{][ ]+)[|]|[|](?![ |]|$)"
|
|
280
|
+
},
|
|
281
|
+
"ugly-round": {
|
|
282
|
+
"name": "invalid.ugly.round.firefly",
|
|
283
|
+
"match": "(?<=[A-Za-z0-9][ ]+)[(]|[(](?=[ ]+[^/])"
|
|
284
|
+
},
|
|
285
|
+
"ugly-square": {
|
|
286
|
+
"name": "invalid.ugly.square.firefly",
|
|
287
|
+
"match": "(?<=[A-Za-z0-9])[ ]+[\\[]|[\\[](?=[ ]+[^/])"
|
|
288
|
+
},
|
|
289
|
+
"ugly-curly": {
|
|
290
|
+
"name": "invalid.ugly.curly.firefly",
|
|
291
|
+
"match": "(?<=[A-Za-z0-9])[{]|[{](?=[ ]+[^/])|[}](?=[a-z])"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|