Author: baum
Date: Sun Dec  4 17:00:00 2011
New Revision: 40363
URL: http://www.lyx.org/trac/changeset/40363

Log:
fix parsing of \def macros (was broken with the spreadsheet template support)

Modified:
   lyx-devel/trunk/src/tex2lyx/text.cpp

Modified: lyx-devel/trunk/src/tex2lyx/text.cpp
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/text.cpp        Sun Dec  4 16:35:59 2011        
(r40362)
+++ lyx-devel/trunk/src/tex2lyx/text.cpp        Sun Dec  4 17:00:00 2011        
(r40363)
@@ -2326,12 +2326,19 @@
 
                else if (is_macro(p)) {
                        // catch the case of \def\inputGnumericTable
+                       bool macro = true;
                        if (t.cs() == "def") {
-                               Token second = p.get_token();
+                               Token second = p.next_token();
                                if (second.cs() == "inputGnumericTable") {
+                                       p.pushPosition();
+                                       p.get_token();
                                        skip_braces(p);
                                        Token third = p.get_token();
+                                       p.popPosition();
                                        if (third.cs() == "input") {
+                                               p.get_token();
+                                               skip_braces(p);
+                                               p.get_token();
                                                string name = 
normalize_filename(p.verbatim_item());
                                                string const path = 
getMasterFilePath();
                                                // We want to preserve relative 
/ absolute filenames,
@@ -2357,10 +2364,11 @@
                                                   << name << "\n";
                                                end_inset(os);
                                                context.check_layout(os);
+                                               macro = false;
                                        }
                                }
                        }
-                       if (is_macro(p))
+                       if (macro)
                                parse_macro(p, os, context);
                }
 

Reply via email to