@eagleoutice/flowr 1.3.14 → 1.4.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/README.md +3 -3
- package/abstract-interpretation/domain.d.ts +27 -0
- package/abstract-interpretation/domain.js +146 -0
- package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
- package/abstract-interpretation/handler/binop/binop.js +40 -0
- package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
- package/abstract-interpretation/handler/binop/operators.js +42 -0
- package/abstract-interpretation/handler/handler.d.ts +6 -0
- package/abstract-interpretation/handler/handler.js +3 -0
- package/abstract-interpretation/processor.d.ts +10 -0
- package/abstract-interpretation/processor.js +84 -0
- package/benchmark/slicer.d.ts +6 -8
- package/benchmark/slicer.js +5 -15
- package/benchmark/stats/print.d.ts +1 -1
- package/benchmark/stats/print.js +0 -2
- package/benchmark/stats/stats.d.ts +3 -4
- package/benchmark/stats/stats.js +1 -1
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +21 -6
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +15 -6
- package/cli/common/features.d.ts +1 -1
- package/cli/common/options.d.ts +1 -1
- package/cli/common/options.js +4 -1
- package/cli/common/script.d.ts +1 -1
- package/cli/common/scripts-info.d.ts +3 -2
- package/cli/common/scripts-info.js +15 -1
- package/cli/export-quads-app.js +1 -5
- package/cli/repl/commands/cfg.d.ts +1 -1
- package/cli/repl/commands/cfg.js +3 -3
- package/cli/repl/commands/commands.d.ts +4 -2
- package/cli/repl/commands/commands.js +67 -28
- package/cli/repl/commands/dataflow.d.ts +1 -1
- package/cli/repl/commands/dataflow.js +2 -2
- package/cli/repl/commands/execute.d.ts +2 -2
- package/cli/repl/commands/main.d.ts +2 -2
- package/cli/repl/commands/normalize.d.ts +1 -1
- package/cli/repl/commands/normalize.js +2 -2
- package/cli/repl/commands/parse.d.ts +1 -1
- package/cli/repl/commands/parse.js +12 -12
- package/cli/repl/commands/quit.d.ts +1 -1
- package/cli/repl/commands/quit.js +4 -1
- package/cli/repl/commands/version.d.ts +1 -1
- package/cli/repl/core.d.ts +5 -3
- package/cli/repl/core.js +63 -7
- package/cli/repl/execute.d.ts +1 -1
- package/cli/repl/execute.js +3 -3
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +4 -8
- package/cli/repl/server/messages/analysis.d.ts +3 -3
- package/cli/repl/server/messages/analysis.js +12 -32
- package/cli/repl/server/messages/error.d.ts +1 -1
- package/cli/repl/server/messages/hello.d.ts +2 -2
- package/cli/repl/server/messages/messages.d.ts +5 -5
- package/cli/repl/server/messages/repl.d.ts +1 -1
- package/cli/repl/server/messages/slice.d.ts +3 -3
- package/cli/repl/server/net.d.ts +16 -0
- package/cli/repl/server/net.js +42 -3
- package/cli/repl/server/send.d.ts +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/repl/server/validate.d.ts +3 -3
- package/cli/statistics-helper-app.js +2 -3
- package/cli/summarizer-app.js +1 -2
- package/config.d.ts +16 -0
- package/config.js +75 -0
- package/core/input.d.ts +5 -5
- package/core/output.d.ts +1 -1
- package/core/print/dataflow-printer.d.ts +3 -3
- package/core/print/normalize-printer.d.ts +2 -2
- package/core/print/parse-printer.d.ts +2 -3
- package/core/print/parse-printer.js +6 -4
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.d.ts +1 -1
- package/core/slicer.d.ts +5 -4
- package/core/slicer.js +2 -2
- package/core/steps.d.ts +10 -9
- package/core/steps.js +5 -4
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/environment.d.ts +4 -4
- package/dataflow/environments/environment.js +8 -0
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/environments/register.d.ts +2 -2
- package/dataflow/environments/register.js +1 -0
- package/dataflow/environments/resolve-by-name.d.ts +2 -2
- package/dataflow/environments/scoping.d.ts +1 -1
- package/dataflow/extractor.d.ts +5 -5
- package/dataflow/extractor.js +10 -2
- package/dataflow/graph/diff.d.ts +3 -3
- package/dataflow/graph/graph.d.ts +8 -7
- package/dataflow/graph/quads.d.ts +2 -2
- package/dataflow/graph/vertex.d.ts +5 -5
- package/dataflow/internal/info.d.ts +2 -2
- package/dataflow/internal/linker.d.ts +3 -3
- package/dataflow/internal/process/access.d.ts +3 -3
- package/dataflow/internal/process/expression-list.d.ts +3 -3
- package/dataflow/internal/process/expression-list.js +0 -4
- package/dataflow/internal/process/functions/argument.d.ts +4 -4
- package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
- package/dataflow/internal/process/functions/function-call.d.ts +3 -3
- package/dataflow/internal/process/functions/function-call.js +7 -1
- package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
- package/dataflow/internal/process/functions/parameter.d.ts +3 -3
- package/dataflow/internal/process/functions/source.d.ts +8 -0
- package/dataflow/internal/process/functions/source.js +81 -0
- package/dataflow/internal/process/if-then-else.d.ts +3 -3
- package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
- package/dataflow/internal/process/operators/assignment.d.ts +3 -3
- package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
- package/dataflow/internal/process/operators/pipe.d.ts +3 -3
- package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
- package/dataflow/internal/process/symbol.d.ts +3 -3
- package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
- package/dataflow/processor.d.ts +12 -3
- package/flowr.d.ts +5 -2
- package/flowr.js +19 -12
- package/package.json +50 -18
- package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/index.js +3 -0
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
- package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
- package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
- package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +4 -7
- package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +6 -2
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +9 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
- package/r-bridge/lang-4.x/values.d.ts +0 -1
- package/r-bridge/lang-4.x/values.js +14 -6
- package/r-bridge/retriever.d.ts +26 -22
- package/r-bridge/retriever.js +73 -23
- package/r-bridge/shell-executor.d.ts +11 -0
- package/r-bridge/shell-executor.js +50 -0
- package/r-bridge/shell.d.ts +12 -31
- package/r-bridge/shell.js +36 -94
- package/reconstruct/reconstruct.d.ts +1 -1
- package/slicing/criterion/collect-all.d.ts +3 -3
- package/slicing/criterion/filters/all-variables.d.ts +1 -1
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/static/static-slicer.d.ts +3 -3
- package/statistics/features/common-syntax-probability.d.ts +3 -2
- package/statistics/features/common-syntax-probability.js +0 -3
- package/statistics/features/feature.d.ts +6 -6
- package/statistics/features/post-processing.d.ts +2 -2
- package/statistics/features/supported/assignments/assignments.d.ts +2 -2
- package/statistics/features/supported/assignments/post-process.d.ts +2 -2
- package/statistics/features/supported/assignments/post-process.js +6 -6
- package/statistics/features/supported/comments/comments.d.ts +2 -2
- package/statistics/features/supported/comments/post-process.d.ts +2 -2
- package/statistics/features/supported/comments/post-process.js +2 -2
- package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
- package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.d.ts +3 -3
- package/statistics/features/supported/data-access/post-process.d.ts +2 -2
- package/statistics/features/supported/data-access/post-process.js +4 -4
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
- package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/defined-functions/post-process.js +4 -4
- package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
- package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
- package/statistics/features/supported/expression-list/post-process.js +3 -3
- package/statistics/features/supported/loops/loops.d.ts +2 -2
- package/statistics/features/supported/loops/post-process.d.ts +2 -2
- package/statistics/features/supported/loops/post-process.js +3 -3
- package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/used-functions/post-process.js +5 -5
- package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
- package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
- package/statistics/features/supported/used-packages/post-process.js +5 -5
- package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
- package/statistics/features/supported/values/post-process.d.ts +2 -2
- package/statistics/features/supported/values/post-process.js +3 -3
- package/statistics/features/supported/values/values.d.ts +2 -2
- package/statistics/features/supported/variables/post-process.d.ts +3 -3
- package/statistics/features/supported/variables/post-process.js +3 -3
- package/statistics/features/supported/variables/variables.d.ts +2 -2
- package/statistics/meta-statistics.d.ts +1 -1
- package/statistics/output/ansi.js +1 -1
- package/statistics/output/print-stats.d.ts +2 -2
- package/statistics/output/statistics-file.d.ts +1 -1
- package/statistics/statistics.d.ts +4 -4
- package/statistics/statistics.js +7 -8
- package/util/args.d.ts +8 -4
- package/util/args.js +11 -4
- package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
- package/util/{cfg.js → cfg/cfg.js} +42 -37
- package/util/cfg/visitor.d.ts +14 -0
- package/util/cfg/visitor.js +64 -0
- package/util/diff.d.ts +1 -1
- package/util/files.d.ts +7 -1
- package/util/files.js +11 -1
- package/util/log.js +3 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/cfg.d.ts +2 -2
- package/util/mermaid/dfg.d.ts +3 -3
- package/util/objects.d.ts +1 -1
- package/util/quads.d.ts +2 -2
- package/util/summarizer/benchmark/data.d.ts +1 -1
- package/util/summarizer/benchmark/first-phase/input.d.ts +2 -1
- package/util/summarizer/benchmark/first-phase/input.js +20 -4
- package/util/summarizer/benchmark/first-phase/process.d.ts +4 -3
- package/util/summarizer/benchmark/first-phase/process.js +14 -5
- package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
- package/util/summarizer/benchmark/second-phase/graph.js +1 -1
- package/util/summarizer/benchmark/second-phase/process.d.ts +3 -1
- package/util/summarizer/benchmark/second-phase/process.js +48 -11
- package/util/summarizer/benchmark/summarizer.d.ts +3 -6
- package/util/summarizer/benchmark/summarizer.js +16 -11
- package/util/summarizer/statistics/first-phase/process.js +8 -8
- package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
- package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
- package/util/summarizer/statistics/post-process/post-process-output.js +4 -5
- package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
- package/util/summarizer/statistics/summarizer.d.ts +3 -2
- package/util/summarizer/summarizer.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
- package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
- package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
- package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParserData } from '../../data';
|
|
2
|
-
import { XmlBasedJson } from '../../input-format';
|
|
3
|
-
import { RBreak } from '../../../../model';
|
|
1
|
+
import type { ParserData } from '../../data';
|
|
2
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
3
|
+
import type { RBreak } from '../../../../model';
|
|
4
4
|
export declare function normalizeBreak(data: ParserData, obj: XmlBasedJson): RBreak;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeBreak = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const hooks_1 = require("../../hooks");
|
|
6
5
|
const meta_1 = require("../meta");
|
|
6
|
+
const parser_1 = require("../../../json/parser");
|
|
7
7
|
function normalizeBreak(data, obj) {
|
|
8
8
|
parser_1.parseLog.debug(`[break] try: ${JSON.stringify(obj)}`);
|
|
9
9
|
obj = (0, hooks_1.executeHook)(data.hooks.loops.onBreak.before, data, obj);
|
|
10
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
10
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
|
|
11
11
|
const result = {
|
|
12
12
|
type: "RBreak" /* RType.Break */,
|
|
13
13
|
location,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RForLoop } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RForLoop } from '../../../../model';
|
|
4
4
|
export declare function tryNormalizeFor(data: ParserData, forToken: NamedXmlBasedJson, head: NamedXmlBasedJson, body: NamedXmlBasedJson): RForLoop | undefined;
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tryNormalizeFor = void 0;
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
5
|
const meta_1 = require("../meta");
|
|
6
|
-
const parser_1 = require("../../parser");
|
|
7
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
8
7
|
const values_1 = require("../values");
|
|
9
8
|
const structure_1 = require("../structure");
|
|
10
9
|
const hooks_1 = require("../../hooks");
|
|
11
10
|
const other_1 = require("../other");
|
|
11
|
+
const parser_1 = require("../../../json/parser");
|
|
12
12
|
function tryNormalizeFor(data, forToken, head, body) {
|
|
13
13
|
// funny, for does not use top-level parenthesis
|
|
14
14
|
if (forToken.name !== "FOR" /* RawRType.For */) {
|
|
@@ -35,7 +35,7 @@ function tryNormalizeFor(data, forToken, head, body) {
|
|
|
35
35
|
parseBody,
|
|
36
36
|
])}`);
|
|
37
37
|
}
|
|
38
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
38
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(forToken.content);
|
|
39
39
|
const result = {
|
|
40
40
|
type: "RForLoop" /* RType.ForLoop */,
|
|
41
41
|
variable: parsedVariable,
|
|
@@ -54,10 +54,7 @@ function tryNormalizeFor(data, forToken, head, body) {
|
|
|
54
54
|
exports.tryNormalizeFor = tryNormalizeFor;
|
|
55
55
|
function normalizeForHead(data, forCondition) {
|
|
56
56
|
// must have a child which is `in`, a variable on the left, and a vector on the right
|
|
57
|
-
const children = (0, input_format_1.getKeysGuarded)(forCondition,
|
|
58
|
-
name: (0, meta_1.getTokenType)(data.config.tokenMap, content),
|
|
59
|
-
content
|
|
60
|
-
}));
|
|
57
|
+
const children = (0, input_format_1.getKeysGuarded)(forCondition, input_format_1.childrenKey).map(content => ({ name: (0, meta_1.getTokenType)(content), content }));
|
|
61
58
|
const { comments, others } = (0, structure_1.splitComments)(children);
|
|
62
59
|
const inPosition = others.findIndex(elem => elem.name === "IN" /* RawRType.ForIn */);
|
|
63
60
|
(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
|
-
import { ParserData } from '../../data';
|
|
2
|
-
import { XmlBasedJson } from '../../input-format';
|
|
3
|
-
import { RNext } from '../../../../model';
|
|
1
|
+
import type { ParserData } from '../../data';
|
|
2
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
3
|
+
import type { RNext } from '../../../../model';
|
|
4
4
|
export declare function normalizeNext(data: ParserData, obj: XmlBasedJson): RNext;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeNext = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const hooks_1 = require("../../hooks");
|
|
6
5
|
const meta_1 = require("../meta");
|
|
6
|
+
const parser_1 = require("../../../json/parser");
|
|
7
7
|
function normalizeNext(data, obj) {
|
|
8
8
|
parser_1.parseLog.debug(`[next] try: ${JSON.stringify(obj)}`);
|
|
9
9
|
obj = (0, hooks_1.executeHook)(data.hooks.loops.onNext.before, data, obj);
|
|
10
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
10
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
|
|
11
11
|
const result = {
|
|
12
12
|
type: "RNext" /* RType.Next */,
|
|
13
13
|
location,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RRepeatLoop } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RRepeatLoop } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Try to parse the construct as a {@link RRepeatLoop}.
|
|
6
6
|
*
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeRepeat = void 0;
|
|
4
4
|
const meta_1 = require("../meta");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const structure_1 = require("../structure");
|
|
7
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
8
7
|
const hooks_1 = require("../../hooks");
|
|
8
|
+
const parser_1 = require("../../../json/parser");
|
|
9
9
|
/**
|
|
10
10
|
* Try to parse the construct as a {@link RRepeatLoop}.
|
|
11
11
|
*
|
|
@@ -24,7 +24,7 @@ function tryNormalizeRepeat(data, repeatToken, body) {
|
|
|
24
24
|
({ repeatToken, body } = (0, hooks_1.executeHook)(data.hooks.loops.onRepeatLoop.before, data, { repeatToken, body }));
|
|
25
25
|
const parseBody = (0, structure_1.tryNormalizeSingleNode)(data, body);
|
|
26
26
|
(0, assert_1.guard)(parseBody.type !== "RDelimiter" /* RType.Delimiter */, () => `no body for repeat-loop ${JSON.stringify(repeatToken)} (${JSON.stringify(body)})`);
|
|
27
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
27
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(repeatToken.content);
|
|
28
28
|
const result = {
|
|
29
29
|
type: "RRepeatLoop" /* RType.RepeatLoop */,
|
|
30
30
|
location,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RWhileLoop } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RWhileLoop } from '../../../../model';
|
|
4
4
|
export declare function tryNormalizeWhile(data: ParserData, whileToken: NamedXmlBasedJson, leftParen: NamedXmlBasedJson, condition: NamedXmlBasedJson, rightParen: NamedXmlBasedJson, body: NamedXmlBasedJson): RWhileLoop | undefined;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tryNormalizeWhile = void 0;
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
5
|
const meta_1 = require("../meta");
|
|
6
|
-
const parser_1 = require("../../parser");
|
|
7
6
|
const structure_1 = require("../structure");
|
|
8
7
|
const hooks_1 = require("../../hooks");
|
|
8
|
+
const parser_1 = require("../../../json/parser");
|
|
9
9
|
function tryNormalizeWhile(data, whileToken, leftParen, condition, rightParen, body) {
|
|
10
10
|
if (whileToken.name !== "WHILE" /* RawRType.While */) {
|
|
11
11
|
parser_1.parseLog.debug('encountered non-while token for supposed while-loop structure');
|
|
@@ -26,7 +26,7 @@ function tryNormalizeWhile(data, whileToken, leftParen, condition, rightParen, b
|
|
|
26
26
|
parseBody,
|
|
27
27
|
])} for ${JSON.stringify([whileToken, condition, body])}`);
|
|
28
28
|
}
|
|
29
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
29
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(whileToken.content);
|
|
30
30
|
const result = {
|
|
31
31
|
type: "RWhileLoop" /* RType.WhileLoop */,
|
|
32
32
|
condition: parsedCondition,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson, XmlBasedJson } from '../input-format';
|
|
2
|
-
import { SourceRange } from '../../../../../../util/range';
|
|
3
|
-
import {
|
|
4
|
-
import { RawRType, RExpressionList, RNode } from '../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson, XmlBasedJson } from '../input-format';
|
|
2
|
+
import type { SourceRange } from '../../../../../../util/range';
|
|
3
|
+
import type { RawRType, RExpressionList, RNode } from '../../../model';
|
|
5
4
|
/**
|
|
6
5
|
* if the passed object is an array with only one element, remove the array wrapper
|
|
7
6
|
*/
|
|
@@ -14,37 +13,33 @@ export declare function extractLocation(ast: XmlBasedJson): SourceRange;
|
|
|
14
13
|
* The json object that represents the input xml contains various meta-information.
|
|
15
14
|
* This function extracts the meta-information and returns it.
|
|
16
15
|
*
|
|
17
|
-
* @param config - The configuration of the parser to use to retrieve the corresponding name fields
|
|
18
16
|
* @param obj - The json object to extract the meta-information from
|
|
19
17
|
*/
|
|
20
|
-
export declare function retrieveMetaStructure(
|
|
18
|
+
export declare function retrieveMetaStructure(obj: XmlBasedJson): {
|
|
21
19
|
/** the obj passed in, but potentially without surrounding array wrappers (see {@link objectWithArrUnwrap}) */
|
|
22
20
|
unwrappedObj: XmlBasedJson;
|
|
23
21
|
/** location information of the corresponding R-ast element */
|
|
24
22
|
location: SourceRange;
|
|
25
23
|
content: string;
|
|
26
24
|
};
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function assureTokenType(tokenMap: XmlParserConfig['tokenMap'], obj: XmlBasedJson, expectedName: RawRType): void;
|
|
25
|
+
export declare function assureTokenType(obj: XmlBasedJson, expectedName: RawRType): void;
|
|
29
26
|
/**
|
|
30
27
|
* Extract the token-type of the given object. This is based on the knowledge, that all json objects created
|
|
31
28
|
* from the R xml have a name attached.
|
|
32
29
|
*
|
|
33
|
-
* @param tokenMap - used to revert token types (i.e., revert `xmlparsedata`)
|
|
34
30
|
* @param content - the json object to extract the token-type from
|
|
35
31
|
*/
|
|
36
|
-
export declare function getTokenType(
|
|
37
|
-
export declare function getWithTokenType(
|
|
32
|
+
export declare function getTokenType(content: XmlBasedJson): RawRType;
|
|
33
|
+
export declare function getWithTokenType(obj: XmlBasedJson[]): {
|
|
38
34
|
name: RawRType;
|
|
39
35
|
content: XmlBasedJson;
|
|
40
36
|
}[];
|
|
41
|
-
export declare function retrieveOpName(
|
|
37
|
+
export declare function retrieveOpName(operator: NamedXmlBasedJson): string;
|
|
42
38
|
/**
|
|
43
39
|
* Ensure that the first child is completely before the second child.
|
|
44
40
|
*
|
|
45
|
-
* @param config - the configuration of the parser to use to retrieve the corresponding name fields
|
|
46
41
|
* @param first - the first child which should be the lhs
|
|
47
42
|
* @param second - the second child which should be the rhs
|
|
48
43
|
*/
|
|
49
|
-
export declare function ensureChildrenAreLhsAndRhsOrdered(
|
|
44
|
+
export declare function ensureChildrenAreLhsAndRhsOrdered(first: XmlBasedJson, second: XmlBasedJson): void;
|
|
50
45
|
export declare function ensureExpressionList<Info>(node: RNode<Info>): RExpressionList<Info>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureExpressionList = exports.ensureChildrenAreLhsAndRhsOrdered = exports.retrieveOpName = exports.getWithTokenType = exports.getTokenType = exports.assureTokenType = exports.
|
|
3
|
+
exports.ensureExpressionList = exports.ensureChildrenAreLhsAndRhsOrdered = exports.retrieveOpName = exports.getWithTokenType = exports.getTokenType = exports.assureTokenType = exports.retrieveMetaStructure = exports.extractLocation = exports.objectWithArrUnwrap = void 0;
|
|
4
4
|
const input_format_1 = require("../input-format");
|
|
5
5
|
const range_1 = require("../../../../../../util/range");
|
|
6
6
|
const assert_1 = require("../../../../../../util/assert");
|
|
@@ -34,13 +34,12 @@ exports.extractLocation = extractLocation;
|
|
|
34
34
|
* The json object that represents the input xml contains various meta-information.
|
|
35
35
|
* This function extracts the meta-information and returns it.
|
|
36
36
|
*
|
|
37
|
-
* @param config - The configuration of the parser to use to retrieve the corresponding name fields
|
|
38
37
|
* @param obj - The json object to extract the meta-information from
|
|
39
38
|
*/
|
|
40
|
-
function retrieveMetaStructure(
|
|
39
|
+
function retrieveMetaStructure(obj) {
|
|
41
40
|
const unwrappedObj = objectWithArrUnwrap(obj);
|
|
42
|
-
const attributes = obj[
|
|
43
|
-
const content = obj[
|
|
41
|
+
const attributes = obj[input_format_1.attributesKey];
|
|
42
|
+
const content = obj[input_format_1.contentKey] ?? '';
|
|
44
43
|
(0, assert_1.guard)(attributes !== undefined, () => `expected attributes to be defined for ${JSON.stringify(obj)}`);
|
|
45
44
|
const location = extractLocation(attributes);
|
|
46
45
|
return {
|
|
@@ -50,13 +49,8 @@ function retrieveMetaStructure(config, obj) {
|
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
exports.retrieveMetaStructure = retrieveMetaStructure;
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
return tokenMap[token] ?? token;
|
|
56
|
-
}
|
|
57
|
-
exports.revertTokenReplacement = revertTokenReplacement;
|
|
58
|
-
function assureTokenType(tokenMap, obj, expectedName) {
|
|
59
|
-
const name = getTokenType(tokenMap, obj);
|
|
52
|
+
function assureTokenType(obj, expectedName) {
|
|
53
|
+
const name = getTokenType(obj);
|
|
60
54
|
if (name !== expectedName) {
|
|
61
55
|
throw new input_format_1.XmlParseError(`expected name to be ${expectedName}, yet received ${name} for ${JSON.stringify(obj)}`);
|
|
62
56
|
}
|
|
@@ -66,37 +60,35 @@ exports.assureTokenType = assureTokenType;
|
|
|
66
60
|
* Extract the token-type of the given object. This is based on the knowledge, that all json objects created
|
|
67
61
|
* from the R xml have a name attached.
|
|
68
62
|
*
|
|
69
|
-
* @param tokenMap - used to revert token types (i.e., revert `xmlparsedata`)
|
|
70
63
|
* @param content - the json object to extract the token-type from
|
|
71
64
|
*/
|
|
72
|
-
function getTokenType(
|
|
73
|
-
return
|
|
65
|
+
function getTokenType(content) {
|
|
66
|
+
return (0, input_format_1.getKeysGuarded)(content, input_format_1.nameKey);
|
|
74
67
|
}
|
|
75
68
|
exports.getTokenType = getTokenType;
|
|
76
|
-
function getWithTokenType(
|
|
69
|
+
function getWithTokenType(obj) {
|
|
77
70
|
return obj.map((content) => ({
|
|
78
|
-
name: getTokenType(
|
|
71
|
+
name: getTokenType(content),
|
|
79
72
|
content
|
|
80
73
|
}));
|
|
81
74
|
}
|
|
82
75
|
exports.getWithTokenType = getWithTokenType;
|
|
83
|
-
function retrieveOpName(
|
|
76
|
+
function retrieveOpName(operator) {
|
|
84
77
|
/*
|
|
85
78
|
* only real arithmetic ops have their operation as their own name, the others identify via content
|
|
86
79
|
*/
|
|
87
|
-
return operator.content[
|
|
80
|
+
return operator.content[input_format_1.contentKey];
|
|
88
81
|
}
|
|
89
82
|
exports.retrieveOpName = retrieveOpName;
|
|
90
83
|
/**
|
|
91
84
|
* Ensure that the first child is completely before the second child.
|
|
92
85
|
*
|
|
93
|
-
* @param config - the configuration of the parser to use to retrieve the corresponding name fields
|
|
94
86
|
* @param first - the first child which should be the lhs
|
|
95
87
|
* @param second - the second child which should be the rhs
|
|
96
88
|
*/
|
|
97
|
-
function ensureChildrenAreLhsAndRhsOrdered(
|
|
98
|
-
const firstOtherLoc = extractLocation(first[
|
|
99
|
-
const secondOtherLoc = extractLocation(second[
|
|
89
|
+
function ensureChildrenAreLhsAndRhsOrdered(first, second) {
|
|
90
|
+
const firstOtherLoc = extractLocation(first[input_format_1.attributesKey]);
|
|
91
|
+
const secondOtherLoc = extractLocation(second[input_format_1.attributesKey]);
|
|
100
92
|
if (!(0, range_1.rangeStartsCompletelyBefore)(firstOtherLoc, secondOtherLoc)) {
|
|
101
93
|
throw new input_format_1.XmlParseError(`expected the first child to be the lhs, yet received ${JSON.stringify(first)} & ${JSON.stringify(second)}`);
|
|
102
94
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RNode } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RNode } from '../../../../model';
|
|
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)
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeBinary = void 0;
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const meta_1 = require("../meta");
|
|
7
6
|
const special_1 = require("./special");
|
|
8
7
|
const structure_1 = require("../structure");
|
|
9
8
|
const model_1 = require("../../../../model");
|
|
10
9
|
const hooks_1 = require("../../hooks");
|
|
11
10
|
const assert_1 = require("../../../../../../../util/assert");
|
|
11
|
+
const parser_1 = require("../../../json/parser");
|
|
12
12
|
/**
|
|
13
13
|
* Parsing binary operations includes the pipe, even though the produced PIPE construct is not a binary operation,
|
|
14
14
|
* to ensure it is handled separately from the others (especially in the combination of a pipe bind)
|
|
@@ -46,18 +46,18 @@ exports.tryNormalizeBinary = tryNormalizeBinary;
|
|
|
46
46
|
function parseBinaryOp(data, flavor, lhs, operator, rhs) {
|
|
47
47
|
parser_1.parseLog.debug(`[binary op] trying to parse ${flavor}`);
|
|
48
48
|
({ flavor, lhs, rhs, operator } = (0, hooks_1.executeHook)(data.hooks.operators.onBinary.before, data, { flavor, lhs, operator, rhs }));
|
|
49
|
-
(0, meta_1.ensureChildrenAreLhsAndRhsOrdered)(
|
|
49
|
+
(0, meta_1.ensureChildrenAreLhsAndRhsOrdered)(lhs.content, rhs.content);
|
|
50
50
|
let parsedLhs = (0, structure_1.tryNormalizeSingleNode)(data, lhs);
|
|
51
51
|
let parsedRhs = (0, structure_1.tryNormalizeSingleNode)(data, rhs);
|
|
52
52
|
if (parsedLhs.type === "RDelimiter" /* RType.Delimiter */ || parsedRhs.type === "RDelimiter" /* RType.Delimiter */) {
|
|
53
53
|
throw new input_format_1.XmlParseError(`unexpected under-sided binary op, received ${JSON.stringify([parsedLhs, parsedRhs])} for ${JSON.stringify([lhs, operator, rhs])}`);
|
|
54
54
|
}
|
|
55
|
-
const operationName = (0, meta_1.retrieveOpName)(
|
|
55
|
+
const operationName = (0, meta_1.retrieveOpName)(operator);
|
|
56
56
|
// special support for strings in assignments
|
|
57
57
|
if (flavor === 'assignment') {
|
|
58
|
-
[parsedLhs, parsedRhs] = processLhsAndRhsForAssignment(
|
|
58
|
+
[parsedLhs, parsedRhs] = processLhsAndRhsForAssignment(operationName, parsedLhs, parsedRhs);
|
|
59
59
|
}
|
|
60
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
60
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(operator.content);
|
|
61
61
|
if (flavor === 'special') {
|
|
62
62
|
flavor = (0, special_1.identifySpecialOp)(content);
|
|
63
63
|
}
|
|
@@ -142,7 +142,7 @@ function parseBinaryOp(data, flavor, lhs, operator, rhs) {
|
|
|
142
142
|
}
|
|
143
143
|
return (0, hooks_1.executeHook)(data.hooks.operators.onBinary.after, data, result);
|
|
144
144
|
}
|
|
145
|
-
function processLhsAndRhsForAssignment(
|
|
145
|
+
function processLhsAndRhsForAssignment(opName, parsedLhs, parsedRhs) {
|
|
146
146
|
const isRhs = opName === '->' || opName === '->>';
|
|
147
147
|
const assigned = isRhs ? parsedRhs : parsedLhs;
|
|
148
148
|
if (assigned.type !== "RString" /* RType.String */) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RNode } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RNode } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Parses the construct as a {@link RUnaryOp} (automatically identifies the flavor).
|
|
6
6
|
*
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeUnary = void 0;
|
|
4
4
|
const meta_1 = require("../meta");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const structure_1 = require("../structure");
|
|
7
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
8
7
|
const model_1 = require("../../../../model");
|
|
9
8
|
const hooks_1 = require("../../hooks");
|
|
9
|
+
const parser_1 = require("../../../json/parser");
|
|
10
10
|
/**
|
|
11
11
|
* Parses the construct as a {@link RUnaryOp} (automatically identifies the flavor).
|
|
12
12
|
*
|
|
@@ -39,8 +39,8 @@ function parseUnaryOp(data, flavor, operator, operand) {
|
|
|
39
39
|
({ flavor, operator, operand } = (0, hooks_1.executeHook)(data.hooks.operators.onUnary.before, data, { flavor, operator, operand }));
|
|
40
40
|
const parsedOperand = (0, structure_1.tryNormalizeSingleNode)(data, operand);
|
|
41
41
|
(0, assert_1.guard)(parsedOperand.type !== "RDelimiter" /* RType.Delimiter */, () => 'unexpected under-sided unary op');
|
|
42
|
-
const operationName = (0, meta_1.retrieveOpName)(
|
|
43
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
42
|
+
const operationName = (0, meta_1.retrieveOpName)(operator);
|
|
43
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(operator.content);
|
|
44
44
|
const result = {
|
|
45
45
|
type: "RUnaryOp" /* RType.UnaryOp */,
|
|
46
46
|
flavor,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { RComment } from '../../../../model';
|
|
3
|
-
import { ParserData } from '../../data';
|
|
1
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { RComment } from '../../../../model';
|
|
3
|
+
import type { ParserData } from '../../data';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as an R comment.
|
|
6
6
|
* This requires you to check the corresponding name beforehand.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeComment = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const meta_1 = require("../meta");
|
|
6
5
|
const assert_1 = require("../../../../../../../util/assert");
|
|
7
6
|
const hooks_1 = require("../../hooks");
|
|
7
|
+
const parser_1 = require("../../../json/parser");
|
|
8
8
|
/**
|
|
9
9
|
* Normalize the given object as an R comment.
|
|
10
10
|
* This requires you to check the corresponding name beforehand.
|
|
@@ -15,7 +15,7 @@ const hooks_1 = require("../../hooks");
|
|
|
15
15
|
function normalizeComment(data, obj) {
|
|
16
16
|
parser_1.parseLog.debug('[comment]');
|
|
17
17
|
obj = (0, hooks_1.executeHook)(data.hooks.other.onComment.before, data, obj);
|
|
18
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
18
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
|
|
19
19
|
(0, assert_1.guard)(content.startsWith('#'), 'comment must start with #');
|
|
20
20
|
const result = {
|
|
21
21
|
type: "RComment" /* RType.Comment */,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { RComment, RLineDirective } from '../../../../model';
|
|
3
|
-
import { ParserData } from '../../data';
|
|
1
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { RComment, RLineDirective } from '../../../../model';
|
|
3
|
+
import type { ParserData } from '../../data';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as an R line directive (`#line <number> "<file>"`).
|
|
6
6
|
* This requires you to check the corresponding name beforehand.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeLineDirective = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const meta_1 = require("../meta");
|
|
6
5
|
const assert_1 = require("../../../../../../../util/assert");
|
|
7
6
|
const hooks_1 = require("../../hooks");
|
|
7
|
+
const parser_1 = require("../../../json/parser");
|
|
8
8
|
const LineDirectiveRegex = /^#line\s+(\d+)\s+"([^"]+)"\s*$/;
|
|
9
9
|
/**
|
|
10
10
|
* Normalize the given object as an R line directive (`#line <number> "<file>"`).
|
|
@@ -17,7 +17,7 @@ const LineDirectiveRegex = /^#line\s+(\d+)\s+"([^"]+)"\s*$/;
|
|
|
17
17
|
function normalizeLineDirective(data, obj) {
|
|
18
18
|
parser_1.parseLog.debug('[line-directive]');
|
|
19
19
|
obj = (0, hooks_1.executeHook)(data.hooks.other.onLineDirective.before, data, obj);
|
|
20
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
20
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
|
|
21
21
|
(0, assert_1.guard)(content.startsWith('#line'), 'line directive must start with #line');
|
|
22
22
|
const match = LineDirectiveRegex.exec(content);
|
|
23
23
|
let result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NamedXmlBasedJson, XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RNode } from '../../../../model';
|
|
4
|
-
import { RDelimiter } from '../../../../model/nodes/info';
|
|
1
|
+
import type { NamedXmlBasedJson, XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RNode } from '../../../../model';
|
|
4
|
+
import type { RDelimiter } from '../../../../model/nodes/info';
|
|
5
5
|
export declare function splitComments(mappedWithName: NamedXmlBasedJson[]): {
|
|
6
6
|
comments: NamedXmlBasedJson[];
|
|
7
7
|
others: NamedXmlBasedJson[];
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseNodesWithUnknownType = exports.normalizeBasedOnType = exports.splitComments = void 0;
|
|
4
4
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const meta_1 = require("../meta");
|
|
7
6
|
const single_element_1 = require("./single-element");
|
|
8
7
|
const values_1 = require("../values");
|
|
@@ -11,6 +10,7 @@ const loops_1 = require("../loops");
|
|
|
11
10
|
const control_1 = require("../control");
|
|
12
11
|
const log_1 = require("../../../../../../../util/log");
|
|
13
12
|
const other_1 = require("../other");
|
|
13
|
+
const parser_1 = require("../../../json/parser");
|
|
14
14
|
function normalizeMappedWithoutSemicolonBasedOnType(mappedWithName, data) {
|
|
15
15
|
if (mappedWithName.length === 1) {
|
|
16
16
|
return [(0, single_element_1.tryNormalizeSingleNode)(data, mappedWithName[0])];
|
|
@@ -103,14 +103,14 @@ function normalizeBasedOnType(data, obj) {
|
|
|
103
103
|
mappedWithName = obj;
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
mappedWithName = (0, meta_1.getWithTokenType)(
|
|
106
|
+
mappedWithName = (0, meta_1.getWithTokenType)(obj);
|
|
107
107
|
}
|
|
108
108
|
log_1.log.trace(`[parseBasedOnType] names: [${mappedWithName.map(({ name }) => name).join(', ')}]`);
|
|
109
109
|
const semiColons = [];
|
|
110
110
|
const splitOnSemicolon = (0, arrays_1.splitArrayOn)(mappedWithName, node => {
|
|
111
111
|
const res = node.name === ";" /* RawRType.Semicolon */;
|
|
112
112
|
if (res) {
|
|
113
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
113
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(node.content);
|
|
114
114
|
semiColons.push({
|
|
115
115
|
type: "RDelimiter" /* RType.Delimiter */,
|
|
116
116
|
subtype: ";" /* RawRType.Semicolon */,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RExpressionList } from '../../../../model';
|
|
1
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RExpressionList } from '../../../../model';
|
|
4
4
|
export declare function parseRootObjToAst(data: ParserData, obj: XmlBasedJson): RExpressionList;
|
|
@@ -7,12 +7,11 @@ const elements_1 = require("./elements");
|
|
|
7
7
|
const log_1 = require("../../../../../../../util/log");
|
|
8
8
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
9
9
|
function parseRootObjToAst(data, obj) {
|
|
10
|
-
const config = data.config;
|
|
11
10
|
const exprContent = (0, input_format_1.getKeysGuarded)(obj, "exprlist" /* RawRType.ExpressionList */);
|
|
12
|
-
(0, meta_1.assureTokenType)(
|
|
11
|
+
(0, meta_1.assureTokenType)(exprContent, "exprlist" /* RawRType.ExpressionList */);
|
|
13
12
|
let parsedChildren = [];
|
|
14
|
-
if (
|
|
15
|
-
const children = (0, input_format_1.getKeysGuarded)(exprContent,
|
|
13
|
+
if (input_format_1.childrenKey in exprContent) {
|
|
14
|
+
const children = (0, input_format_1.getKeysGuarded)(exprContent, input_format_1.childrenKey);
|
|
16
15
|
parsedChildren = (0, elements_1.normalizeBasedOnType)(data, children);
|
|
17
16
|
}
|
|
18
17
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RNode } from '../../../../model';
|
|
4
|
-
import { RDelimiter } from '../../../../model/nodes/info';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RNode } from '../../../../model';
|
|
4
|
+
import type { RDelimiter } from '../../../../model/nodes/info';
|
|
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,7 +10,7 @@ const other_1 = require("../other");
|
|
|
10
10
|
const loops_1 = require("../loops");
|
|
11
11
|
const line_directive_1 = require("../other/line-directive");
|
|
12
12
|
function normalizeDelimiter(data, elem) {
|
|
13
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
13
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(elem.content);
|
|
14
14
|
return {
|
|
15
15
|
type: "RDelimiter" /* RType.Delimiter */,
|
|
16
16
|
location,
|
|
@@ -52,7 +52,7 @@ function tryNormalizeSingleNode(data, elem) {
|
|
|
52
52
|
case "SYMBOL" /* RawRType.Symbol */:
|
|
53
53
|
case "SLOT" /* RawRType.Slot */:
|
|
54
54
|
case "NULL_CONST" /* RawRType.NullConst */: {
|
|
55
|
-
const symbol = (0, values_1.tryNormalizeSymbol)(data, (0, meta_1.getWithTokenType)(
|
|
55
|
+
const symbol = (0, values_1.tryNormalizeSymbol)(data, (0, meta_1.getWithTokenType)([elem.content]));
|
|
56
56
|
(0, assert_1.guard)(symbol !== undefined, () => `should have been parsed to a symbol but was ${JSON.stringify(symbol)}`);
|
|
57
57
|
return symbol;
|
|
58
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { RNa } from '../../../../../values';
|
|
3
|
-
import { RLogical, RSymbol, NoInfo, RNumber } from '../../../../model';
|
|
4
|
-
import { ParserData } from '../../data';
|
|
1
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { RNa } from '../../../../../values';
|
|
3
|
+
import type { RLogical, RSymbol, NoInfo, RNumber } from '../../../../model';
|
|
4
|
+
import type { ParserData } from '../../data';
|
|
5
5
|
/**
|
|
6
6
|
* Normalize the given object as a R number (see {@link number2ts}), supporting booleans (see {@link boolean2ts}),
|
|
7
7
|
* and special values.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeNumber = void 0;
|
|
4
4
|
const values_1 = require("../../../../../values");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const meta_1 = require("../meta");
|
|
7
6
|
const hooks_1 = require("../../hooks");
|
|
7
|
+
const parser_1 = require("../../../json/parser");
|
|
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.
|
|
@@ -16,7 +16,7 @@ const hooks_1 = require("../../hooks");
|
|
|
16
16
|
function normalizeNumber(data, obj) {
|
|
17
17
|
parser_1.parseLog.debug('[number]');
|
|
18
18
|
obj = (0, hooks_1.executeHook)(data.hooks.values.onNumber.before, data, obj);
|
|
19
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
19
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
|
|
20
20
|
const common = {
|
|
21
21
|
location,
|
|
22
22
|
lexeme: content,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { RString } from '../../../../model';
|
|
3
|
-
import { ParserData } from '../../data';
|
|
1
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { RString } from '../../../../model';
|
|
3
|
+
import type { ParserData } from '../../data';
|
|
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.
|