Reads a .do file and returns a list of parsed command objects. Handles comment stripping, line continuation, loop expansion, and command tokenization.
Value
A list of StataCommand lists, each with fields: cmd, args, if_clause, options, raw_line, line_num, capture
See also
Other transpiler:
parse_stata_labels(),
transpile_coverage(),
transpile_stata(),
transpile_stata_module()
Examples
# \donttest{
tf <- tempfile(fileext = ".do")
writeLines(c("gen age2 = edad^2", "replace sexo = 1 if sexo == ."), tf)
cmds <- parse_do_file(tf)
length(cmds)
#> [1] 2
cmds[[1]]$cmd
#> [1] "gen"
# }