File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ module RDF; class Literal
1212 # @since 0.2.1
1313 class Decimal < Numeric
1414 DATATYPE = RDF ::URI ( "http://www.w3.org/2001/XMLSchema#decimal" )
15- GRAMMAR = /^[\+ \- ]?\d +(\. \d *)?$/ . freeze
15+ GRAMMAR = /^[\+ \- ]?(?:(?: \d +(?: \. \d *)?)|(?: \. \d +)) $/ . freeze
1616
1717 ##
1818 # @param [String, BigDecimal, Numeric] value
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ module RDF; class Literal
1212 # @since 0.2.1
1313 class Double < Numeric
1414 DATATYPE = RDF ::URI ( "http://www.w3.org/2001/XMLSchema#double" )
15- GRAMMAR = /^(?:NaN|\- ?INF|[+\- ]?(?:\d +(:?\. \d *)?|\. \d +)(?:[eE][\+ \- ]?\d +)?)$/ . freeze
15+ GRAMMAR = /^(?:NaN|[+ \- ] ?INF|[+\- ]?(?:\d +(:?\. \d *)?|\. \d +)(?:[eE][\+ \- ]?\d +)?)$/ . freeze
1616
1717 ##
1818 # @param [String, Float, #to_f] value
Original file line number Diff line number Diff line change @@ -540,6 +540,7 @@ def self.literals(*selector)
540540 %w( 0123 123.0 ) ,
541541 %w( -1 -1.0 ) ,
542542 %w( 1. 1.0 ) ,
543+ %w( +.7 0.7 ) ,
543544 %w( 1.0 1.0 ) ,
544545 %w( 1.00 1.0 ) ,
545546 %w( +001.00 1.0 ) ,
@@ -561,6 +562,7 @@ def self.literals(*selector)
561562 1.
562563 1.0
563564 1.00
565+ +.7
564566 +001.00
565567 123.456
566568 1.000000000
@@ -625,7 +627,8 @@ def self.literals(*selector)
625627 %w( 0123 1.23E2 ) ,
626628 %w( -1 -1.0E0 ) ,
627629 %w( +01.000 1.0E0 ) ,
628- #%w(1. 1.0E0),
630+ %w( -.2e3 -2.0E2 ) ,
631+ %w( 1. 1.0E0 ) ,
629632 %w( 1.0 1.0E0 ) ,
630633 %w( 123.456 1.23456E2 ) ,
631634 %w( 1.0e+1 1.0E1 ) ,
@@ -647,6 +650,7 @@ def self.literals(*selector)
647650 -1
648651 +01.000
649652 1.0
653+ -.2e3
650654 123.456
651655 1.0e+1
652656 1.0e-10
You can’t perform that action at this time.
0 commit comments