class Rsec::PDouble
double precision float parser
Public Class Methods
new(sign_strategy, is_hex)
click to toggle source
# File lib/rsec/parsers/prim.rb, line 28 def initialize sign_strategy, is_hex self.left = float_pattern sign_strategy, is_hex end
Public Instance Methods
_parse(ctx)
click to toggle source
# File lib/rsec/parsers/prim.rb, line 32 def _parse ctx if (d = ctx.scan left) d = Float(d) return d if d.finite? end INVALID end
float_pattern(sign_strategy, is_hex)
click to toggle source
# File lib/rsec/parsers/prim.rb, line 19 def float_pattern sign_strategy, is_hex sign = sign_strategy_to_pattern sign_strategy if is_hex /#{sign}0x[\da-f]+(\.[\da-f]+)?/i else /#{sign}\d+(\.\d+)?(e[\+\-]?\d+)?/i end end