aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-07-02 13:00:58 -0400
committerDave Barach <openvpp@barachs.net>2019-07-03 11:29:39 +0000
commit063f374393b7e3a86acee232ae828ba674e95839 (patch)
tree148a88d8785d5fa75b65a65553b0c28211e16c93 /src/tools
parentc2ac2357fb0ff598ca1cb650a5766a552e017833 (diff)
vppapigen: allow decimal number in NUM token
Needed to set f64 default values. Type: feature Change-Id: Ic58ebc0d9d890bf0e7821894285e61a5bee13199 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/tools')
-rwxr-xr-xsrc/tools/vppapigen/vppapigen.py8
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