Skip to content

Commit

Permalink
Improve bugs macro doc (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 authored Mar 12, 2024
1 parent 43daf28 commit fe710e6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/parser/bugs_macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,18 @@ function bugs_expression(expr, line_num)
end

"""
@bugs(prog::String, replace_period=true, no_enclosure=false)
@bugs(program::Expr)
@bugs(program::String; replace_period::Bool=true, no_enclosure::Bool=false)
Produce similar output as [`@bugs`](@ref), but takes a string as input. This is useful for
parsing original BUGS programs.
Constructs a Julia Abstract Syntax Tree (AST) representation of a BUGS program. This macro supports two forms of input: a Julia expression or a string containing the BUGS program code.
# Arguments
- `prog::String`: The BUGS program code as a string.
- `replace_period::Bool`: If true, periods in the BUGS code will be replaced (default `true`).
- `no_enclosure::Bool`: If true, the parser will not expect the program to be wrapped between `model{ }` (default `false`).
- When provided with a string, the macro parses it as a BUGS program, with optional arguments to control parsing behavior.
- When given an expression, it performs syntactic checks to ensure compatibility with BUGS syntax.
## Arguments for String Input
For the string input variant, the following optional arguments are available:
- `replace_period::Bool`: When set to `true`, all periods (`.`) in the BUGS code are replaced. This is enabled by default.
- `no_enclosure::Bool`: When `true`, the parser does not require the BUGS program to be enclosed within `model{ ... }` brackets. By default, this is set to `false`.
"""
macro bugs(prog::String, replace_period=true, no_enclosure=false)
Expand Down

0 comments on commit fe710e6

Please sign in to comment.