Sha256: 5aa6e90dcf2973d2990f7688b30fe83645b127aed45311e3c5717bd1b5bfd9f6

Contents?: true

Size: 584 Bytes

Versions: 103

Compression:

Stored size: 584 Bytes

Contents

module Parser

  class StaticEnvironment
    def initialize
      reset
    end

    def reset
      @variables = Set[]
      @stack     = []
    end

    def extend_static
      @stack.push(@variables)
      @variables = Set[]

      self
    end

    def extend_dynamic
      @stack.push(@variables)
      @variables = @variables.dup

      self
    end

    def unextend
      @variables = @stack.pop

      self
    end

    def declare(name)
      @variables.add(name.to_sym)

      self
    end

    def declared?(name)
      @variables.include?(name.to_sym)
    end
  end

end

Version data entries

103 entries across 103 versions & 5 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/lib/parser/static_environment.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/lib/parser/static_environment.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/lib/parser/static_environment.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/lib/parser/static_environment.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/lib/parser/static_environment.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/lib/parser/static_environment.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.0/lib/parser/static_environment.rb
parser-2.4.0.2 lib/parser/static_environment.rb
parser-2.4.0.1 lib/parser/static_environment.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/lib/parser/static_environment.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/lib/parser/static_environment.rb
parser-2.4.0.0 lib/parser/static_environment.rb
parser-2.3.3.1 lib/parser/static_environment.rb
parser-2.3.3.0 lib/parser/static_environment.rb
parser-2.3.2.0 lib/parser/static_environment.rb
parser-2.3.1.4 lib/parser/static_environment.rb
parser-2.3.1.3 lib/parser/static_environment.rb
erruby_parser-2.3.1.2 lib/parser/static_environment.rb
parser-2.3.1.2 lib/parser/static_environment.rb
parser-2.3.1.1 lib/parser/static_environment.rb