1637 
1637 
decimal = '\d+(?:_\d+)*'

1638 
1638 
binary = 'b[01]+(?:_[01]+)*'

1639 
1639 
hex = 'x[\daf]+(?:_[\daf]+)*'

1640 

octal = "0(?:[07]*(?:_[07]+)*#{binary}#{hex})"


1640 
octal = "0(?:[07]+(?:_[07]+)*#{binary}#{hex})?"

1641 
1641 
integer = "#{octal}#{decimal}"


1642 

1642 
1643 
accept(Integer, %r"\A[+]?(?:#{integer})"io) {s, Integer(s) if s}

1643 
1644 

1644 
1645 
#

...  ...  
1664 
1665 
#

1665 
1666 
# Decimal integer format, to be converted to Integer.

1666 
1667 
#

1667 

DecimalInteger = /\A[+]?#{decimal}/io

1668 

accept(DecimalInteger) {s, s.to_i if s}


1668 
DecimalInteger = /\A([+]?#{decimal})/io


1669 
accept(DecimalInteger, DecimalInteger) {s,d


1670 
begin


1671 
Integer(d)


1672 
rescue ArgumentError


1673 
raise OptionParser::InvalidArgument, s


1674 
end


1675 
}

1669 
1676 

1670 
1677 
#

1671 
1678 
# Ruby/C like octal/hexadecimal/binary integer format, to be converted to

1672 
1679 
# Integer.

1673 
1680 
#

1674 
1681 
OctalInteger = /\A[+]?(?:[07]+(?:_[07]+)*0(?:#{binary}#{hex}))/io

1675 

accept(OctalInteger) {s, s.oct if s}


1682 
accept(OctalInteger, OctalInteger) {s, s.oct if s}

1676 
1683 

1677 
1684 
#

1678 
1685 
# Decimal integer/float number format, to be converted to Integer for

1679 
1686 
# integer format, Float for float format.

1680 
1687 
#

1681 
1688 
DecimalNumeric = floatpat # decimal integer is allowed as float also.

1682 

accept(DecimalNumeric) {s, eval(s) if s}


1689 
accept(DecimalNumeric, floatpat) {s,


1690 
begin


1691 
eval(s)


1692 
rescue SyntaxError


1693 
raise OptionParser::InvalidArgument, s


1694 
end if s


1695 
}

1683 
1696 

1684 
1697 
#

1685 
1698 
# Boolean switch, which means whether it is present or not, whether it is
