class AdLint::Cc1::OrdinaryIdentifiers

Public Class Methods

new() click to toggle source
# File lib/adlint/cc1/lexer.rb, line 264
def initialize
  @id_stack = [[]]
end

Public Instance Methods

add_enumerator_name(tok) click to toggle source
# File lib/adlint/cc1/lexer.rb, line 284
def add_enumerator_name(tok)
  add(tok.value, :enumerator)
end
add_object_name(tok) click to toggle source
# File lib/adlint/cc1/lexer.rb, line 280
def add_object_name(tok)
  add(tok.value, :object)
end
add_typedef_name(tok) click to toggle source
# File lib/adlint/cc1/lexer.rb, line 276
def add_typedef_name(tok)
  add(tok.value, :typedef)
end
enter_scope() click to toggle source
# File lib/adlint/cc1/lexer.rb, line 268
def enter_scope
  @id_stack.unshift([])
end
find(id_str) click to toggle source
# File lib/adlint/cc1/lexer.rb, line 288
def find(id_str)
  @id_stack.each do |id_ary|
    if pair = id_ary.assoc(id_str)
      return pair.last
    end
  end
  nil
end
leave_scope() click to toggle source
# File lib/adlint/cc1/lexer.rb, line 272
def leave_scope
  @id_stack.shift
end

Private Instance Methods

add(id_str, tag) click to toggle source
# File lib/adlint/cc1/lexer.rb, line 298
def add(id_str, tag)
  @id_stack.first.unshift([id_str, tag])
end