From: Serbinenko Vladimir <serbinenko.vova@list.ru>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Pre-alpha scripting engine
Date: Tue, 18 Jan 2005 20:54:12 +0100 [thread overview]
Message-ID: <41ED6964.9010102@list.ru> (raw)
In-Reply-To: <87zmz6in2h.fsf@marco.marco-g.com>
Marco Gerards wrote:
>Can you please explain how the parser itself works? What kind of
>parser is it, something about the scanner perhaps, etc?
>
>
>
It's two times parser. First time it removes comments and creates
function list.Then it launches "script_load" function. Real script
execution is in script_execute. This function detects what structure is
used. IF it's a loop it makes a recursive call. If it's return,
brake,... if return value and status(why exited?) for expressions it
uses recursive function script_eval_expr. It checks the type of first
token(string,function, variable,...) ,calculates it and stores to cur,
then it repeats until end of expression. If it's an operator it can be
unary operator only if cur==NULL. Then it determines the part of
expression that must be passed as right argument
Ex: $a+$b*$c When it finds+ cur contains $a so it's binary+ right part
is $b*$c as priority of * is bigger than binary+.
Then it invokes corresponding function(in that case script_arith). There
are some special operators like ?:, ||, &&,... that control execution so
they must be calculated directly in script_eval_expr and so .func_do=NULL
Function script_parse_args converts script-like argument to internal
format. Function import_args imports arguments to local environment.
script_exec_* are made to call different functions. For information
about other functions just mail me or wait alpha-beta version where I'll
add some comments
>>For now all script files must be made of functions and nothing except
>>functions. All other will be ignored. Function must be declared as:
>>function [global] <function
>>name>([$arg1[=defval1]][,$arg2[=defval2]][,...]){
>> <function body here>
>>}
>>
>>
>
>How about grub.cfg? It would be nice if it would be possible to embed
>code there.
>
>
>
You can just write in grub.cfg
insmod script
script <file>
And there is no mess between scripts and shell(however shell functions
can be used by scripts...will in alpha)
>>Notes:
>>
>>
>[...]
>
>
>>Spaces in (type) are not supported,
>>
>>
>
>Sorry, I don't understand this one.
>
>
>
in PHP you can write ( int ), ( int), (int ), (int
),... and so on but current version supports only (int), (bool) and (str)
>Thanks,
>Marco
>
>
>
>_______________________________________________
>Grub-devel mailing list
>Grub-devel@gnu.org
>http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
>
>
next prev parent reply other threads:[~2005-01-18 20:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1CpUhp-000IYX-00.grub-devel-bounces+serbinenko-vova=list-ru-gnu-org@mx11.mail.ru>
2005-01-14 18:48 ` Pre-alpha scripting engine Serbinenko Vladimir
2005-01-18 18:55 ` Marco Gerards
2005-01-18 19:54 ` Serbinenko Vladimir [this message]
2005-01-19 13:01 ` Marco Gerards
2005-01-19 20:04 ` Yoshinori K. Okuji
2005-01-19 20:48 ` Marco Gerards
2005-01-19 21:48 ` Maurizio Boriani
2005-01-20 17:10 ` Serbinenko Vladimir
2005-01-20 17:56 ` Yoshinori K. Okuji
2005-01-20 18:34 ` Serbinenko Vladimir
2005-01-21 2:26 ` Hollis Blanchard
2005-01-21 17:23 ` Scripting, partitions and filesystems Serbinenko Vladimir
2005-01-21 17:52 ` Device syntax, scripting, " Serbinenko Vladimir
2005-01-23 14:22 ` Pre-alpha scripting engine Yoshinori K. Okuji
2005-01-19 20:59 ` Tomas Ebenlendr
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=41ED6964.9010102@list.ru \
--to=serbinenko.vova@list.ru \
--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 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.