class Mustermann::AST::Boundaries

@!visibility private
Make sure #start and #stop is set on every node and within its parents #start and #stop.

def self.set_boundaries(ast, string: nil, start: 0, stop: string.length)

Returns:
  • (Mustermann::AST::Node) - the ast passed as first argument
def self.set_boundaries(ast, string: nil, start: 0, stop: string.length)
  new.translate(ast, start, stop)
  ast
end

def set_boundaries(node, start, stop)

@!visibility private
Checks that a node is within the given boundaries.
def set_boundaries(node, start, stop)
  node.start = start                      if node.start.nil? or node.start < start
  node.stop  = node.start + node.min_size if node.stop.nil?  or node.stop  < node.start
  node.stop  = stop                       if node.stop > stop
end