r'[+-]?\d+\.?\d*[yzafpnumkMGTP]
(t)
| 166 | |
| 167 | # Define a rule for numbers with scale factors (postfixes) |
| 168 | def t_SCALE(t): |
| 169 | r'[+-]?\d+\.?\d*[yzafpnumkMGTP]' |
| 170 | """ |
| 171 | Replaces scale factors in numbers and converts numbers into floats |
| 172 | """ |
| 173 | try: |
| 174 | t.value = sp.Rational(t.value[0:-1] + 'e' + _SCALEFACTORS[t.value[-1]]) |
| 175 | except TypeError: |
| 176 | exc_type, value, exc_traceback = sys.exc_info() |
| 177 | print('\n', value) |
| 178 | _printError('Cannot convert number to float.', t) |
| 179 | lexer.errCount += 1 |
| 180 | t.type = 'FLT' |
| 181 | return t |
| 182 | |
| 183 | def t_FLT(t): |
| 184 | r'[+-]?\d+\.\d*' |
nothing calls this directly
no test coverage detected