spiffyscore
Diff
Not logged in

Differences From Artifact [ba81961e5a244d10]:

To Artifact [09e3498be39b61fc]:


30 raise TypeError("Unknown text '%s'" % (t.value,)) 30 raise TypeError("Unknown text '%s'" % (t.value,)) 31 31 32 t_ignore = " |" 32 t_ignore = " |" 33 33 34 lex.lex() 34 lex.lex() 35 35 36 #lex.input("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD") 36 #lex.input("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD") 37 #s = "GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD" | 37 s = "GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD" 38 s = "GF_G,/2" | 38 #s = "GF_G,/2" 39 lex.input(s) 39 lex.input(s) 40 for tok in iter(lex.token, None): 40 for tok in iter(lex.token, None): 41 print repr(tok.type), repr(tok.value) 41 print repr(tok.type), repr(tok.value) 42 42 43 43 44 # Parse (yacc) 44 # Parse (yacc) 45 45 46 class Note(object): 46 class Note(object): 47 def __init__(self, value, duration=.25, octave=8): 47 def __init__(self, value, duration=.25, octave=8): 48 self.value = value 48 self.value = value 49 self.duration = duration 49 self.duration = duration 50 self.octave = octave 50 self.octave = octave > 51 self.accidental = None 51 def __repr__(self): 52 def __repr__(self): 52 return "Note %s %s %s" % (self.value, self.duration, self.octave) 53 return "Note %s %s %s" % (self.value, self.duration, self.octave) 53 54 54 #def p_element(p): 55 #def p_element(p): 55 # "element : note_element" 56 # "element : note_element" 56 # p[0] = p[1] 57 # p[0] = p[1] 57 # 58 #