diff options
author | Ole Troan <ot@cisco.com> | 2020-08-10 17:06:44 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-08-11 14:55:41 +0000 |
commit | 68ebcd50bfb9eee419b3efabfde3411550160d03 (patch) | |
tree | 506a894cbc527f6075be9ef3bac4b3bb00dae97e /src/tools/vppapigen/vppapigen.py | |
parent | 710fe104620683755de71e2bb5d97c438987df74 (diff) |
vppapigen: add support for empty options
Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I59323447bee7bb4f0563251a5df80cbefb9bd89e
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/tools/vppapigen/vppapigen.py')
-rwxr-xr-x | src/tools/vppapigen/vppapigen.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py index 8b6297e728d..e571f26a5ac 100755 --- a/src/tools/vppapigen/vppapigen.py +++ b/src/tools/vppapigen/vppapigen.py @@ -350,7 +350,7 @@ class Import(): class Option(): - def __init__(self, option, value): + def __init__(self, option, value=None): self.type = 'Option' self.option = option self.value = value @@ -686,8 +686,12 @@ class VPPAPIParser(object): p[0] = Array(p[1], p[2], p[4]) def p_option(self, p): - '''option : OPTION ID '=' assignee ';' ''' - p[0] = Option(p[2], p[4]) + '''option : OPTION ID '=' assignee ';' + | OPTION ID ';' ''' + if len(p) == 4: + p[0] = Option(p[2]) + else: + p[0] = Option(p[2], p[4]) def p_assignee(self, p): '''assignee : NUM |