Lähettäjä: Edward Bartolo Päiväys: Vastaanottaja: Steve Litt Kopio: dng Aihe: Re: [DNG] Would you guys hate me if...
In the case of simple parsing requirements, I prefer to have the
program itself do the parsing instead of relying on an external
parser. This remove the extra dependency on the parser.
I would also like to comment on the text file format in which menus
and menu trees will be stored. If I were to code the project myself I
would opt to avoid using a nested format to mimic a tree structure.
Instead lines defining tree-nodes would be used as I described
earlier.
placement="main menu/sub-menu1/next-sub-menu1"
This neatly describes tree nodes without using a nested format. It
also allows menu items to be placed anywhere in the file which is an
advantage.
Such parser would "understand" the start of a menu definition by the
"placement=" string after which it should search for other fields as I
described earlier. A menu definition would be delimited by the next
"placement=" string.
What I am describing is simple but it can effectively be used to
define a menu tree that is saved in a human editable/readable format
not requiring any external parsers.
Requoting for ease of reference:
<<
placement="/path/to/menu/item/in/menu/tree"
name="my cool menu"
command="/path/to/command param1 param2 ..."
icon="/path/to/icon" >>
Edward
--
If you can't explain it simply, you don't understand it well enough.