class Racc::GrammarFileParser

Constants

USER_CODE_LABELS

Public Class Methods

new(debug_flags = DebugFlags.new) click to toggle source
# File lib/racc/grammarfileparser.rb, line 191
def initialize(debug_flags = DebugFlags.new)
  @yydebug = debug_flags.parse
end
parse(src, filename = '-', lineno = 1) click to toggle source
# File lib/racc/grammarfileparser.rb, line 187
def GrammarFileParser.parse(src, filename = '-', lineno = 1)
  new().parse(src, filename, lineno)
end
parse_file(filename) click to toggle source
# File lib/racc/grammarfileparser.rb, line 183
def GrammarFileParser.parse_file(filename)
  parse(File.read(filename), filename, 1)
end

Public Instance Methods

parse(src, filename = '-', lineno = 1) click to toggle source
# File lib/racc/grammarfileparser.rb, line 195
def parse(src, filename = '-', lineno = 1)
  @filename = filename
  @lineno = lineno
  @scanner = GrammarFileScanner.new(src, @filename)
  @scanner.debug = @yydebug
  @grammar = Grammar.new
  @result = Result.new(@grammar)
  @embedded_action_seq = 0
  yyparse @scanner, :yylex
  parse_user_code
  @result.grammar.init
  @result
end