@eagleoutice/flowr 2.1.1 → 2.1.3
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/cli/repl/commands/repl-parse.js +7 -16
- package/cli/repl/commands/repl-query.d.ts +0 -5
- package/cli/repl/commands/repl-query.js +2 -73
- package/core/print/parse-printer.js +1 -22
- package/core/steps/pipeline/default-pipelines.d.ts +64 -0
- package/core/steps/pipeline/default-pipelines.js +2 -1
- package/dataflow/cluster.d.ts +20 -0
- package/dataflow/cluster.js +46 -0
- package/dataflow/graph/edge.d.ts +2 -3
- package/dataflow/graph/graph.d.ts +1 -1
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -1
- package/documentation/data/server/doc-data-server-messages.js +16 -5
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +9 -0
- package/documentation/doc-util/doc-dfg.d.ts +1 -0
- package/documentation/doc-util/doc-dfg.js +5 -4
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +5 -1
- package/documentation/doc-util/doc-query.js +154 -9
- package/documentation/doc-util/doc-server-message.js +3 -5
- package/documentation/doc-util/doc-types.js +19 -11
- package/documentation/print-dataflow-graph-wiki.js +10 -1
- package/documentation/print-interface-wiki.js +1 -1
- package/documentation/print-normalized-ast-wiki.js +2 -2
- package/documentation/print-query-wiki.js +196 -37
- package/package.json +3 -2
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.d.ts +4 -3
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.js +22 -16
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.d.ts +6 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +3 -0
- package/queries/catalog/cluster-query/cluster-query-executor.js +19 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +12 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +17 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +12 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +3 -0
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +3 -0
- package/queries/catalog/id-map-query/id-map-query-executor.js +17 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +8 -0
- package/{r-bridge/lang-4.x/ast/parser/xml/normalizer-data.js → queries/catalog/id-map-query/id-map-query-format.js} +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +3 -0
- package/queries/catalog/lineage-query/lineage-query-executor.js +22 -0
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +14 -0
- package/queries/catalog/lineage-query/lineage-query-format.js +3 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +3 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +17 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +11 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +3 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +4 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +40 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +24 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -0
- package/queries/query-schema.d.ts +6 -0
- package/queries/query-schema.js +26 -3
- package/queries/query.d.ts +22 -4
- package/queries/query.js +14 -2
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +37 -13
- package/r-bridge/lang-4.x/ast/parser/json/format.js +59 -6
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -40
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then-else.js +5 -8
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.d.ts +7 -7
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.js +11 -12
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.js +4 -7
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.js +6 -9
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.js +5 -6
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-while.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.js +1 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-delimiter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +41 -0
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +85 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/normalizer-data.d.ts +10 -4
- package/r-bridge/lang-4.x/ast/parser/main/normalizer-data.js +14 -0
- package/slicing/criterion/parse.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/util/ansi.js +9 -2
- package/util/time.d.ts +4 -0
- package/util/time.js +8 -0
- package/util/version.js +1 -1
- package/documentation/doc-util/doc-ms.d.ts +0 -1
- package/documentation/doc-util/doc-ms.js +0 -8
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +0 -39
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +0 -38
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.d.ts +0 -15
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.d.ts +0 -47
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +0 -110
- /package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-delimiter.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-expressions.js +0 -0
|
@@ -16,7 +16,6 @@ const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
|
16
16
|
* @returns The parsed argument or `undefined` if the given object is not an argument.
|
|
17
17
|
*/
|
|
18
18
|
function tryToNormalizeArgument(data, objs) {
|
|
19
|
-
parser_1.parseLog.debug('[argument]');
|
|
20
19
|
if (objs.length < 1 || objs.length > 3) {
|
|
21
20
|
parser_1.parseLog.warn(`Either [expr|value], [SYMBOL_SUB, EQ_SUB], or [SYMBOL_SUB, EQ_SUB, expr], but got: ${objs.map(o => o.name).join(', ')}`);
|
|
22
21
|
return undefined;
|
|
@@ -64,7 +63,8 @@ function tryToNormalizeArgument(data, objs) {
|
|
|
64
63
|
}
|
|
65
64
|
function parseWithValue(data, objs) {
|
|
66
65
|
(0, assert_1.guard)(objs[1].name === type_1.RawRType.EqualSub, () => `[arg-default] second element of parameter must be ${type_1.RawRType.EqualFormals}, but: ${JSON.stringify(objs)}`);
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const snd = objs[2];
|
|
67
|
+
(0, assert_1.guard)(objs.length === 2 || snd.name === type_1.RawRType.Expression, () => `[arg-default] third element of parameter must be an Expression or undefined (for 'x=') but: ${JSON.stringify(objs)}`);
|
|
68
|
+
return snd ? (0, normalize_single_node_1.normalizeSingleNode)(data, snd) : null;
|
|
69
69
|
}
|
|
70
70
|
//# sourceMappingURL=normalize-argument.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RFunctionCall } from '../../../../model/nodes/r-function-call';
|
|
4
3
|
import type { RNext } from '../../../../model/nodes/r-next';
|
|
5
4
|
import type { RBreak } from '../../../../model/nodes/r-break';
|
|
5
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
6
6
|
/**
|
|
7
7
|
* Tries to parse the given data as a function call.
|
|
8
8
|
*
|
|
9
9
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
10
|
-
* @param mappedWithName - The
|
|
10
|
+
* @param mappedWithName - The JSON object to extract the meta-information from
|
|
11
11
|
*
|
|
12
12
|
* @returns The parsed {@link RFunctionCall} (either named or unnamed) or `undefined` if the given construct is not a function call
|
|
13
13
|
* May return a {@link RNext} or {@link RBreak} as `next()` and `break()` work as such.
|
|
14
14
|
*/
|
|
15
|
-
export declare function tryNormalizeFunctionCall(data: NormalizerData, mappedWithName:
|
|
15
|
+
export declare function tryNormalizeFunctionCall(data: NormalizerData, mappedWithName: readonly NamedJsonEntry[]): RFunctionCall | RNext | RBreak | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeFunctionCall = tryNormalizeFunctionCall;
|
|
4
|
-
const input_format_1 = require("../../input-format");
|
|
5
4
|
const parser_1 = require("../../../json/parser");
|
|
6
5
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
7
6
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
@@ -16,7 +15,7 @@ const normalize_symbol_1 = require("../values/normalize-symbol");
|
|
|
16
15
|
* Tries to parse the given data as a function call.
|
|
17
16
|
*
|
|
18
17
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
19
|
-
* @param mappedWithName - The
|
|
18
|
+
* @param mappedWithName - The JSON object to extract the meta-information from
|
|
20
19
|
*
|
|
21
20
|
* @returns The parsed {@link RFunctionCall} (either named or unnamed) or `undefined` if the given construct is not a function call
|
|
22
21
|
* May return a {@link RNext} or {@link RBreak} as `next()` and `break()` work as such.
|
|
@@ -31,9 +30,8 @@ function tryNormalizeFunctionCall(data, mappedWithName) {
|
|
|
31
30
|
parser_1.parseLog.trace('expected function call to have parenthesis for a call, but was not');
|
|
32
31
|
return undefined;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const symbolContent = (0, input_format_1.getKeyGuarded)(unwrappedObj, input_format_1.childrenKey);
|
|
33
|
+
const { content, location } = (0, normalize_meta_1.retrieveMetaStructure)(fnBase.content);
|
|
34
|
+
const symbolContent = fnBase.content.children;
|
|
37
35
|
const namedSymbolContent = (0, normalize_meta_1.getWithTokenType)(symbolContent);
|
|
38
36
|
if (namedSymbolContent.length === 1 && namedSymbolContent[0].name === type_1.RawRType.StringConst) {
|
|
39
37
|
// special handling when someone calls a function by string
|
|
@@ -41,8 +39,7 @@ function tryNormalizeFunctionCall(data, mappedWithName) {
|
|
|
41
39
|
}
|
|
42
40
|
else if (namedSymbolContent.findIndex(x => x.name === type_1.RawRType.SymbolFunctionCall) < 0) {
|
|
43
41
|
parser_1.parseLog.trace(`is not named function call, as the name is not of type ${type_1.RType.FunctionCall}, but: ${namedSymbolContent.map(n => n.name).join(',')}`);
|
|
44
|
-
|
|
45
|
-
return mayResult;
|
|
42
|
+
return tryParseUnnamedFunctionCall(data, mappedWithName, location, content);
|
|
46
43
|
}
|
|
47
44
|
else {
|
|
48
45
|
return parseNamedFunctionCall(data, namedSymbolContent, mappedWithName, location, content);
|
|
@@ -68,7 +65,7 @@ function tryParseUnnamedFunctionCall(data, mappedWithName, location, content) {
|
|
|
68
65
|
const calledFunction = (0, normalize_expression_1.normalizeExpression)(data, mappedWithName[0].content);
|
|
69
66
|
const parsedArguments = parseArguments(mappedWithName, data);
|
|
70
67
|
if (parsedArguments.length === 0) {
|
|
71
|
-
//
|
|
68
|
+
// interestingly, next() and break() work
|
|
72
69
|
if (calledFunction.type === type_1.RType.Next) {
|
|
73
70
|
return {
|
|
74
71
|
type: type_1.RType.Next,
|
|
@@ -125,7 +122,7 @@ function parseNamedFunctionCall(data, symbolContent, mappedWithName, location, c
|
|
|
125
122
|
functionName = (0, normalize_symbol_1.tryNormalizeSymbol)(data, symbolContent);
|
|
126
123
|
}
|
|
127
124
|
(0, assert_1.guard)(functionName !== undefined, 'expected function name to be a symbol, yet received none');
|
|
128
|
-
(0, assert_1.guard)(
|
|
125
|
+
(0, assert_1.guard)(functionName.type === type_1.RType.Symbol, () => `expected function name to be a symbol, yet received ${JSON.stringify(functionName)}`);
|
|
129
126
|
const parsedArguments = parseArguments(mappedWithName, data);
|
|
130
127
|
return {
|
|
131
128
|
type: type_1.RType.FunctionCall,
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.d.ts
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RFunctionDefinition } from '../../../../model/nodes/r-function-definition';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Tries to parse the given data as a function definition.
|
|
6
6
|
*
|
|
7
7
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
8
|
-
* @param mappedWithName - The
|
|
8
|
+
* @param mappedWithName - The JSON object to extract the meta-information from
|
|
9
9
|
*
|
|
10
10
|
* @returns The parsed {@link RFunctionDefinition} or `undefined` if the given construct is not a function definition
|
|
11
11
|
*/
|
|
12
|
-
export declare function tryNormalizeFunctionDefinition(data: NormalizerData, mappedWithName: readonly
|
|
12
|
+
export declare function tryNormalizeFunctionDefinition(data: NormalizerData, mappedWithName: readonly NamedJsonEntry[]): RFunctionDefinition | undefined;
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.js
RENAMED
|
@@ -12,7 +12,7 @@ const normalize_expressions_1 = require("../structure/normalize-expressions");
|
|
|
12
12
|
* Tries to parse the given data as a function definition.
|
|
13
13
|
*
|
|
14
14
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
15
|
-
* @param mappedWithName - The
|
|
15
|
+
* @param mappedWithName - The JSON object to extract the meta-information from
|
|
16
16
|
*
|
|
17
17
|
* @returns The parsed {@link RFunctionDefinition} or `undefined` if the given construct is not a function definition
|
|
18
18
|
*/
|
|
@@ -28,13 +28,11 @@ function tryNormalizeFunctionDefinition(data, mappedWithName) {
|
|
|
28
28
|
const closingParenIndex = mappedWithName.findIndex(x => x.name === type_1.RawRType.ParenRight);
|
|
29
29
|
(0, assert_1.guard)(closingParenIndex !== -1, () => `expected closing parenthesis, yet received ${JSON.stringify(mappedWithName)}`);
|
|
30
30
|
const splitParameters = (0, arrays_1.splitArrayOn)(mappedWithName.slice(2, closingParenIndex), x => x.name === type_1.RawRType.Comma);
|
|
31
|
-
parser_1.parseLog.trace(`function definition has ${splitParameters.length} parameters (by comma split)`);
|
|
32
31
|
const parameters = splitParameters.map(x => (0, normalize_parameter_1.tryNormalizeParameter)(data, x));
|
|
33
32
|
if (parameters.some(p => p === undefined)) {
|
|
34
33
|
parser_1.parseLog.error(`function had unexpected unknown parameters: ${JSON.stringify(parameters.filter(assert_1.isNotUndefined))}, aborting.`);
|
|
35
34
|
return undefined;
|
|
36
35
|
}
|
|
37
|
-
parser_1.parseLog.trace(`function definition retained ${parameters.length} parameters after parsing, moving to body.`);
|
|
38
36
|
const bodyStructure = mappedWithName.slice(closingParenIndex + 1);
|
|
39
37
|
(0, assert_1.guard)(bodyStructure.length === 1, () => `expected function body to be unique, yet received ${bodyStructure.length}`);
|
|
40
38
|
const body = (0, normalize_expressions_1.normalizeExpressions)(data, bodyStructure);
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RParameter } from '../../../../model/nodes/r-parameter';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Either parses `[SYMBOL_FORMALS]` or `[SYMBOL_FORMALS, EQ_FORMALS, expr]` as a parameter of a function definition in R.
|
|
6
6
|
* Probably directly called by the function definition parser as otherwise, we do not expect to find parameters.
|
|
@@ -10,4 +10,4 @@ import type { RParameter } from '../../../../model/nodes/r-parameter';
|
|
|
10
10
|
*
|
|
11
11
|
* @returns The parsed parameter or `undefined` if the given object is not a parameter.
|
|
12
12
|
*/
|
|
13
|
-
export declare function tryNormalizeParameter(data: NormalizerData, objs: readonly
|
|
13
|
+
export declare function tryNormalizeParameter(data: NormalizerData, objs: readonly NamedJsonEntry[]): RParameter | undefined;
|
|
@@ -16,7 +16,6 @@ const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
|
16
16
|
* @returns The parsed parameter or `undefined` if the given object is not a parameter.
|
|
17
17
|
*/
|
|
18
18
|
function tryNormalizeParameter(data, objs) {
|
|
19
|
-
parser_1.parseLog.debug('[parameter]');
|
|
20
19
|
if (objs.length !== 1 && objs.length !== 3) {
|
|
21
20
|
parser_1.parseLog.warn(`Either [SYMBOL_FORMALS] or [SYMBOL_FORMALS, EQ_FORMALS, expr], but got: ${JSON.stringify(objs)}`);
|
|
22
21
|
return undefined;
|
|
@@ -28,6 +27,7 @@ function tryNormalizeParameter(data, objs) {
|
|
|
28
27
|
}
|
|
29
28
|
const defaultValue = objs.length === 3 ? parseWithDefaultValue(data, objs) : undefined;
|
|
30
29
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(symbol.content);
|
|
30
|
+
const delim = defaultValue?.type === type_1.RType.Delimiter;
|
|
31
31
|
return {
|
|
32
32
|
type: type_1.RType.Parameter,
|
|
33
33
|
location,
|
|
@@ -44,17 +44,18 @@ function tryNormalizeParameter(data, objs) {
|
|
|
44
44
|
fullLexeme: content
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
defaultValue:
|
|
47
|
+
defaultValue: delim ? undefined : defaultValue,
|
|
48
48
|
info: {
|
|
49
49
|
fullRange: location,
|
|
50
50
|
fullLexeme: content,
|
|
51
|
-
additionalTokens:
|
|
51
|
+
additionalTokens: delim ? [defaultValue] : []
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
function parseWithDefaultValue(data, objs) {
|
|
56
56
|
(0, assert_1.guard)(objs[1].name === type_1.RawRType.EqualFormals, () => `[arg-default] second element of parameter must be ${type_1.RawRType.EqualFormals}, but: ${JSON.stringify(objs)}`);
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const snd = objs[2];
|
|
58
|
+
(0, assert_1.guard)(snd.name === type_1.RawRType.Expression, () => `[arg-default] third element of parameter must be an Expression but: ${JSON.stringify(objs)}`);
|
|
59
|
+
return (0, normalize_single_node_1.normalizeSingleNode)(data, snd);
|
|
59
60
|
}
|
|
60
61
|
//# sourceMappingURL=normalize-parameter.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RBreak } from '../../../../model/nodes/r-break';
|
|
4
|
-
|
|
3
|
+
import type { JsonEntry } from '../../../json/format';
|
|
4
|
+
export declare function normalizeBreak(data: NormalizerData, obj: JsonEntry): RBreak;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RForLoop } from '../../../../model/nodes/r-for-loop';
|
|
4
|
-
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
|
+
export declare function tryNormalizeFor(data: NormalizerData, [forToken, head, body]: [NamedJsonEntry, NamedJsonEntry, NamedJsonEntry]): RForLoop | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeFor = tryNormalizeFor;
|
|
4
|
-
const
|
|
4
|
+
const normalizer_data_1 = require("../../normalizer-data");
|
|
5
5
|
const parser_1 = require("../../../json/parser");
|
|
6
6
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
7
7
|
const assert_1 = require("../../../../../../../util/assert");
|
|
@@ -17,19 +17,18 @@ function tryNormalizeFor(data, [forToken, head, body]) {
|
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
19
|
else if (head.name !== type_1.RawRType.ForCondition) {
|
|
20
|
-
throw new
|
|
20
|
+
throw new normalizer_data_1.ParseError(`expected condition for for-loop but found ${JSON.stringify(head)}`);
|
|
21
21
|
}
|
|
22
22
|
else if (body.name !== type_1.RawRType.Expression && body.name !== type_1.RawRType.ExprOfAssignOrHelp && body.name !== type_1.RawRType.LegacyEqualAssign) {
|
|
23
|
-
throw new
|
|
23
|
+
throw new normalizer_data_1.ParseError(`expected expr body for for-loop but found ${JSON.stringify(body)}`);
|
|
24
24
|
}
|
|
25
|
-
parser_1.parseLog.debug('trying to parse for-loop');
|
|
26
25
|
const newParseData = { ...data, data, currentRange: undefined, currentLexeme: undefined };
|
|
27
26
|
const { variable: parsedVariable, vector: parsedVector, comments } = normalizeForHead(newParseData, head.content);
|
|
28
27
|
const parseBody = (0, normalize_single_node_1.normalizeSingleNode)(newParseData, body);
|
|
29
28
|
if (parsedVariable === undefined ||
|
|
30
29
|
parsedVector === undefined ||
|
|
31
30
|
parseBody.type === type_1.RType.Delimiter) {
|
|
32
|
-
throw new
|
|
31
|
+
throw new normalizer_data_1.ParseError(`unexpected under-sided for-loop, received ${JSON.stringify([
|
|
33
32
|
parsedVariable,
|
|
34
33
|
parsedVariable,
|
|
35
34
|
parseBody,
|
|
@@ -52,7 +51,7 @@ function tryNormalizeFor(data, [forToken, head, body]) {
|
|
|
52
51
|
}
|
|
53
52
|
function normalizeForHead(data, forCondition) {
|
|
54
53
|
// must have a child which is `in`, a variable on the left, and a vector on the right
|
|
55
|
-
const children = (0,
|
|
54
|
+
const children = (0, normalize_meta_1.getWithTokenType)(forCondition.children);
|
|
56
55
|
const { comments, others } = (0, normalize_expressions_1.splitComments)(children);
|
|
57
56
|
const inPosition = others.findIndex(elem => elem.name === type_1.RawRType.ForIn);
|
|
58
57
|
(0, assert_1.guard)(inPosition > 0 && inPosition < others.length - 1, () => `for loop searched in and found at ${inPosition}, but this is not in legal bounds for ${JSON.stringify(children)}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RNext } from '../../../../model/nodes/r-next';
|
|
4
|
-
|
|
3
|
+
import type { JsonEntry } from '../../../json/format';
|
|
4
|
+
export declare function normalizeNext(data: NormalizerData, obj: JsonEntry): RNext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RRepeatLoop } from '../../../../model/nodes/r-repeat-loop';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Try to parse the construct as a {@link RRepeatLoop}.
|
|
6
6
|
*
|
|
@@ -10,4 +10,4 @@ import type { RRepeatLoop } from '../../../../model/nodes/r-repeat-loop';
|
|
|
10
10
|
*
|
|
11
11
|
* @returns The parsed {@link RRepeatLoop} or `undefined` if the given construct is not a repeat-loop
|
|
12
12
|
*/
|
|
13
|
-
export declare function tryNormalizeRepeat(data: NormalizerData, [repeatToken, bodyToken]: [
|
|
13
|
+
export declare function tryNormalizeRepeat(data: NormalizerData, [repeatToken, bodyToken]: [NamedJsonEntry, NamedJsonEntry]): RRepeatLoop | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
+
import type { RWhileLoop } from '../../../../model/nodes/r-while-loop';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
|
+
export declare function tryNormalizeWhile(data: NormalizerData, [whileToken, leftParen, condition, rightParen, body]: [NamedJsonEntry, NamedJsonEntry, NamedJsonEntry, NamedJsonEntry, NamedJsonEntry]): RWhileLoop | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeWhile = tryNormalizeWhile;
|
|
4
|
-
const
|
|
4
|
+
const normalizer_data_1 = require("../../normalizer-data");
|
|
5
5
|
const parser_1 = require("../../../json/parser");
|
|
6
6
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
7
7
|
const type_1 = require("../../../../model/type");
|
|
@@ -12,16 +12,16 @@ function tryNormalizeWhile(data, [whileToken, leftParen, condition, rightParen,
|
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
14
|
else if (leftParen.name !== type_1.RawRType.ParenLeft) {
|
|
15
|
-
throw new
|
|
15
|
+
throw new normalizer_data_1.ParseError(`expected left-parenthesis for while but found ${JSON.stringify(leftParen)}`);
|
|
16
16
|
}
|
|
17
17
|
else if (rightParen.name !== type_1.RawRType.ParenRight) {
|
|
18
|
-
throw new
|
|
18
|
+
throw new normalizer_data_1.ParseError(`expected right-parenthesis for while but found ${JSON.stringify(rightParen)}`);
|
|
19
19
|
}
|
|
20
20
|
parser_1.parseLog.debug('trying to parse while-loop');
|
|
21
21
|
const parsedCondition = (0, normalize_single_node_1.normalizeSingleNode)(data, condition);
|
|
22
22
|
const parseBody = (0, normalize_single_node_1.normalizeSingleNode)(data, body);
|
|
23
23
|
if (parsedCondition.type === type_1.RType.Delimiter || parseBody.type === type_1.RType.Delimiter) {
|
|
24
|
-
throw new
|
|
24
|
+
throw new normalizer_data_1.ParseError(`unexpected under-sided while-loop, received ${JSON.stringify([
|
|
25
25
|
parsedCondition,
|
|
26
26
|
parseBody,
|
|
27
27
|
])} for ${JSON.stringify([whileToken, condition, body])}`);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { NamedXmlBasedJson } from '../input-format';
|
|
2
1
|
import type { NormalizerData } from '../normalizer-data';
|
|
3
2
|
import type { RAccess } from '../../../model/nodes/r-access';
|
|
3
|
+
import type { NamedJsonEntry } from '../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Tries to normalize the given data as access (e.g., indexing).
|
|
6
6
|
*
|
|
7
7
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
8
|
-
* @param mappedWithName - The
|
|
8
|
+
* @param mappedWithName - The JSON object to extract the meta-information from
|
|
9
9
|
*
|
|
10
10
|
* @returns The parsed {@link RAccess} or `undefined` if the given construct is not accessing a value
|
|
11
11
|
*/
|
|
12
|
-
export declare function tryNormalizeAccess(data: NormalizerData, mappedWithName:
|
|
12
|
+
export declare function tryNormalizeAccess(data: NormalizerData, mappedWithName: NamedJsonEntry[]): RAccess | undefined;
|
|
@@ -40,12 +40,11 @@ function normalizeAbstractArgument(x, data, operator) {
|
|
|
40
40
|
* Tries to normalize the given data as access (e.g., indexing).
|
|
41
41
|
*
|
|
42
42
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
43
|
-
* @param mappedWithName - The
|
|
43
|
+
* @param mappedWithName - The JSON object to extract the meta-information from
|
|
44
44
|
*
|
|
45
45
|
* @returns The parsed {@link RAccess} or `undefined` if the given construct is not accessing a value
|
|
46
46
|
*/
|
|
47
47
|
function tryNormalizeAccess(data, mappedWithName) {
|
|
48
|
-
parser_1.parseLog.trace('trying to parse access');
|
|
49
48
|
if (mappedWithName.length < 3) {
|
|
50
49
|
parser_1.parseLog.trace('expected at least three elements are required to parse an access');
|
|
51
50
|
return undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RNode } from '../../../../model/model';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Parsing binary operations includes the pipe, even though the produced PIPE construct is not a binary operation,
|
|
6
6
|
* to ensure it is handled separately from the others (especially in the combination of a pipe bind)
|
|
7
7
|
*/
|
|
8
|
-
export declare function tryNormalizeBinary(data: NormalizerData, [lhs, operator, rhs]: [
|
|
8
|
+
export declare function tryNormalizeBinary(data: NormalizerData, [lhs, operator, rhs]: [NamedJsonEntry, NamedJsonEntry, NamedJsonEntry]): RNode | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeBinary = tryNormalizeBinary;
|
|
4
|
-
const
|
|
4
|
+
const normalizer_data_1 = require("../../normalizer-data");
|
|
5
5
|
const parser_1 = require("../../../json/parser");
|
|
6
6
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
7
7
|
const assert_1 = require("../../../../../../../util/assert");
|
|
@@ -28,7 +28,7 @@ function parseBinaryOp(data, lhs, operator, rhs) {
|
|
|
28
28
|
const parsedLhs = (0, normalize_single_node_1.normalizeSingleNode)(data, lhs);
|
|
29
29
|
const parsedRhs = (0, normalize_single_node_1.normalizeSingleNode)(data, rhs);
|
|
30
30
|
if (parsedLhs.type === type_1.RType.Delimiter || parsedRhs.type === type_1.RType.Delimiter) {
|
|
31
|
-
throw new
|
|
31
|
+
throw new normalizer_data_1.ParseError(`unexpected under-sided binary op, received ${JSON.stringify([parsedLhs, parsedRhs])} for ${JSON.stringify([lhs, operator, rhs])}`);
|
|
32
32
|
}
|
|
33
33
|
const operationName = (0, normalize_meta_1.retrieveOpName)(operator);
|
|
34
34
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(operator.content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RNode } from '../../../../model/model';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Parses the construct as a {@link RUnaryOp}.
|
|
6
6
|
*
|
|
@@ -10,4 +10,4 @@ import type { RNode } from '../../../../model/model';
|
|
|
10
10
|
*
|
|
11
11
|
* @returns The parsed {@link RUnaryOp} or `undefined` if the given construct is not a unary operator
|
|
12
12
|
*/
|
|
13
|
-
export declare function tryNormalizeUnary(data: NormalizerData, [operator, operand]: [
|
|
13
|
+
export declare function tryNormalizeUnary(data: NormalizerData, [operator, operand]: [NamedJsonEntry, NamedJsonEntry]): RNode | undefined;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RComment } from '../../../../model/nodes/r-comment';
|
|
3
|
+
import type { JsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as an R comment.
|
|
6
6
|
* This requires you to check the corresponding name beforehand.
|
|
7
7
|
*
|
|
8
8
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
9
|
-
* @param obj - The
|
|
9
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
10
10
|
*/
|
|
11
|
-
export declare function normalizeComment(data: NormalizerData, obj:
|
|
11
|
+
export declare function normalizeComment(data: NormalizerData, obj: JsonEntry): RComment;
|
|
@@ -9,7 +9,7 @@ const type_1 = require("../../../../model/type");
|
|
|
9
9
|
* This requires you to check the corresponding name beforehand.
|
|
10
10
|
*
|
|
11
11
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
12
|
-
* @param obj - The
|
|
12
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
13
13
|
*/
|
|
14
14
|
function normalizeComment(data, obj) {
|
|
15
15
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(obj);
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.d.ts
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RLineDirective } from '../../../../model/nodes/r-line-directive';
|
|
4
3
|
import type { RComment } from '../../../../model/nodes/r-comment';
|
|
4
|
+
import type { JsonEntry } from '../../../json/format';
|
|
5
5
|
/**
|
|
6
6
|
* Normalize the given object as an R line directive (`#line <number> "<file>"`).
|
|
7
7
|
* This requires you to check the corresponding name beforehand.
|
|
8
8
|
* If the given object turns out to be no line directive, this returns a normal comment instead.
|
|
9
9
|
*
|
|
10
10
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
11
|
-
* @param obj - The
|
|
11
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
12
12
|
*/
|
|
13
|
-
export declare function normalizeLineDirective(data: NormalizerData, obj:
|
|
13
|
+
export declare function normalizeLineDirective(data: NormalizerData, obj: JsonEntry): RLineDirective | RComment;
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.js
RENAMED
|
@@ -12,7 +12,7 @@ const LineDirectiveRegex = /^#line\s+(\d+)\s+"([^"]+)"\s*$/;
|
|
|
12
12
|
* If the given object turns out to be no line directive, this returns a normal comment instead.
|
|
13
13
|
*
|
|
14
14
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
15
|
-
* @param obj - The
|
|
15
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
16
16
|
*/
|
|
17
17
|
function normalizeLineDirective(data, obj) {
|
|
18
18
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(obj);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
+
import type { RDelimiter } from '../../../../model/nodes/info/r-delimiter';
|
|
3
|
+
import type { RNode } from '../../../../model/model';
|
|
4
|
+
import type { JsonEntry, NamedJsonEntry } from '../../../json/format';
|
|
5
|
+
export declare function splitComments(tokens: readonly NamedJsonEntry[]): {
|
|
6
|
+
comments: NamedJsonEntry[];
|
|
7
|
+
others: NamedJsonEntry[];
|
|
8
|
+
};
|
|
9
|
+
export declare function normalizeExpressions(data: NormalizerData, tokens: readonly JsonEntry[] | readonly NamedJsonEntry[]): (RNode | RDelimiter)[];
|
|
10
|
+
export declare function parseNodesWithUnknownType(data: NormalizerData, mappedWithName: readonly NamedJsonEntry[] | undefined): (RNode | RDelimiter)[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RExpressionList } from '../../../../model/nodes/r-expression-list';
|
|
4
|
-
|
|
3
|
+
import type { JsonEntry } from '../../../json/format';
|
|
4
|
+
export declare function normalizeRootObjToAst(data: NormalizerData, obj: JsonEntry): RExpressionList;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeRootObjToAst = normalizeRootObjToAst;
|
|
4
|
-
const input_format_1 = require("../../input-format");
|
|
5
4
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
6
5
|
const normalize_expressions_1 = require("./normalize-expressions");
|
|
7
6
|
const log_1 = require("../../../../../../../util/log");
|
|
8
7
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
9
8
|
const type_1 = require("../../../../model/type");
|
|
10
9
|
function normalizeRootObjToAst(data, obj) {
|
|
11
|
-
const exprContent =
|
|
10
|
+
const exprContent = obj.token;
|
|
12
11
|
(0, normalize_meta_1.assureTokenType)(exprContent, type_1.RawRType.ExpressionList);
|
|
13
12
|
let parsedChildren = [];
|
|
14
|
-
if (
|
|
15
|
-
const children =
|
|
13
|
+
if (obj.children.length > 0) {
|
|
14
|
+
const children = obj.children;
|
|
16
15
|
parsedChildren = (0, normalize_expressions_1.normalizeExpressions)(data, children);
|
|
17
16
|
}
|
|
18
17
|
else {
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.d.ts
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RNode } from '../../../../model/model';
|
|
4
3
|
import type { RDelimiter } from '../../../../model/nodes/info/r-delimiter';
|
|
4
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
5
5
|
/**
|
|
6
6
|
* Parses a single structure in the ast based on its type (e.g., a string, a number, a symbol, ...)
|
|
7
7
|
*
|
|
@@ -10,4 +10,4 @@ import type { RDelimiter } from '../../../../model/nodes/info/r-delimiter';
|
|
|
10
10
|
*
|
|
11
11
|
* @returns The parsed element as an `RNode` or an `RDelimiter` if it is such.
|
|
12
12
|
*/
|
|
13
|
-
export declare function normalizeSingleNode(data: NormalizerData, elem:
|
|
13
|
+
export declare function normalizeSingleNode(data: NormalizerData, elem: NamedJsonEntry): RNode | RDelimiter;
|
package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.js
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeSingleNode = normalizeSingleNode;
|
|
4
4
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
5
|
-
const
|
|
5
|
+
const normalizer_data_1 = require("../../normalizer-data");
|
|
6
6
|
const normalize_line_directive_1 = require("../other/normalize-line-directive");
|
|
7
7
|
const assert_1 = require("../../../../../../../util/assert");
|
|
8
8
|
const normalize_delimiter_1 = require("./normalize-delimiter");
|
|
@@ -54,7 +54,7 @@ function normalizeSingleNode(data, elem) {
|
|
|
54
54
|
return symbol;
|
|
55
55
|
}
|
|
56
56
|
default:
|
|
57
|
-
throw new
|
|
57
|
+
throw new normalizer_data_1.ParseError(`unknown type ${elem.name} for ${JSON.stringify(elem)} in ${JSON.stringify(data)}`);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
//# sourceMappingURL=normalize-single-node.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RNa } from '../../../../../convert-values';
|
|
4
3
|
import type { RNumber } from '../../../../model/nodes/r-number';
|
|
5
4
|
import type { RLogical } from '../../../../model/nodes/r-logical';
|
|
6
5
|
import type { RSymbol } from '../../../../model/nodes/r-symbol';
|
|
7
6
|
import type { NoInfo } from '../../../../model/model';
|
|
7
|
+
import type { JsonEntry } from '../../../json/format';
|
|
8
8
|
/**
|
|
9
9
|
* Normalize the given object as a R number (see {@link number2ts}), supporting booleans (see {@link boolean2ts}),
|
|
10
10
|
* and special values.
|
|
11
11
|
* This requires you to check the corresponding name beforehand.
|
|
12
12
|
*
|
|
13
13
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
14
|
-
* @param obj - The
|
|
14
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
15
15
|
*/
|
|
16
|
-
export declare function normalizeNumber(data: NormalizerData, obj:
|
|
16
|
+
export declare function normalizeNumber(data: NormalizerData, obj: JsonEntry): RNumber | RLogical | RSymbol<NoInfo, typeof RNa>;
|
|
@@ -10,7 +10,7 @@ const type_1 = require("../../../../model/type");
|
|
|
10
10
|
* This requires you to check the corresponding name beforehand.
|
|
11
11
|
*
|
|
12
12
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
13
|
-
* @param obj - The
|
|
13
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
14
14
|
*/
|
|
15
15
|
function normalizeNumber(data, obj) {
|
|
16
16
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(obj);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RString } from '../../../../model/nodes/r-string';
|
|
3
|
+
import type { JsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as a R string (see {@link string2ts}).
|
|
6
6
|
* This requires you to check the corresponding name beforehand.
|
|
7
7
|
*
|
|
8
8
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
9
|
-
* @param obj - The
|
|
9
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
10
10
|
*/
|
|
11
|
-
export declare function normalizeString(data: NormalizerData, obj:
|
|
11
|
+
export declare function normalizeString(data: NormalizerData, obj: JsonEntry): RString;
|
|
@@ -10,7 +10,7 @@ const type_1 = require("../../../../model/type");
|
|
|
10
10
|
* This requires you to check the corresponding name beforehand.
|
|
11
11
|
*
|
|
12
12
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
13
|
-
* @param obj - The
|
|
13
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
14
14
|
*/
|
|
15
15
|
function normalizeString(data, obj) {
|
|
16
16
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(obj);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RSymbol } from '../../../../model/nodes/r-symbol';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as an R symbol (incorporating namespace information).
|
|
6
6
|
* <p>
|
|
7
7
|
* The special symbols `T` and `F` are parsed as logic values.
|
|
8
8
|
*
|
|
9
9
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
10
|
-
* @param objs - The
|
|
10
|
+
* @param objs - The JSON object to extract the meta-information from
|
|
11
11
|
*
|
|
12
12
|
* @returns The parsed symbol (with populated namespace information) or `undefined` if the given object is not a symbol.
|
|
13
13
|
*/
|
|
14
|
-
export declare function tryNormalizeSymbol(data: NormalizerData, objs: readonly
|
|
14
|
+
export declare function tryNormalizeSymbol(data: NormalizerData, objs: readonly NamedJsonEntry[]): RSymbol | undefined;
|