[EMAIL PROTECTED] writes:

> Author: uwestoehr
> Date: Sat Apr 12 14:50:04 2008
> New Revision: 24244
>
> URL: http://www.lyx.org/trac/changeset/24244
> Log:
> tex2lyx: text.cpp, Parser.h, Parser.cpp:
>    fix the import of \makebox, fixes 
> http://bugzilla.lyx.org/show_bug.cgi?id=2504

Uwe, I have not been fast enough to react to your patch. I think the
new method is not needed because direct code is almost as compact.
Moreover, it is better IMO to keep the Parser interface small.

Does the attached patch make sense to you. It seems to work on the
test case you provided, but you'd better check yourself :)

JMarc

svndiff src/tex2lyx/

Index: src/tex2lyx/Parser.h
===================================================================
--- src/tex2lyx/Parser.h	(revision 24288)
+++ src/tex2lyx/Parser.h	(working copy)
@@ -158,8 +158,6 @@ public:
 	 * <tt>\begin{name}</tt> must be parsed already, <tt>\end{name}</tt>
 	 * is parsed but not returned.
 	 */
-	std::string getFullParentheseOpt();
-	/// \returns getArg('(', ')') including the parentheses
 	std::string const verbatimEnvironment(std::string const & name);
 	/// Returns the character of the current token and increments the token position.
 	char getChar();
Index: src/tex2lyx/text.cpp
===================================================================
--- src/tex2lyx/text.cpp	(revision 24288)
+++ src/tex2lyx/text.cpp	(working copy)
@@ -2349,10 +2349,11 @@ void parse_text(Parser & p, ostream & os
 		//\makebox() is part of the picture environment and different from \makebox{}
 		//\makebox{} will be parsed by parse_box when bug 2956 is fixed
 		else if (t.cs() == "makebox") {
-			string arg = "\\makebox";
-			if (p.next_token().character() == '(')
+			string arg = t.asInput();
+			Parser::Arg paren = p.getFullArg('(', ')');
+			if (paren.first)
 				//the syntax is: \makebox(x,y)[position]{content}
-				arg += p.getFullParentheseOpt();
+				arg += '(' + paren.second + ')';
 			else
 				//the syntax is: \makebox[width][position]{content}
 				arg += p.getFullOpt();
Index: src/tex2lyx/Parser.cpp
===================================================================
--- src/tex2lyx/Parser.cpp	(revision 24288)
+++ src/tex2lyx/Parser.cpp	(working copy)
@@ -317,13 +317,6 @@ string Parser::getOpt()
 	return res.empty() ? string() : '[' + res + ']';
 }
 
-string Parser::getFullParentheseOpt()
-{
-	Arg arg = getFullArg('(', ')');
-	if (arg.first)
-		return '(' + arg.second + ')';
-	return arg.second;
-}
 
 string const Parser::verbatimEnvironment(string const & name)
 {

Reply via email to