Overview
| Comment: | Now parses chord length |
|---|---|
| Timelines: | family | ancestors | descendants | both | ply |
| Files: | files | file ages | folders |
| SHA1: |
4aeb057ae0280185788e41edb33f2a26 |
| User & Date: | spiffytech@gmail.com on 2010-11-16 16:36:19.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2010-11-16
| ||
| 18:37 | Now prints csound code, both notes and chords, replicating the functionality of the original Minimaly Functional Version check-in: 9bd31df856 user: spiffytech@gmail.com tags: ply | |
| 16:36 | Now parses chord length check-in: 4aeb057ae0 user: spiffytech@gmail.com tags: ply | |
| 16:34 | Now parses chords check-in: 3d9a81ddef user: spiffytech@gmail.com tags: ply | |
Changes
Modified parse.py
from [486dbc368e]
to [8130e10658].
| ︙ | ︙ | |||
34 35 36 37 38 39 40 |
def t_error(t):
raise TypeError("Unknown text '%s'" % (t.value,))
lex.lex()
#lex.input("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD")
#s = "GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD"
| | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
def t_error(t):
raise TypeError("Unknown text '%s'" % (t.value,))
lex.lex()
#lex.input("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD")
#s = "GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD"
s = '''I IV V VI I "I" "ii"/2'''
#s = "GF_G,/2"
lex.input(s)
for tok in iter(lex.token, None):
print repr(tok.type), repr(tok.value)
# Parse (yacc)
|
| ︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
'''
p[0] = p[1]
def p_note_length(p):
''' note : note NOTE_LENGTH
'''
new_note = p[1]
new_note.duration = p[2]
p[0] = new_note
def p_chord(p):
'''chord : QUOTE pitch QUOTE
| > > > > > > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
'''
p[0] = p[1]
def p_note_length(p):
''' note : note NOTE_LENGTH
'''
new_note = p[1]
new_note.duration = p[2]
p[0] = new_note
def p_chord_length(p):
''' chord : chord NOTE_LENGTH
'''
new_note = p[1]
new_note.duration = p[2]
p[0] = new_note
def p_chord(p):
'''chord : QUOTE pitch QUOTE
|
| ︙ | ︙ |