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

Issue 4871041: lexer.ll: remove unused patterns, avoid backing up (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by Keith
Modified:
12 years, 8 months ago
Reviewers:
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

lexer.ll: remove unused patterns, avoid backing up This removes the rest of the warnings from Lilypond `make bin` ... except for a type conversion warning in out/parser.cc generated by Bison -- I don't see a way to remove that warning.

Patch Set 1 #

Patch Set 2 : distinguish multiple tokens "7/b" from fraction #

Total comments: 5

Patch Set 3 : cleaner way to avoid (why?) backing up #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -22 lines) Patch
M lily/lexer.ll View 1 2 13 chunks +34 lines, -22 lines 8 comments Download

Messages

Total messages: 2
Keith
While we are cleaning up warnings, here is a patch for the lexer warnings. This ...
12 years, 8 months ago (2011-08-12 18:13:31 UTC) #1
Keith
12 years, 8 months ago (2011-08-18 06:28:54 UTC) #2
Moved the comments to the latest patch set for easy reading.

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll
File lily/lexer.ll (right):

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode23
lily/lexer.ll:23: backup rules
This comment instruction was violated, so this patch brings the code back in
compliance.
I do not know /why/ we avoid backup states -- we get no speed advantage -- but
it doesn't hurt.

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode265
lily/lexer.ll:265: <version>{ANY_CHAR} 	{
Include \n in the pattern, to avoid warning about fall back to the default
match.  (The fall-back never happened, because the rules that leave us in
<version> never left \n on the input stream.)

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode309
lily/lexer.ll:309: <incl>\\{BLACK}*{WHITE}? { /* got the include identifier */
Accept \include \foo<<EOF>> 
The old pattern failed if there was no whitespace after \foo, and had to back up
to the \

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode419
lily/lexer.ll:419: {UNSIGNED}/\/[^0-9] { // backup rule
The un-escaped forward slash is lookahead.  The pattern after the forward slash
remains on the input stream.
A FRACTION like 2/3 is a single token, but 7/b is three tokens (as in g:maj7/b).
 If we peek ahead two characters before taking the '/' off the stream, we avoid
the need to back up partway through a match of FRACTION.

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode423
lily/lexer.ll:423: {UNSIGNED}/\/	| // backup rule
Catches 3/<<EOF>>
Would be nice to combine these patterns with an OR, but that creates
"variable-trailing-context" which are said to be slower than having backup
states.

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode615
lily/lexer.ll:615: if (YY_START == longcomment)
Error reporting moved from line 287, to avoid warning that two rules match
<<EOF>> in start condition <longcomment>

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode647
lily/lexer.ll:647: -{UNSIGNED}	| // backup rule
When reading \paper { indent = -3 }
there was hope to read a REAL, but without a decimal point we had to backup and
return two tokens '-' '3'
Instead, accept -3 in the same was as a real.

http://codereview.appspot.com/4871041/diff/8001/lily/lexer.ll#newcode657
lily/lexer.ll:657: -\.	{ // backup rule
When reading \paper { indent = -.\mm }
lexer was hoping to see -.5 , but had to backup and return two tokens '-' '.' 
We could throw an error, or just let it be zero.
Sign in to reply to this message.

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