All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Enrico Weigelt, metux IT consult" <info@metux.net>
To: mst@redhat.com, ehabkost@redhat.com, crosa@redhat.com,
	qemu-devel@nongnu.org
Subject: [PATCH 1/5] scripts: minikconf: support config titles
Date: Fri, 27 Nov 2020 19:29:13 +0100	[thread overview]
Message-ID: <20201127182917.2387-1-info@metux.net> (raw)

Add support for config option titles, like the real kconfig does.
Even though they're not presented anywhere yet (since minikconf
only acts in the background), it's good to have them supported,
so we can start adding descriptions in the Kconfig files.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 scripts/minikconf.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/scripts/minikconf.py b/scripts/minikconf.py
index bcd91015d3..28c67906cb 100644
--- a/scripts/minikconf.py
+++ b/scripts/minikconf.py
@@ -206,6 +206,7 @@ class KconfigData:
         self.defined_vars = set()
         self.referenced_vars = dict()
         self.clauses = list()
+        self.title = None
 
     # semantic analysis -------------
 
@@ -290,6 +291,9 @@ class KconfigData:
         cond = (cond & var) if cond is not None else var
         self.clauses.append(KconfigData.SelectClause(symbol, cond))
 
+    def do_title(self, title):
+        self.title = title
+
     def do_imply(self, var, symbol, cond=None):
         # "config X imply Y [if COND]" is the same as
         # "config Y default y if X [&& COND]"
@@ -323,6 +327,7 @@ TOK_BOOL = 15;    TOKENS[TOK_BOOL] = '"bool"';
 TOK_IF = 16;      TOKENS[TOK_IF] = '"if"';
 TOK_ID = 17;      TOKENS[TOK_ID] = 'identifier';
 TOK_EOF = 18;     TOKENS[TOK_EOF] = 'end of file';
+TOK_QUOTED = 19;  TOKENS[TOK_QUOTED] = 'quoted string';
 
 class KconfigParserError(Exception):
     def __init__(self, parser, msg, tok=None):
@@ -501,6 +506,7 @@ class KconfigParser:
     # property: DEFAULT y_or_n condition
     #       | DEPENDS ON expr
     #       | SELECT var condition
+    #       | BOOL "comment"
     #       | BOOL
     def parse_property(self, var):
         if self.tok == TOK_DEFAULT:
@@ -526,6 +532,9 @@ class KconfigParser:
             self.data.do_imply(var, symbol, cond)
         elif self.tok == TOK_BOOL:
             self.get_token()
+            if self.tok == TOK_QUOTED:
+                self.data.do_title(self.val)
+                self.get_token()
         else:
             raise KconfigParserError(self, 'Error in recursive descent?')
 
@@ -645,6 +654,11 @@ class KconfigParser:
             self.cursor = self.src.find('\n', self.cursor)
             self.val = self.src[start:self.cursor]
             return TOK_SOURCE
+        elif self.tok == '"':
+            start = self.cursor
+            self.cursor = self.src.find('"', self.cursor)+1
+            self.val = self.src[start:self.cursor]
+            return TOK_QUOTED;
         elif self.tok.isalnum():
             # identifier
             while self.src[self.cursor].isalnum() or self.src[self.cursor] == '_':
-- 
2.11.0



             reply	other threads:[~2020-11-27 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27 18:29 Enrico Weigelt, metux IT consult [this message]
2020-11-27 18:29 ` [PATCH 2/5] backends: introduce gpio backend subsystem Enrico Weigelt, metux IT consult
2020-11-27 18:29 ` [PATCH 3/5] backends: gpio: dummy builtin backend Enrico Weigelt, metux IT consult
2020-11-27 18:29 ` [PATCH 4/5] standard-headers: virtio-gpio protocol headers Enrico Weigelt, metux IT consult
2020-11-27 18:29 ` [PATCH 5/5] hw: virtio: add virtio-gpio device emulation Enrico Weigelt, metux IT consult

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201127182917.2387-1-info@metux.net \
    --to=info@metux.net \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.