class Gamefic::Scanner::Nesting
Strict scanning for entities inside of other entities, e.g., ‘sock inside drawer`.
def denest
def denest near = selection far = selection parts = token.split(NEST_REGEXP) until parts.empty? current = parts.pop last_result = subprocessor.scan(near, current) last_result = subprocessor.scan(far, current) if last_result.matched.empty? && near != far return unmatched_result if last_result.matched.empty? || last_result.matched.length > 1 near = last_result.matched.first.children & selection far = last_result.matched.first.flatten & selection end last_result end
def scan
def scan return unmatched_result unless token =~ NEST_REGEXP denest end
def subprocessor
def subprocessor Strict end