lib/cel/parser.rb in cel-0.1.0 vs lib/cel/parser.rb in cel-0.1.1

- old
+ new

@@ -1,8 +1,8 @@ # # DO NOT MODIFY!!!! -# This file is automatically generated by Racc 1.5.1 +# This file is automatically generated by Racc 1.6.0 # from Racc grammar file "". # require 'racc/parser.rb' @@ -140,24 +140,24 @@ def convert_to_number(scanner) matched = scanner.matched hexa, uint, number, floating, exp = scanner.captures - if !hexa.empty? + if hexa && !hexa.empty? return [:tINT, hexa.to_i(16)] end - if !uint.empty? + if uint && !uint.empty? return [:tUINT, Integer(uint)] end - if !exp.empty? + if exp && !exp.empty? # third matched group, can only be a floating exponential, let's convert tout suite [:tDOUBLE, BigDecimal(matched)] - elsif !floating.empty? + elsif floating && !floating.empty? if number == floating || floating.start_with?(".") [:tDOUBLE, Float(matched)] - elsif number.empty? + elsif number.nil? || number.empty? [:tDOUBLE, BigDecimal(matched)] end else if matched[-1].downcase == "u" [:tINT, Integer(matched[0..-2]).abs]