>>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> Jean-Marc Lasgouttes wrote:
>> This seems much better. Feel free to apply it once you are
>> satisfied that it works.

Georg> I tested a bit more, and it seems to work, but makes the
Georg> assumption that LyXLex::getString() never returns an empty
Georg> string. Is that true, or do I have to check for that?

getString() can return an empty string if next() finds an empty token,
which is two consecutive quotes ("").

Another option that you could explore (in order to avoid to push
tokens), is to use LyXLex::eatLine() instead of LyXLex::nextToken(). This
uses the remainder of the line as next token. I am not sure whether it
will give you correctly an empty token when the argument to
\paperpackage is missing, but it is probably worth trying.

It would give something like:

+               lex.eatLine();
+               if (lex.getString().empty()) {
+                       params.paperpackage = BufferParams::PACKAGE_WIDEMARGINSA4;
+               } else {
+                       int tmpret = lex.findToken(string_paperpackages);
+                       if (tmpret == -1) {
+                               ++tmpret;
+                               params.paperpackage = BufferParams::PACKAGE_NONE;
+                       } else
+                               params.paperpackage = tmpret;
+               }

What do you think of that?

JMarc

Reply via email to