@herb-tools/core 0.1.0

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 (49) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +9 -0
  3. package/dist/herb-core.browser.js +2704 -0
  4. package/dist/herb-core.browser.js.map +1 -0
  5. package/dist/herb-core.cjs +2759 -0
  6. package/dist/herb-core.cjs.map +1 -0
  7. package/dist/herb-core.esm.js +2704 -0
  8. package/dist/herb-core.esm.js.map +1 -0
  9. package/dist/herb-core.umd.js +2765 -0
  10. package/dist/herb-core.umd.js.map +1 -0
  11. package/dist/types/ast.d.ts +4 -0
  12. package/dist/types/backend.d.ts +24 -0
  13. package/dist/types/error.d.ts +16 -0
  14. package/dist/types/errors.d.ts +222 -0
  15. package/dist/types/herb-backend.d.ts +87 -0
  16. package/dist/types/index.d.ts +15 -0
  17. package/dist/types/lex-result.d.ts +50 -0
  18. package/dist/types/location.d.ts +18 -0
  19. package/dist/types/node.d.ts +27 -0
  20. package/dist/types/nodes.d.ts +682 -0
  21. package/dist/types/parse-result.d.ts +62 -0
  22. package/dist/types/position.d.ts +15 -0
  23. package/dist/types/range.d.ts +12 -0
  24. package/dist/types/result.d.ts +10 -0
  25. package/dist/types/token-list.d.ts +16 -0
  26. package/dist/types/token.d.ts +22 -0
  27. package/dist/types/util.d.ts +2 -0
  28. package/dist/types/visitor.d.ts +11 -0
  29. package/dist/types/warning.d.ts +11 -0
  30. package/package.json +49 -0
  31. package/src/ast.ts +7 -0
  32. package/src/backend.ts +85 -0
  33. package/src/error.ts +38 -0
  34. package/src/errors.ts +820 -0
  35. package/src/herb-backend.ts +152 -0
  36. package/src/index.ts +15 -0
  37. package/src/lex-result.ts +78 -0
  38. package/src/location.ts +51 -0
  39. package/src/node.ts +106 -0
  40. package/src/nodes.ts +2294 -0
  41. package/src/parse-result.ts +101 -0
  42. package/src/position.ts +38 -0
  43. package/src/range.ts +35 -0
  44. package/src/result.ts +26 -0
  45. package/src/token-list.ts +57 -0
  46. package/src/token.ts +63 -0
  47. package/src/util.ts +19 -0
  48. package/src/visitor.ts +14 -0
  49. package/src/warning.ts +20 -0
@@ -0,0 +1,18 @@
1
+ import { Position } from "./position.js";
2
+ import type { SerializedPosition } from "./position.js";
3
+ export type SerializedLocation = {
4
+ start: SerializedPosition;
5
+ end: SerializedPosition;
6
+ };
7
+ export declare class Location {
8
+ readonly start: Position;
9
+ readonly end: Position;
10
+ static from(location: SerializedLocation): Location;
11
+ constructor(start: Position, end: Position);
12
+ toHash(): SerializedLocation;
13
+ toJSON(): SerializedLocation;
14
+ treeInspect(): string;
15
+ treeInspectWithLabel(): string;
16
+ inspect(): string;
17
+ toString(): string;
18
+ }
@@ -0,0 +1,27 @@
1
+ import { Location, SerializedLocation } from "./location.js";
2
+ import { HerbError, SerializedHerbError } from "./error.js";
3
+ import { NodeType, SerializedNodeType } from "./nodes.js";
4
+ export interface SerializedNode {
5
+ type: SerializedNodeType;
6
+ location: SerializedLocation;
7
+ errors: SerializedHerbError[];
8
+ }
9
+ export interface BaseNodeProps {
10
+ type: NodeType;
11
+ location: Location;
12
+ errors: HerbError[];
13
+ }
14
+ export declare abstract class Node implements BaseNodeProps {
15
+ readonly type: NodeType;
16
+ readonly location: Location;
17
+ readonly errors: HerbError[];
18
+ static from(node: SerializedNode): Node;
19
+ constructor(type: NodeType, location: Location, errors: HerbError[]);
20
+ toJSON(): SerializedNode;
21
+ inspect(): string;
22
+ abstract treeInspect(indent?: number): string;
23
+ abstract recursiveErrors(): HerbError[];
24
+ abstract childNodes(): Node[];
25
+ protected inspectArray(array: (Node | HerbError)[] | null | undefined, prefix: string): string;
26
+ protected inspectNode(node: Node | HerbError | undefined | null, prefix: string, prefix2?: string, last?: boolean, trailingNewline?: boolean): string;
27
+ }