Class: LanguageParser::CT_WaitingForComment

Inherits:
CT_State
  • Object
show all
Defined in:
lib/cgialib/lp/CTokenizer.rb

Overview

class : CT_WatingForComment

Handles switching between old comments, new comments, and slashes.

Instance Method Summary collapse

Methods inherited from CT_State

#initialize

Constructor Details

This class inherits a constructor from LanguageParser::CT_State

Instance Method Details

#next(ch) ⇒ Object

next( ch )

ch - The character

Handles the character in the parsing stream



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/cgialib/lp/CTokenizer.rb', line 296

def next( ch )
  
  # Check to see if we are looking at a new or old
  # style comment
  
  if ( ch == "*" )
  
    @newstate.call( CT_OldComment )
  
  elsif ( ch == "/" )
  
    @newstate.call( CT_NewComment )
  
  else
  
    # Or if it was just a slash
  
    @addtoken.call( CodeToken.new( "/" ) )
    @newstate.call( CT_NormalState )
  
  end
  
end