]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/convert-ly.py
(1.9.0): Handle phrasing slur.
[lilypond.git] / scripts / convert-ly.py
index d13fad6140d178c01adbe6a08df4ec2e15ac1e2f..0812c0e06547c639ae227c2c5ed802a4211a7f0c 100644 (file)
@@ -1,9 +1,9 @@
 #!@PYTHON@
 #
 # convert-ly.py -- Update old LilyPond input files (fix name?)
-# 
+#
 # source file of the GNU LilyPond music typesetter
-# 
+#
 # (c)  1998--2003  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 #                 Jan Nieuwenhuizen <janneke@gnu.org>
 
@@ -41,7 +41,7 @@ def identify ():
 
 def usage ():
        sys.stdout.write (
-               r"""Usage: %s [OPTIONS]... [FILE]... 
+               r"""Usage: %s [OPTIONS]... [FILE]...
 Try to convert to newer lilypond-versions.  The version number of the
 input is guessed by default from \version directive.
 
@@ -517,7 +517,7 @@ if 1:
                str = re.sub (r"""\\key *([a-z]+) *;""", r"""\\key \1 \major;""",str);
                return str
        conversions.append (((1,3,59), conv,
-                '\key X ; -> \key X major; ')) 
+                '\key X ; -> \key X major; '))
 
 if 1:
        def conv (str):
@@ -632,7 +632,7 @@ if 1:
                str = re.sub ('\\\\property *"?Voice"? *[.] *"?textStyle"? *= *"([^"]*)"', '\\\\property Voice.TextScript \\\\set #\'font-style = #\'\\1', str)
                str = re.sub ('\\\\property *"?Lyrics"? *[.] *"?textStyle"? *= *"([^"]*)"', '\\\\property Lyrics.LyricText \\\\set #\'font-style = #\'\\1', str)
 
-               str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?timeSignatureStyle"? *= *"([^"]*)"', '\\\\property \\1.TimeSignature \\\\override #\'style = #\'\\2', str) 
+               str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?timeSignatureStyle"? *= *"([^"]*)"', '\\\\property \\1.TimeSignature \\\\override #\'style = #\'\\2', str)
 
                str = re.sub ('"?timeSignatureStyle"? *= *#?""', 'TimeSignature \\\\override #\'style = ##f', str)
                
@@ -640,12 +640,12 @@ if 1:
                
                str = re.sub ('#\'style *= #*"([^"])"', '#\'style = #\'\\1', str)
                
-               str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?horizontalNoteShift"? *= *"?#?([-0-9]+)"?', '\\\\property \\1.NoteColumn \\\\override #\'horizontal-shift = #\\2', str) 
+               str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?horizontalNoteShift"? *= *"?#?([-0-9]+)"?', '\\\\property \\1.NoteColumn \\\\override #\'horizontal-shift = #\\2', str)
 
                # ugh
                str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *""', '\\\\property \\1.Stem \\\\override #\'flag-style = ##f', str)
                
-               str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *"([^"]*)"', '\\\\property \\1.Stem \\\\override #\'flag-style = #\'\\2', str) 
+               str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *"([^"]*)"', '\\\\property \\1.Stem \\\\override #\'flag-style = #\'\\2', str)
                return str
        
        conversions.append (((1,3,98), conv, 'CONTEXT.textStyle -> GROB.#font-style '))
@@ -866,7 +866,7 @@ if 1:
                              func, str)
                return str
 
-       # 40 ? 
+       # 40 ?
        conversions.append (((1,5,40), conv, 'breakAlignOrder property names'))
        
 
@@ -1008,7 +1008,7 @@ if 1:
                return "(make-span-event '%s %s)" % (mtype , stype)
 
        def subst_definition_ev_name(match):
-               return ' = #%s' % subst_ev_name (match) 
+               return ' = #%s' % subst_ev_name (match)
        def subst_inline_ev_name (match):
                s = subst_ev_name (match)
                return '#(ly-export %s)' % s
@@ -1284,95 +1284,120 @@ if 1:
 
                last_str = ''
                while last_str <> str:
-                 last_str = str
-                 def sub_dyn_end (m):
-                         dyns.append (' -\!')
-                         return ' ' + m.group(2)
-
-                 str = re.sub (r'(\\!)\s*([a-z]+)', sub_dyn_end, str)
-                 def sub_slurs(m):
-                         if '-)' not in slur_strs:
-                                 slur_strs.append ( '-)')
-                         return m.group(1)
-                 def sub_p_slurs(m):
-                         if '-\)' not in slur_strs:
-                                 slur_strs.append ( '-\)')
-                         return m.group(1)
-                 str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str)
-                 str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str)
-                 def sub_begin_slurs(m):
-                         if '-(' not in slur_strs:
-                                 slur_strs.append ( '-(')
-                         return m.group(1)
-                 str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(", sub_begin_slurs, str)
-                 def sub_begin_p_slurs(m):
-                         if '-\(' not in slur_strs:
-                                 slur_strs.append ( '-\(')
-                         return m.group(1)
-
-                 str = re.sub (r"([a-z]+[,'!?0-9 ]*)\\\(", sub_begin_p_slurs, str)
-
-                 def sub_dyns (m):
-                         s = m.group(0)
-                         if s == '@STARTCRESC@':
-                                 slur_strs.append ("-\\<")
-                         elif s == '@STARTDECRESC@':
-                                 slur_strs.append ("-\\>")
-                         elif s == r'-?\\!':
-                                 slur_strs.append ('-\\!')
-                         return ''
-
-                 str = re.sub (r'@STARTCRESC@', sub_dyns, str)
-                 str = re.sub (r'-?\\!', sub_dyns, str)
-
-                 def sub_articulations (m):
-                         a = m.group(1)
-                         if a not in slur_strs:
-                                 slur_strs.append (a)
-                         return ''
-
-                 str = re.sub (r"([_^-]\@ACCENT\@)", sub_articulations, str)
-                 str = re.sub (r"([_^-]\\[a-z]+)", sub_articulations, str)
-                 str = re.sub (r"([_^-][>_.+|^-])", sub_articulations, str)
-
-                 def sub_pslurs(m):
-                         slur_strs.append ( ' -\\)')
-                         return m.group(1)
-                 str = re.sub (r"\\\)[ ]*([a-z]+)", sub_pslurs, str)
-
-               suffix = string.join (slur_strs, '') + string.join (pslur_strs, '') \
+                       last_str = str
+                       def sub_tremolos (m):
+                               tr = m.group (2)
+                               if tr not in slur_strs:
+                                       slur_strs.append (tr)
+                               return  m.group (1)
+                       
+                       str = re.sub (r"([a-z]+[',!? ]*)(:[0-9]+)",
+                                     sub_tremolos, str)
+
+                       def sub_dyn_end (m):
+                               dyns.append (' \!')
+                               return ' ' + m.group(2)
+
+                       str = re.sub (r'(\\!)\s*([a-z]+)', sub_dyn_end, str)
+                       def sub_slurs(m):
+                               if '-)' not in slur_strs:
+                                       slur_strs.append (')')
+                               return m.group(1)
+                       
+                       def sub_p_slurs(m):
+                               if '-\)' not in slur_strs:
+                                       slur_strs.append ('\)')
+                               return m.group(1)
+                       
+                       str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str)
+                       str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str)
+                       def sub_begin_slurs(m):
+                               if '-(' not in slur_strs:
+                                       slur_strs.append ('(')
+                               return m.group(1)
+                       
+                       str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(",
+                                     sub_begin_slurs, str)
+                       def sub_begin_p_slurs(m):
+                               if '-\(' not in slur_strs:
+                                       slur_strs.append ('\(')
+                               return m.group(1)
+
+                       str = re.sub (r"([a-z]+[,'!?0-9 ]*)\\\(",
+                               sub_begin_p_slurs, str)
+
+                       def sub_dyns (m):
+                               s = m.group(0)
+                               if s == '@STARTCRESC@':
+                                       slur_strs.append ("\\<")
+                               elif s == '@STARTDECRESC@':
+                                       slur_strs.append ("\\>")
+                               elif s == r'-?\\!':
+                                       slur_strs.append ('\\!')
+                               return ''
+
+                       str = re.sub (r'@STARTCRESC@', sub_dyns, str)
+                       str = re.sub (r'-?\\!', sub_dyns, str)
+
+                       def sub_articulations (m):
+                               a = m.group(1)
+                               if a not in slur_strs:
+                                       slur_strs.append (a)
+                               return ''
+
+                       str = re.sub (r"([_^-]\@ACCENT\@)", sub_articulations,
+                                     str)
+                       str = re.sub (r"([_^-]\\[a-z]+)", sub_articulations,
+                                     str)
+                       str = re.sub (r"([_^-][>_.+|^-])", sub_articulations,
+                                     str)
+
+                       def sub_pslurs(m):
+                               slur_strs.append (' \\)')
+                               return m.group(1)
+                       str = re.sub (r"\\\)[ ]*([a-z]+)", sub_pslurs, str)
+
+               ## end of while <>
+
+               suffix = string.join (slur_strs, '') + string.join (pslur_strs,
+                                                                   '') \
                         + string.join (dyns, '')
 
                return '@STARTCHORD@%s@ENDCHORD@%s%s' % (str , dur_str, suffix)
 
 
 
-
-
        def sub_chords (str):
                simend = '>'
-               simstart = "<" 
+               simstart = '<'
                chordstart = '<<'
                chordend = '>>'
+               marker_str = '%% new-chords-done %%'
 
                if re.search (marker_str,str):
                        return str
-               str= re.sub (r'\\<', '@STARTCRESC@', str)
-               str= re.sub (r'\\>', '@STARTDECRESC@', str)
-               str= re.sub (r'([_^-])>', r'\1@ACCENT@', str)
-               str = re.sub ('<([^<>{}]+)>', sub_chord, str)
-
-               str = re.sub (r'\[ *(@STARTCHORD@[^@]+@ENDCHORD@[0-9.]+)',
-                             r'\1-[',
-                             str)
-               str = re.sub (r'\\! *(@STARTCHORD@[^@]+@ENDCHORD@[0-9.]+)',
-                             r'\1-\\!',
-                             str)
-               str = re.sub ('<([^?])', r'%s\1' % simstart, str)
-               str = re.sub ('>([^?])', r'%s\1' % simend,  str)
+               str = re.sub ('<<', '@STARTCHORD@', str)
+               str = re.sub ('>>', '@ENDCHORD@', str)
+               
+               str = re.sub (r'\\<', '@STARTCRESC@', str)
+               str = re.sub (r'\\>', '@STARTDECRESC@', str)
+               str = re.sub (r'([_^-])>', r'\1@ACCENT@', str)
+               str = re.sub (r'<([^<>{}]+)>', sub_chord, str)
+
+               # add dash: -[, so that [<<a b>> c d] becomes
+               #                      <<a b>>-[ c d]
+               # and gets skipped by articulation_substitute
+               str = re.sub (r'\[ *(@STARTCHORD@[^@]+@ENDCHORD@[0-9.]*)',
+                             r'\1-[', str)
+               str = re.sub (r'\\! *(@STARTCHORD@[^@]+@ENDCHORD@[0-9.]*)',
+                             r'\1-\\!', str)
+               
+               str = re.sub (r'<([^?])', r'%s\1' % simstart, str)
+               str = re.sub (r'>([^?])', r'%s\1' % simend,  str)
                str = re.sub ('@STARTCRESC@', r'\\<', str)
                str = re.sub ('@STARTDECRESC@', r'\\>' ,str)
-               str = re.sub (r'\\context *Voice *@STARTCHORD@', '@STARTCHORD@', str)
+               str = re.sub (r'\\context *Voice *@STARTCHORD@',
+                             '@STARTCHORD@', str)
                str = re.sub ('@STARTCHORD@', chordstart, str)
                str = re.sub ('@ENDCHORD@', chordend, str)
                str = re.sub (r'@ACCENT@', '>', str)
@@ -1380,11 +1405,13 @@ if 1:
 
        def articulation_substitute (str):
                str = re.sub (r"""([^-])\[ *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
-                             r" \1 \2-[", str)
-               str = re.sub (r"""([^-])\) *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
-                             r"\1 \2-)", str)
+                             r"\1 \2[", str)
+               str = re.sub (r"""([^-])\\\) *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
+                             r"\1 \2\\)", str)
+               str = re.sub (r"""([^-\\])\) *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
+                             r"\1 \2)", str)
                str = re.sub (r"""([^-])\\! *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
-                             r"\1 \2-\\!", str)
+                             r"\1 \2\\!", str)
                return str
        
        def conv_relative(str):
@@ -1395,15 +1422,292 @@ if 1:
        
        def conv (str):
                str =  conv_relative (str)
-               if re.search (marker_str, str) == None :
-                       str = sub_chords (str)
+               str = sub_chords (str)
 
                str = articulation_substitute (str)
                
                return str
        
        conversions.append (((1,9,0), conv, """New relative mode,
-Postfix articulations, new chord syntax."))
+Postfix articulations, new chord syntax."""))
+
+if 1:
+       def conv (str):
+               if re.search ("font-style",str):
+                       sys.stderr.write ("font-style is deprecated. Please remove.")
+                       raise FatalConversionError()
+                       
+               str = re.sub (r'-\\markup', r'@\\markup', str)
+               str = re.sub (r'-\\', r'\\', str)
+               str = re.sub (r'-\)', ')', str)
+               str = re.sub (r'-\(', '(', str)
+               str = re.sub ('-\[', '[', str)
+               str = re.sub ('-\]', ']', str)
+               str = re.sub ('-~', '~', str)
+               str = re.sub (r'@\\markup', r'-\\markup', str)
+               return str
+
+       conversions.append (((1,9,1), conv, """Remove - before articulation"""))
+if 1:
+       def conv (str):
+               str = re.sub ('ly:set-context-property',
+                             'ly:set-context-property!', str)
+               str = re.sub ('\\\\newcontext', '\\\\new', str)
+               str = re.sub ('\\\\grace[\t\n ]*([^{ ]+)',
+                             r'\\grace { \1 }', str)
+               str = re.sub ("\\\\grace[\t\n ]*{([^}]+)}",
+                             r"""\\grace {
+  \\property Voice.Stem \\override #'stroke-style = #"grace"
+  \1
+  \\property Voice.Stem \\revert #'stroke-style }
+""", str)
+               
+               return str
+       
+       conversions.append (((1,9,2), conv, """\newcontext -> \new"""))
+
+if 1:
+       def conv (str):
+               str = re.sub ('accacciatura',
+                             'acciaccatura', str)
+
+               if re.search ("context-spec-music", str):
+                       sys.stderr.write ("context-spec-music takes a symbol for the context now. Update by hand.")
+                                       
+                       raise FatalConversionError()
+               
+               str = re.sub ('fingerHorizontalDirection *= *#(LEFT|-1)',
+                             "fingeringOrientations = #'(up down left)", str)
+               str = re.sub ('fingerHorizontalDirection *= *#(RIGHT|1)',
+                             "fingeringOrientations = #'(up down right)", str)
+
+               return str
+       
+       conversions.append (((1,9,3), conv,
+                            """\acciaccatura misspelling, fingerHorizontalDirection -> fingeringOrientations"""))
+
+
+def conv (str):
+       if re.search ('\\figures', str):
+               sys.stderr.write ("Warning: attempting automatic \\figures conversion.  Check results!");
+               
+       
+       def figures_replace (m):
+               s = m.group (1)
+               s = re.sub ('<', '@FIGOPEN@',s)
+               s = re.sub ('>', '@FIGCLOSE@',s)
+               return '\\figures { %s }' % s
+       
+       str = re.sub (r'\\figures[ \t\n]*{([^}]+)}', figures_replace, str)
+       str = re.sub (r'\\<', '@STARTCRESC@', str)
+       str = re.sub (r'\\>', '@STARTDECRESC@', str)
+       str = re.sub (r'([-^_])>', r'\1@ACCENT@', str)
+       str = re.sub (r'<<', '@STARTCHORD@', str)
+       str = re.sub (r'>>', '@ENDCHORD@', str)
+       str = re.sub (r'>', '@ENDSIMUL@', str)
+       str = re.sub (r'<', '@STARTSIMUL@', str)
+       str = re.sub ('@STARTDECRESC@', '\\>', str)
+       str = re.sub ('@STARTCRESC@', '\\<', str)
+       str = re.sub ('@ACCENT@', '>', str)
+       str = re.sub ('@ENDCHORD@', '>', str)
+       str = re.sub ('@STARTCHORD@', '<', str)
+       str = re.sub ('@STARTSIMUL@', '<<', str)
+       str = re.sub ('@ENDSIMUL@', '>>', str)
+       str = re.sub ('@FIGOPEN@', '<', str)
+       str = re.sub ('@FIGCLOSE@', '>', str)
+
+       return str
+
+conversions.append (((1,9,4), conv, 'Swap < > and << >>'))
+
+
+def conv (str):
+       str = re.sub ('HaraKiriVerticalGroup', 'RemoveEmptyVerticalGroup', str)
+
+       return str
+
+conversions.append (((1,9,5), conv, 'HaraKiriVerticalGroup -> RemoveEmptyVerticalGroup'))
+
+def conv (str):
+       if re.search ("ly:get-font", str) :
+               sys.stderr.write (r"(ly:get-font foo ..)  has been replaced by" + \
+                                 " (ly:paper-get-font (ly:grob-get-paper foo) .. ).\n" +\
+                                 "please update manually.")
+               
+               raise FatalConversionError()
+       
+       if re.search ("\\pitch *#", str) :
+               sys.stderr.write (r"\\pitch has been deprecated. " +\
+                                 " Use Scheme code to construct arbitrary note events.")
+               
+               raise FatalConversionError()
+       
+       return str
+               
+
+conversions.append (((1,9,6), conv, 'ly:get-font deprecated.'))
+
+def conv (str):
+       def sub_alteration (m):
+               alt = m.group (3)
+               alt = {
+                       '-1': 'FLAT',
+                       '-2': 'DOUBLE-FLAT',
+                       '0': 'NATURAL',
+                       '1': 'SHARP',
+                       '2': 'DOUBLE-SHARP',
+                       }[alt]
+               
+               return '(ly:make-pitch %s %s %s)' % (m.group(1), m.group (2),
+                                                    alt)
+       
+       str =re.sub ("\\(ly:make-pitch *([0-9-]+) *([0-9-]+) *([0-9-]+) *\\)",
+                    sub_alteration, str)
+
+
+       str = re.sub ("ly:verbose", "ly:get-option 'verbose", str)
+
+       m= re.search ("\\\\outputproperty #([^#]+)[\t\n ]*#'([^ ]+)", str)
+       if m:
+               sys.stderr.write (\
+                       r"""\outputproperty found,
+Please hand-edit, using
+
+  \applyoutput #(outputproperty-compatibility %s '%s <GROB PROPERTY VALUE>)
+
+as a substitution text.""" % (m.group (1), m.group (2)) )
+               raise FatalConversionError ()
+
+       if re.search ("ly:(make-pitch|pitch-alteration)", str) \
+              or re.search ("keySignature", str):
+               sys.stderr.write (
+"""The alteration field of Scheme pitches was multiplied by 2
+to support quarter tone accidentals. You have to edit the following constructs by hand:
+
+* calls of  ly:make-pitch and ly:pitch-alteration
+* keySignature settings made with \property
+""")
+               raise FatalConversionError ()
+       
+       return str
+conversions.append (((1,9,7), conv,
+                    '''use symbolic constants for alterations,
+remove \\outputproperty, move ly:verbose into ly:get-option'''))
+
+
+def conv (str):
+       if re.search ("dash-length",str):
+               sys.stderr.write ("""dash-length has been removed. Use dash-fraction instead.""")
+               raise FatalConversionError()
+       return str
+
+conversions.append (((1,9,8), conv, """dash-length -> dash-fraction"""))
+
+
+def conv (str):
+       def func(match):
+               return "#'font-size = #%d" % (2*string.atoi (match.group (1))) 
+               
+       str =re.sub (r"#'font-relative-size\s*=\s*#([0-9-]+)", func, str)
+       str =re.sub (r"#'font-family\s*=\s*#'ancient",
+                    r"#'font-family = #'music", str)
+       
+       return str
+
+conversions.append (((2,1,1), conv, """font-relative-size -> font-size"""))
+
+def conv (str):
+       str =re.sub (r"ly:get-music-length", "ly:music-length", str)
+       return str
+
+conversions.append (((2,1,2), conv, """ly:get-music-length -> ly:music-length"""))
+
+def conv (str):
+       str =re.sub (r"\.\s+stz=", ". instr ", str)
+       return str
+
+conversions.append (((2,1,3), conv, """stanza -> instrument"""))
+
+def conv (str):
+       def func (match):
+               c = match.group (1)
+               b = match.group (2)
+               
+               if b == 't':
+                       if c == 'Score':
+                               return ''
+                       else:
+                               return r" \property %s.melismaBusyProperties \unset"  % c
+               elif b == 'f':
+                       return r"\property %s.melismaBusyProperties = #'(melismaBusy)"  % c
+               
+       str =re.sub (r"\\property ([a-zA-Z]+)\s*\.\s*automaticMelismata\s*=\s*##([ft])", func, str)
+       return str
+
+conversions.append (((2,1,4), conv, """removal of automaticMelismata; use melismaBusyProperties instead."""))
+
+
+
+def conv (str):
+       str =re.sub (r"\\translator\s+([a-zA-Z]+)", r"\\change \1", str)
+       return str
+
+conversions.append (((2,1,7), conv, """\\translator Staff -> \\change Staff"""))
+
+def conv (str):
+       str =re.sub (r"\\newaddlyrics", r"\\lyricsto", str)
+       return str
+
+conversions.append (((2,1,10), conv, """\\newaddlyrics -> \\lyricsto"""))
+
+def conv (str):
+       str = re.sub (r'\\include\s*"paper([0-9]+)(-init)?.ly"',
+                     r"#(set-staff-size \1)", str)
+
+       def sub_note (match):
+               dur = ''
+               log = string.atoi (match.group (1))
+               dots = string.atoi (match.group (2))
+               
+               if log >= 0:
+                       dur = '%d' % (1 << log)
+               else:
+                       dur = { -1 : 'breve',
+                               -2 : 'longa',
+                               -3 : 'maxima'}[log]
+
+               dur += ('.' * dots)
+               
+               return r'\note #"%s" #%s' % (dur, match.group (3))
+       
+       str = re.sub (r'\\note\s+#([0-9-]+)\s+#([0-9]+)\s+#([0-9.-]+)',
+                     sub_note, str)
+       return str
+
+conversions.append (((2,1,11), conv, """\\include "paper16.ly" -> #(set-staff-size 16)
+\note #3 #1 #1 -> \note #"8." #1
+"""))
+
+
+def conv (str):
+       str =re.sub (r"OttavaSpanner", r"OttavaBracket", str)
+       return str
+
+conversions.append (((2,1,12), conv, """OttavaSpanner -> OttavaBracket"""))
+
+
+def conv (str):
+       str =re.sub (r"\(set-staff-size ", r"(set-global-staff-size ", str)
+       return str
+
+conversions.append (((2,1,13), conv, """set-staff-size -> set-global-staff-size"""))
+
+def conv (str):
+       str =re.sub (r"#'style\s*=\s*#'dotted-line",
+                    r"#'dash-fraction = #0.0 ", str)
+       return str
+
+conversions.append (((2,1,14), conv, """style = dotted -> dash-fraction = 0"""))
 
 ################################
 #      END OF CONVERSIONS      
@@ -1539,7 +1843,7 @@ identify ()
 for f in files:
        if f == '-':
                f = ''
-       if not os.path.isfile (f):
+       elif not os.path.isfile (f):
                continue
        try:
                do_one_file (f)
@@ -1555,4 +1859,5 @@ for f in files:
                else:
                        sys.stderr.write ("%s: skipping: `%s' " % (program_name,  f))
                pass
+
 sys.stderr.write ('\n')