]> git.donarmstrong.com Git - lilypond.git/commitdiff
(re_dict): remove all *? regexps.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 22 Apr 2002 16:14:55 +0000 (16:14 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 22 Apr 2002 16:14:55 +0000 (16:14 +0000)
ChangeLog
scripts/lilypond-book.py

index 8ea5954ecbb9b859be4c8b9d9fdfd8725710753d..48dd9bf94282701e07009cadbc6e45f485c5a927 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-04-22  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * scripts/lilypond-book.py (re_dict): remove all *? regexps.
+
 2002-04-22  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scripts/lilypond-book.py (re_dict): Fix for python 2.x.
 
        * Rewrote new conditional guile >= 1.5 compilation switches, to keep
          code clean from conditionals and have a concentrated sets of
-         compatitility fixes for old guile versions.
+         compatibility fixes for old guile versions.
 
        * Fixes for guile 1.4, including embedded ps.
 
index 413060a70a1132d6be365c8d32e8c803f6b57d14..9710a8dcc0bd387998f78d5d95095f14d7a0b905 100644 (file)
@@ -468,23 +468,23 @@ def output_verbatim (body):
 
 
 re_dict = {
-       'latex': {'input': r'(?m)^[^%\n]*?(?P<match>\\mbinput{?([^}\t \n}]*))',
-                 'include': r'(?m)^[^%\n]*?(?P<match>\\mbinclude{(?P<filename>[^}]+)})',
+       'latex': {'input': r'(?m)^[^%\n]*(?P<match>\\mbinput{?([^}\t \n}]*))',
+                 'include': r'(?m)^[^%\n]*(?P<match>\\mbinclude{(?P<filename>[^}]+)})',
                  'option-sep' : ',\s*',
-                 'header': r"\\documentclass\s*(\[.*?\])?",
-                 'geometry': r"^(?m)[^%\n]*?\\usepackage\s*(\[(?P<options>.*)\])?\s*{geometry}",
+                 'header': r"\\documentclass\s*(\[.*\])?",
+                 'geometry': r"^(?m)[^%\n]*\\usepackage\s*(\[(?P<options>.*)\])?\s*{geometry}",
                  'preamble-end': r'(?P<code>\\begin{document})',
-                 'verbatim': r"(?s)(?P<code>\\begin{verbatim}.*?\\end{verbatim})",
-                 'verb': r"(?P<code>\\verb(?P<del>.).*?(?P=del))",
-                 'lilypond-file': r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*{(P<filename>[^}]+)})',
-                 'lilypond' : r'(?m)^[^%\n]*?(?P<match>\\lilypond\s*(\[(?P<options>.*?)\])?\s*{(?P<code>.*?)})',
-                 'lilypond-block': r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
+                 'verbatim': r"(?s)(?P<code>\\begin{verbatim}.*\\end{verbatim})",
+                 'verb': r"(?P<code>\\verb(?P<del>.).*(?P=del))",
+                 'lilypond-file': r'(?m)^[^%\n]*(?P<match>\\lilypondfile\s*(\[(?P<options>.*)\])?\s*{(?P<filename>[^}]+)})',
+                 'lilypond' : r'(?m)^[^%\n]*(?P<match>\\lilypond\s*(\[(?P<options>.*)\])?\s*{(?P<code>.*)})',
+                 'lilypond-block': r"(?sm)^[^%\n]*(?P<match>\\begin\s*(\[(?P<options>.*)\])?\s*{lilypond}(?P<code>.*)\\end{lilypond})",
                  'def-post-re': r"\\def\\postLilypondExample",
                  'def-pre-re': r"\\def\\preLilypondExample",             
                  'usepackage-graphics': r"\usepackage{graphics}",
-                 'intertext': r',?\s*intertext=\".*?\"',
+                 'intertext': r',?\s*intertext=\".*\"',
                  'multiline-comment': no_match,
-                 'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
+                 'singleline-comment': r"(?m)^.*(?P<match>(?P<code>^%.*$\n+))",
                  'numcols': r"(?P<code>\\(?P<num>one|two)column)",
                  },
 
@@ -493,20 +493,20 @@ re_dict = {
 
        
        'texi': {
-                'include':  '(?m)^[^%\n]*?(?P<match>@mbinclude[ \n\t]+(?P<filename>[^\t \n]*))',
+                'include':  '(?m)^[^%\n]*(?P<match>@mbinclude[ \n\t]+(?P<filename>[^\t \n]*))',
                 'input': no_match,
                 'header': no_match,
                 'preamble-end': no_match,
                 'landscape': no_match,
-                'verbatim': r"""(?s)(?P<code>@example\s.*?@end example\s)""",
-                'verb': r"""(?P<code>@code{.*?})""",
-                'lilypond-file': '(?m)^(?P<match>@lilypondfile(\[(?P<options>[^]]*)\])?{(?P<filename>[^}]+)})',
-                'lilypond' : '(?m)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?{(?P<code>.*?)})',
-                'lilypond-block': r"""(?ms)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?\s(?P<code>.*?)@end lilypond)\s""",
+                'verbatim': r"""(?s)(?P<code>@example\s.*@end example\s)""",
+                'verb': r"""(?P<code>@code{.*})""",
+                'lilypond-file': r"""(?m)^(?P<match>@lilypondfile(\[(?P<options>[^]]*)\])?{(?P<filename>[^}]+)})""",
+                'lilypond' : r"""(?m)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?{(?P<code>.*)})""",
+                'lilypond-block': r"""(?ms)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?\s(?P<code>.*)@end lilypond)\s""",
                  'option-sep' : ',\s*',
-                 'intertext': r',?\s*intertext=\".*?\"',
-                 'multiline-comment': r"(?sm)^\s*(?!@c\s+)(?P<code>@ignore\s.*?@end ignore)\s",
-                 'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>@c.*$\n+))",
+                 'intertext': r',?\s*intertext=\".*\"',
+                 'multiline-comment': r"(?sm)^\s*(?!@c\s+)(?P<code>@ignore\s.*@end ignore)\s",
+                 'singleline-comment': r"(?m)^.*(?P<match>(?P<code>@c.*$\n+))",
                  'numcols': no_match,
                 }
        }
@@ -637,8 +637,8 @@ def compose_full_body (body, opts):
 
 def parse_options_string(s):
        d = {}
-       r1 = re.compile("((\w+)={(.*?)})((,\s*)|$)")
-       r2 = re.compile("((\w+)=(.*?))((,\s*)|$)")
+       r1 = re.compile("((\w+)={(.*)})((,\s*)|$)")
+       r2 = re.compile("((\w+)=(.*))((,\s*)|$)")
        r3 = re.compile("(\w+?)((,\s*)|$)")
        while s:
                m = r1.match(s)
@@ -676,7 +676,7 @@ def scan_latex_preamble(chunks):
                for o in options:
                        if o == 'landscape':
                                paperguru.m_landscape = 1
-                       m = re.match("(.*?)paper", o)
+                       m = re.match("(.*)paper", o)
                        if m:
                                paperguru.m_papersize = m.group()
                        else:
@@ -836,6 +836,7 @@ def chop_chunks(chunks, re_name, func, use_match=0):
         if c[0] == 'input':
             str = c[1]
             while str:
+               print re_name
                 m = get_re (re_name).search (str)
                 if m == None:
                     newchunks.append (('input', str))
@@ -916,7 +917,7 @@ def schedule_lilypond_block (chunk):
        file_body = compose_full_body (body, opts)
        basename = 'lily-' + `abs(hash (file_body))`
        for o in opts:
-               m = re.search ('filename="(.*?)"', o)
+               m = re.search ('filename="(.*)"', o)
                if m:
                        basename = m.group (1)
                        if not taken_file_names.has_key(basename):
@@ -963,7 +964,7 @@ def schedule_lilypond_block (chunk):
                newbody = output_verbatim (body)
 
        for o in opts:
-               m = re.search ('intertext="(.*?)"', o)
+               m = re.search ('intertext="(.*)"', o)
                if m:
                        newbody = newbody  + m.group (1) + "\n\n"
        if format == 'latex':
@@ -1260,7 +1261,7 @@ def fix_epswidth (chunks):
 
                        return '%fpt' % (dims[0] *lmag)
        
-               body = re.sub (r"""\\lilypondepswidth{(.*?)}""", replace_eps_dim, c[1])
+               body = re.sub (r"""\\lilypondepswidth{(.*)}""", replace_eps_dim, c[1])
                newchunks.append(('lilypond', body, c[2], c[3], c[4]))
                        
        return newchunks