Method: XDry::ScopeStack#parse_line
- Defined in:
- lib/xdry/parsing/scope_stack.rb
#parse_line(line, eol_comments, indent) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/xdry/parsing/scope_stack.rb', line 13 def parse_line line, eol_comments, indent parse_line_using_parser! line, eol_comments, indent do |node| unless node.nil? # to simply code we allow the parser to yield nil when it cannot parse something # update the scope based on this new node while @current_scope.ends_after? node yield @current_scope, node pop end if subscope = @current_scope.subscope_for(node) # a subscope is added as a child of its parent scope yield @current_scope, subscope subscope.assert_bound! push subscope end # add the new node to the scope we have finally decided on yield @current_scope, node end end end |