@collie-lang/compiler 1.4.0 → 1.5.2

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/dist/index.d.cts CHANGED
@@ -40,7 +40,7 @@ interface ClassAliasDecl {
40
40
  interface ClassAliasesDecl {
41
41
  aliases: ClassAliasDecl[];
42
42
  }
43
- type InputDeclKind = "value";
43
+ type InputDeclKind = "value" | "fn";
44
44
  interface InputDecl {
45
45
  name: string;
46
46
  kind: InputDeclKind;
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ interface ClassAliasDecl {
40
40
  interface ClassAliasesDecl {
41
41
  aliases: ClassAliasDecl[];
42
42
  }
43
- type InputDeclKind = "value";
43
+ type InputDeclKind = "value" | "fn";
44
44
  interface InputDecl {
45
45
  name: string;
46
46
  kind: InputDeclKind;
package/dist/index.js CHANGED
@@ -3322,7 +3322,7 @@ function parseInputDecl(line, lineNumber, column, lineOffset, diagnostics) {
3322
3322
  pushDiag(
3323
3323
  diagnostics,
3324
3324
  "COLLIE104",
3325
- 'Types are not supported in #inputs yet. Use "name".',
3325
+ 'Types are not supported in #inputs yet. Use "name" or "name()".',
3326
3326
  lineNumber,
3327
3327
  column,
3328
3328
  lineOffset,
@@ -3341,10 +3341,21 @@ function parseInputDecl(line, lineNumber, column, lineOffset, diagnostics) {
3341
3341
  span: createSpan(lineNumber, nameColumn, name.length, lineOffset)
3342
3342
  };
3343
3343
  }
3344
+ const fnMatch = trimmed.match(/^([A-Za-z_$][A-Za-z0-9_$]*)\(\)$/);
3345
+ if (fnMatch) {
3346
+ const name = fnMatch[1];
3347
+ const nameStart = line.indexOf(name);
3348
+ const nameColumn = column + nameStart;
3349
+ return {
3350
+ name,
3351
+ kind: "fn",
3352
+ span: createSpan(lineNumber, nameColumn, name.length, lineOffset)
3353
+ };
3354
+ }
3344
3355
  pushDiag(
3345
3356
  diagnostics,
3346
3357
  "COLLIE105",
3347
- 'Invalid #inputs declaration. Use "name".',
3358
+ 'Invalid #inputs declaration. Use "name" or "name()".',
3348
3359
  lineNumber,
3349
3360
  column,
3350
3361
  lineOffset,