Class: Racc::GrammarFileParser
Overview
reopen
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(debug_flags = DebugFlags.new) ⇒ GrammarFileParser
constructor
A new instance of GrammarFileParser.
- #parse(src, filename = '-', lineno = 1) ⇒ Object
Constructor Details
#initialize(debug_flags = DebugFlags.new) ⇒ GrammarFileParser
Returns a new instance of GrammarFileParser.
191 192 193 |
# File 'lib/racc/grammarfileparser.rb', line 191 def initialize(debug_flags = DebugFlags.new) @yydebug = debug_flags.parse end |
Class Method Details
.parse(src, filename = '-', lineno = 1) ⇒ Object
187 188 189 |
# File 'lib/racc/grammarfileparser.rb', line 187 def GrammarFileParser.parse(src, filename = '-', lineno = 1) new().parse(src, filename, lineno) end |
.parse_file(filename) ⇒ Object
183 184 185 |
# File 'lib/racc/grammarfileparser.rb', line 183 def GrammarFileParser.parse_file(filename) parse(File.read(filename), filename, 1) end |
Instance Method Details
#parse(src, filename = '-', lineno = 1) ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 207 |
# 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 |