MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / t_SCALE

Function t_SCALE

SLiCAP/SLiCAPlex.py:168–181  ·  view source on GitHub ↗

r'[+-]?\d+\.?\d*[yzafpnumkMGTP]

(t)

Source from the content-addressed store, hash-verified

166
167# Define a rule for numbers with scale factors (postfixes)
168def 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
183def t_FLT(t):
184 r'[+-]?\d+\.\d*'

Callers

nothing calls this directly

Calls 1

_printErrorFunction · 0.85

Tested by

no test coverage detected