Did I not read Jean-Marc saying yesterday that lyxlex tokens do not _have_ 
to start with '\\' ?

Well, given a string:

\labelwidthstring Senseless with this layout!
\align center 
\alignpossible 8
\aligndefault 8
\ininset 0

The block of code below works perfectly.

However, given
\labelwidthstring Senseless with this layout!
\align center
alignpossible 8
aligndefault 8
ininset 0

and stripping the '\\' from the 'token == "\\foobar"', I get:

Entered loop, token is 'alignpossible 8'

If tokens do not need to start with '\\' then I think that something is 
wrong with lyxlex. Jean-Marc, could you confirm that my understanding is 
correct.

Angus

        while (lex.isOK()) {
                lex.next();
                string const token = lex.getString();

                lyxerr << "Entered loop, token is '" << token << '\''
                       << std::endl;
                int Int = 0;
                if (token == "\\alignpossible" ||
                    token == "\\aligndefault" ||
                    token == "\\ininset") {
                        lex.next();
                        Int = lex.getInteger();
                } else {
                        // Unrecognised token
                        break;
                }
                    
                ++nset;

                if (token == "\\alignpossible") {
                        alignpossible_ = static_cast<LyXAlignment>(Int);
                } else if (token == "\\aligndefault") {
                        aligndefault_ = static_cast<LyXAlignment>(Int);
                } else {
                        ininset_ = Int;
                }
        }
        lyx::Assert(nset == 3);


Reply via email to