]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.149.jcn2
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 20 Apr 2001 13:44:19 +0000 (15:44 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 20 Apr 2001 13:44:19 +0000 (15:44 +0200)
1.3.149.jcn2
============

* Fixed one more shift/reduce rule in parser: c1/e  NOT

CHANGES
VERSION
input/no-notation/parse5.ly [new file with mode: 0644]
lily/parser.yy

diff --git a/CHANGES b/CHANGES
index 6ef74cf32f799846bd447f0dff256b291a4a7e76..b7adacbb30beb6005c180334d5725e70e9e059f3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+1.3.149.jcn2
+============
+
+* Fixed one more shift/reduce rule in parser: c1/e  NOT
+
 1.3.149.jcn1
 ============
 
diff --git a/VERSION b/VERSION
index 5303002d8dbc90ea70c90836709cdd044357a759..1139b03c0f9dda72ac094b2a354f660b1da982dc 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=149
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=jcn2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/input/no-notation/parse5.ly b/input/no-notation/parse5.ly
new file mode 100644 (file)
index 0000000..da016ea
--- /dev/null
@@ -0,0 +1,12 @@
+
+\score {
+   \context ChordNames \chords {
+        c1 /e  % trivial
+
+       c1 * 1/2   % think
+       c1 * 3 /e  % think
+
+       c1 * 1/3 /e % hard
+       c1/2 % must have parse error here
+   }
+}
index 39ebda46bbdb98868bb3cfa39a2c321d3ebfdffc..bf19d07cc17bf0e401537976f9b56a81dc56f726 100644 (file)
@@ -8,6 +8,13 @@
   (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
            Jan Nieuwenhuizen <janneke@gnu.org>
 */
+
+/*
+  Two shift/reduce problems:
+    -
+    -
+ */
+
 #include <ctype.h>
 #include <iostream.h>
 
@@ -294,11 +301,33 @@ yylex (YYSTYPE *s,  void * v_l)
 %type <scm>    script_abbreviation
 
 
-
+/*
+  left association: must reduce
+  a - b - c = (a - b) - c
+ */
 %left '-' '+'
 %left '*' '/'
 %left UNARY_MINUS
 
+
+
+/*
+  multiplied_duration precedence
+  `* 3 / c' and `* 1 / 2' should be equal, try shift rather than
+   forced reduce, and take higher precedence than plain `*' and `/'
+
+  -- ugr, but it doesn't really work? input/no-notation/parse5.ly
+     it seems that:
+
+       %left *forces* reduce
+       %right *forces* shift
+
+     but we need (the default): *try* shift, and we can't override
+     above %left '*' '/' with `%prec default setting'?
+
+ */
+%right MUL1 MUL2 INVERSION
+
 %%
 
 lilypond:      /* empty */
@@ -1584,15 +1613,32 @@ steno_duration:
 
 
 
+/*
+  Multiplied durations are always multiplied, ie,
+  c1 * INT or c1 * RAT.
+
+  No support for c1 /4 and c1 /2/2.
+
+  '*' and '/' are declared %left, with makes them reduce rather than
+  shift.
+
+  Because there are no a/b/c association problems anymore, it is
+  safe to allow '*' and '/' to shift.
+
+   * 1 / 4 shifts to match second rule: '* 1 / 4'
+
+   '/' TONIC_NAME shifts to match rule: chord_inversion
+
+ */
 multiplied_duration:
        steno_duration {
                $$ = $1;
        }
-       | multiplied_duration '*' bare_unsigned {
-               $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
+       | multiplied_duration '*' bare_unsigned %prec MUL1 {
+               $$ = unsmob_duration ($$)->compressed ($3).smobbed_copy ();
        }
-       | multiplied_duration '/' bare_unsigned {
-               $$ = unsmob_duration ($$)->compressed (Moment (1,$3)).smobbed_copy ();
+       | multiplied_duration '*' bare_unsigned '/' bare_unsigned %prec MUL2 {
+               $$ = unsmob_duration ($$)->compressed (Moment ($3, $5)).smobbed_copy ();
        }
        ;
 
@@ -1751,7 +1797,7 @@ chord_inversion:
        {
                $$ = SCM_EOL;
        }
-       | '/' steno_tonic_pitch {
+       | '/' steno_tonic_pitch %prec INVERSION {
                $$ = $2;
        }
        ;