Builder for the FlowrAnalyzer, use it to configure all analysis aspects before creating the analyzer instance with .build() or .buildSync().

You can add new files and folders to analyze using the constructor or the .add() method.

const analyzer = new FlowrAnalyzerBuilder()
.add('file:///path/to/script.R')
.setParser(new TreeSitterExecutor())
.buildSync();

If you now want to get the dataflow information for the file, you can do this:

const dfInfo = await analyzer.dataflow();
console.log(dfInfo);

Constructors

Methods

  • Apply an amendment to the configuration the builder currently holds. Per default, the defaultConfigOptions are used.

    Parameters

    • func: (
          config: {
              abstractInterpretation: {
                  dataFrame: {
                      maxColNames: number;
                      readLoadedData: { maxReadLines: number; readExternalFiles: boolean };
                      wideningThreshold: number;
                  };
              };
              defaultEngine?: "r-shell"
              | "tree-sitter";
              engines: (
                  | { rPath?: string; type: "r-shell"; [key: string]: unknown }
                  | {
                      lax?: boolean;
                      treeSitterWasmPath?: string;
                      type: "tree-sitter";
                      wasmPath?: string;
                      [key: string]: unknown;
                  }
              )[];
              ignoreSourceCalls: boolean;
              semantics: {
                  environment: {
                      overwriteBuiltIns: {
                          definitions: (
                              | {
                                  assumePrimitive?: boolean;
                                  names: Identifier[];
                                  type: "constant";
                                  value: any;
                              }
                              | {
                                  assumePrimitive?: boolean;
                                  config?: unknown;
                                  evalHandler?: string;
                                  names: Identifier[];
                                  processor: any;
                                  type: "function";
                              }
                              | {
                                  assumePrimitive?: boolean;
                                  config: { readIndices: boolean };
                                  names: Identifier[];
                                  suffixes: ("<-" | "<<-")[];
                                  type: "replacement";
                              }
                          )[];
                          loadDefaults?: boolean;
                      };
                  };
              };
              solver: {
                  evalStrings: boolean;
                  pointerTracking: boolean
                  | { maxIndexCount: number };
                  resolveSource?: {
                      applyReplacements?: { [key: string]: string }[];
                      dropPaths: DropPathsOption;
                      ignoreCapitalization: boolean;
                      inferWorkingDirectory: InferWorkingDirectory;
                      repeatedSourceLimit?: number;
                      searchPath: string[];
                      [key: string]: unknown;
                  };
                  slicer?: { threshold?: number };
                  variables: VariableResolve;
              };
              [key: string]: unknown;
          },
      ) => void
      | FlowrConfigOptions

      Receives the current configuration of the builder and allows for amendment.

    Returns this