firefly-compiler 0.5.4 → 0.5.5
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/bin/Release.ff +0 -1
- package/compiler/Parser.ff +1 -1
- package/compiler/Tokenizer.ff +8 -0
- package/fireflysite/assets/markdown/reference/JavascriptInterop.md +17 -0
- package/output/js/ff/compiler/Parser.mjs +2 -2
- package/output/js/ff/compiler/Tokenizer.mjs +6 -0
- package/package.json +1 -1
- package/vscode/package.json +1 -1
package/bin/Release.ff
CHANGED
|
@@ -35,7 +35,6 @@ release(
|
|
|
35
35
|
releaseFireflyPackage(system, accessKeyId, secretAccessKey, "postgresql")
|
|
36
36
|
releaseFireflyPackage(system, accessKeyId, secretAccessKey, "rpc")
|
|
37
37
|
releaseFireflyPackage(system, accessKeyId, secretAccessKey, "s3")
|
|
38
|
-
releaseFireflyPackage(system, accessKeyId, secretAccessKey, "unsafejs")
|
|
39
38
|
releaseFireflyPackage(system, accessKeyId, secretAccessKey, "webserver")
|
|
40
39
|
runSuccessful(system, "git", ["commit", "-a", "-m", "Autorelease " + version], system.path(".."))
|
|
41
40
|
runSuccessful(system, "git", ["push"], system.path(".."))
|
package/compiler/Parser.ff
CHANGED
|
@@ -1152,7 +1152,7 @@ extend self: Parser {
|
|
|
1152
1152
|
True
|
|
1153
1153
|
} else {False}
|
|
1154
1154
|
mutable result = self.parseAtom()
|
|
1155
|
-
while {self.current().is4(LBracketLeft, LColon, LDot, LArrowThin)} {
|
|
1155
|
+
while {self.current().is4(LBracketLeft, LColon, LDot, LArrowThin) || self.current().rawIs2("!", "?")} {
|
|
1156
1156
|
if(self.current().is(LDot)) {
|
|
1157
1157
|
self.skip(LDot)
|
|
1158
1158
|
if(self.current().rawIs("{")) {
|
package/compiler/Tokenizer.ff
CHANGED
|
@@ -204,6 +204,14 @@ tokenize(file: String, code: String, completionAt: Option[Location], attemptFixe
|
|
|
204
204
|
i += 1
|
|
205
205
|
emitToken(LComma, start, i)
|
|
206
206
|
|
|
207
|
+
} elseIf {
|
|
208
|
+
(code.grab(i) == '!' || code.grab(i) == '?') && i + 1 < code.size() &&
|
|
209
|
+
(code.grab(i + 1) == '.' || code.grab(i + 1) == '-')
|
|
210
|
+
} {
|
|
211
|
+
|
|
212
|
+
i += 1
|
|
213
|
+
emitToken(LOperator, start, i)
|
|
214
|
+
|
|
207
215
|
} elseIf {operatorCharacters.contains(code.grab(i))} {
|
|
208
216
|
|
|
209
217
|
i += 1
|
|
@@ -40,6 +40,8 @@ The `->` is shorthand for calling the methods `get`, `set`, `increment`, `decrem
|
|
|
40
40
|
|
|
41
41
|
The `js` variable is of the type `JsSystem` and the rest of the expressions return `JsValue`, which represents an arbitrary JavaScript value.
|
|
42
42
|
|
|
43
|
+
In addition, the `!` and `?` postfix operators can be used as shorthand for `UnsafeJs.value(...)` and `UnsafeJs.fromValue(...)`.
|
|
44
|
+
|
|
43
45
|
|
|
44
46
|
# The UnsafeJs module
|
|
45
47
|
|
|
@@ -61,8 +63,23 @@ throwIfCancelled(): Unit
|
|
|
61
63
|
// Returns true if the current task has been aborted
|
|
62
64
|
cancelled(): Bool
|
|
63
65
|
|
|
66
|
+
// Returns true if the current target is async
|
|
67
|
+
inAsync(): Bool
|
|
68
|
+
|
|
69
|
+
// Returns true if the current target is browser
|
|
70
|
+
inBrowser(): Bool
|
|
71
|
+
|
|
72
|
+
// Returns true if the current target is node
|
|
73
|
+
inNode(): Bool
|
|
74
|
+
|
|
75
|
+
// Returns true if the current target is build
|
|
76
|
+
inBuild(): Bool
|
|
77
|
+
|
|
64
78
|
// Casts any Firefly value to a JavaScript value without conversion
|
|
65
79
|
value[T](value: T): JsValue
|
|
80
|
+
|
|
81
|
+
// Casts any JavaScript value to a Firefly value without conversion
|
|
82
|
+
fromValue[T](value: JsValue): T
|
|
66
83
|
```
|
|
67
84
|
|
|
68
85
|
In the future, it may be possible to provide a whitelist of dependencies that are allowed to use this module.
|
|
@@ -1507,7 +1507,7 @@ return true
|
|
|
1507
1507
|
})()
|
|
1508
1508
|
: false);
|
|
1509
1509
|
let result_ = ff_compiler_Parser.Parser_parseAtom(self_);
|
|
1510
|
-
while(ff_compiler_Token.Token_is4(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft(), ff_compiler_Token.LColon(), ff_compiler_Token.LDot(), ff_compiler_Token.LArrowThin())) {
|
|
1510
|
+
while((ff_compiler_Token.Token_is4(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft(), ff_compiler_Token.LColon(), ff_compiler_Token.LDot(), ff_compiler_Token.LArrowThin()) || ff_compiler_Token.Token_rawIs2(ff_compiler_Parser.Parser_current(self_), "!", "?"))) {
|
|
1511
1511
|
if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())) {
|
|
1512
1512
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
|
|
1513
1513
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
@@ -3125,7 +3125,7 @@ return true
|
|
|
3125
3125
|
})())
|
|
3126
3126
|
: false);
|
|
3127
3127
|
let result_ = ff_compiler_Parser.Parser_parseAtom(self_);
|
|
3128
|
-
while(ff_compiler_Token.Token_is4(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft(), ff_compiler_Token.LColon(), ff_compiler_Token.LDot(), ff_compiler_Token.LArrowThin())) {
|
|
3128
|
+
while((ff_compiler_Token.Token_is4(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LBracketLeft(), ff_compiler_Token.LColon(), ff_compiler_Token.LDot(), ff_compiler_Token.LArrowThin()) || ff_compiler_Token.Token_rawIs2(ff_compiler_Parser.Parser_current(self_), "!", "?"))) {
|
|
3129
3129
|
if(ff_compiler_Token.Token_is(ff_compiler_Parser.Parser_current(self_), ff_compiler_Token.LDot())) {
|
|
3130
3130
|
ff_compiler_Parser.Parser_skip(self_, ff_compiler_Token.LDot());
|
|
3131
3131
|
if(ff_compiler_Token.Token_rawIs(ff_compiler_Parser.Parser_current(self_), "{")) {
|
|
@@ -280,6 +280,9 @@ emitToken_(ff_compiler_Token.LWildcard(), start_, i_)
|
|
|
280
280
|
} else if((ff_core_String.String_grab(code_, i_) === 44)) {
|
|
281
281
|
i_ += 1;
|
|
282
282
|
emitToken_(ff_compiler_Token.LComma(), start_, i_)
|
|
283
|
+
} else if(((((ff_core_String.String_grab(code_, i_) === 33) || (ff_core_String.String_grab(code_, i_) === 63)) && ((i_ + 1) < ff_core_String.String_size(code_))) && ((ff_core_String.String_grab(code_, (i_ + 1)) === 46) || (ff_core_String.String_grab(code_, (i_ + 1)) === 45)))) {
|
|
284
|
+
i_ += 1;
|
|
285
|
+
emitToken_(ff_compiler_Token.LOperator(), start_, i_)
|
|
283
286
|
} else if(ff_core_Set.Set_contains(operatorCharacters_, ff_core_String.String_grab(code_, i_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Char_Char)) {
|
|
284
287
|
i_ += 1;
|
|
285
288
|
if(((((ff_core_String.String_grab(code_, (i_ - 1)) === 46) && ((i_ + 1) < ff_core_String.String_size(code_))) && (ff_core_String.String_grab(code_, i_) === 46)) && (ff_core_String.String_grab(code_, (i_ + 1)) !== 46))) {
|
|
@@ -524,6 +527,9 @@ emitToken_(ff_compiler_Token.LWildcard(), start_, i_)
|
|
|
524
527
|
} else if((ff_core_String.String_grab(code_, i_) === 44)) {
|
|
525
528
|
i_ += 1;
|
|
526
529
|
emitToken_(ff_compiler_Token.LComma(), start_, i_)
|
|
530
|
+
} else if(((((ff_core_String.String_grab(code_, i_) === 33) || (ff_core_String.String_grab(code_, i_) === 63)) && ((i_ + 1) < ff_core_String.String_size(code_))) && ((ff_core_String.String_grab(code_, (i_ + 1)) === 46) || (ff_core_String.String_grab(code_, (i_ + 1)) === 45)))) {
|
|
531
|
+
i_ += 1;
|
|
532
|
+
emitToken_(ff_compiler_Token.LOperator(), start_, i_)
|
|
527
533
|
} else if(ff_core_Set.Set_contains(operatorCharacters_, ff_core_String.String_grab(code_, i_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Char_Char)) {
|
|
528
534
|
i_ += 1;
|
|
529
535
|
if(((((ff_core_String.String_grab(code_, (i_ - 1)) === 46) && ((i_ + 1) < ff_core_String.String_size(code_))) && (ff_core_String.String_grab(code_, i_) === 46)) && (ff_core_String.String_grab(code_, (i_ + 1)) !== 46))) {
|
package/package.json
CHANGED