]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2826: Let do_yyparse return a value rather than going through parseStringResult
authorDavid Kastrup <dak@gnu.org>
Sun, 9 Sep 2012 19:01:03 +0000 (21:01 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 9 Sep 2012 19:22:16 +0000 (21:22 +0200)
This is a much more dignified manner of interaction.

Documentation/de/notation/notation-appendices.itely
Documentation/es/notation/notation-appendices.itely
Documentation/fr/notation/notation-appendices.itely
Documentation/notation/notation-appendices.itely
lily/include/lily-parser.hh
lily/lily-parser.cc
lily/parser.yy

index fa23864dad52bea286e950dab369ee883e761e0b..f3d73f961d99bf14fdde15ac4578bc584486d826 100644 (file)
@@ -1635,7 +1635,6 @@ LilyPond benutzt folgende Parser-Variablen:
 @item mode
 @item output-count
 @item output-suffix
-@item parseStringResult
 @item partCombineListener
 @item pitchnames
 @item toplevel-bookparts
index 0a8fe0f779d26eef353c81edc1101e4beeceff64..8322909bb8cebc7b8ac1a7ebf6b3caf202b9ad17 100644 (file)
@@ -1656,7 +1656,6 @@ LilyPond.
 @cindex modo
 @cindex output-count
 @cindex output-suffix
-@cindex parseStringResult
 @cindex partCombineListener
 @cindex pitchnames
 @cindex toplevel-bookparts
@@ -1684,7 +1683,6 @@ LilyPond utiliza las siguientes variables del analizador sintáctico:
 @item mode
 @item output-count
 @item output-suffix
-@item parseStringResult
 @item partCombineListener
 @item pitchnames
 @item toplevel-bookparts
index 9653d907e38d21cd149f6296c12034c932a1afc3..ee1e153a6f361b79e93fcf622571abf38020504a 100644 (file)
@@ -1646,7 +1646,6 @@ programmes binaires de LilyPond.
 @cindex mode
 @cindex output-count
 @cindex output-suffix
-@cindex parseStringResult
 @cindex partCombineListener
 @cindex pitchnames
 @cindex toplevel-bookparts
@@ -1674,7 +1673,6 @@ LilyPond utilise les variables suivantes :
 @item mode
 @item output-count
 @item output-suffix
-@item parseStringResult
 @item partCombineListener
 @item pitchnames
 @item toplevel-bookparts
index 2eb3182e46201771d74cf7441300010f5a5d1526..e74dae6184639caa4a96455ece846bfe9dca6557 100644 (file)
@@ -1559,7 +1559,6 @@ binary installation.
 @cindex mode
 @cindex output-count
 @cindex output-suffix
-@cindex parseStringResult
 @cindex partCombineListener
 @cindex pitchnames
 @cindex toplevel-bookparts
@@ -1587,7 +1586,6 @@ LilyPond uses the following parser variables:
 @item mode
 @item output-count
 @item output-suffix
-@item parseStringResult
 @item partCombineListener
 @item pitchnames
 @item toplevel-bookparts
index 2e065ff31d70dd3b38e204ade3088484699ad6b2..810076c8a241a7e3d9e0b42ae3acf7a82dbddb7e 100644 (file)
@@ -60,7 +60,7 @@ public:
 
   void clear ();
   void do_init_file ();
-  void do_yyparse ();
+  SCM do_yyparse ();
   void include_string (string ly_code);
   void parse_file (string init, string name, string out_name);
   void parse_string (string ly_code);
@@ -68,7 +68,7 @@ public:
   void parser_error (string);
   void parser_error (Input const &, string);
   // The following is called as yyerror
-  static void parser_error (Input const *i, Lily_parser *parser, string s);
+  static void parser_error (Input const *i, Lily_parser *parser, SCM *, string s);
   void set_yydebug (bool);
 
   SCM make_scope () const;
index 67b7bcac1fe7a473471cdf71be42d718d7eb5c37..7b35f0e8e478c5b9a3cf3b7c26a18ab4fc418145 100644 (file)
@@ -171,9 +171,7 @@ Lily_parser::parse_string_expression (string ly_code, string filename,
   SCM parser = lexer_->lookup_identifier_symbol (ly_symbol2scm ("parser"));
   lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
   lexer_->push_extra_token (EMBEDDED_LILY);
-  do_yyparse ();
-  SCM result = lexer_->lookup_identifier_symbol (ly_symbol2scm ("parseStringResult"));
-  // parseStringResult is set in the grammar rule for embedded_lilypond
+  SCM result = do_yyparse ();
 
   lexer_->set_identifier (ly_symbol2scm ("parser"), parser);
   scm_set_current_module (mod);
index b7d9df12140de7e098fa524a1f9a8d9231220f1c..bacdcf23698d50e79acf1d1976ff332262e1e3fe 100644 (file)
@@ -40,6 +40,7 @@
 %}
 
 %parse-param {Lily_parser *parser}
+%parse-param {SCM *retval}
 %lex-param {Lily_parser *parser}
 %error-verbose
 %debug
@@ -144,7 +145,7 @@ using namespace std;
 #include "warn.hh"
 
 void
-Lily_parser::parser_error (Input const *i, Lily_parser *parser, string s)
+Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, string s)
 {
        parser->parser_error (*i, s);
 }
@@ -568,7 +569,7 @@ start_symbol:
                parser->lexer_->push_note_state (nn);
        } embedded_lilypond {
                parser->lexer_->pop_state ();
-               parser->lexer_->set_identifier (ly_symbol2scm ("parseStringResult"), $3);
+                *retval = $3;
        }
        ;
 
@@ -3251,10 +3252,12 @@ Lily_parser::set_yydebug (bool x)
        yydebug = x;
 }
 
-void
+SCM
 Lily_parser::do_yyparse ()
 {
-       yyparse (this);
+        SCM retval = SCM_UNDEFINED;
+       yyparse (this, &retval);
+        return retval;
 }