firefly-compiler 0.4.78 → 0.4.80

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.
Files changed (67) hide show
  1. package/compiler/Builder.ff +2 -2
  2. package/compiler/Compiler.ff +1 -1
  3. package/compiler/Inference.ff +2 -1
  4. package/compiler/JsEmitter.ff +11 -17
  5. package/compiler/Main.ff +3 -3
  6. package/compiler/ModuleCache.ff +1 -1
  7. package/compiler/Tokenizer.ff +1 -1
  8. package/compiler/Unification.ff +1 -1
  9. package/core/.firefly/include/package-lock.json +267 -97
  10. package/core/.firefly/include/package.json +1 -1
  11. package/core/Float.ff +25 -0
  12. package/core/Lock.ff +1 -1
  13. package/core/NodeSystem.ff +1 -1
  14. package/core/Stream.ff +9 -9
  15. package/core/Task.ff +3 -3
  16. package/core/Try.ff +25 -4
  17. package/experimental/s3/S3TestAuthorizationHeader.ff +2 -1
  18. package/experimental/s3/S3TestPut.ff +2 -1
  19. package/fireflysite/CommunityOverview.ff +2 -2
  20. package/fireflysite/CountingButtonDemo.ff +1 -1
  21. package/fireflysite/DocumentParser.ff +332 -0
  22. package/fireflysite/ExamplesOverview.ff +11 -2
  23. package/fireflysite/FrontPage.ff +344 -0
  24. package/fireflysite/{GuideIntroduction.ff → GettingStarted.ff} +1 -25
  25. package/fireflysite/Guide.ff +239 -104
  26. package/fireflysite/Main.ff +100 -51
  27. package/fireflysite/MatchingPasswordsDemo.ff +13 -17
  28. package/fireflysite/PackagesOverview.ff +1 -1
  29. package/fireflysite/PostgresqlDemo.ff +34 -0
  30. package/fireflysite/ReferenceAll.ff +19 -0
  31. package/fireflysite/ReferenceIntroduction.ff +11 -0
  32. package/fireflysite/Styles.ff +358 -97
  33. package/fireflysite/Test.ff +38 -0
  34. package/fireflysite/assets/font/NotoSansMono-Regular.ttf +0 -0
  35. package/fireflysite/assets/font/NunitoSans-VariableFont_YTLC,opsz,wdth,wght.ttf +0 -0
  36. package/fireflysite/assets/image/autocomplete-small.png +0 -0
  37. package/fireflysite/assets/image/autocomplete.png +0 -0
  38. package/fireflysite/assets/image/edit-time-error.png +0 -0
  39. package/fireflysite/assets/image/firefly-logo-yellow.png +0 -0
  40. package/fireflysite/assets/markdown/reference/BaseTypes.md +209 -0
  41. package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +208 -0
  42. package/fireflysite/assets/markdown/reference/ModulesAndPackages.md +168 -0
  43. package/fireflysite/assets/markdown/reference/PatternMatching.md +224 -0
  44. package/fireflysite/assets/markdown/reference/StatementsAndExpressions.md +86 -0
  45. package/fireflysite/assets/markdown/reference/TraitsAndInstances.md +100 -0
  46. package/fireflysite/assets/markdown/reference/UserDefinedTypes.md +184 -0
  47. package/fireflysite/assets/markdown/scratch/ControlFlow.md +136 -0
  48. package/fireflysite/assets/markdown/scratch/Toc.md +41 -0
  49. package/lsp/Handler.ff +4 -4
  50. package/lsp/LanguageServer.ff +5 -5
  51. package/lux/Lux.ff +9 -9
  52. package/lux/Main2.ff +1 -1
  53. package/output/js/ff/compiler/Builder.mjs +4 -4
  54. package/output/js/ff/compiler/Inference.mjs +2 -2
  55. package/output/js/ff/compiler/JsEmitter.mjs +18 -72
  56. package/output/js/ff/compiler/Main.mjs +4 -4
  57. package/output/js/ff/compiler/ModuleCache.mjs +4 -4
  58. package/output/js/ff/core/Float.mjs +50 -0
  59. package/output/js/ff/core/NodeSystem.mjs +4 -4
  60. package/output/js/ff/core/Task.mjs +8 -8
  61. package/output/js/ff/core/Try.mjs +98 -4
  62. package/package.json +1 -1
  63. package/postgresql/Pg.ff +1 -1
  64. package/vscode/package.json +15 -1
  65. package/vscode/syntaxes/firefly-markdown-injection.json +45 -0
  66. package/webserver/.firefly/include/package-lock.json +7 -1
  67. /package/fireflysite/{firefly-logo-notext.png → assets/image/firefly-logo-notext.png} +0 -0
@@ -145,11 +145,11 @@ check(
145
145
  } else {
146
146
  compiler.resolve(resolvedDependencies.mainPackagePair, localFile.dropLast(".ff".size()))
147
147
  }
148
- } catch {| CompileError(_, _) @ c, error =>
148
+ } tryCatch {| CompileError(_, _) @ c, error =>
149
149
  errors.push(c)
150
150
  } catch {| CompileErrors(compileErrors), error =>
151
151
  errors.pushList(compileErrors)
152
- } grab()
152
+ }
153
153
  }
154
154
  cache.mergeVersions(compiler.cache)
155
155
  }
@@ -168,7 +168,7 @@ extend self: Compiler {
168
168
  } catch {| CompileError(_, _) @ e, error =>
169
169
  let newError = CompileError(import.at, "Parse error in imported module: " + import.package.groupName() + "/" + newModuleName)
170
170
  throw(CompileErrors([e, newError]))
171
- } grab()
171
+ }
172
172
  }
173
173
  }
174
174
 
@@ -479,7 +479,8 @@ extend self: Inference {
479
479
  | a => a
480
480
  })
481
481
  | ECall e {e.target | DynamicCall c} {c.function | EField f} {
482
- f.field == "else" || f.field == "elseIf" || f.field == "grab" ||
482
+ f.field == "else" || f.field == "elseIf" ||
483
+ f.field == "tryCatch" || f.field == "tryCatchAny" || f.field == "tryFinally" ||
483
484
  f.field == "catch" || f.field == "catchAny" || f.field == "finally"
484
485
  } =>
485
486
  e.ECall(target = c.DynamicCall(function = f.EField(record = semicolonUnit(f.record))))
@@ -86,7 +86,7 @@ extend self: JsEmitter {
86
86
  body()
87
87
  } finally {
88
88
  self.emittingAsync = False
89
- } grab()
89
+ }
90
90
  }
91
91
 
92
92
  emitRun(functions: List[DFunction], mainPackagePair: PackagePair, bootstrapping: Bool): List[String] {
@@ -533,22 +533,16 @@ extend self: JsEmitter {
533
533
  let d = self.emitDictionary(dictionary)
534
534
  let a = self.emitArgument(at, argument, async)
535
535
  "throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(" + a + ", " + d + ")})"
536
- | ECall(at, StaticCall("ff:core/Core.try", _, _), _, _, _, _) {!last} =>
537
- throw(CompileError(at, "Statements can't be a try without a grab"))
538
- | ECall(at, StaticCall("ff:core/Try.Try_map", _, _), _, _, _, _) {!last} =>
539
- throw(CompileError(at, "Statements can't be a map without a grab"))
540
- | ECall(at, StaticCall("ff:core/Try.Try_flatMap", _, _), _, _, _, _) {!last} =>
541
- throw(CompileError(at, "Statements can't be a flatMap without a grab"))
542
- | ECall(at, StaticCall("ff:core/Try.Try_flatten", _, _), _, _, _, _) {!last} =>
543
- throw(CompileError(at, "Statements can't be a flatten without a grab"))
544
- | ECall(at, StaticCall("ff:core/Try.Try_catch", _, _), _, _, _, _) {!last} =>
545
- throw(CompileError(at, "Statements can't be a catch without a grab"))
546
- | ECall(at, StaticCall("ff:core/Try.Try_catchAny", _, _), _, _, _, _) {!last} =>
547
- throw(CompileError(at, "Statements can't be a catchAny without a grab"))
548
- | ECall(at, StaticCall("ff:core/Try.Try_finally", _, _), _, _, _, _) {!last} =>
549
- throw(CompileError(at, "Statements can't be a finally without a grab"))
550
- | ECall(at, StaticCall("ff:core/Try.Try_grab", _, _), _, _, [argument], _) {
551
- self.emitTryCatchFinally(argument.value, last, async) | Some(code)
536
+ | ECall(at, StaticCall("ff:core/Try.Try_catch", _, _), _, _, _, _) {
537
+ self.emitTryCatchFinally(term, last, async) | Some(code)
538
+ } =>
539
+ code
540
+ | ECall(at, StaticCall("ff:core/Try.Try_catchAny", _, _), _, _, _, _) {
541
+ self.emitTryCatchFinally(term, last, async) | Some(code)
542
+ } =>
543
+ code
544
+ | ECall(at, StaticCall("ff:core/Try.Try_finally", _, _), _, _, _, _) {
545
+ self.emitTryCatchFinally(term, last, async) | Some(code)
552
546
  } =>
553
547
  code
554
548
  | ECall(at, StaticCall("ff:unsafejs/UnsafeJs.throwIfCancelled", _, _), _, _, [], _) =>
package/compiler/Main.ff CHANGED
@@ -148,9 +148,9 @@ main(system: NodeSystem): Unit {
148
148
  try {
149
149
  let command = parseCommandLine(system.arguments())
150
150
  runCommand(command)
151
- } catch {| CommandLineError(message), _ =>
151
+ } tryCatch {| CommandLineError(message), _ =>
152
152
  Log.debug(message)
153
- } catch {| CompileError(at, message), _ =>
153
+ } tryCatch {| CompileError(at, message), _ =>
154
154
  Log.debug(message)
155
155
  Log.debug(" at " + at.file.replace("./", "") + ":" + at.line + ":" + at.column)
156
156
  } catch {| CompileErrors(errors), _ =>
@@ -158,7 +158,7 @@ main(system: NodeSystem): Unit {
158
158
  Log.debug(message)
159
159
  Log.debug(" at " + at.file.replace("./", "") + ":" + at.line + ":" + at.column)
160
160
  }
161
- } grab()
161
+ }
162
162
  }
163
163
 
164
164
  usageString = """
@@ -150,7 +150,7 @@ extend self: ModuleCache {
150
150
  } catchAny {error =>
151
151
  self.emittedModules = self.emittedModules.remove(path.absolute())
152
152
  error.rethrow()
153
- } grab()
153
+ }
154
154
  }
155
155
 
156
156
  }
@@ -268,7 +268,7 @@ tokenize(file: String, code: String, completionAt: Option[Location], attemptFixe
268
268
  }
269
269
  } catch {| GrabException e, error =>
270
270
  throw(CompileError(Location(file, line, i - lineOffset), "Unexpected end of file"))
271
- } grab()
271
+ }
272
272
 
273
273
  List.range(5).each {_ => emitToken(LEnd, i, i) }
274
274
 
@@ -67,7 +67,7 @@ extend self: Unification {
67
67
  body()
68
68
  } finally {
69
69
  self.instances = oldInstances
70
- } grab()
70
+ }
71
71
  }
72
72
 
73
73
  freshUnificationVariable(at: Location): Type {