diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/tools/vppapigen/vppapigen.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py index 9c6b21ed48d..8ae991c9c95 100755 --- a/src/tools/vppapigen/vppapigen.py +++ b/src/tools/vppapigen/vppapigen.py @@ -77,9 +77,12 @@ class VPPAPILexer(object): t_ignore_LINE_COMMENT = '//.*' def t_NUM(self, t): - r'0[xX][0-9a-fA-F]+|-?\d+' + r'0[xX][0-9a-fA-F]+|-?\d+\.?\d*' base = 16 if t.value.startswith('0x') else 10 - t.value = int(t.value, base) + if '.' in t.value: + t.value = float(t.value) + else: + t.value = int(t.value, base) return t def t_ID(self, t): @@ -123,6 +126,7 @@ def crc_block_combine(block, crc): s = str(block).encode() return binascii.crc32(s, crc) & 0xffffffff + class Service(): def __init__(self, caller, reply, events=None, stream=False): self.caller = caller |