On 2022-04-18 19:46, Jean-Marc Lasgouttes wrote:
Le 18/03/2022 à 18:45, Daniel a écrit :
Is it possible to have optional arguments read with Lexer? I imagine something like:

Command <Parameter1> [<Parameter2>]

So Parameter1 is necessary but Parameter2 is optional. The Lexer would only look on the same line for an optional parameter.

Going back to old mails...

Me too... Unfortunately, I still find the lexer stuff hard to understand.

What is possible is to read one line with eatLine() and then parse it, possibly with the lexer itself.

Maybe someone can give me a hint on how to create a lexer from a string that I get via eatLine()?

Or do something like in Layout::readAlignPossible.

So, could I alternatively just use lex.next() and still don't eat too many commands because it would be somehow reset once I use lex.popTable(), or what would be the idea?

Background:

I am back to getting the DynamicMenuButton to work with classic menus rather than having to hard code every menu in a cumbersome and non-customizable way.

It works, but I would like to combine two different button styles:

(1) a simple menu when one clicks on a button (as with Custom text styles)

(2) a function on the button itself and a menu to the side (as with Paste).

So, I thought about a function like this:

DynamicMenuButton <menu> <label> [<function>]

where the last argument is optional.

/Daniel


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to