[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Allow digits in identifiers (issue 6493072)
From: |
k-ohara5a5a |
Subject: |
Re: Allow digits in identifiers (issue 6493072) |
Date: |
Sun, 02 Sep 2012 17:59:53 +0000 |
Reviewers: dak,
http://codereview.appspot.com/6493072/diff/14/input/regression/page-spacing-nonstaff-lines-independent.ly
File input/regression/page-spacing-nonstaff-lines-independent.ly (left):
http://codereview.appspot.com/6493072/diff/14/input/regression/page-spacing-nonstaff-lines-independent.ly#oldcode11
input/regression/page-spacing-nonstaff-lines-independent.ly:11:
\addlyrics { high \skip2 }
On 2012/09/02 11:52:46, dak wrote:
It is also not clear why c5 should not be
a valid identifier when ce5 is.
Both /can/ be valid identifiers, if we want.
c4 = {...} at top-level defines a variable, then inside any braces for
music-entry:
c4 is a quarter note on do.
\c4 references the variable.
More simple than today, when I may use 'recs' as an identifier name,
unless I speak Spanish.
http://codereview.appspot.com/6493072/diff/14/input/regression/ragged-bottom-one-page.ly
File input/regression/ragged-bottom-one-page.ly (right):
http://codereview.appspot.com/6493072/diff/14/input/regression/ragged-bottom-one-page.ly#newcode13
input/regression/ragged-bottom-one-page.ly:13: \repeat unfold 16 { c'4 }
On 2012/09/02 11:52:46, dak wrote:
Why are the braces needed here?
Maybe not strictly needed here, but showing the concept of always
putting music-with-durations inside at least one level of bracing.
http://codereview.appspot.com/6493072/diff/14/lily/lexer.ll
File lily/lexer.ll (left):
http://codereview.appspot.com/6493072/diff/14/lily/lexer.ll#oldcode397
lily/lexer.ll:397: <chords,notes,figures>{RESTNAME}/[-_] | // pseudo
backup rule
On 2012/09/02 11:52:46, dak wrote:
Did you check that r-. does still work as intended when removing this
rule?
The syntax never allowed new identifier definitions in
sequential/simultaneous music.
\relative c' { new-variable-name = { c d e f } } % never valid
So there lexer need not look ahead for un-escaped WORDs while scanning
note and rest entries.
http://codereview.appspot.com/6493072/diff/14/lily/lexer.ll
File lily/lexer.ll (right):
http://codereview.appspot.com/6493072/diff/14/lily/lexer.ll#newcode34
lily/lexer.ll:34: flex -b <this lexer file>
On 2012/09/02 11:52:46, dak wrote:
Did you do this?
A long while ago; I haven't checked it lately,
http://codereview.appspot.com/6493072/diff/14/lily/lexer.ll#newcode476
lily/lexer.ll:476: {A}+ {
On 2012/09/02 11:52:46, dak wrote:
So words no longer correspond to commands regarding their syntax in
note mode?
COMMAND is still \WORD so they strictly correspond.
Only COMMAND is a token in note-mode, not WORD, because we are not
defining new identifiers here.
Previously, WORD was matching note-names, but that was wrong because in
{ c d e_sharp f } 'e_sharp' is a valid WORD, but not a valid note-name.
http://codereview.appspot.com/6493072/diff/14/lily/lexer.ll#newcode859
lily/lexer.ll:859: push_note_state (nn);
On 2012/09/02 11:52:46, dak wrote:
What is this supposed to do? INITIAL state is not supposed to have
pitchnames
defined.
To fully-bake this implementation, I would want INITIAL to have
pitchnames defined, so I can use INITIAL at top level to recognize the
pitch in \relative do' {}.
Then entry into note-mode would not need to push onto
pitchname_tab_stack_
http://codereview.appspot.com/6493072/diff/14/lily/parser.yy
File lily/parser.yy (right):
http://codereview.appspot.com/6493072/diff/14/lily/parser.yy#newcode1190
lily/parser.yy:1190: '{' { parser->lexer_->push_maybe_note_state (); }
music_list '}'
On 2012/09/02 11:52:46, dak wrote:
Pushing a separate "maybe_note_ state for _every_ braced music list?
Seriously?
For every nested level of braces.
Description:
Allow digits in identifiers
Set lexer state to INITIAL for top-level expressions,
switching to 'notes' mode inside music-expressions
Please review this at http://codereview.appspot.com/6493072/
Affected files:
A input/regression/identifiers-with-digits.ly
M input/regression/page-spacing-nonstaff-lines-independent.ly
M input/regression/phrasing-slur-multiple.ly
M input/regression/ragged-bottom-one-page.ly
M input/regression/skiptypesetting-show-first-and-last.ly
M input/regression/skiptypesetting-show-first.ly
M input/regression/skiptypesetting-show-last.ly
M input/regression/slur-multiple.ly
M lily/include/lily-lexer.hh
M lily/lexer.ll
M lily/lily-lexer.cc
M lily/parser.yy
M scripts/musicxml2ly.py