From: Marco Gerards <metgerards@student.han.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Scripting support (PATCH)
Date: Sun, 30 Oct 2005 17:05:01 +0100 [thread overview]
Message-ID: <87vezfgfde.fsf@student.han.nl> (raw)
In-Reply-To: <4364DB7F.1060309@gmail.com> (Vladimir Serbinenko's message of "Sun, 30 Oct 2005 15:41:03 +0100")
Vladimir Serbinenko <phcoder@gmail.com> writes:
> But the next questions are menu entries. I propose the following syntax:
> menu [arguments] name
> {
> Commands
> }
>
> arguments can be --default, --fallback perhaps some more in the future.
>
> But the main question is about realization. We need to store the
> source code to be able to edit it. Marco and me propose the following
> solution:
> lexer keeps the buffer of current parsed script/block and it stores
> begin and end of tokens in this buffer in yylloc's new fields: buf_beg
> and buf_end. Then when parser founds a menu entry it copies a part of
> buffer using position of command. E.g (schematically):
>
> "menu" string '{' commands '}'
I would even propose something like:
menuargs: /* Empty */
menuargs ARG
...
;
menuentry: "menu" menuargs '{' commands '}'
;
Or something like that. Arg is something the scanner can recognize or
so. I am not sure how that should work :)
> {
> char was = buf[@4.buf_end];
> buf[@4.buf_end] = 0;
> create_menu_command ($2, grub_strdup (&buf[@4.buf_beg]));
> }
I didn't know that bison had such buffer. I think it is cleaner to
use grub_strndup so you don't have to modify the buffer. You also
have to pass the result of `commands' ($4 in your example) to
create_menu_command.
> And menu is always stored unparsed and parsed only just before
> execution. Than editing is no problem.
I think you have to parse it immediately and both store parsed and the
unparsed code. After editing you do the same again.
> Other solution proposed by Marco was to rerun the script file or part
> of it.
This solution is required if you want to be able to edit the complete
script instead of just the separate menu entries. I think this is not
interesting, but if someone wants to know I can say more about this.
Thanks,
Marco
next prev parent reply other threads:[~2005-10-30 16:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-29 21:41 Scripting support (PATCH) Marco Gerards
2005-10-30 5:25 ` Yoshinori K. Okuji
2005-10-30 9:45 ` Marco Gerards
2005-10-30 11:55 ` Yoshinori K. Okuji
2005-10-30 12:17 ` Marco Gerards
2005-10-30 10:14 ` Marco Gerards
2005-10-30 14:41 ` Vladimir Serbinenko
2005-10-30 16:05 ` Marco Gerards [this message]
2005-10-30 16:46 ` Vladimir Serbinenko
2005-10-30 16:59 ` Marco Gerards
2005-10-30 17:15 ` Vladimir Serbinenko
2005-10-30 18:17 ` Marco Gerards
2005-10-31 6:39 ` Yoshinori K. Okuji
2005-10-30 20:49 ` Hollis Blanchard
2005-10-30 21:04 ` Marco Gerards
2005-10-31 6:45 ` Yoshinori K. Okuji
2005-10-31 18:58 ` Marco Gerards
2005-11-01 19:06 ` Marco Gerards
2005-11-01 19:55 ` Yoshinori K. Okuji
2005-11-03 21:58 ` Marco Gerards
2005-11-06 22:26 ` Marco Gerards
2005-11-08 3:38 ` Hollis Blanchard
2005-11-08 18:24 ` Marco Gerards
2005-11-09 6:14 ` Hollis Blanchard
[not found] <200511010611.jA16B6Bq030884@dell01.dinaserver.com>
2005-11-02 9:37 ` adrian15
2005-11-06 22:13 ` Marco Gerards
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=87vezfgfde.fsf@student.han.nl \
--to=metgerards@student.han.nl \
--cc=grub-devel@gnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox