firefly-compiler 0.4.87 → 0.4.88
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/compiler/Parser.ff +3 -3
- package/compiler/Tokenizer.ff +3 -1
- package/compression/.firefly/package.ff +1 -0
- package/compression/Compression.ff +50 -0
- package/output/js/ff/compiler/Parser.mjs +6 -6
- package/output/js/ff/compiler/Tokenizer.mjs +2 -2
- package/package.json +1 -1
- package/unsafejs/UnsafeJs.ff +4 -0
- package/vscode/package.json +1 -1
package/compiler/Parser.ff
CHANGED
|
@@ -1185,10 +1185,10 @@ extend self: Parser {
|
|
|
1185
1185
|
|
|
1186
1186
|
parseDynamicMember(record: Term): Term {
|
|
1187
1187
|
self.skip(LArrowThin)
|
|
1188
|
-
let token = if(self.current().is(
|
|
1189
|
-
self.skip(LUpper)
|
|
1190
|
-
} elseIf {self.current().is(LLower)} {
|
|
1188
|
+
let token = if(self.current().is(LLower)) {
|
|
1191
1189
|
self.skip(LLower)
|
|
1190
|
+
} elseIf {self.current().is(LUpper)} {
|
|
1191
|
+
self.skip(LUpper)
|
|
1192
1192
|
} else {
|
|
1193
1193
|
self.skip(LString)
|
|
1194
1194
|
}
|
package/compiler/Tokenizer.ff
CHANGED
|
@@ -162,7 +162,9 @@ tokenize(file: String, code: String, completionAt: Option[Location], attemptFixe
|
|
|
162
162
|
let kind = if(code.grab(i) >= 'a') {LLower} else {LUpper}
|
|
163
163
|
i += 1
|
|
164
164
|
while {i < code.size() && code.grab(i).isAsciiLetterOrDigit()} {i += 1}
|
|
165
|
-
if(i < code.size() && kind == LUpper && code.grab(i) == '.'
|
|
165
|
+
if(i < code.size() && kind == LUpper && code.grab(i) == '.' && (
|
|
166
|
+
tokens.isEmpty() || tokens.grabLast().kind != LArrowThin
|
|
167
|
+
)) {
|
|
166
168
|
i += 1
|
|
167
169
|
emitToken(LNamespace, start, i)
|
|
168
170
|
} else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dependency ff:unsafejs:0.0.0
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import UnsafeJs from ff:unsafejs
|
|
2
|
+
|
|
3
|
+
capability Compression {}
|
|
4
|
+
|
|
5
|
+
extend self: Compression {
|
|
6
|
+
|
|
7
|
+
compressBrotli(uncompressed: Buffer, level: Int = 4): Buffer
|
|
8
|
+
|
|
9
|
+
decompressBrotli(compressed: Buffer): Buffer
|
|
10
|
+
|
|
11
|
+
compressGzip(uncompressed: Buffer, level: Int = 6): Buffer
|
|
12
|
+
|
|
13
|
+
decompressGzip(compressed: Buffer): Buffer
|
|
14
|
+
target js async """
|
|
15
|
+
async function DecompressBlob(blob) {
|
|
16
|
+
const ds = new DecompressionStream("gzip");
|
|
17
|
+
const decompressedStream = blob.stream().pipeThrough(ds);
|
|
18
|
+
return await new Response(decompressedStream).blob();
|
|
19
|
+
}
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
compressDeflate(uncompressed: Buffer, level: Int = 6): Buffer
|
|
23
|
+
|
|
24
|
+
decompressDeflate(compressed: Buffer): Buffer
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
newForBrowserSystem(browserSystem: BrowserSystem): Compression
|
|
29
|
+
target js async "return globalThis"
|
|
30
|
+
|
|
31
|
+
newForNodeSystem(nodeSystem: NodeSystem): Compression
|
|
32
|
+
target js async "return globalThis"
|
|
33
|
+
|
|
34
|
+
internalCompress(algorithm: String, level: Int, buffer: Buffer): Buffer {
|
|
35
|
+
let js = UnsafeJs.jsSystem()
|
|
36
|
+
let dataView = UnsafeJs.toJsValue(buffer)
|
|
37
|
+
let uint8Array = js->"Uint8Array".new3(dataView->buffer, dataView->byteOffset, dataView->byteLength)
|
|
38
|
+
let stream = js->"ReadableStream".new1(js.object().with("start",
|
|
39
|
+
js.function1 {controller =>
|
|
40
|
+
controller->enqueue(uint8Array)
|
|
41
|
+
controller->close()
|
|
42
|
+
}
|
|
43
|
+
))
|
|
44
|
+
let ds = js->"DecompressionStream".new1(algorithm)
|
|
45
|
+
let decompressedStream = stream->pipeThrough(ds)
|
|
46
|
+
let response = UnsafeJs.await {js->"Response".new1(decompressedStream)}
|
|
47
|
+
let decompressedData = UnsafeJs.await {response->arrayBuffer()}
|
|
48
|
+
js->"DataView".new1(decompressedData).grabBuffer()
|
|
49
|
+
}
|
|
50
|
+
|
|
@@ -1540,10 +1540,10 @@ return result_
|
|
|
1540
1540
|
|
|
1541
1541
|
export function Parser_parseDynamicMember(self_, record_) {
|
|
1542
1542
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThin());
|
|
1543
|
-
const token_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.
|
|
1544
|
-
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper())
|
|
1545
|
-
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
|
|
1543
|
+
const token_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
|
|
1546
1544
|
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
|
|
1545
|
+
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LUpper())
|
|
1546
|
+
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper())
|
|
1547
1547
|
: ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString()));
|
|
1548
1548
|
const member_ = ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), (ff_compiler_Token.Token_is(token_, ff_compiler_Token.LString())
|
|
1549
1549
|
? ff_compiler_Token.Token_raw(token_)
|
|
@@ -3109,10 +3109,10 @@ return result_
|
|
|
3109
3109
|
|
|
3110
3110
|
export async function Parser_parseDynamicMember$(self_, record_, $task) {
|
|
3111
3111
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LArrowThin());
|
|
3112
|
-
const token_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.
|
|
3113
|
-
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper())
|
|
3114
|
-
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
|
|
3112
|
+
const token_ = (ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LLower())
|
|
3115
3113
|
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LLower())
|
|
3114
|
+
: ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LUpper())
|
|
3115
|
+
? ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LUpper())
|
|
3116
3116
|
: ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LString()));
|
|
3117
3117
|
const member_ = ff_compiler_Syntax.EString(ff_compiler_Token.Token_at(token_), (ff_compiler_Token.Token_is(token_, ff_compiler_Token.LString())
|
|
3118
3118
|
? ff_compiler_Token.Token_raw(token_)
|
|
@@ -245,7 +245,7 @@ i_ += 1;
|
|
|
245
245
|
while(((i_ < ff_core_String.String_size(code_)) && ff_core_Char.Char_isAsciiLetterOrDigit(ff_core_String.String_grab(code_, i_)))) {
|
|
246
246
|
i_ += 1
|
|
247
247
|
};
|
|
248
|
-
if((((i_ < ff_core_String.String_size(code_)) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(kind_, ff_compiler_Token.LUpper())) && (ff_core_String.String_grab(code_, i_) === 46))) {
|
|
248
|
+
if(((((i_ < ff_core_String.String_size(code_)) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(kind_, ff_compiler_Token.LUpper())) && (ff_core_String.String_grab(code_, i_) === 46)) && (ff_core_Array.Array_isEmpty(tokens_) || ff_core_Equal.notEquals_(ff_core_Array.Array_grabLast(tokens_).kind_, ff_compiler_Token.LArrowThin(), ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind)))) {
|
|
249
249
|
i_ += 1;
|
|
250
250
|
emitToken_(ff_compiler_Token.LNamespace(), start_, i_)
|
|
251
251
|
} else {
|
|
@@ -489,7 +489,7 @@ i_ += 1;
|
|
|
489
489
|
while(((i_ < ff_core_String.String_size(code_)) && ff_core_Char.Char_isAsciiLetterOrDigit(ff_core_String.String_grab(code_, i_)))) {
|
|
490
490
|
i_ += 1
|
|
491
491
|
};
|
|
492
|
-
if((((i_ < ff_core_String.String_size(code_)) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(kind_, ff_compiler_Token.LUpper())) && (ff_core_String.String_grab(code_, i_) === 46))) {
|
|
492
|
+
if(((((i_ < ff_core_String.String_size(code_)) && ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind.equals_(kind_, ff_compiler_Token.LUpper())) && (ff_core_String.String_grab(code_, i_) === 46)) && (ff_core_Array.Array_isEmpty(tokens_) || ff_core_Equal.notEquals_(ff_core_Array.Array_grabLast(tokens_).kind_, ff_compiler_Token.LArrowThin(), ff_compiler_Token.ff_core_Equal_Equal$ff_compiler_Token_TokenKind)))) {
|
|
493
493
|
i_ += 1;
|
|
494
494
|
emitToken_(ff_compiler_Token.LNamespace(), start_, i_)
|
|
495
495
|
} else {
|
package/package.json
CHANGED
package/unsafejs/UnsafeJs.ff
CHANGED