Class: Code::Parser::Number
- Defined in:
- lib/code/parser/number.rb
Instance Method Summary collapse
- #a ⇒ Object
- #b ⇒ Object
- #base_10_digit ⇒ Object
- #base_10_number ⇒ Object
- #base_10_whole ⇒ Object
- #base_16_digit ⇒ Object
- #base_16_number ⇒ Object
- #base_16_whole ⇒ Object
- #base_2_digit ⇒ Object
- #base_2_number ⇒ Object
- #base_2_whole ⇒ Object
- #base_8_digit ⇒ Object
- #base_8_number ⇒ Object
- #base_8_whole ⇒ Object
- #c ⇒ Object
- #d ⇒ Object
- #decimal ⇒ Object
- #dot ⇒ Object
- #e ⇒ Object
- #eight ⇒ Object
- #exponent ⇒ Object
- #f ⇒ Object
- #five ⇒ Object
- #four ⇒ Object
- #nine ⇒ Object
- #number ⇒ Object
- #o ⇒ Object
- #one ⇒ Object
- #root ⇒ Object
- #seven ⇒ Object
- #six ⇒ Object
- #three ⇒ Object
- #two ⇒ Object
- #underscore ⇒ Object
- #x ⇒ Object
- #zero ⇒ Object
Instance Method Details
#a ⇒ Object
54 55 56 |
# File 'lib/code/parser/number.rb', line 54 def a str("a") | str("A") end |
#b ⇒ Object
58 59 60 |
# File 'lib/code/parser/number.rb', line 58 def b str("b") | str("B") end |
#base_10_digit ⇒ Object
95 96 97 |
# File 'lib/code/parser/number.rb', line 95 def base_10_digit zero | one | two | three | four | five | six | seven | eight | nine end |
#base_10_number ⇒ Object
135 136 137 |
# File 'lib/code/parser/number.rb', line 135 def base_10_number base_10_whole.aka(:whole) << exponent.maybe end |
#base_10_whole ⇒ Object
111 112 113 |
# File 'lib/code/parser/number.rb', line 111 def base_10_whole base_10_digit << (underscore.ignore | base_10_digit).repeat end |
#base_16_digit ⇒ Object
90 91 92 93 |
# File 'lib/code/parser/number.rb', line 90 def base_16_digit zero | one | two | three | four | five | six | seven | eight | nine | a | b | c | d | e | f end |
#base_16_number ⇒ Object
131 132 133 |
# File 'lib/code/parser/number.rb', line 131 def base_16_number zero.ignore << x.ignore << base_16_whole end |
#base_16_whole ⇒ Object
107 108 109 |
# File 'lib/code/parser/number.rb', line 107 def base_16_whole base_16_digit << (underscore.ignore | base_16_digit).repeat end |
#base_2_digit ⇒ Object
103 104 105 |
# File 'lib/code/parser/number.rb', line 103 def base_2_digit zero | one end |
#base_2_number ⇒ Object
143 144 145 |
# File 'lib/code/parser/number.rb', line 143 def base_2_number zero.ignore << b.ignore << base_2_whole end |
#base_2_whole ⇒ Object
119 120 121 |
# File 'lib/code/parser/number.rb', line 119 def base_2_whole base_2_digit << (underscore.ignore | base_2_digit).repeat end |
#base_8_digit ⇒ Object
99 100 101 |
# File 'lib/code/parser/number.rb', line 99 def base_8_digit zero | one | two | three | four | five | six | seven end |
#base_8_number ⇒ Object
139 140 141 |
# File 'lib/code/parser/number.rb', line 139 def base_8_number zero.ignore << o.ignore << base_8_whole end |
#base_8_whole ⇒ Object
115 116 117 |
# File 'lib/code/parser/number.rb', line 115 def base_8_whole base_8_digit << (underscore.ignore | base_8_digit).repeat end |
#c ⇒ Object
62 63 64 |
# File 'lib/code/parser/number.rb', line 62 def c str("c") | str("C") end |
#d ⇒ Object
66 67 68 |
# File 'lib/code/parser/number.rb', line 66 def d str("d") | str("D") end |
#decimal ⇒ Object
127 128 129 |
# File 'lib/code/parser/number.rb', line 127 def decimal (base_10_whole << dot << base_10_whole).aka(:decimal) << exponent.maybe end |
#dot ⇒ Object
50 51 52 |
# File 'lib/code/parser/number.rb', line 50 def dot str(".") end |
#e ⇒ Object
70 71 72 |
# File 'lib/code/parser/number.rb', line 70 def e str("e") | str("E") end |
#eight ⇒ Object
42 43 44 |
# File 'lib/code/parser/number.rb', line 42 def eight str("8") end |
#exponent ⇒ Object
123 124 125 |
# File 'lib/code/parser/number.rb', line 123 def exponent (e << number).aka(:exponent) end |
#f ⇒ Object
74 75 76 |
# File 'lib/code/parser/number.rb', line 74 def f str("f") | str("F") end |
#five ⇒ Object
30 31 32 |
# File 'lib/code/parser/number.rb', line 30 def five str("5") end |
#four ⇒ Object
26 27 28 |
# File 'lib/code/parser/number.rb', line 26 def four str("4") end |
#nine ⇒ Object
46 47 48 |
# File 'lib/code/parser/number.rb', line 46 def nine str("9") end |
#o ⇒ Object
78 79 80 |
# File 'lib/code/parser/number.rb', line 78 def o str("o") | str("O") end |
#one ⇒ Object
14 15 16 |
# File 'lib/code/parser/number.rb', line 14 def one str("1") end |
#root ⇒ Object
147 148 149 150 151 152 153 |
# File 'lib/code/parser/number.rb', line 147 def root ( decimal.aka(:decimal) | base_16_number.aka(:base_16) | base_8_number.aka(:base_8) | base_2_number.aka(:base_2) | base_10_number.aka(:base_10) ).aka(:number) | Boolean end |
#seven ⇒ Object
38 39 40 |
# File 'lib/code/parser/number.rb', line 38 def seven str("7") end |
#six ⇒ Object
34 35 36 |
# File 'lib/code/parser/number.rb', line 34 def six str("6") end |
#three ⇒ Object
22 23 24 |
# File 'lib/code/parser/number.rb', line 22 def three str("3") end |
#two ⇒ Object
18 19 20 |
# File 'lib/code/parser/number.rb', line 18 def two str("2") end |
#underscore ⇒ Object
86 87 88 |
# File 'lib/code/parser/number.rb', line 86 def underscore str("_") end |
#x ⇒ Object
82 83 84 |
# File 'lib/code/parser/number.rb', line 82 def x str("x") | str("X") end |
#zero ⇒ Object
10 11 12 |
# File 'lib/code/parser/number.rb', line 10 def zero str("0") end |