Class | Brakeman::SexpProcessor |
In: |
lib/ruby_parser/bm_sexp_processor.rb
|
Parent: | Object |
SexpProcessor provides a uniform interface to process Sexps.
In order to create your own SexpProcessor subclass you‘ll need to call super in the initialize method, then set any of the Sexp flags you want to be different from the defaults.
SexpProcessor uses a Sexp‘s type to determine which process method to call in the subclass. For Sexp s(:lit, 1) SexpProcessor will call process_lit, if it is defined.
VERSION | = | 'CUSTOM' |
context | [R] | Return a stack of contexts. Most recent node is first. |
env | [R] | A scoped environment to make you happy. |
expected | [RW] | Expected result class |
Creates a new SexpProcessor. Use super to invoke this initializer from SexpProcessor subclasses, then use the attributes above to customize the functionality of the SexpProcessor
Add a scope level to the current env. Eg:
def process_defn exp name = exp.shift args = process(exp.shift) scope do body = process(exp.shift) # ... end end env[:x] = 42 scope do env[:x] # => 42 env[:y] = 24 end env[:y] # => nil