Class: Racc::GrammarFileScanner
Instance Attribute Summary collapse
- 
  
    
      #debug  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute debug.
 - 
  
    
      #epilogue  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute epilogue.
 
Instance Method Summary collapse
- 
  
    
      #initialize(str, filename = '-')  ⇒ GrammarFileScanner 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of GrammarFileScanner.
 - #lineno ⇒ Object
 - #yylex(&block) ⇒ Object
 
Constructor Details
#initialize(str, filename = '-') ⇒ GrammarFileScanner
Returns a new instance of GrammarFileScanner.
      298 299 300 301 302 303 304 305 306 307 308 309  | 
    
      # File 'lib/racc/grammarfileparser.rb', line 298 def initialize(str, filename = '-') @lines = str.b.split(/\n|\r\n|\r/) @filename = filename @lineno = -1 @line_head = true @in_rule_blk = false @in_conv_blk = false @in_block = nil @epilogue = '' @debug = false next_line end  | 
  
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
      317 318 319  | 
    
      # File 'lib/racc/grammarfileparser.rb', line 317 def debug @debug end  | 
  
#epilogue ⇒ Object (readonly)
Returns the value of attribute epilogue.
      311 312 313  | 
    
      # File 'lib/racc/grammarfileparser.rb', line 311 def epilogue @epilogue end  | 
  
Instance Method Details
#lineno ⇒ Object
      313 314 315  | 
    
      # File 'lib/racc/grammarfileparser.rb', line 313 def lineno @lineno + 1 end  | 
  
#yylex(&block) ⇒ Object
      319 320 321 322 323 324 325 326 327 328  | 
    
      # File 'lib/racc/grammarfileparser.rb', line 319 def yylex(&block) unless @debug yylex0(&block) else yylex0 do |sym, tok| $stderr.printf "%7d %-10s %s\n", lineno(), sym.inspect, tok.inspect yield [sym, tok] end end end  |