Class: BCDice::Arithmetic::Parser

Inherits:
Racc::Parser
  • Object
show all
Defined in:
lib/bcdice/arithmetic/parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(source) ⇒ Object



18
19
20
# File 'lib/bcdice/arithmetic/parser.rb', line 18

def self.parse(source)
  new.parse(source)
end

Instance Method Details

#parse(source) ⇒ Object



22
23
24
25
26
27
# File 'lib/bcdice/arithmetic/parser.rb', line 22

def parse(source)
  @lexer = BCDice::CommonCommand::Lexer.new(source)
  do_parse()
rescue ParseError
  nil
end