Class: BCDice::GameSystem::SwordWorld::RatingParser

Inherits:
Racc::Parser
  • Object
show all
Defined in:
lib/bcdice/game_system/sword_world/rating_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(version: :v1_0, round_type: RoundType::CEIL) ⇒ RatingParser

デフォルトの丸めを切り上げとしているが、SwordWorldには切り捨てもあるので決め切れない(四捨五入は現状ない)



24
25
26
27
28
# File 'lib/bcdice/game_system/sword_world/rating_parser.rb', line 24

def initialize(version: :v1_0, round_type: RoundType::CEIL)
  super()
  @version = version
  @round_type = round_type
end

Instance Method Details

#parse(source) ⇒ BCDice::GameSystem::SwordWorld::RatingParsed?

Parameters:

  • source (String)

Returns:



37
38
39
40
41
42
# File 'lib/bcdice/game_system/sword_world/rating_parser.rb', line 37

def parse(source)
  @lexer = RatingLexer.new(source)
  do_parse()
rescue ParseError, ZeroDivisionError
  nil
end

#set_debugObject



30
31
32
33
# File 'lib/bcdice/game_system/sword_world/rating_parser.rb', line 30

def set_debug
  @yydebug = true
  return self
end