agency-lang 0.0.15 → 0.0.17

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 (41) hide show
  1. package/dist/lib/backends/agencyGenerator.js +24 -6
  2. package/dist/lib/backends/agencyGenerator.test.d.ts +1 -0
  3. package/dist/lib/backends/agencyGenerator.test.js +205 -0
  4. package/dist/lib/backends/baseGenerator.d.ts +1 -0
  5. package/dist/lib/backends/baseGenerator.js +12 -2
  6. package/dist/lib/backends/graphGenerator.js +7 -5
  7. package/dist/lib/backends/typescriptGenerator.d.ts +3 -3
  8. package/dist/lib/backends/typescriptGenerator.js +17 -11
  9. package/dist/lib/parsers/access.d.ts +3 -5
  10. package/dist/lib/parsers/access.js +54 -13
  11. package/dist/lib/parsers/access.test.js +40 -500
  12. package/dist/lib/parsers/assignment.js +2 -2
  13. package/dist/lib/parsers/assignment.test.d.ts +1 -0
  14. package/dist/lib/parsers/assignment.test.js +279 -0
  15. package/dist/lib/parsers/dataStructures.js +3 -3
  16. package/dist/lib/parsers/function.d.ts +3 -1
  17. package/dist/lib/parsers/function.js +6 -4
  18. package/dist/lib/parsers/function.test.js +653 -8
  19. package/dist/lib/parsers/functionCall.js +3 -2
  20. package/dist/lib/parsers/functionCall.test.js +310 -0
  21. package/dist/lib/parsers/literals.d.ts +2 -1
  22. package/dist/lib/parsers/literals.js +15 -5
  23. package/dist/lib/parsers/literals.test.js +189 -16
  24. package/dist/lib/parsers/matchBlock.js +2 -2
  25. package/dist/lib/parsers/parserUtils.test.d.ts +1 -0
  26. package/dist/lib/parsers/parserUtils.test.js +46 -0
  27. package/dist/lib/parsers/returnStatement.js +2 -2
  28. package/dist/lib/parsers/returnStatement.test.d.ts +1 -0
  29. package/dist/lib/parsers/returnStatement.test.js +268 -0
  30. package/dist/lib/parsers/specialVar.test.d.ts +1 -0
  31. package/dist/lib/parsers/specialVar.test.js +219 -0
  32. package/dist/lib/types/access.d.ts +5 -5
  33. package/dist/lib/types/access.js +6 -1
  34. package/dist/lib/types/dataStructures.d.ts +3 -3
  35. package/dist/lib/types/function.d.ts +10 -4
  36. package/dist/lib/types/literals.d.ts +5 -1
  37. package/dist/lib/types/matchBlock.d.ts +2 -2
  38. package/dist/lib/types/returnStatement.d.ts +2 -2
  39. package/dist/lib/types/whileLoop.d.ts +2 -2
  40. package/dist/lib/types.d.ts +3 -3
  41. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- import { AccessExpression, AgencyNode, FunctionCall, Literal } from "../types.js";
1
+ import { AccessExpression, AgencyNode, FunctionCall, IndexAccess, Literal } from "../types.js";
2
2
  export type WhileLoop = {
3
3
  type: "whileLoop";
4
- condition: FunctionCall | AccessExpression | Literal;
4
+ condition: IndexAccess | FunctionCall | AccessExpression | Literal;
5
5
  body: AgencyNode[];
6
6
  };
@@ -1,7 +1,7 @@
1
1
  import { Literal } from "./types/literals.js";
2
2
  import { TypeAlias, TypeHint, VariableType } from "./types/typeHints.js";
3
3
  import { MatchBlock } from "./types/matchBlock.js";
4
- import { AccessExpression } from "./types/access.js";
4
+ import { AccessExpression, DotProperty, IndexAccess } from "./types/access.js";
5
5
  import { FunctionCall, FunctionDefinition } from "./types/function.js";
6
6
  import { AgencyArray, AgencyObject } from "./types/dataStructures.js";
7
7
  import { GraphNodeDefinition } from "./types/graphNode.js";
@@ -24,13 +24,13 @@ export * from "./types/whileLoop.js";
24
24
  export type Assignment = {
25
25
  type: "assignment";
26
26
  variableName: string;
27
- value: AccessExpression | Literal | FunctionCall | AgencyObject | AgencyArray;
27
+ value: AccessExpression | Literal | FunctionCall | AgencyObject | AgencyArray | IndexAccess;
28
28
  };
29
29
  export type AgencyComment = {
30
30
  type: "comment";
31
31
  content: string;
32
32
  };
33
- export type AgencyNode = TypeHint | TypeAlias | UsesTool | GraphNodeDefinition | FunctionDefinition | Assignment | Literal | FunctionCall | MatchBlock | ReturnStatement | AccessExpression | AgencyComment | AgencyObject | AgencyArray | ImportStatement | WhileLoop | SpecialVar;
33
+ export type AgencyNode = TypeHint | TypeAlias | UsesTool | GraphNodeDefinition | FunctionDefinition | Assignment | Literal | FunctionCall | MatchBlock | ReturnStatement | AccessExpression | AgencyComment | AgencyObject | AgencyArray | ImportStatement | WhileLoop | SpecialVar | IndexAccess | DotProperty;
34
34
  export type AgencyProgram = {
35
35
  type: "agencyProgram";
36
36
  nodes: AgencyNode[];
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "test": "vitest",
8
8
  "test:run": "vitest run",
9
9
  "build": "rm -rf dist/ && tsc && tsc-alias",
10
- "start": "node dist/lib/index.js",
10
+ "start": "node dist/index.js",
11
11
  "templates": "typestache ./lib/templates",
12
12
  "typecheck": "tsc --noEmit",
13
13
  "agency": "node ./dist/scripts/agency.js",