class Racc::GrammarFileScanner

Constants

CACHE
LEFT_TO_RIGHT
ReservedWord

Attributes

Public Class Methods

# 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

Public Instance Methods

# File lib/racc/grammarfileparser.rb, line 313
def lineno
  @lineno + 1
end
# 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