Skip to content

Commit

Permalink
Eliminated strong dependency on whiteSpace locations, at cost of a Sh…
Browse files Browse the repository at this point in the history
…ift-Reduce conflict.
  • Loading branch information
pgeerkens committed May 9, 2016
1 parent b01e95d commit a56ff2b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions QABCIronyParser/QabcGrammar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ public QabcGrammar() : base(false) {
Tune.Rule = MakePlusList<QabcAstNode>(Direction, whiteSpace, true) + NewLine
+ MakePlusList<QabcAstNode>(MusicLine);

MusicLine.Rule = MakePlusList<QabcAstNode>(MusicBar, whiteSpace, true) + NewLine;
MusicLine.Rule = MakePlusList<QabcAstNode>(MusicBar, whiteSpace, true) + NewLine
| whiteSpace + MusicLine;

MusicBar.Rule = MakePlusList<MusicBarAstNode>(Music, whiteSpace, true) + bar;
MusicBar.Rule = MakePlusList<MusicBarAstNode>(Music) + bar;

Music.Rule = Direction | Beam
| Music + whiteSpace;
#if KeySpec
| FieldKeyLine
#endif
Expand All @@ -128,20 +130,20 @@ public QabcGrammar() : base(false) {
Pitch.Rule = noteLetter
| noteLetter + sharpFlat;

Direction.ErrorRule = SyntaxError + NewLine;
Note.ErrorRule = SyntaxError + whiteSpace;
MusicLine.ErrorRule = SyntaxError + NewLine;
Music.ErrorRule = SyntaxError + whiteSpace;

#region Key Specification
#if KeySpec
FieldKeyLine.Rule = FieldK + Key; // + NewLine;
FieldKeyLine.Rule = FieldK + Key; // + NewLine;
Key.Rule = KeySpec | bagpipes;
KeySpec.Rule = Pitch
// | keyNote + modeSpec
; // | KeySpec + MakePlusList(GlobalAccidental,typeof(ListNode));
// keyNote.Rule = noteLetter | noteLetter + sharpFlat; //KeyAccidental;
// modeSpec.Rule = Mode
// modeSpec.Rule = Mode
// | PreferShiftHere() + whiteSpace + Mode;
// Mode.Rule = MakePlusList(Alpha, typeof(AbcList_String));
// Mode.Rule = MakePlusList(Alpha, typeof(AbcList_String));
// only specified modes allowed: look-up in list
// GlobalAccidental.Rule= PreferShiftHere() + whiteSpace + noteLetter + sharpFlat;
MarkTransient(FieldKeyLine);
Expand All @@ -158,7 +160,7 @@ public QabcGrammar() : base(false) {
new List<Irony.Parsing.Terminal>() {noteLetter,sharpFlat,dot,integer},
new List<Irony.Parsing.Terminal>() {tempo,length,octave,shift}
);
#endregion 7-Color Highlighting
#endregion 4-Color Highlighting
}

/// <summary>Whitespace is part of this grammar, so we override the routine that skips it.</summary>
Expand Down

0 comments on commit a56ff2b

Please sign in to comment.