From 5e4493d97be6b5cb4c4e740870a5c6923e5f6a69 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 4 Nov 2010 15:44:32 +0000 Subject: [PATCH] Move generally useful parser routines to parser_tools. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36065 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 13 ++----------- lib/lyx2lyx/parser_tools.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 92e9cb7675..4241531484 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -23,7 +23,8 @@ import re, string import unicodedata import sys, os -from parser_tools import find_token, find_end_of, find_tokens, get_value, get_value_string +from parser_tools import find_token, find_end_of, find_tokens, \ + find_end_of_inset, find_end_of_layout, get_value, get_value_string #################################################################### # Private helper functions @@ -38,16 +39,6 @@ def remove_option(document, m, option): return True -def find_end_of_inset(lines, i): - " Find end of inset, where lines[i] is included." - return find_end_of(lines, i, "\\begin_inset", "\\end_inset") - - -def find_end_of_layout(lines, i): - " Find end of layout, where lines[i] is included." - return find_end_of(lines, i, "\\begin_layout", "\\end_layout") - - # Note that text can be either a list of lines or a single line. def add_to_preamble(document, text): """ Add text to the preamble if it is not already there. diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index 9b63e00fd1..0299ed7c4a 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -231,3 +231,13 @@ def find_nonempty_line(lines, start, end = 0): if is_nonempty_line(lines[i]): return i return -1 + + +def find_end_of_inset(lines, i): + " Find end of inset, where lines[i] is included." + return find_end_of(lines, i, "\\begin_inset", "\\end_inset") + + +def find_end_of_layout(lines, i): + " Find end of layout, where lines[i] is included." + return find_end_of(lines, i, "\\begin_layout", "\\end_layout") -- 2.39.2