2015-04-27 9:56 GMT+02:00 Jürgen Spitzmüller:

> 2015-04-26 21:40 GMT+02:00 Jean-Marc Lasgouttes:
>
>> I think it should treat tab like space. It is probably not that hard to
>> look up all the uses of eatLine in the code. The only place I would be
>> scared about is the parsing on .lyx files
>>
>
> So should eatLine itself care about the \t -> blank conversion, or should
> we do it at the places where eatLine is used (which are only a few)?
>

I inspected the (actually not so few) uses now, and I think that getString
and getDocString is the place where tabs should be replaced by blanks.
Doing it in eatLine breaks parsing of LANGUAGES.

See attached patch. Opinions?

Jürgen


>
> Jürgen
>
>
>>
>> JMarc
>>
>>
>
diff --git a/src/Lexer.cpp b/src/Lexer.cpp
index c4b738f..1523155 100644
--- a/src/Lexer.cpp
+++ b/src/Lexer.cpp
@@ -700,7 +700,7 @@ string const Lexer::getString() const
        lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
 
        if (lastReadOk_)
-       return pimpl_->getString();
+               return ltrim(pimpl_->getString(), "\t ");
 
        return string();
 }
@@ -711,7 +711,7 @@ docstring const Lexer::getDocString() const
        lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
 
        if (lastReadOk_)
-               return pimpl_->getDocString();
+               return ltrim(pimpl_->getDocString(), "\t ");
 
        return docstring();
 }
@@ -731,7 +731,7 @@ string const Lexer::getLongString(string const & endtoken)
                        // blank line in the file being read
                        continue;
 
-               string const token = trim(getString(), " \t");
+               string const token = getString();
 
                LYXERR(Debug::PARSER, "LongString: `" << getString() << '\'');
 
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 02fc86e..5326247 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -981,7 +981,6 @@ bool TextClass::readCiteEngine(Lexer & lexrc)
                lexrc.eatLine();
                def = lexrc.getString();
                def = subst(def, " ", "");
-               def = subst(def, "\t", "");
                if (compare_ascii_no_case(def, "end") == 0) {
                        getout = true;
                        continue;

Reply via email to