@traqula/core 0.0.25 → 1.0.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.
- package/README.md +2 -1
- package/dist/cjs/lib/types.js.map +1 -1
- package/dist/esm/lib/types.d.ts +1 -1
- package/dist/esm/lib/types.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@traqula/core)
|
|
4
4
|
|
|
5
5
|
Traqula core contains core components of Traqula.
|
|
6
|
-
Most importantly, its [lexer builder](./lib/lexer-builder/LexerBuilder.ts), [parser builder](./lib/parser-builder/parserBuilder.ts), and [generator builder](./lib/generator-builder/generatorBuilder.ts)
|
|
6
|
+
Most importantly, its [lexer builder](./lib/lexer-builder/LexerBuilder.ts), [parser builder](./lib/parser-builder/parserBuilder.ts), and [generator builder](./lib/generator-builder/generatorBuilder.ts);
|
|
7
|
+
as well as providing generic DAG transformers/ visitors.
|
|
7
8
|
This library heavily relies on the amazing [Chevrotain package](https://chevrotain.io/docs/).
|
|
8
9
|
Knowing the basics of that package will allow you to quickly generate your own grammars.
|
|
9
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type that is used by the Traqula core package to type raw objects/ Data Transfer Objects (DTO).\n * Enforces the presence of a type string, and that in case the subType key is present, it also be a string.\n */\nexport interface Typed<Type extends string = string> {\n type: Type;\n subType?: string;\n}\n\n/**\n * A {@link Typed} object that is sure to have a subType\n */\nexport interface SubTyped<Type extends string = string, SubType extends string = string> extends Typed<Type> {\n subType: SubType;\n}\n\n/**\n * Type used by the parser and generator builders of the core Traqula package to annotate\n * the relation between AST objects and the source string.\n */\nexport interface Localized {\n loc: SourceLocation;\n}\n\n/**\n * Wrapper type for localization,\n * can be used to state localization information about any other type (including primitive types)\n */\nexport interface Wrap<T> extends Localized {\n val: T;\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type that is used by the Traqula core package to type raw objects/ Data Transfer Objects (DTO).\n * Enforces the presence of a type string, and that in case the subType key is present, it also be a string.\n */\nexport interface Typed<Type extends string = string> {\n type: Type;\n subType?: string;\n}\n\n/**\n * A {@link Typed} object that is sure to have a subType\n */\nexport interface SubTyped<Type extends string = string, SubType extends string = string> extends Typed<Type> {\n subType: SubType;\n}\n\n/**\n * Type used by the parser and generator builders of the core Traqula package to annotate\n * the relation between AST objects and the source string.\n */\nexport interface Localized {\n loc: SourceLocation;\n}\n\n/**\n * Wrapper type for localization,\n * can be used to state localization information about any other type (including primitive types)\n */\nexport interface Wrap<T> extends Localized {\n val: T;\n}\n\n/**\n * An AST node. Nodes are indexable by their types.\n * When generating, the SUBRULES called should be located within the current location range.\n */\nexport interface Node extends Localized, Typed {}\n\nexport interface SourceLocationBase {\n sourceLocationType: string;\n}\n\n/**\n * SourceLocation type that annotates that the node represents the AST representation of\n * the given range in the source string.\n */\nexport interface SourceLocationSource extends SourceLocationBase {\n sourceLocationType: 'source';\n start: number;\n end: number;\n}\n\n/**\n * Similar to {@link SourceLocationSource} but also carrying the source it related too.\n * All sourceLocation nodes that are descends of this one, relate themselves to this source.\n */\nexport interface SourceLocationInlinedSource extends SourceLocationBase, Localized {\n sourceLocationType: 'inlinedSource';\n /**\n * The string that will be used as the source for this node and the descends of this node.\n * Note that the generator will print the characters from newSource[0] until start. Likewise for the suffix.\n */\n newSource: string;\n /**\n * Behavior of the current loc, after replacing the source string.\n */\n loc: SourceLocation;\n /**\n * The range that this node replaces in the context of the original source.\n */\n start: number;\n end: number;\n startOnNew: number;\n endOnNew: number;\n}\n\n/**\n * NoStringManifestation means the node does not have a string representation.\n * For example the literal '5' has an integer type (which is an AST node),\n * but the type does not have an associated string representation.\n * When set to true, the node will not be printed, start and end are meaningless in this case.\n */\nexport interface SourceLocationNoMaterialize extends SourceLocationBase {\n sourceLocationType: 'noMaterialize';\n}\n\n/**\n * SourceLocation type that annotates that the node has been replaced\n * in relation to the original string by a new string.\n * It means that this node should be generated, and that the source string from start to end has been changed.\n */\nexport interface SourceLocationStringReplace extends SourceLocationBase {\n sourceLocationType: 'stringReplace';\n /**\n * The string that will replace the given range in the original source.\n */\n newSource: string;\n /**\n * The start of the region in the original source string that this node replaces.\n */\n start: number;\n /**\n * The end of the region in the original source string that this node replaces.\n */\n end: number;\n}\n\n/**\n * SourceLocation type that annotates that the node has been replaced in relation to the original string.\n * It means that this node should be generated, and that the source string from start to end has been changed.\n */\nexport interface SourceLocationNodeReplace extends SourceLocationBase {\n sourceLocationType: 'nodeReplace';\n /**\n * The start of the region in the original source string that this node replaces.\n */\n start: number;\n /**\n * The end of the region in the original source string that this node replaces.\n */\n end: number;\n}\n/**\n * Must have an ancestor of type {@link SourceLocationNodeReplace}\n */\nexport interface SourceLocationNodeAutoGenerate extends SourceLocationBase {\n sourceLocationType: 'autoGenerate';\n}\n\nexport type SourceLocation =\n // Relate yourself to the source\n | SourceLocationSource\n // Add a new source\n | SourceLocationInlinedSource\n // No not generate anything for the current node and descendants\n | SourceLocationNoMaterialize\n // Replace some range by a string\n | SourceLocationStringReplace\n // Replace this node by some autogen\n | SourceLocationNodeReplace\n // Auto gen current node.\n | SourceLocationNodeAutoGenerate;\n"]}
|
package/dist/esm/lib/types.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface Wrap<T> extends Localized {
|
|
|
27
27
|
val: T;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* An AST node. Nodes are indexable by their types.
|
|
31
31
|
* When generating, the SUBRULES called should be located within the current location range.
|
|
32
32
|
*/
|
|
33
33
|
export interface Node extends Localized, Typed {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type that is used by the Traqula core package to type raw objects/ Data Transfer Objects (DTO).\n * Enforces the presence of a type string, and that in case the subType key is present, it also be a string.\n */\nexport interface Typed<Type extends string = string> {\n type: Type;\n subType?: string;\n}\n\n/**\n * A {@link Typed} object that is sure to have a subType\n */\nexport interface SubTyped<Type extends string = string, SubType extends string = string> extends Typed<Type> {\n subType: SubType;\n}\n\n/**\n * Type used by the parser and generator builders of the core Traqula package to annotate\n * the relation between AST objects and the source string.\n */\nexport interface Localized {\n loc: SourceLocation;\n}\n\n/**\n * Wrapper type for localization,\n * can be used to state localization information about any other type (including primitive types)\n */\nexport interface Wrap<T> extends Localized {\n val: T;\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type that is used by the Traqula core package to type raw objects/ Data Transfer Objects (DTO).\n * Enforces the presence of a type string, and that in case the subType key is present, it also be a string.\n */\nexport interface Typed<Type extends string = string> {\n type: Type;\n subType?: string;\n}\n\n/**\n * A {@link Typed} object that is sure to have a subType\n */\nexport interface SubTyped<Type extends string = string, SubType extends string = string> extends Typed<Type> {\n subType: SubType;\n}\n\n/**\n * Type used by the parser and generator builders of the core Traqula package to annotate\n * the relation between AST objects and the source string.\n */\nexport interface Localized {\n loc: SourceLocation;\n}\n\n/**\n * Wrapper type for localization,\n * can be used to state localization information about any other type (including primitive types)\n */\nexport interface Wrap<T> extends Localized {\n val: T;\n}\n\n/**\n * An AST node. Nodes are indexable by their types.\n * When generating, the SUBRULES called should be located within the current location range.\n */\nexport interface Node extends Localized, Typed {}\n\nexport interface SourceLocationBase {\n sourceLocationType: string;\n}\n\n/**\n * SourceLocation type that annotates that the node represents the AST representation of\n * the given range in the source string.\n */\nexport interface SourceLocationSource extends SourceLocationBase {\n sourceLocationType: 'source';\n start: number;\n end: number;\n}\n\n/**\n * Similar to {@link SourceLocationSource} but also carrying the source it related too.\n * All sourceLocation nodes that are descends of this one, relate themselves to this source.\n */\nexport interface SourceLocationInlinedSource extends SourceLocationBase, Localized {\n sourceLocationType: 'inlinedSource';\n /**\n * The string that will be used as the source for this node and the descends of this node.\n * Note that the generator will print the characters from newSource[0] until start. Likewise for the suffix.\n */\n newSource: string;\n /**\n * Behavior of the current loc, after replacing the source string.\n */\n loc: SourceLocation;\n /**\n * The range that this node replaces in the context of the original source.\n */\n start: number;\n end: number;\n startOnNew: number;\n endOnNew: number;\n}\n\n/**\n * NoStringManifestation means the node does not have a string representation.\n * For example the literal '5' has an integer type (which is an AST node),\n * but the type does not have an associated string representation.\n * When set to true, the node will not be printed, start and end are meaningless in this case.\n */\nexport interface SourceLocationNoMaterialize extends SourceLocationBase {\n sourceLocationType: 'noMaterialize';\n}\n\n/**\n * SourceLocation type that annotates that the node has been replaced\n * in relation to the original string by a new string.\n * It means that this node should be generated, and that the source string from start to end has been changed.\n */\nexport interface SourceLocationStringReplace extends SourceLocationBase {\n sourceLocationType: 'stringReplace';\n /**\n * The string that will replace the given range in the original source.\n */\n newSource: string;\n /**\n * The start of the region in the original source string that this node replaces.\n */\n start: number;\n /**\n * The end of the region in the original source string that this node replaces.\n */\n end: number;\n}\n\n/**\n * SourceLocation type that annotates that the node has been replaced in relation to the original string.\n * It means that this node should be generated, and that the source string from start to end has been changed.\n */\nexport interface SourceLocationNodeReplace extends SourceLocationBase {\n sourceLocationType: 'nodeReplace';\n /**\n * The start of the region in the original source string that this node replaces.\n */\n start: number;\n /**\n * The end of the region in the original source string that this node replaces.\n */\n end: number;\n}\n/**\n * Must have an ancestor of type {@link SourceLocationNodeReplace}\n */\nexport interface SourceLocationNodeAutoGenerate extends SourceLocationBase {\n sourceLocationType: 'autoGenerate';\n}\n\nexport type SourceLocation =\n // Relate yourself to the source\n | SourceLocationSource\n // Add a new source\n | SourceLocationInlinedSource\n // No not generate anything for the current node and descendants\n | SourceLocationNoMaterialize\n // Replace some range by a string\n | SourceLocationStringReplace\n // Replace this node by some autogen\n | SourceLocationNodeReplace\n // Auto gen current node.\n | SourceLocationNodeAutoGenerate;\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "Core components of Traqula",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"build:cjs": "node \"../../node_modules/typescript/bin/tsc\" -b tsconfig.cjs.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@traqula/chevrotain": "^0.0
|
|
44
|
+
"@traqula/chevrotain": "^1.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "9e648d6d9081a3b4f994599fa22116414914746f"
|
|
47
47
|
}
|