On 20.11.2011 16:45, Georg Baum wrote:
Peter Kümmel wrote:

The idea is nice, but the 4-character restriction makes it quite
unreadable IMHO.

Played around a bit and found this readable solution:


typedef boost::mpl::string<'\\end','_lay','out'>  end_layout;
typedef boost::mpl::string<'\\end','in','set'>    end_inset;

...


switch (boost::hash_value(token)) {
case hash_string<end_layout>::value:
LYXERR0("Solitary \\end_layout in line "<<  lex.lineNumber()<<  "\n"
<<  "Missing \\begin_layout ?");
return;
case hash_string<end_inset>::value:
LYXERR0("Solitary \\end_inset in line "<<  lex.lineNumber()<<  "\n"
<<  "Missing \\begin_inset ?");
return;
default:
;
};


This is indeed readable, and I like it. The speed argument is not
unimportant, since tex2lyx can be quite slow for larger docs. Nevertheless I
would propose not to use it as long as major tex2lyx backports to 2.0.x are
planned. Maybe after 2.0.3 this could indeed be the way to go.

Then I prepare the future switch.



Georg


Reply via email to