@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,5 +1,5 @@
|
|
|
1
|
-
import { Leaf, Location, Namespace, NoInfo } from '../model';
|
|
2
|
-
import { RType } from '../type';
|
|
1
|
+
import type { Leaf, Location, Namespace, NoInfo } from '../model';
|
|
2
|
+
import type { RType } from '../type';
|
|
3
3
|
export declare function isSpecialSymbol(symbol: RSymbol): boolean;
|
|
4
4
|
export interface RSymbol<Info = NoInfo, T extends string = string> extends Leaf<Info>, Namespace, Location {
|
|
5
5
|
readonly type: RType.Symbol;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Base, Location, NoInfo, RNode } from '../model';
|
|
2
|
-
import { RType } from '../type';
|
|
3
|
-
import { UnaryOperatorFlavor } from '../operators';
|
|
1
|
+
import type { Base, Location, NoInfo, RNode } from '../model';
|
|
2
|
+
import type { RType } from '../type';
|
|
3
|
+
import type { UnaryOperatorFlavor } from '../operators';
|
|
4
4
|
export interface RUnaryOp<Info = NoInfo> extends Base<Info>, Location {
|
|
5
5
|
readonly type: RType.UnaryOp;
|
|
6
6
|
readonly flavor: UnaryOperatorFlavor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Base, Location, NoInfo, RNode } from '../model';
|
|
2
|
-
import { RType } from '../type';
|
|
3
|
-
import { RExpressionList } from './r-expression-list';
|
|
1
|
+
import type { Base, Location, NoInfo, RNode } from '../model';
|
|
2
|
+
import type { RType } from '../type';
|
|
3
|
+
import type { RExpressionList } from './r-expression-list';
|
|
4
4
|
/**
|
|
5
5
|
* ```ts
|
|
6
6
|
* while ( <condition> ) <body>
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
import { NoInfo, RNode } from '../model';
|
|
11
|
+
import type { NoInfo, RNode } from '../model';
|
|
12
|
+
import type { SourceRange } from '../../../../../util/range';
|
|
12
13
|
import { BiMap } from '../../../../../util/bimap';
|
|
13
|
-
import { MergeableRecord } from '../../../../../util/objects';
|
|
14
|
+
import type { MergeableRecord } from '../../../../../util/objects';
|
|
14
15
|
import { RoleInParent } from './role';
|
|
15
16
|
/** The type of the id assigned to each node. Branded to avoid problematic usages with other string types. */
|
|
16
17
|
export type NodeId = string & {
|
|
@@ -27,6 +28,7 @@ export type IdGenerator<OtherInfo> = (data: RNode<OtherInfo>) => NodeId;
|
|
|
27
28
|
* The simplest id generator which just increments a number on each call.
|
|
28
29
|
*/
|
|
29
30
|
export declare function deterministicCountingIdGenerator(start?: number): () => NodeId;
|
|
31
|
+
export declare function sourcedDeterministicCountingIdGenerator(path: string, location: SourceRange, start?: number): () => NodeId;
|
|
30
32
|
/**
|
|
31
33
|
* Generates the location id, used by {@link deterministicLocationIdGenerator}.
|
|
32
34
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.decorateAst = exports.deterministicLocationIdGenerator = exports.nodeToLocationId = exports.deterministicCountingIdGenerator = void 0;
|
|
13
|
+
exports.decorateAst = exports.deterministicLocationIdGenerator = exports.nodeToLocationId = exports.sourcedDeterministicCountingIdGenerator = exports.deterministicCountingIdGenerator = void 0;
|
|
14
14
|
const assert_1 = require("../../../../../util/assert");
|
|
15
15
|
const bimap_1 = require("../../../../../util/bimap");
|
|
16
16
|
const fold_1 = require("./fold");
|
|
@@ -22,6 +22,11 @@ function deterministicCountingIdGenerator(start = 0) {
|
|
|
22
22
|
return () => `${id++}`;
|
|
23
23
|
}
|
|
24
24
|
exports.deterministicCountingIdGenerator = deterministicCountingIdGenerator;
|
|
25
|
+
function sourcedDeterministicCountingIdGenerator(path, location, start = 0) {
|
|
26
|
+
let id = start;
|
|
27
|
+
return () => `${path}-${loc2Id(location)}-${id++}`;
|
|
28
|
+
}
|
|
29
|
+
exports.sourcedDeterministicCountingIdGenerator = sourcedDeterministicCountingIdGenerator;
|
|
25
30
|
function loc2Id(loc) {
|
|
26
31
|
return `${loc.start.line}:${loc.start.column}-${loc.end.line}:${loc.end.column}`;
|
|
27
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
2
|
-
import { RNode } from '../model';
|
|
3
|
-
import { StatefulFoldFunctions } from './stateful-fold';
|
|
1
|
+
import type { DeepReadonly } from 'ts-essentials';
|
|
2
|
+
import type { RNode } from '../model';
|
|
3
|
+
import type { StatefulFoldFunctions } from './stateful-fold';
|
|
4
4
|
export type FoldFunctions<Info, Out> = Omit<StatefulFoldFunctions<Info, undefined, Out>, 'down'>;
|
|
5
5
|
/**
|
|
6
6
|
* Folds in old functional-fashion over the AST structure.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DecoratedAstMap, RNodeWithParent } from './decorate';
|
|
1
|
+
import type { DecoratedAstMap, RNodeWithParent } from './decorate';
|
|
2
2
|
/**
|
|
3
3
|
* Describes the role of the node in its parent. For example,
|
|
4
4
|
* if we have `if(TRUE) { ... }`, the role of the `TRUE` node is `IfCondition`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
2
|
-
import { RExpressionList, RNumber, RSymbol, RLogical, RString, RArithmeticBinaryOp, RAssignmentOp, RComparisonBinaryOp, RLogicalBinaryOp, RArithmeticUnaryOp, RLogicalUnaryOp, RIfThenElse, RForLoop, RRepeatLoop, RWhileLoop, RFunctionCall, RComment, RNext, RBreak, RParameter, RArgument, RFunctionDefinition, RAccess, RModelFormulaBinaryOp, RModelFormulaUnaryOp, RLineDirective, RPipe } from '../nodes';
|
|
3
|
-
import { RNode } from '../model';
|
|
1
|
+
import type { DeepReadonly } from 'ts-essentials';
|
|
2
|
+
import type { RExpressionList, RNumber, RSymbol, RLogical, RString, RArithmeticBinaryOp, RAssignmentOp, RComparisonBinaryOp, RLogicalBinaryOp, RArithmeticUnaryOp, RLogicalUnaryOp, RIfThenElse, RForLoop, RRepeatLoop, RWhileLoop, RFunctionCall, RComment, RNext, RBreak, RParameter, RArgument, RFunctionDefinition, RAccess, RModelFormulaBinaryOp, RModelFormulaUnaryOp, RLineDirective, RPipe } from '../nodes';
|
|
3
|
+
import type { RNode } from '../model';
|
|
4
4
|
/**
|
|
5
5
|
* Called during the down-pass, will pe propagated to children and used in the up-pass (see {@link StatefulFoldFunctions}).
|
|
6
6
|
* <p>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NoInfo, RNode } from '../model';
|
|
1
|
+
import type { NoInfo, RNode } from '../model';
|
|
2
2
|
/** Return `true` to stop visiting from this node (i.e., do not continue to visit this node *and* the children) */
|
|
3
3
|
export type OnEnter<OtherInfo> = (node: RNode<OtherInfo>) => (boolean | void);
|
|
4
4
|
/** Similar to {@link OnEnter} but called when leaving a node. Can't stop exploration as the subtree is already visited! */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const RootId = 0;
|
|
2
|
+
export interface Entry extends Record<string, unknown> {
|
|
3
|
+
line1: number;
|
|
4
|
+
col1: number;
|
|
5
|
+
line2: number;
|
|
6
|
+
col2: number;
|
|
7
|
+
id: number;
|
|
8
|
+
parent: number;
|
|
9
|
+
token: string;
|
|
10
|
+
terminal: boolean;
|
|
11
|
+
text: string;
|
|
12
|
+
children?: Entry[];
|
|
13
|
+
}
|
|
14
|
+
export declare function prepareParsedData(data: string): Map<number, Entry>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareParsedData = exports.RootId = void 0;
|
|
4
|
+
const retriever_1 = require("../../../../retriever");
|
|
5
|
+
const assert_1 = require("../../../../../util/assert");
|
|
6
|
+
exports.RootId = 0;
|
|
7
|
+
function prepareParsedData(data) {
|
|
8
|
+
const json = JSON.parse(data);
|
|
9
|
+
(0, assert_1.guard)(Array.isArray(json), () => `Expected ${data} to be an array but was not`);
|
|
10
|
+
const ret = new Map(json.map(([line1, col1, line2, col2, id, parent, token, terminal, text]) => {
|
|
11
|
+
return [id, { line1, col1, line2, col2, id, parent, token: (0, retriever_1.removeRQuotes)(token), terminal, text }];
|
|
12
|
+
}));
|
|
13
|
+
// iterate a second time to set parent-child relations (since they may be out of order in the csv)
|
|
14
|
+
for (const entry of ret.values()) {
|
|
15
|
+
if (entry.parent != exports.RootId) {
|
|
16
|
+
const parent = ret.get(entry.parent);
|
|
17
|
+
if (parent) {
|
|
18
|
+
parent.children ??= [];
|
|
19
|
+
parent.children.push(entry);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return ret;
|
|
24
|
+
}
|
|
25
|
+
exports.prepareParsedData = prepareParsedData;
|
|
26
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DeepPartial } from 'ts-essentials';
|
|
2
|
+
import type { XmlBasedJson, XmlParserHooks } from '../xml';
|
|
3
|
+
import type { IdGenerator, NoInfo, NormalizedAst } from '../../model';
|
|
4
|
+
import type { Entry } from './format';
|
|
5
|
+
export declare const parseLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
6
|
+
export declare function normalize(jsonString: string, hooks?: DeepPartial<XmlParserHooks>, getId?: IdGenerator<NoInfo>): NormalizedAst;
|
|
7
|
+
export declare function convertPreparedParsedData(valueMapping: Map<number, Entry>): XmlBasedJson;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertPreparedParsedData = exports.normalize = exports.parseLog = void 0;
|
|
4
|
+
const xml_1 = require("../xml");
|
|
5
|
+
const model_1 = require("../../model");
|
|
6
|
+
const objects_1 = require("../../../../../util/objects");
|
|
7
|
+
const format_1 = require("./format");
|
|
8
|
+
const internal_1 = require("../xml/internal");
|
|
9
|
+
const log_1 = require("../../../../../util/log");
|
|
10
|
+
exports.parseLog = log_1.log.getSubLogger({ name: 'ast-parser' });
|
|
11
|
+
function normalize(jsonString, hooks, getId = (0, model_1.deterministicCountingIdGenerator)(0)) {
|
|
12
|
+
const hooksWithDefaults = (0, objects_1.deepMergeObject)(xml_1.DEFAULT_PARSER_HOOKS, hooks);
|
|
13
|
+
const data = { hooks: hooksWithDefaults, currentRange: undefined, currentLexeme: undefined };
|
|
14
|
+
const object = convertPreparedParsedData((0, format_1.prepareParsedData)(jsonString));
|
|
15
|
+
return (0, model_1.decorateAst)((0, internal_1.parseRootObjToAst)(data, object), getId);
|
|
16
|
+
}
|
|
17
|
+
exports.normalize = normalize;
|
|
18
|
+
function convertPreparedParsedData(valueMapping) {
|
|
19
|
+
const exprlist = {};
|
|
20
|
+
exprlist[xml_1.nameKey] = 'exprlist';
|
|
21
|
+
const children = [];
|
|
22
|
+
for (const entry of valueMapping.values()) {
|
|
23
|
+
if (entry.parent == format_1.RootId) {
|
|
24
|
+
children.push(convertEntry(entry));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exprlist[xml_1.childrenKey] = children;
|
|
28
|
+
return { 'exprlist': exprlist };
|
|
29
|
+
}
|
|
30
|
+
exports.convertPreparedParsedData = convertPreparedParsedData;
|
|
31
|
+
function convertEntry(csvEntry) {
|
|
32
|
+
const xmlEntry = {};
|
|
33
|
+
xmlEntry[xml_1.attributesKey] = {
|
|
34
|
+
'line1': csvEntry.line1,
|
|
35
|
+
'col1': csvEntry.col1,
|
|
36
|
+
'line2': csvEntry.line2,
|
|
37
|
+
'col2': csvEntry.col2
|
|
38
|
+
};
|
|
39
|
+
xmlEntry[xml_1.nameKey] = csvEntry.token;
|
|
40
|
+
if (csvEntry.text) {
|
|
41
|
+
xmlEntry[xml_1.contentKey] = csvEntry.text;
|
|
42
|
+
}
|
|
43
|
+
// check and recursively iterate children
|
|
44
|
+
if (csvEntry.children && csvEntry.children.length > 0) {
|
|
45
|
+
xmlEntry[xml_1.childrenKey] = csvEntry.children
|
|
46
|
+
// we sort children the same way xmlparsedata does (by line, by column, by inverse end line, by inverse end column, by terminal state, by combined "start" tiebreaker value)
|
|
47
|
+
// (https://github.com/r-lib/xmlparsedata/blob/main/R/package.R#L153C72-L153C78)
|
|
48
|
+
.sort((c1, c2) => c1.line1 - c2.line1 || c1.col1 - c2.col1 || c2.line2 - c1.line2 || c2.col2 - c1.col2 || Number(c1.terminal) - Number(c2.terminal) || sortTiebreak(c1) - sortTiebreak(c2))
|
|
49
|
+
.map(convertEntry);
|
|
50
|
+
}
|
|
51
|
+
return xmlEntry;
|
|
52
|
+
}
|
|
53
|
+
function sortTiebreak(entry) {
|
|
54
|
+
// see https://github.com/r-lib/xmlparsedata/blob/main/R/package.R#L110C5-L110C11
|
|
55
|
+
return entry.line1 * (Math.max(entry.col1, entry.col2) + 1) + entry.col1;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { MergeableRecord } from '../../../../../util/objects';
|
|
2
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SourceRange } from '../../../../../util/range';
|
|
1
|
+
import type { MergeableRecord } from '../../../../../util/objects';
|
|
2
|
+
import type { DeepReadonly } from 'ts-essentials';
|
|
3
|
+
import type { XmlParserHooks } from './hooks';
|
|
4
|
+
import type { SourceRange } from '../../../../../util/range';
|
|
6
5
|
/**
|
|
7
6
|
* Contains all information populated and present during parsing and normalization of the R AST.
|
|
8
7
|
*/
|
|
9
8
|
export interface ParserData extends MergeableRecord {
|
|
10
|
-
/** @see XmlParserConfig */
|
|
11
|
-
readonly config: DeepReadonly<XmlParserConfig>;
|
|
12
9
|
/** @see XmlParserHooks */
|
|
13
10
|
readonly hooks: DeepReadonly<XmlParserHooks>;
|
|
14
11
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NamedXmlBasedJson, XmlBasedJson } from './input-format';
|
|
2
|
-
import { RNumber, NoInfo, RBinaryOp, RComment, RForLoop, RFunctionCall, RIfThenElse, RNode, RRepeatLoop, RString, RUnaryOp, RWhileLoop, RSymbol, RLogical, BinaryOperatorFlavor, RParameter, RFunctionDefinition, RArgument, UnaryOperatorFlavor, RBreak, RNext, RAccess, RLineDirective, RPipe } from '../../model';
|
|
3
|
-
import { RNa } from '../../../values';
|
|
4
|
-
import { ParserData } from './data';
|
|
5
|
-
import { DeepReadonly, DeepRequired } from 'ts-essentials';
|
|
1
|
+
import type { NamedXmlBasedJson, XmlBasedJson } from './input-format';
|
|
2
|
+
import type { RNumber, NoInfo, RBinaryOp, RComment, RForLoop, RFunctionCall, RIfThenElse, RNode, RRepeatLoop, RString, RUnaryOp, RWhileLoop, RSymbol, RLogical, BinaryOperatorFlavor, RParameter, RFunctionDefinition, RArgument, UnaryOperatorFlavor, RBreak, RNext, RAccess, RLineDirective, RPipe } from '../../model';
|
|
3
|
+
import type { RNa } from '../../../values';
|
|
4
|
+
import type { ParserData } from './data';
|
|
5
|
+
import type { DeepReadonly, DeepRequired } from 'ts-essentials';
|
|
6
6
|
/** Denotes that if you return `undefined`, the parser will automatically take the original arguments (unchanged) */
|
|
7
7
|
type AutoIfOmit<T> = T | undefined | void;
|
|
8
8
|
/**
|
|
@@ -16,7 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./data"), exports);
|
|
18
18
|
__exportStar(require("./hooks"), exports);
|
|
19
|
-
__exportStar(require("./config"), exports);
|
|
20
|
-
__exportStar(require("./parser"), exports);
|
|
21
19
|
__exportStar(require("./input-format"), exports);
|
|
22
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { RawRType } from '../../model';
|
|
1
|
+
import type { RawRType } from '../../model';
|
|
2
|
+
export declare const attributesKey = "a";
|
|
3
|
+
export declare const childrenKey = "c";
|
|
4
|
+
export declare const contentKey = "@";
|
|
5
|
+
export declare const nameKey = "#";
|
|
2
6
|
/**
|
|
3
7
|
* Thrown if the given input xml is not valid/contains unexpected elements.
|
|
4
8
|
*/
|
|
@@ -29,4 +33,4 @@ export interface NamedXmlBasedJson {
|
|
|
29
33
|
* @typeParam T - the type of the values to retrieve. Note, that this type is not checked at runtime.
|
|
30
34
|
*/
|
|
31
35
|
export declare function getKeysGuarded<T extends XmlBasedJsonValue>(obj: XmlBasedJson, key: string): T;
|
|
32
|
-
export declare function getKeysGuarded<T extends XmlBasedJsonValue>(obj: XmlBasedJson, ...key: string[]): Record<string, T>;
|
|
36
|
+
export declare function getKeysGuarded<T extends XmlBasedJsonValue>(obj: XmlBasedJson, ...key: readonly string[]): Record<string, T>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getKeysGuarded = exports.XmlParseError = void 0;
|
|
3
|
+
exports.getKeysGuarded = exports.XmlParseError = exports.nameKey = exports.contentKey = exports.childrenKey = exports.attributesKey = void 0;
|
|
4
|
+
exports.attributesKey = 'a';
|
|
5
|
+
exports.childrenKey = 'c';
|
|
6
|
+
exports.contentKey = '@';
|
|
7
|
+
exports.nameKey = '#';
|
|
4
8
|
/**
|
|
5
9
|
* Thrown if the given input xml is not valid/contains unexpected elements.
|
|
6
10
|
*/
|
|
@@ -12,19 +16,12 @@ class XmlParseError extends Error {
|
|
|
12
16
|
}
|
|
13
17
|
exports.XmlParseError = XmlParseError;
|
|
14
18
|
function getKeysGuarded(obj, ...key) {
|
|
15
|
-
const keys = Object.keys(obj);
|
|
16
|
-
const check = (key) => {
|
|
17
|
-
if (!keys.includes(key)) {
|
|
18
|
-
throw new XmlParseError(`expected obj to have key ${key}, yet received ${JSON.stringify(obj)}`);
|
|
19
|
-
}
|
|
20
|
-
return obj[key];
|
|
21
|
-
};
|
|
22
19
|
if (key.length === 1) {
|
|
23
|
-
return
|
|
20
|
+
return obj[key[0]];
|
|
24
21
|
}
|
|
25
22
|
else {
|
|
26
23
|
return key.reduce((acc, key) => {
|
|
27
|
-
acc[key] =
|
|
24
|
+
acc[key] = obj[key];
|
|
28
25
|
return acc;
|
|
29
26
|
}, {});
|
|
30
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../input-format';
|
|
2
|
-
import { ParserData } from '../data';
|
|
3
|
-
import { RAccess } from '../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../input-format';
|
|
2
|
+
import type { ParserData } from '../data';
|
|
3
|
+
import type { RAccess } from '../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Tries to normalize the given data as access (e.g., indexing).
|
|
6
6
|
*
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeAccess = void 0;
|
|
4
4
|
const meta_1 = require("./meta");
|
|
5
|
-
const parser_1 = require("../parser");
|
|
6
5
|
const hooks_1 = require("../hooks");
|
|
7
6
|
const structure_1 = require("./structure");
|
|
8
7
|
const assert_1 = require("../../../../../../util/assert");
|
|
9
8
|
const arrays_1 = require("../../../../../../util/arrays");
|
|
10
9
|
const argument_1 = require("./functions/argument");
|
|
10
|
+
const parser_1 = require("../../json/parser");
|
|
11
11
|
/**
|
|
12
12
|
* Tries to normalize the given data as access (e.g., indexing).
|
|
13
13
|
*
|
|
@@ -75,7 +75,7 @@ function tryNormalizeAccess(data, mappedWithName) {
|
|
|
75
75
|
(0, assert_1.guard)(first !== null && (first.type === "RSymbol" /* RType.Symbol */ || first.type === "RString" /* RType.String */ || first.type === "RLogical" /* RType.Logical */), () => `${JSON.stringify(operator)} requires one symbol, yet received ${JSON.stringify(parsedAccess)}`);
|
|
76
76
|
resultingAccess = first.type === "RString" /* RType.String */ ? first.content.str : first.lexeme;
|
|
77
77
|
}
|
|
78
|
-
const { content, location } = (0, meta_1.retrieveMetaStructure)(
|
|
78
|
+
const { content, location } = (0, meta_1.retrieveMetaStructure)(accessOp.content);
|
|
79
79
|
const result = {
|
|
80
80
|
type: "RAccess" /* RType.Access */,
|
|
81
81
|
location,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RIfThenElse } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RIfThenElse } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Try to parse the construct as a {@link RIfThenElse}.
|
|
6
6
|
*/
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeIfThenElse = void 0;
|
|
4
4
|
const structure_1 = require("../structure");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const if_then_1 = require("./if-then");
|
|
7
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
8
7
|
const hooks_1 = require("../../hooks");
|
|
9
8
|
const meta_1 = require("../meta");
|
|
9
|
+
const parser_1 = require("../../../json/parser");
|
|
10
10
|
/**
|
|
11
11
|
* Try to parse the construct as a {@link RIfThenElse}.
|
|
12
12
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RIfThenElse } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RIfThenElse } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Try to parse the construct as a {@link RIfThenElse}.
|
|
6
6
|
*/
|
|
@@ -4,8 +4,8 @@ exports.tryNormalizeIfThen = void 0;
|
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
5
|
const structure_1 = require("../structure");
|
|
6
6
|
const meta_1 = require("../meta");
|
|
7
|
-
const parser_1 = require("../../parser");
|
|
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 RIfThenElse}.
|
|
11
11
|
*/
|
|
@@ -27,7 +27,7 @@ function tryNormalizeIfThen(data, tokens) {
|
|
|
27
27
|
if (parsedCondition.type === "RDelimiter" /* RType.Delimiter */ || parsedThen.type === "RDelimiter" /* RType.Delimiter */) {
|
|
28
28
|
throw new input_format_1.XmlParseError(`unexpected missing parts of if, received ${JSON.stringify([parsedCondition, parsedThen])} for ${JSON.stringify(tokens)}`);
|
|
29
29
|
}
|
|
30
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
30
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(tokens[0].content);
|
|
31
31
|
const result = {
|
|
32
32
|
type: "RIfThenElse" /* RType.IfThenElse */,
|
|
33
33
|
condition: parsedCondition,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { XmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RNode } from '../../../../model';
|
|
1
|
+
import type { XmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RNode } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Returns an expression list if there are multiple children, otherwise returns the single child directly with no expr wrapper
|
|
6
6
|
*
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeExpression = 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 functions_1 = require("../functions");
|
|
9
8
|
const hooks_1 = require("../../hooks");
|
|
10
9
|
const access_1 = require("../access");
|
|
11
10
|
const other_1 = require("../other");
|
|
12
11
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
12
|
+
const parser_1 = require("../../../json/parser");
|
|
13
13
|
/**
|
|
14
14
|
* Returns an expression list if there are multiple children, otherwise returns the single child directly with no expr wrapper
|
|
15
15
|
*
|
|
@@ -19,9 +19,9 @@ const arrays_1 = require("../../../../../../../util/arrays");
|
|
|
19
19
|
function normalizeExpression(data, obj) {
|
|
20
20
|
parser_1.parseLog.debug('Parsing expr');
|
|
21
21
|
obj = (0, hooks_1.executeHook)(data.hooks.expression.onExpression.before, data, obj);
|
|
22
|
-
const { unwrappedObj, content, location } = (0, meta_1.retrieveMetaStructure)(
|
|
23
|
-
const childrenSource = (0, input_format_1.getKeysGuarded)(unwrappedObj,
|
|
24
|
-
const typed = (0, meta_1.getWithTokenType)(
|
|
22
|
+
const { unwrappedObj, content, location } = (0, meta_1.retrieveMetaStructure)(obj);
|
|
23
|
+
const childrenSource = (0, input_format_1.getKeysGuarded)(unwrappedObj, input_format_1.childrenKey);
|
|
24
|
+
const typed = (0, meta_1.getWithTokenType)(childrenSource);
|
|
25
25
|
const { others, comments } = (0, structure_1.splitComments)(typed);
|
|
26
26
|
const childData = { ...data, currentRange: location, currentLexeme: content };
|
|
27
27
|
const maybeFunctionCall = (0, functions_1.tryNormalizeFunctionCall)(childData, others);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { RArgument } from '../../../../model';
|
|
3
|
-
import { ParserData } from '../../data';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { RArgument } from '../../../../model';
|
|
3
|
+
import type { ParserData } from '../../data';
|
|
4
4
|
/**
|
|
5
5
|
* Either parses `[expr]` or `[SYMBOL_SUB, EQ_SUB, expr]` as an argument of a function call in R.
|
|
6
6
|
* Probably directly called by the function call parser as otherwise, we do not expect to find arguments.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryToNormalizeArgument = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const meta_1 = require("../meta");
|
|
6
5
|
const hooks_1 = require("../../hooks");
|
|
7
6
|
const log_1 = require("../../../../../../../util/log");
|
|
8
7
|
const assert_1 = require("../../../../../../../util/assert");
|
|
9
8
|
const structure_1 = require("../structure");
|
|
9
|
+
const parser_1 = require("../../../json/parser");
|
|
10
10
|
/**
|
|
11
11
|
* Either parses `[expr]` or `[SYMBOL_SUB, EQ_SUB, expr]` as an argument of a function call in R.
|
|
12
12
|
* Probably directly called by the function call parser as otherwise, we do not expect to find arguments.
|
|
@@ -24,7 +24,7 @@ function tryToNormalizeArgument(data, objs) {
|
|
|
24
24
|
return (0, hooks_1.executeUnknownHook)(data.hooks.functions.onArgument.unknown, data, objs);
|
|
25
25
|
}
|
|
26
26
|
const symbolOrExpr = objs[0];
|
|
27
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
27
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(symbolOrExpr.content);
|
|
28
28
|
let parsedValue;
|
|
29
29
|
let name;
|
|
30
30
|
if (symbolOrExpr.name === "expr" /* RawRType.Expression */) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { ParserData } from '../../data';
|
|
3
|
-
import { RFunctionCall, RNext, RBreak } from '../../../../model';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { ParserData } from '../../data';
|
|
3
|
+
import type { RFunctionCall, RNext, RBreak } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Tries to parse the given data as a function call.
|
|
6
6
|
*
|
|
@@ -5,11 +5,11 @@ const input_format_1 = require("../../input-format");
|
|
|
5
5
|
const assert_1 = require("../../../../../../../util/assert");
|
|
6
6
|
const meta_1 = require("../meta");
|
|
7
7
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
8
|
-
const parser_1 = require("../../parser");
|
|
9
8
|
const values_1 = require("../values");
|
|
10
9
|
const hooks_1 = require("../../hooks");
|
|
11
10
|
const argument_1 = require("./argument");
|
|
12
11
|
const expression_1 = require("../expression");
|
|
12
|
+
const parser_1 = require("../../../json/parser");
|
|
13
13
|
/**
|
|
14
14
|
* Tries to parse the given data as a function call.
|
|
15
15
|
*
|
|
@@ -31,10 +31,10 @@ function tryNormalizeFunctionCall(data, mappedWithName) {
|
|
|
31
31
|
}
|
|
32
32
|
parser_1.parseLog.trace('trying to parse function call');
|
|
33
33
|
mappedWithName = (0, hooks_1.executeHook)(data.hooks.functions.onFunctionCall.before, data, mappedWithName);
|
|
34
|
-
const { unwrappedObj, content, location } = (0, meta_1.retrieveMetaStructure)(
|
|
35
|
-
const symbolContent = (0, input_format_1.getKeysGuarded)(unwrappedObj,
|
|
34
|
+
const { unwrappedObj, content, location } = (0, meta_1.retrieveMetaStructure)(fnBase.content);
|
|
35
|
+
const symbolContent = (0, input_format_1.getKeysGuarded)(unwrappedObj, input_format_1.childrenKey);
|
|
36
36
|
let result;
|
|
37
|
-
const namedSymbolContent = (0, meta_1.getWithTokenType)(
|
|
37
|
+
const namedSymbolContent = (0, meta_1.getWithTokenType)(symbolContent);
|
|
38
38
|
if (namedSymbolContent.length === 1 && namedSymbolContent[0].name === "STR_CONST" /* RawRType.StringConst */) {
|
|
39
39
|
// special handling when someone calls a function by string
|
|
40
40
|
result = parseNamedFunctionCall(data, namedSymbolContent, mappedWithName, location, content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParserData } from '../../data';
|
|
2
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
3
|
-
import { RFunctionDefinition } from '../../../../model';
|
|
1
|
+
import type { ParserData } from '../../data';
|
|
2
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
|
+
import type { RFunctionDefinition } from '../../../../model';
|
|
4
4
|
/**
|
|
5
5
|
* Tries to parse the given data as a function definition.
|
|
6
6
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeFunctionDefinition = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const hooks_1 = require("../../hooks");
|
|
6
5
|
const meta_1 = require("../meta");
|
|
7
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
@@ -9,6 +8,7 @@ const arrays_1 = require("../../../../../../../util/arrays");
|
|
|
9
8
|
const structure_1 = require("../structure");
|
|
10
9
|
const parameter_1 = require("./parameter");
|
|
11
10
|
const log_1 = require("../../../../../../../util/log");
|
|
11
|
+
const parser_1 = require("../../../json/parser");
|
|
12
12
|
/**
|
|
13
13
|
* Tries to parse the given data as a function definition.
|
|
14
14
|
*
|
|
@@ -25,7 +25,7 @@ function tryNormalizeFunctionDefinition(data, mappedWithName) {
|
|
|
25
25
|
}
|
|
26
26
|
parser_1.parseLog.trace('trying to parse function definition');
|
|
27
27
|
mappedWithName = (0, hooks_1.executeHook)(data.hooks.functions.onFunctionDefinition.before, data, mappedWithName);
|
|
28
|
-
const { content, location } = (0, meta_1.retrieveMetaStructure)(
|
|
28
|
+
const { content, location } = (0, meta_1.retrieveMetaStructure)(fnBase.content);
|
|
29
29
|
const openParen = mappedWithName[1];
|
|
30
30
|
(0, assert_1.guard)(openParen.name === "(" /* RawRType.ParenLeft */, () => `expected opening parenthesis, yet received ${openParen.name}`);
|
|
31
31
|
const closingParenIndex = mappedWithName.findIndex(x => x.name === ")" /* RawRType.ParenRight */);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
-
import { RParameter } from '../../../../model';
|
|
3
|
-
import { ParserData } from '../../data';
|
|
1
|
+
import type { NamedXmlBasedJson } from '../../input-format';
|
|
2
|
+
import type { RParameter } from '../../../../model';
|
|
3
|
+
import type { ParserData } from '../../data';
|
|
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.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeParameter = void 0;
|
|
4
|
-
const parser_1 = require("../../parser");
|
|
5
4
|
const meta_1 = require("../meta");
|
|
6
5
|
const hooks_1 = require("../../hooks");
|
|
7
6
|
const log_1 = require("../../../../../../../util/log");
|
|
8
7
|
const assert_1 = require("../../../../../../../util/assert");
|
|
9
8
|
const structure_1 = require("../structure");
|
|
9
|
+
const parser_1 = require("../../../json/parser");
|
|
10
10
|
/**
|
|
11
11
|
* Either parses `[SYMBOL_FORMALS]` or `[SYMBOL_FORMALS, EQ_FORMALS, expr]` as a parameter of a function definition in R.
|
|
12
12
|
* Probably directly called by the function definition parser as otherwise, we do not expect to find parameters.
|
|
@@ -29,7 +29,7 @@ function tryNormalizeParameter(data, objs) {
|
|
|
29
29
|
return (0, hooks_1.executeUnknownHook)(data.hooks.functions.onParameter.unknown, data, objs);
|
|
30
30
|
}
|
|
31
31
|
const defaultValue = objs.length === 3 ? parseWithDefaultValue(data, objs) : undefined;
|
|
32
|
-
const { location, content } = (0, meta_1.retrieveMetaStructure)(
|
|
32
|
+
const { location, content } = (0, meta_1.retrieveMetaStructure)(symbol.content);
|
|
33
33
|
const result = {
|
|
34
34
|
type: "RParameter" /* RType.Parameter */,
|
|
35
35
|
location,
|
|
@@ -23,5 +23,4 @@ __exportStar(require("./operators"), exports);
|
|
|
23
23
|
__exportStar(require("./structure"), exports);
|
|
24
24
|
__exportStar(require("./expression"), exports);
|
|
25
25
|
__exportStar(require("./meta"), exports);
|
|
26
|
-
__exportStar(require("./xml-to-json"), exports);
|
|
27
26
|
//# sourceMappingURL=index.js.map
|