Class: AdLint::Cc1::OrdinaryIdentifiers
- Inherits:
-
Object
- Object
- AdLint::Cc1::OrdinaryIdentifiers
- Defined in:
- lib/adlint/cc1/lexer.rb
Instance Method Summary collapse
- #add_enumerator_name(tok) ⇒ Object
- #add_object_name(tok) ⇒ Object
- #add_typedef_name(tok) ⇒ Object
- #enter_scope ⇒ Object
- #find(id_str) ⇒ Object
-
#initialize ⇒ OrdinaryIdentifiers
constructor
A new instance of OrdinaryIdentifiers.
- #leave_scope ⇒ Object
Constructor Details
#initialize ⇒ OrdinaryIdentifiers
Returns a new instance of OrdinaryIdentifiers.
264 265 266 |
# File 'lib/adlint/cc1/lexer.rb', line 264 def initialize @id_stack = [[]] end |
Instance Method Details
#add_enumerator_name(tok) ⇒ Object
284 285 286 |
# File 'lib/adlint/cc1/lexer.rb', line 284 def add_enumerator_name(tok) add(tok.value, :enumerator) end |
#add_object_name(tok) ⇒ Object
280 281 282 |
# File 'lib/adlint/cc1/lexer.rb', line 280 def add_object_name(tok) add(tok.value, :object) end |
#add_typedef_name(tok) ⇒ Object
276 277 278 |
# File 'lib/adlint/cc1/lexer.rb', line 276 def add_typedef_name(tok) add(tok.value, :typedef) end |
#enter_scope ⇒ Object
268 269 270 |
# File 'lib/adlint/cc1/lexer.rb', line 268 def enter_scope @id_stack.unshift([]) end |
#find(id_str) ⇒ Object
288 289 290 291 292 293 294 295 |
# 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 ⇒ Object
272 273 274 |
# File 'lib/adlint/cc1/lexer.rb', line 272 def leave_scope @id_stack.shift end |