Skip to content

Commit

Permalink
Updated docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
LoLo5689 authored Nov 27, 2024
1 parent 0c76903 commit b133e0b
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/rulenode_operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,9 @@ function _rulenode2expr(typ::Symbol, rulenode::AbstractRuleNode, grammar::Abstra
retval, j
end


"""
expr2ulenode(expr::Expr, grammar::AbstractGrammar)
Converts an expression into a [`AbstractRuleNode`](@ref) corresponding to the rule definitions in the grammar.
"""
# ---------------------------------------------
# expr2rulenode and associated functions
# ---------------------------------------------

function grammar_map_right_to_left(grammar::AbstractGrammar)
tags = Dict{Any,Any}()
Expand Down Expand Up @@ -318,6 +315,11 @@ function _expr2rulenode(expr::Any, grammar::AbstractGrammar, tags::Dict{Any,Any}
return (tags[expr], RuleNode(rule, []))
end

"""
expr2rulenode(expr::Expr, grammar::AbstractGrammar, startSymbol::Symbol)
Converts an expression into a [`AbstractRuleNode`](@ref) corresponding to the rule definitions in the grammar.
"""
function expr2rulenode(expr::Expr, grammar::AbstractGrammar, startSymbol::Symbol)
tags = grammar_map_right_to_left(grammar)
(s, rn) = _expr2rulenode(expr, grammar, tags)
Expand All @@ -335,12 +337,22 @@ function expr2rulenode(expr::Expr, grammar::AbstractGrammar, startSymbol::Symbol
return rn
end

"""
expr2rulenode(expr::Expr, grammar::AbstractGrammar)
Converts an expression into a [`AbstractRuleNode`](@ref) corresponding to the rule definitions in the grammar.
"""
function expr2rulenode(expr::Expr, grammar::AbstractGrammar)
tags = grammar_map_right_to_left(grammar)
(s, rn) = _expr2rulenode(expr, grammar, tags)
return rn
end

"""
expr2rulenode(expr::Symbol, grammar::AbstractGrammar, startSymbol::Symbol)
Converts an expression into a [`AbstractRuleNode`](@ref) corresponding to the rule definitions in the grammar.
"""
function expr2rulenode(expr::Symbol, grammar::AbstractGrammar, startSymbol::Symbol)
tags = get_tags(grammar)
(s, rn) = expr2rulenode(expr, grammar, tags)
Expand All @@ -358,6 +370,11 @@ function expr2rulenode(expr::Symbol, grammar::AbstractGrammar, startSymbol::Symb
return rn

Check warning on line 370 in src/rulenode_operators.jl

View check run for this annotation

Codecov / codecov/patch

src/rulenode_operators.jl#L367-L370

Added lines #L367 - L370 were not covered by tests
end

"""
expr2rulenode(expr::Symbol, grammar::AbstractGrammar)
Converts an expression into a [`AbstractRuleNode`](@ref) corresponding to the rule definitions in the grammar.
"""
function expr2rulenode(expr::Symbol, grammar::AbstractGrammar)
tags = get_tags(grammar)
(s, rn) = expr2rulenode(expr, grammar, tags)
Expand Down

0 comments on commit b133e0b

Please sign in to comment.