1 | <?php |
||
22 | class NumberValueNode extends Rule implements AstValueInterface |
||
23 | { |
||
24 | /** |
||
25 | * @return ValueInterface |
||
26 | */ |
||
27 | public function unpack(): ValueInterface |
||
37 | |||
38 | /** |
||
39 | * @return int|float |
||
40 | */ |
||
41 | protected function parse() |
||
65 | |||
66 | /** |
||
67 | * @param LeafInterface $leaf |
||
68 | * @return bool |
||
69 | */ |
||
70 | private function isHex(LeafInterface $leaf): bool |
||
74 | |||
75 | /** |
||
76 | * @param string $value |
||
77 | * @return int |
||
78 | */ |
||
79 | private function parseHex(string $value): int |
||
83 | |||
84 | /** |
||
85 | * @param LeafInterface $leaf |
||
86 | * @return bool |
||
87 | */ |
||
88 | private function isBinary(LeafInterface $leaf): bool |
||
92 | |||
93 | /** |
||
94 | * @param string $value |
||
95 | * @return int |
||
96 | */ |
||
97 | private function parseBin(string $value): int |
||
101 | |||
102 | /** |
||
103 | * @param LeafInterface $leaf |
||
104 | * @return bool |
||
105 | */ |
||
106 | private function isExponential(LeafInterface $leaf): bool |
||
110 | |||
111 | /** |
||
112 | * @param string $value |
||
113 | * @return float |
||
114 | */ |
||
115 | private function parseExponential(string $value): float |
||
119 | |||
120 | /** |
||
121 | * @param LeafInterface $leaf |
||
122 | * @return bool |
||
123 | */ |
||
124 | private function isFloat(LeafInterface $leaf): bool |
||
128 | |||
129 | /** |
||
130 | * @param string $value |
||
131 | * @return float |
||
132 | */ |
||
133 | private function parseFloat(string $value): float |
||
137 | |||
138 | /** |
||
139 | * @param LeafInterface $leaf |
||
140 | * @return bool |
||
141 | */ |
||
142 | private function isInt(LeafInterface $leaf): bool |
||
146 | |||
147 | /** |
||
148 | * @param string $value |
||
149 | * @return int |
||
150 | */ |
||
151 | private function parseInt(string $value): int |
||
155 | } |
||
156 |