From 1a648029168f98a795112869f7620f85673ffa8f Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Thu, 29 Feb 2024 15:47:31 +0000 Subject: [PATCH] Add function to parse orderly script details from AST --- DESCRIPTION | 4 ++-- NAMESPACE | 1 + R/read.R | 16 ++++++++++++++++ man/orderly_build_script_details.Rd | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 man/orderly_build_script_details.Rd diff --git a/DESCRIPTION b/DESCRIPTION index f31a2101..131cf5a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: orderly2 Title: Orderly Next Generation -Version: 1.99.12 +Version: 1.99.13 Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), email = "rich.fitzjohn@gmail.com"), person("Robert", "Ashton", role = "aut"), @@ -11,7 +11,7 @@ Description: Reimplementation of orderly based on outpack. License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 URL: https://github.com/mrc-ide/orderly2 BugReports: https://github.com/mrc-ide/orderly2/issues Imports: diff --git a/NAMESPACE b/NAMESPACE index 1b22cabf..a2c36248 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,7 @@ S3method(format,orderly_query) S3method(print,orderly_cleanup_status) S3method(print,orderly_query_explain) export(orderly_artefact) +export(orderly_build_script_details) export(orderly_cleanup) export(orderly_cleanup_status) export(orderly_config) diff --git a/R/read.R b/R/read.R index 3faa6edf..d54c7a3d 100644 --- a/R/read.R +++ b/R/read.R @@ -6,6 +6,22 @@ orderly_read <- function(path, call = NULL) { orderly_read_r <- function(path, entrypoint_filename) { exprs <- parse(file = path) + orderly_build_script_details(exprs, entrypoint_filename) +} + +#' Build the details of an orderly source script +#' +#' Takes the parsed AST from an orderly script, parses details +#' of any calls to orderly_ in-script functions into intermediate +#' representation for downstream use. Also validates calls to +#' orderly_ in-script functions are well-formed. +#' +#' @param exprs Parsed AST from orderly script +#' @param entrypoint_filename Name of entrypoint file to include in metadata +#' +#' @return Details of orderly script +#' @export +orderly_build_script_details <- function(exprs, entrypoint_filename) { inputs <- list() artefacts <- list() diff --git a/man/orderly_build_script_details.Rd b/man/orderly_build_script_details.Rd new file mode 100644 index 00000000..0653375f --- /dev/null +++ b/man/orderly_build_script_details.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/read.R +\name{orderly_build_script_details} +\alias{orderly_build_script_details} +\title{Build the details of an orderly source script} +\usage{ +orderly_build_script_details(exprs, entrypoint_filename) +} +\arguments{ +\item{exprs}{Parsed AST from orderly script} + +\item{entrypoint_filename}{Name of entrypoint file to include in metadata} +} +\value{ +Details of orderly script +} +\description{ +Takes the parsed AST from an orderly script, parses details +of any calls to orderly_ in-script functions into intermediate +representation for downstream use. Also validates calls to +orderly_ in-script functions are well-formed. +}