[master] 80f09e4f7 More use of tokenlist

Poul-Henning Kamp phk at FreeBSD.org
Tue Nov 27 16:17:11 UTC 2018


commit 80f09e4f73ff772ac92ed9ad74f738537b98bee1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 27 14:05:09 2018 +0000

    More use of tokenlist

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 5061be2d9..19d8b1fa9 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -591,10 +591,17 @@ class stanza(object):
 
 
 class s_module(stanza):
+
+    ''' $Module modname man_section description ... '''
+
     def parse(self):
+        if len(self.toks) < 4:
+            self.syntax()
         a = self.line[1].split(None, 2)
-        self.vcc.modname = a[0]
-        self.vcc.mansection = a[1]
+        self.vcc.modname = self.toks[1]
+        self.vcc.mansection = self.toks[2]
+        # XXX: Find better solution for moddesc
+        self.vcc.moddesc = " ".join(self.toks[2:])
         self.vcc.moddesc = a[2]
         self.rstlbl = "vmod_%s(%s)" % (
             self.vcc.modname,
@@ -678,17 +685,31 @@ class s_prefix(stanza):
 
 
 class s_synopsis(stanza):
+
+    ''' $Synopsis [auto|manual] '''
+
     def parse(self):
-        if self.line[1] not in ('auto', 'manual'):
+        if len(self.toks) != 2:
+            self.syntax()
+        valid = {
+            'auto': True,
+            'manual': False,
+        }
+        self.vcc.auto_synopsis = vald.get(self.toks[1])
+        if self.vcc.auto_synopsis is None:
             err("Valid Synopsis values are 'auto' or 'manual', got '%s'\n" %
-                self.line[1])
-        self.vcc.auto_synopsis = self.line[1] == 'auto'
+                self.toks[1])
         self.vcc.contents.append(self)
 
 
 class s_event(stanza):
+
+    ''' $Event function_name '''
+
     def parse(self):
-        self.event_func = self.line[1]
+        if len(self.toks) != 2:
+            self.syntax()
+        self.event_func = self.toks[1]
         self.vcc.contents.append(self)
 
     def rstfile(self, fo, man):


More information about the varnish-commit mailing list