Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5640)

Issue 316430043: Parser: discriminate quoted and non-quoted strings (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years ago by dak
Modified:
6 years, 5 months ago
Reviewers:
Visibility:
Public.

Description

Parser: discriminate quoted and non-quoted strings Checking quoted strings for syntactic correctness seems spurious, as does splitting them into multiple symbols. Now "x.y" is treated as a list of two symbols without the quotation marks, but as a single string or symbol when given quotation marks. This allows using quotation marks for creating arbitrary symbols, and consequently specifying key lists using quoted strings without the strings being split in other components or being rejected because of syntactical reasons. Also contains commit: Reorganize Lily_lexer::scan_bare_word This also redefines LilyPond's manners of converting simple expressions into music, most notably checking drum types for being defined before accepting them as note values.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+189 lines, -26 lines) Patch
M lily/include/lily-lexer.hh View 1 chunk +1 line, -0 lines 0 comments Download
M lily/lexer.ll View 5 chunks +19 lines, -8 lines 0 comments Download
M lily/parser.yy View 18 chunks +169 lines, -18 lines 0 comments Download

Messages

Total messages: 3
lemzwerg
Honestly, I don't understand the description of your change. Can you give a second example? ...
7 years ago (2017-04-02 16:47:52 UTC) #1
Dan Eble
FWIW, the description sounds like a good idea to me.
7 years ago (2017-04-02 16:57:12 UTC) #2
dak
7 years ago (2017-04-02 17:21:39 UTC) #3
On 2017/04/02 16:47:52, lemzwerg wrote:
> Honestly, I don't understand the description of your change.   Can you give a
> second example?  And is there something to add to the documentation?

Words are split into lists at . and , : this is what makes

\lyrics { \override Lyrics.LyricText = ... }

work in the first place since in lyricmode Lyrics.LyricText is a single word. 
But when I write "Lyrics.LyricText" with quotemarks around, splitting it seems
like a bad idea in most contexts.

If I have a function argument of type key-list? and I give it

    1,"soprano2","alto.3"

it seems like complaining about bad symbol syntax for soprano2 and/or splitting
"alto" and "3" into two separate arguments and/or complaining about them will
just not be expected behavior.

The concrete case that I want this behavior for looks like

\version "2.19.59"

\header {
  texidoc = "The @code{\\voicify} command can be used for continuing voices
and changing the order of @code{\\voiceOne}@dots{}@code{\\voiceFour} style
overrides."
}

\layout { ragged-right = ##t }

{
  \time 2/4
  \new Voice = "sop" {
    a'2~ |
    \voicify 1,"sop" << e''2 \\ { \voiceTwo a'2~ \oneVoice } >>
    a'2
  }
  \voicify 1,3,4,2 << a''2 \\ e''2 \\ c''2 \\ a'2 >>
}

Now I don't really want to have to distinguish between using strings/symbols for
key lists on the LilyPond side of things, and obviously something like
"soprano.2" or "tenors, at least purportedly" should end up being one rather
than two list entries.

I am not overly enthused that everything will be turned into symbols in this
application, but as long as strings are being used for identification, interning
them into symbols might actually make sense in the long haul internally even
though currently voice ids are still strings.

\voicify will have a separate review, but most of the tradeoffs taken are
actually integrated in this issue here.  The keypoint is that I don't want
material in quote marks to be further syntax-analyzed or split, even if that
material is intended to end up as a symbol.  And for that the lexer has to tell
the parser whether or not quote marks were involved in its forming of a
word/string.  And I don't want to have the user worry too much about the
string/symbol distinction while sticking with LilyPond syntax (and even a bit of
Scheme).
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b