Finds a block and returns the range of line numbers encompassed by that block.

find_declaration(x, name)

Arguments

x

a stanedit object

name

of the block to find

Value

an integer, the line numbes where the variable is declared; an empty integer if the declaration is not found

See also

Examples

model_file_name <- system.file(package = "stanedit", "regression.stan")
reg <- stanedit(filename = model_file_name)
find_declaration(reg, "alpha")
#> [1] 7