/[svn]/linuxsampler/trunk/src/network/lscp.y
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscp.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1001 by schoenebeck, Wed Dec 27 16:17:08 2006 UTC revision 2510 by schoenebeck, Thu Jan 23 04:00:26 2014 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2014 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 21  Line 21 
21   *   MA  02111-1307  USA                                                   *   *   MA  02111-1307  USA                                                   *
22   ***************************************************************************/   ***************************************************************************/
23    
24  /* CAUTION: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */  /*
25  /*                                                                         */      The parser's C++ source files should be automatically (re)generated if
26  /*     don't forget to run 'make parser' after you changed this file,      */      this file was modified. If not, or in case you want explicitly
27  /*     otherwise the parser will not be regenerated !                      */      regenerate the parser C++ files, run 'make parser'. In both cases you
28  /*                                                                         */      need to have bison or another yacc compatible parser generator
29  /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */      installed though.
30    */
31    
32  %{  %{
33    
34  #include "lscpparser.h"  #include "lscpparser.h"
35  #include "lscpserver.h"  #include "lscpserver.h"
36  #include "lscpevent.h"  #include "lscpevent.h"
37    #include "lscpsymbols.h"
38    #include <algorithm>
39    
40    namespace LinuxSampler {
41    
42  // to save us typing work in the rules action definitions  // to save us typing work in the rules action definitions
43  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer
44    #define SESSION_PARAM ((yyparse_param_t*) yyparse_param)
45    #define INCREMENT_LINE { SESSION_PARAM->iLine++; SESSION_PARAM->iColumn = 0; sParsed.clear(); }
46    
47  // clears input buffer  // clears input buffer
48  void restart(yyparse_param_t* pparam, int& yychar);  void restart(yyparse_param_t* pparam, int& yychar);
49  #define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar)  #define RESTART restart((yyparse_param_t*) YYPARSE_PARAM, yychar)
50    
 // we provide our own version of yyerror() so we don't have to link against the yacc library  
 void yyerror(const char* s);  
   
51  static char buf[1024]; // input buffer to feed the parser with new characters  static char buf[1024]; // input buffer to feed the parser with new characters
52  static int bytes = 0;  // current number of characters in the input buffer  static int bytes = 0;  // current number of characters in the input buffer
53  static int ptr   = 0;  // current position in the input buffer  static int ptr   = 0;  // current position in the input buffer
54    static String sLastError; // error message of the last error occured
55    static String sParsed; ///< Characters of current line which have already been shifted (consumed/parsed) by the parser.
56    
57  // external reference to the function which actually reads from the socket  // external reference to the function which actually reads from the socket
58  extern int GetLSCPCommand( void *buf, int max_size);  extern int GetLSCPCommand( void *buf, int max_size);
59    
60    // external reference to the function in lscpserver.cpp which returns the
61    // current session (only works because the server runs as singleton)
62    extern yyparse_param_t* GetCurrentYaccSession();
63    
64    // returns true if supplied characters has an ASCII code of 128 or higher
65    inline bool isExtendedAsciiChar(const char c) {
66        return (c < 0);
67    }
68    
69  // custom scanner function which reads from the socket  // custom scanner function which reads from the socket
70    // (bison expects it to return the numerical ID of the next
71    // "recognized token" from the input stream)
72  int yylex(YYSTYPE* yylval) {  int yylex(YYSTYPE* yylval) {
73      // check if we have to read new characters      // check if we have to read new characters
74      if (ptr >= bytes) {      if (ptr >= bytes) {
# Line 62  int yylex(YYSTYPE* yylval) { Line 79  int yylex(YYSTYPE* yylval) {
79              return 0;              return 0;
80          }          }
81      }      }
82      return (int) buf[ptr++];      // this is the next character in the input stream
83        const char c = buf[ptr++];
84        // increment current reading position (just for verbosity / messages)
85        GetCurrentYaccSession()->iColumn++;
86        sParsed += c;
87        // we have to handle "normal" and "extended" ASCII characters separately
88        if (isExtendedAsciiChar(c)) {
89            // workaround for characters with ASCII code higher than 127
90            yylval->Char = c;
91            return EXT_ASCII_CHAR;
92        } else {
93            // simply return the ASCII code as terminal symbol ID
94            return (int) c;
95        }
96    }
97    
98    // parser helper functions
99    
100    int octalsToNumber(char oct_digit0, char oct_digit1 = '0', char oct_digit2 = '0') {
101        const char d0[] = { oct_digit0, '\0' };
102        const char d1[] = { oct_digit1, '\0' };
103        const char d2[] = { oct_digit2, '\0' };
104        return atoi(d2)*8*8 + atoi(d1)*8 + atoi(d0);
105    }
106    
107    }
108    
109    using namespace LinuxSampler;
110    
111    static std::set<String> yyExpectedSymbols();
112    
113    /**
114     * Will be called when an error occured (usually syntax error).
115     *
116     * We provide our own version of yyerror() so we a) don't have to link against
117     * the yacc library and b) can render more helpful syntax error messages.
118     */
119    void yyerror(void* x, const char* s) {
120        yyparse_param_t* param = GetCurrentYaccSession();
121    
122        // get the text part already parsed (of current line)
123        const bool bContainsLineFeed =
124            sParsed.find('\r') != std::string::npos ||
125            sParsed.find('\n') != std::string::npos;
126        // remove potential line feed characters
127        if (bContainsLineFeed) {
128            for (size_t p = sParsed.find('\r'); p != std::string::npos;
129                 p = sParsed.find('\r')) sParsed.erase(p);
130            for (size_t p = sParsed.find('\n'); p != std::string::npos;
131                 p = sParsed.find('\n')) sParsed.erase(p);
132        }
133    
134        // start assembling the error message with Bison's own message
135        String txt = s;
136    
137        // append exact position info of syntax error
138        txt += (" (line:"  + ToString(param->iLine+1)) +
139               (",column:" + ToString(param->iColumn)) + ")";
140    
141        // append the part of the lined that has already been parsed
142        txt += ". Context: \"" + sParsed;
143        if (txt.empty() || bContainsLineFeed)
144            txt += "^";
145        else
146            txt.insert(txt.size() - 1, "^");
147        txt += "...\"";
148    
149        // append the non-terminal symbols expected now/next
150        std::set<String> expectedSymbols = yyExpectedSymbols();
151        for (std::set<String>::const_iterator it = expectedSymbols.begin();
152             it != expectedSymbols.end(); ++it)
153        {
154            if (it == expectedSymbols.begin())
155                txt += " -> Should be: " + *it;
156            else
157                txt += " | " + *it;
158        }
159    
160        dmsg(2,("LSCPParser: %s\n", txt.c_str()));
161        sLastError = txt;
162  }  }
163    
164  %}  %}
165    
166  // reentrant parser  // reentrant parser
167  %pure_parser  %pure-parser
168    
169    %parse-param {void* yyparse_param}
170    
171  %type <Char> char digit  // After entering the yyparse() function, store references to the parser's
172  %type <Dotnum> dotnum volume_value boolean  // state stack, so that we can create more helpful syntax error messages than
173  %type <Number> number sampler_channel instrument_index fx_send_id audio_channel_index device_index midi_input_channel_index midi_input_port_index midi_map midi_bank midi_prog midi_ctrl  // Bison (2.x) could do.
174  %type <String> string text stringval digits param_val_list param_val filename map_name entry_name fx_send_name engine_name command add_instruction create_instruction destroy_instruction get_instruction list_instruction load_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type_name midi_input_type_name remove_instruction unmap_instruction set_instruction subscribe_event unsubscribe_event map_instruction reset_instruction clear_instruction  %initial-action {
175        yyparse_param_t* p = (yyparse_param_t*) yyparse_param;
176        p->ppStackBottom = &yyss;
177        p->ppStackTop    = &yyssp;
178    }
179    
180    // tell bison to spit out verbose syntax error messages
181    %error-verbose
182    
183    %token <Char> EXT_ASCII_CHAR
184    
185    %type <Char> char char_base alpha_char digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex
186    %type <Dotnum> real dotnum volume_value boolean control_value
187    %type <Number> number sampler_channel instrument_index fx_send_id audio_channel_index device_index effect_index effect_instance effect_chain chain_pos input_control midi_input_channel_index midi_input_port_index midi_map midi_bank midi_prog midi_ctrl
188    %type <String> string string_escaped text text_escaped text_escaped_base stringval stringval_escaped digits param_val_list param_val query_val filename module effect_system db_path map_name entry_name fx_send_name effect_name engine_name command add_instruction create_instruction destroy_instruction get_instruction list_instruction load_instruction send_instruction set_chan_instruction load_instr_args load_engine_args audio_output_type_name midi_input_type_name remove_instruction unmap_instruction set_instruction subscribe_event unsubscribe_event map_instruction reset_instruction clear_instruction find_instruction move_instruction copy_instruction scan_mode edit_instruction format_instruction append_instruction insert_instruction
189  %type <FillResponse> buffer_size_type  %type <FillResponse> buffer_size_type
190  %type <KeyValList> key_val_list  %type <KeyValList> key_val_list query_val_list
191  %type <LoadMode> instr_load_mode  %type <LoadMode> instr_load_mode
192    %type <Bool> modal_arg
193    %type <UniversalPath> path path_base path_prefix path_body
194    
195  %start input  %start input
196    
# Line 97  input                 : line LF Line 211  input                 : line LF
211                        | line CR LF                        | line CR LF
212                        ;                        ;
213    
214  line                  :  /* epsilon (empty line ignored) */ { return LSCP_DONE; }  line                  :  /* epsilon (empty line ignored) */ { INCREMENT_LINE; return LSCP_DONE; }
215                        |  comment  { return LSCP_DONE; }                        |  comment  { INCREMENT_LINE; return LSCP_DONE; }
216                        |  command  { LSCPSERVER->AnswerClient($1); return LSCP_DONE; }                        |  command  { INCREMENT_LINE; LSCPSERVER->AnswerClient($1); return LSCP_DONE; }
217                        |  error    { LSCPSERVER->AnswerClient("ERR:0:Unknown command.\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }                        |  error    { INCREMENT_LINE; LSCPSERVER->AnswerClient("ERR:0:" + sLastError + "\r\n"); RESTART; return LSCP_SYNTAX_ERROR; }
218                        ;                        ;
219    
220  comment               :  '#'  comment               :  '#'
# Line 122  command               :  ADD SP add_inst Line 236  command               :  ADD SP add_inst
236                        |  SET SP set_instruction                { $$ = $3;                                                }                        |  SET SP set_instruction                { $$ = $3;                                                }
237                        |  SUBSCRIBE SP subscribe_event          { $$ = $3;                                                }                        |  SUBSCRIBE SP subscribe_event          { $$ = $3;                                                }
238                        |  UNSUBSCRIBE SP unsubscribe_event      { $$ = $3;                                                }                        |  UNSUBSCRIBE SP unsubscribe_event      { $$ = $3;                                                }
                       |  SELECT SP text                        { $$ = LSCPSERVER->QueryDatabase($3);                     }  
239                        |  RESET SP reset_instruction            { $$ = $3;                                                }                        |  RESET SP reset_instruction            { $$ = $3;                                                }
240                        |  CLEAR SP clear_instruction            { $$ = $3;                                                }                        |  CLEAR SP clear_instruction            { $$ = $3;                                                }
241                          |  FIND SP find_instruction              { $$ = $3;                                                }
242                          |  MOVE SP move_instruction              { $$ = $3;                                                }
243                          |  COPY SP copy_instruction              { $$ = $3;                                                }
244                          |  EDIT SP edit_instruction              { $$ = $3;                                                }
245                          |  FORMAT SP format_instruction          { $$ = $3;                                                }
246                          |  SEND SP send_instruction              { $$ = $3;                                                }
247                          |  APPEND SP append_instruction          { $$ = $3;                                                }
248                          |  INSERT SP insert_instruction          { $$ = $3;                                                }
249                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }
250                        |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }                        |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }
251                        ;                        ;
252    
253  add_instruction       :  CHANNEL                               { $$ = LSCPSERVER->AddChannel();                          }  add_instruction       :  CHANNEL                               { $$ = LSCPSERVER->AddChannel();                  }
254                          |  CHANNEL SP MIDI_INPUT SP sampler_channel SP device_index                           { $$ = LSCPSERVER->AddChannelMidiInput($5,$7);    }
255                          |  CHANNEL SP MIDI_INPUT SP sampler_channel SP device_index SP midi_input_port_index  { $$ = LSCPSERVER->AddChannelMidiInput($5,$7,$9); }
256                          |  DB_INSTRUMENT_DIRECTORY SP db_path    { $$ = LSCPSERVER->AddDbInstrumentDirectory($3);  }
257                          |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP db_path SP filename                        { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);        }
258                          |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP FILE_AS_DIR SP db_path SP filename         { $$ = LSCPSERVER->AddDbInstruments($5,$9,$11, true, true); }
259                          |  DB_INSTRUMENTS SP scan_mode SP db_path SP filename                                     { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);              }
260                          |  DB_INSTRUMENTS SP scan_mode SP FILE_AS_DIR SP db_path SP filename                      { $$ = LSCPSERVER->AddDbInstruments($3,$7,$9, false, true); }
261                          |  DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename                                     { $$ = LSCPSERVER->AddDbInstruments($5,$7, -1, true);       }
262                          |  DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename SP instrument_index                 { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);        }
263                          |  DB_INSTRUMENTS SP db_path SP filename                                                  { $$ = LSCPSERVER->AddDbInstruments($3,$5);                 }
264                          |  DB_INSTRUMENTS SP db_path SP filename SP instrument_index                              { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);              }
265                        |  MIDI_INSTRUMENT_MAP                   { $$ = LSCPSERVER->AddMidiInstrumentMap();                }                        |  MIDI_INSTRUMENT_MAP                   { $$ = LSCPSERVER->AddMidiInstrumentMap();                }
266                        |  MIDI_INSTRUMENT_MAP SP map_name       { $$ = LSCPSERVER->AddMidiInstrumentMap($3);              }                        |  MIDI_INSTRUMENT_MAP SP map_name       { $$ = LSCPSERVER->AddMidiInstrumentMap($3);              }
267                          |  SEND_EFFECT_CHAIN SP device_index     { $$ = LSCPSERVER->AddSendEffectChain($3);                }
268                        ;                        ;
269    
270  subscribe_event       :  AUDIO_OUTPUT_DEVICE_COUNT             { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_audio_device_count);   }  subscribe_event       :  AUDIO_OUTPUT_DEVICE_COUNT             { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_audio_device_count);   }
# Line 139  subscribe_event       :  AUDIO_OUTPUT_DE Line 272  subscribe_event       :  AUDIO_OUTPUT_DE
272                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_count);    }                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_count);    }
273                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_info);     }                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_device_info);     }
274                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_count);        }                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_count);        }
275                          |  CHANNEL_MIDI                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_midi);         }
276                          |  DEVICE_MIDI                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_device_midi);          }
277                        |  VOICE_COUNT                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_voice_count);          }                        |  VOICE_COUNT                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_voice_count);          }
278                        |  STREAM_COUNT                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_stream_count);         }                        |  STREAM_COUNT                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_stream_count);         }
279                        |  BUFFER_FILL                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_buffer_fill);          }                        |  BUFFER_FILL                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_buffer_fill);          }
280                        |  CHANNEL_INFO                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_info);         }                        |  CHANNEL_INFO                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_channel_info);         }
281                          |  FX_SEND_COUNT                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_fx_send_count);        }
282                          |  FX_SEND_INFO                          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_fx_send_info);         }
283                        |  MIDI_INSTRUMENT_MAP_COUNT             { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_map_count); }                        |  MIDI_INSTRUMENT_MAP_COUNT             { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_map_count); }
284                        |  MIDI_INSTRUMENT_MAP_INFO              { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_map_info);  }                        |  MIDI_INSTRUMENT_MAP_INFO              { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_map_info);  }
285                        |  MIDI_INSTRUMENT_COUNT                 { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_count);     }                        |  MIDI_INSTRUMENT_COUNT                 { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_count);     }
286                        |  MIDI_INSTRUMENT_INFO                  { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_info);      }                        |  MIDI_INSTRUMENT_INFO                  { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_midi_instr_info);      }
287                          |  DB_INSTRUMENT_DIRECTORY_COUNT         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instr_dir_count);   }
288                          |  DB_INSTRUMENT_DIRECTORY_INFO          { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instr_dir_info);    }
289                          |  DB_INSTRUMENT_COUNT                   { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instr_count);       }
290                          |  DB_INSTRUMENT_INFO                    { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instr_info);        }
291                          |  DB_INSTRUMENTS_JOB_INFO               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_db_instrs_job_info);   }
292                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_misc);                 }                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_misc);                 }
293                          |  TOTAL_STREAM_COUNT                    { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_total_stream_count);   }
294                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_total_voice_count);    }                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_total_voice_count);    }
295                          |  GLOBAL_INFO                           { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_global_info);          }
296                          |  EFFECT_INSTANCE_COUNT                 { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_fx_instance_count);    }
297                          |  EFFECT_INSTANCE_INFO                  { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_fx_instance_info);     }
298                          |  SEND_EFFECT_CHAIN_COUNT               { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_send_fx_chain_count);  }
299                          |  SEND_EFFECT_CHAIN_INFO                { $$ = LSCPSERVER->SubscribeNotification(LSCPEvent::event_send_fx_chain_info);   }
300                        ;                        ;
301    
302  unsubscribe_event     :  AUDIO_OUTPUT_DEVICE_COUNT             { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_audio_device_count);   }  unsubscribe_event     :  AUDIO_OUTPUT_DEVICE_COUNT             { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_audio_device_count);   }
# Line 156  unsubscribe_event     :  AUDIO_OUTPUT_DE Line 304  unsubscribe_event     :  AUDIO_OUTPUT_DE
304                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_count);    }                        |  MIDI_INPUT_DEVICE_COUNT               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_count);    }
305                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_info);     }                        |  MIDI_INPUT_DEVICE_INFO                { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_device_info);     }
306                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_count);        }                        |  CHANNEL_COUNT                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_count);        }
307                          |  CHANNEL_MIDI                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_midi);         }
308                          |  DEVICE_MIDI                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_device_midi);          }
309                        |  VOICE_COUNT                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_voice_count);          }                        |  VOICE_COUNT                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_voice_count);          }
310                        |  STREAM_COUNT                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_stream_count);         }                        |  STREAM_COUNT                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_stream_count);         }
311                        |  BUFFER_FILL                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_buffer_fill);          }                        |  BUFFER_FILL                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_buffer_fill);          }
312                        |  CHANNEL_INFO                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_info);         }                        |  CHANNEL_INFO                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_channel_info);         }
313                          |  FX_SEND_COUNT                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_fx_send_count);        }
314                          |  FX_SEND_INFO                          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_fx_send_info);         }
315                        |  MIDI_INSTRUMENT_MAP_COUNT             { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_map_count); }                        |  MIDI_INSTRUMENT_MAP_COUNT             { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_map_count); }
316                        |  MIDI_INSTRUMENT_MAP_INFO              { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_map_info);  }                        |  MIDI_INSTRUMENT_MAP_INFO              { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_map_info);  }
317                        |  MIDI_INSTRUMENT_COUNT                 { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_count);     }                        |  MIDI_INSTRUMENT_COUNT                 { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_count);     }
318                        |  MIDI_INSTRUMENT_INFO                  { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_info);      }                        |  MIDI_INSTRUMENT_INFO                  { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_midi_instr_info);      }
319                          |  DB_INSTRUMENT_DIRECTORY_COUNT         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instr_dir_count);   }
320                          |  DB_INSTRUMENT_DIRECTORY_INFO          { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instr_dir_info);    }
321                          |  DB_INSTRUMENT_COUNT                   { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instr_count);       }
322                          |  DB_INSTRUMENT_INFO                    { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instr_info);        }
323                          |  DB_INSTRUMENTS_JOB_INFO               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_db_instrs_job_info);   }
324                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_misc);                 }                        |  MISCELLANEOUS                         { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_misc);                 }
325                          |  TOTAL_STREAM_COUNT                    { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_total_stream_count);   }
326                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_total_voice_count);    }                        |  TOTAL_VOICE_COUNT                     { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_total_voice_count);    }
327                          |  GLOBAL_INFO                           { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_global_info);          }
328                          |  EFFECT_INSTANCE_COUNT                 { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_fx_instance_count);    }
329                          |  EFFECT_INSTANCE_INFO                  { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_fx_instance_info);     }
330                          |  SEND_EFFECT_CHAIN_COUNT               { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_send_fx_chain_count);  }
331                          |  SEND_EFFECT_CHAIN_INFO                { $$ = LSCPSERVER->UnsubscribeNotification(LSCPEvent::event_send_fx_chain_info);   }
332                        ;                        ;
333    
334  map_instruction       :  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($3,$5,$7,$9,$11,$13,$15,MidiInstrumentMapper::VOID,""); }  map_instruction       :  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,MidiInstrumentMapper::DONTCARE,"",$3); }
335                        |  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($3,$5,$7,$9,$11,$13,$15,$17,""); }                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,$18,"",$3); }
336                        |  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($3,$5,$7,$9,$11,$13,$15,MidiInstrumentMapper::VOID,$17); }                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,MidiInstrumentMapper::DONTCARE,$18,$3); }
337                        |  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($3,$5,$7,$9,$11,$13,$15,$17,$19); }                        |  MIDI_INSTRUMENT SP modal_arg midi_map SP midi_bank SP midi_prog SP engine_name SP filename SP instrument_index SP volume_value SP instr_load_mode SP entry_name { $$ = LSCPSERVER->AddOrReplaceMIDIInstrumentMapping($4,$6,$8,$10,$12,$14,$16,$18,$20,$3); }
338                        ;                        ;
339    
340  unmap_instruction     :  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog  { $$ = LSCPSERVER->RemoveMIDIInstrumentMapping($3,$5,$7); }  unmap_instruction     :  MIDI_INSTRUMENT SP midi_map SP midi_bank SP midi_prog  { $$ = LSCPSERVER->RemoveMIDIInstrumentMapping($3,$5,$7); }
341                        ;                        ;
342    
343  remove_instruction    :  CHANNEL SP sampler_channel       { $$ = LSCPSERVER->RemoveChannel($3);             }  remove_instruction    :  CHANNEL SP sampler_channel                   { $$ = LSCPSERVER->RemoveChannel($3);                      }
344                        |  MIDI_INSTRUMENT_MAP SP midi_map  { $$ = LSCPSERVER->RemoveMidiInstrumentMap($3);   }                        |  CHANNEL SP MIDI_INPUT SP sampler_channel                                           { $$ = LSCPSERVER->RemoveChannelMidiInput($5);       }
345                        |  MIDI_INSTRUMENT_MAP SP ALL       { $$ = LSCPSERVER->RemoveAllMidiInstrumentMaps(); }                        |  CHANNEL SP MIDI_INPUT SP sampler_channel SP device_index                           { $$ = LSCPSERVER->RemoveChannelMidiInput($5,$7);    }
346                          |  CHANNEL SP MIDI_INPUT SP sampler_channel SP device_index SP midi_input_port_index  { $$ = LSCPSERVER->RemoveChannelMidiInput($5,$7,$9); }
347                          |  MIDI_INSTRUMENT_MAP SP midi_map              { $$ = LSCPSERVER->RemoveMidiInstrumentMap($3);            }
348                          |  MIDI_INSTRUMENT_MAP SP ALL                   { $$ = LSCPSERVER->RemoveAllMidiInstrumentMaps();          }
349                          |  SEND_EFFECT_CHAIN SP device_index SP effect_chain  { $$ = LSCPSERVER->RemoveSendEffectChain($3,$5);     }
350                          |  SEND_EFFECT_CHAIN SP EFFECT SP device_index SP effect_chain SP chain_pos  { $$ = LSCPSERVER->RemoveSendEffectChainEffect($5,$7,$9); }
351                          |  FX_SEND SP EFFECT SP sampler_channel SP fx_send_id  { $$ = LSCPSERVER->SetFxSendEffect($5,$7,-1,-1);    }
352                          |  DB_INSTRUMENT_DIRECTORY SP FORCE SP db_path  { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($5, true);  }
353                          |  DB_INSTRUMENT_DIRECTORY SP db_path           { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($3);        }
354                          |  DB_INSTRUMENT SP db_path                     { $$ = LSCPSERVER->RemoveDbInstrument($3);                 }
355                        ;                        ;
356    
357  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }
358                          |  AVAILABLE_EFFECTS                                                          { $$ = LSCPSERVER->GetAvailableEffects();                          }
359                          |  EFFECT_INSTANCES                                                           { $$ = LSCPSERVER->GetEffectInstances();                           }
360                          |  EFFECT SP INFO SP effect_index                                             { $$ = LSCPSERVER->GetEffectInfo($5);                              }
361                          |  EFFECT_INSTANCE SP INFO SP effect_instance                                 { $$ = LSCPSERVER->GetEffectInstanceInfo($5);                      }
362                          |  EFFECT_INSTANCE_INPUT_CONTROL SP INFO SP effect_instance SP input_control  { $$ = LSCPSERVER->GetEffectInstanceInputControlInfo($5,$7);       }
363                          |  SEND_EFFECT_CHAINS SP device_index                                         { $$ = LSCPSERVER->GetSendEffectChains($3);                        }
364                          |  SEND_EFFECT_CHAIN SP INFO SP device_index SP effect_chain                  { $$ = LSCPSERVER->GetSendEffectChainInfo($5,$7);                  }
365                        |  AVAILABLE_MIDI_INPUT_DRIVERS                                               { $$ = LSCPSERVER->GetAvailableMidiInputDrivers();                 }                        |  AVAILABLE_MIDI_INPUT_DRIVERS                                               { $$ = LSCPSERVER->GetAvailableMidiInputDrivers();                 }
366                        |  MIDI_INPUT_DRIVER SP INFO SP string                                        { $$ = LSCPSERVER->GetMidiInputDriverInfo($5);                     }                        |  MIDI_INPUT_DRIVER SP INFO SP string                                        { $$ = LSCPSERVER->GetMidiInputDriverInfo($5);                     }
367                        |  MIDI_INPUT_DRIVER_PARAMETER SP INFO SP string SP string                    { $$ = LSCPSERVER->GetMidiInputDriverParameterInfo($5, $7);        }                        |  MIDI_INPUT_DRIVER_PARAMETER SP INFO SP string SP string                    { $$ = LSCPSERVER->GetMidiInputDriverParameterInfo($5, $7);        }
# Line 206  get_instruction       :  AVAILABLE_ENGIN Line 385  get_instruction       :  AVAILABLE_ENGIN
385                        |  CHANNEL SP VOICE_COUNT SP sampler_channel                                  { $$ = LSCPSERVER->GetVoiceCount($5);                              }                        |  CHANNEL SP VOICE_COUNT SP sampler_channel                                  { $$ = LSCPSERVER->GetVoiceCount($5);                              }
386                        |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }                        |  ENGINE SP INFO SP engine_name                                              { $$ = LSCPSERVER->GetEngineInfo($5);                              }
387                        |  SERVER SP INFO                                                             { $$ = LSCPSERVER->GetServerInfo();                                }                        |  SERVER SP INFO                                                             { $$ = LSCPSERVER->GetServerInfo();                                }
388                        |  TOTAL_VOICE_COUNT                                                          { $$ = LSCPSERVER->GetTotalVoiceCount();                                }                        |  TOTAL_STREAM_COUNT                                                         { $$ = LSCPSERVER->GetTotalStreamCount();                           }
389                          |  TOTAL_VOICE_COUNT                                                          { $$ = LSCPSERVER->GetTotalVoiceCount();                           }
390                        |  TOTAL_VOICE_COUNT_MAX                                                      { $$ = LSCPSERVER->GetTotalVoiceCountMax();                        }                        |  TOTAL_VOICE_COUNT_MAX                                                      { $$ = LSCPSERVER->GetTotalVoiceCountMax();                        }
391                        |  MIDI_INSTRUMENTS SP midi_map                                               { $$ = LSCPSERVER->GetMidiInstrumentMappings($3);                  }                        |  MIDI_INSTRUMENTS SP midi_map                                               { $$ = LSCPSERVER->GetMidiInstrumentMappings($3);                  }
392                        |  MIDI_INSTRUMENTS SP ALL                                                    { $$ = LSCPSERVER->GetAllMidiInstrumentMappings();                 }                        |  MIDI_INSTRUMENTS SP ALL                                                    { $$ = LSCPSERVER->GetAllMidiInstrumentMappings();                 }
# Line 215  get_instruction       :  AVAILABLE_ENGIN Line 395  get_instruction       :  AVAILABLE_ENGIN
395                        |  MIDI_INSTRUMENT_MAP SP INFO SP midi_map                                    { $$ = LSCPSERVER->GetMidiInstrumentMap($5);                       }                        |  MIDI_INSTRUMENT_MAP SP INFO SP midi_map                                    { $$ = LSCPSERVER->GetMidiInstrumentMap($5);                       }
396                        |  FX_SENDS SP sampler_channel                                                { $$ = LSCPSERVER->GetFxSends($3);                                 }                        |  FX_SENDS SP sampler_channel                                                { $$ = LSCPSERVER->GetFxSends($3);                                 }
397                        |  FX_SEND SP INFO SP sampler_channel SP fx_send_id                           { $$ = LSCPSERVER->GetFxSendInfo($5,$7);                           }                        |  FX_SEND SP INFO SP sampler_channel SP fx_send_id                           { $$ = LSCPSERVER->GetFxSendInfo($5,$7);                           }
398                          |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP db_path                          { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($5, true);        }
399                          |  DB_INSTRUMENT_DIRECTORIES SP db_path                                       { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($3, false);       }
400                          |  DB_INSTRUMENT_DIRECTORY SP INFO SP db_path                                 { $$ = LSCPSERVER->GetDbInstrumentDirectoryInfo($5);               }
401                          |  DB_INSTRUMENTS SP RECURSIVE SP db_path                                     { $$ = LSCPSERVER->GetDbInstrumentCount($5, true);                 }
402                          |  DB_INSTRUMENTS SP db_path                                                  { $$ = LSCPSERVER->GetDbInstrumentCount($3, false);                }
403                          |  DB_INSTRUMENT SP INFO SP db_path                                           { $$ = LSCPSERVER->GetDbInstrumentInfo($5);                        }
404                          |  DB_INSTRUMENTS_JOB SP INFO SP number                                       { $$ = LSCPSERVER->GetDbInstrumentsJobInfo($5);                    }
405                          |  VOLUME                                                                     { $$ = LSCPSERVER->GetGlobalVolume();                              }
406                          |  VOICES                                                                     { $$ = LSCPSERVER->GetGlobalMaxVoices();                           }
407                          |  STREAMS                                                                    { $$ = LSCPSERVER->GetGlobalMaxStreams();                          }
408                          |  FILE SP INSTRUMENTS SP filename                                            { $$ = LSCPSERVER->GetFileInstruments($5);                         }
409                          |  FILE SP INSTRUMENT SP INFO SP filename SP instrument_index                 { $$ = LSCPSERVER->GetFileInstrumentInfo($7,$9);                   }
410                        ;                        ;
411    
412  set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }  set_instruction       :  AUDIO_OUTPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list             { $$ = LSCPSERVER->SetAudioOutputDeviceParameter($3, $5, $7);      }
413                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP number SP number SP string '=' param_val_list  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }                        |  AUDIO_OUTPUT_CHANNEL_PARAMETER SP number SP number SP string '=' param_val_list  { $$ = LSCPSERVER->SetAudioOutputChannelParameter($3, $5, $7, $9); }
414                        |  MIDI_INPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list               { $$ = LSCPSERVER->SetMidiInputDeviceParameter($3, $5, $7);        }                        |  MIDI_INPUT_DEVICE_PARAMETER SP number SP string '=' param_val_list               { $$ = LSCPSERVER->SetMidiInputDeviceParameter($3, $5, $7);        }
415                          |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' NONE                 { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, "");      }
416                        |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' param_val_list       { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, $9);      }                        |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' param_val_list       { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, $9);      }
417                          |  EFFECT_INSTANCE_INPUT_CONTROL SP VALUE SP effect_instance SP input_control SP control_value  { $$ = LSCPSERVER->SetEffectInstanceInputControlValue($5, $7, $9); }
418                        |  CHANNEL SP set_chan_instruction                                                  { $$ = $3;                                                         }                        |  CHANNEL SP set_chan_instruction                                                  { $$ = $3;                                                         }
419                        |  MIDI_INSTRUMENT_MAP SP NAME SP midi_map SP map_name                              { $$ = LSCPSERVER->SetMidiInstrumentMapName($5, $7);               }                        |  MIDI_INSTRUMENT_MAP SP NAME SP midi_map SP map_name                              { $$ = LSCPSERVER->SetMidiInstrumentMapName($5, $7);               }
420                          |  FX_SEND SP NAME SP sampler_channel SP fx_send_id SP fx_send_name                 { $$ = LSCPSERVER->SetFxSendName($5,$7,$9);                        }
421                        |  FX_SEND SP AUDIO_OUTPUT_CHANNEL SP sampler_channel SP fx_send_id SP audio_channel_index SP audio_channel_index  { $$ = LSCPSERVER->SetFxSendAudioOutputChannel($5,$7,$9,$11); }                        |  FX_SEND SP AUDIO_OUTPUT_CHANNEL SP sampler_channel SP fx_send_id SP audio_channel_index SP audio_channel_index  { $$ = LSCPSERVER->SetFxSendAudioOutputChannel($5,$7,$9,$11); }
422                          |  FX_SEND SP MIDI_CONTROLLER SP sampler_channel SP fx_send_id SP midi_ctrl         { $$ = LSCPSERVER->SetFxSendMidiController($5,$7,$9);              }
423                          |  FX_SEND SP LEVEL SP sampler_channel SP fx_send_id SP volume_value                { $$ = LSCPSERVER->SetFxSendLevel($5,$7,$9);                       }
424                          |  FX_SEND SP EFFECT SP sampler_channel SP fx_send_id SP effect_chain SP chain_pos  { $$ = LSCPSERVER->SetFxSendEffect($5,$7,$9,$11);                  }
425                          |  DB_INSTRUMENT_DIRECTORY SP NAME SP db_path SP stringval_escaped                  { $$ = LSCPSERVER->SetDbInstrumentDirectoryName($5,$7);            }
426                          |  DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP db_path SP stringval_escaped           { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7);     }
427                          |  DB_INSTRUMENT SP NAME SP db_path SP stringval_escaped                            { $$ = LSCPSERVER->SetDbInstrumentName($5,$7);                     }
428                          |  DB_INSTRUMENT SP DESCRIPTION SP db_path SP stringval_escaped                     { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7);              }
429                          |  DB_INSTRUMENT SP FILE_PATH SP filename SP filename                               { $$ = LSCPSERVER->SetDbInstrumentFilePath($5,$7);                 }
430                        |  ECHO SP boolean                                                                  { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }                        |  ECHO SP boolean                                                                  { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }
431                          |  VOLUME SP volume_value                                                           { $$ = LSCPSERVER->SetGlobalVolume($3);                            }
432                          |  VOICES SP number                                                                 { $$ = LSCPSERVER->SetGlobalMaxVoices($3);                         }
433                          |  STREAMS SP number                                                                { $$ = LSCPSERVER->SetGlobalMaxStreams($3);                        }
434                        ;                        ;
435    
436  create_instruction    :  AUDIO_OUTPUT_DEVICE SP string SP key_val_list  { $$ = LSCPSERVER->CreateAudioOutputDevice($3,$5); }  create_instruction    :  AUDIO_OUTPUT_DEVICE SP string SP key_val_list  { $$ = LSCPSERVER->CreateAudioOutputDevice($3,$5); }
# Line 233  create_instruction    :  AUDIO_OUTPUT_DE Line 439  create_instruction    :  AUDIO_OUTPUT_DE
439                        |  MIDI_INPUT_DEVICE SP string                    { $$ = LSCPSERVER->CreateMidiInputDevice($3);      }                        |  MIDI_INPUT_DEVICE SP string                    { $$ = LSCPSERVER->CreateMidiInputDevice($3);      }
440                        |  FX_SEND SP sampler_channel SP midi_ctrl        { $$ = LSCPSERVER->CreateFxSend($3,$5);            }                        |  FX_SEND SP sampler_channel SP midi_ctrl        { $$ = LSCPSERVER->CreateFxSend($3,$5);            }
441                        |  FX_SEND SP sampler_channel SP midi_ctrl SP fx_send_name  { $$ = LSCPSERVER->CreateFxSend($3,$5,$7); }                        |  FX_SEND SP sampler_channel SP midi_ctrl SP fx_send_name  { $$ = LSCPSERVER->CreateFxSend($3,$5,$7); }
442                          |  EFFECT_INSTANCE SP effect_index                { $$ = LSCPSERVER->CreateEffectInstance($3);       }
443                          |  EFFECT_INSTANCE SP effect_system SP module SP effect_name  { $$ = LSCPSERVER->CreateEffectInstance($3,$5,$7); }
444                        ;                        ;
445    
446  reset_instruction     :  CHANNEL SP sampler_channel  { $$ = LSCPSERVER->ResetChannel($3); }  reset_instruction     :  CHANNEL SP sampler_channel  { $$ = LSCPSERVER->ResetChannel($3); }
# Line 242  clear_instruction     :  MIDI_INSTRUMENT Line 450  clear_instruction     :  MIDI_INSTRUMENT
450                        |  MIDI_INSTRUMENTS SP ALL        { $$ = LSCPSERVER->ClearAllMidiInstrumentMappings(); }                        |  MIDI_INSTRUMENTS SP ALL        { $$ = LSCPSERVER->ClearAllMidiInstrumentMappings(); }
451                        ;                        ;
452    
453    find_instruction      :  DB_INSTRUMENTS SP NON_RECURSIVE SP db_path SP query_val_list              { $$ = LSCPSERVER->FindDbInstruments($5,$7, false);           }
454                          |  DB_INSTRUMENTS SP db_path SP query_val_list                               { $$ = LSCPSERVER->FindDbInstruments($3,$5, true);            }
455                          |  DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP db_path SP query_val_list   { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); }
456                          |  DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list                    { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true);  }
457                          |  LOST SP DB_INSTRUMENT_FILES                                               { $$ = LSCPSERVER->FindLostDbInstrumentFiles();                 }
458                          ;
459    
460    move_instruction      :  DB_INSTRUMENT_DIRECTORY SP db_path SP db_path    { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); }
461                          |  DB_INSTRUMENT SP db_path SP db_path              { $$ = LSCPSERVER->MoveDbInstrument($3,$5);          }
462                          ;
463    
464    copy_instruction      :  DB_INSTRUMENT_DIRECTORY SP db_path SP db_path    { $$ = LSCPSERVER->CopyDbInstrumentDirectory($3,$5); }
465                          |  DB_INSTRUMENT SP db_path SP db_path              { $$ = LSCPSERVER->CopyDbInstrument($3,$5);          }
466                          ;
467    
468  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }
469                        |  MIDI_INPUT_DEVICE SP number    { $$ = LSCPSERVER->DestroyMidiInputDevice($3);   }                        |  MIDI_INPUT_DEVICE SP number    { $$ = LSCPSERVER->DestroyMidiInputDevice($3);   }
470                        |  FX_SEND SP sampler_channel SP fx_send_id  { $$ = LSCPSERVER->DestroyFxSend($3,$5); }                        |  FX_SEND SP sampler_channel SP fx_send_id  { $$ = LSCPSERVER->DestroyFxSend($3,$5); }
471                          |  EFFECT_INSTANCE SP number      { $$ = LSCPSERVER->DestroyEffectInstance($3);    }
472                        ;                        ;
473    
474  load_instruction      :  INSTRUMENT SP load_instr_args  { $$ = $3; }  load_instruction      :  INSTRUMENT SP load_instr_args  { $$ = $3; }
475                        |  ENGINE SP load_engine_args     { $$ = $3; }                        |  ENGINE SP load_engine_args     { $$ = $3; }
476                        ;                        ;
477    
478    append_instruction    :  SEND_EFFECT_CHAIN SP EFFECT SP device_index SP effect_chain SP effect_instance  { $$ = LSCPSERVER->AppendSendEffectChainEffect($5,$7,$9); }
479                          ;
480    
481    insert_instruction    :  SEND_EFFECT_CHAIN SP EFFECT SP device_index SP effect_chain SP chain_pos SP effect_instance  { $$ = LSCPSERVER->InsertSendEffectChainEffect($5,$7,$9,$11); }
482                          ;
483    
484  set_chan_instruction  :  AUDIO_OUTPUT_DEVICE SP sampler_channel SP device_index                                              { $$ = LSCPSERVER->SetAudioOutputDevice($5, $3);      }  set_chan_instruction  :  AUDIO_OUTPUT_DEVICE SP sampler_channel SP device_index                                              { $$ = LSCPSERVER->SetAudioOutputDevice($5, $3);      }
485                        |  AUDIO_OUTPUT_CHANNEL SP sampler_channel SP audio_channel_index SP audio_channel_index               { $$ = LSCPSERVER->SetAudioOutputChannel($5, $7, $3); }                        |  AUDIO_OUTPUT_CHANNEL SP sampler_channel SP audio_channel_index SP audio_channel_index               { $$ = LSCPSERVER->SetAudioOutputChannel($5, $7, $3); }
486                        |  AUDIO_OUTPUT_TYPE SP sampler_channel SP audio_output_type_name                                      { $$ = LSCPSERVER->SetAudioOutputType($5, $3);        }                        |  AUDIO_OUTPUT_TYPE SP sampler_channel SP audio_output_type_name                                      { $$ = LSCPSERVER->SetAudioOutputType($5, $3);        }
# Line 267  set_chan_instruction  :  AUDIO_OUTPUT_DE Line 497  set_chan_instruction  :  AUDIO_OUTPUT_DE
497                        |  MIDI_INSTRUMENT_MAP SP sampler_channel SP DEFAULT                                                   { $$ = LSCPSERVER->SetChannelMap($3, -2);             }                        |  MIDI_INSTRUMENT_MAP SP sampler_channel SP DEFAULT                                                   { $$ = LSCPSERVER->SetChannelMap($3, -2);             }
498                        ;                        ;
499    
500    edit_instruction      :  CHANNEL SP INSTRUMENT SP sampler_channel  { $$ = LSCPSERVER->EditSamplerChannelInstrument($5); }
501                          ;
502    
503    format_instruction    :  INSTRUMENTS_DB  { $$ = LSCPSERVER->FormatInstrumentsDb(); }
504                          ;
505    
506    modal_arg             :  /* epsilon (empty argument) */  { $$ = true;  }
507                          |  NON_MODAL SP                    { $$ = false; }
508                          ;
509    
510  key_val_list          :  string '=' param_val_list                  { $$[$1] = $3;          }  key_val_list          :  string '=' param_val_list                  { $$[$1] = $3;          }
511                        |  key_val_list SP string '=' param_val_list  { $$ = $1; $$[$3] = $5; }                        |  key_val_list SP string '=' param_val_list  { $$ = $1; $$[$3] = $5; }
512                        ;                        ;
# Line 275  buffer_size_type      :  BYTES       { $ Line 515  buffer_size_type      :  BYTES       { $
515                        |  PERCENTAGE  { $$ = fill_response_percentage; }                        |  PERCENTAGE  { $$ = fill_response_percentage; }
516                        ;                        ;
517    
518  list_instruction      :  AUDIO_OUTPUT_DEVICES            { $$ = LSCPSERVER->GetAudioOutputDevices();           }  list_instruction      :  AUDIO_OUTPUT_DEVICES                               { $$ = LSCPSERVER->GetAudioOutputDevices();              }
519                        |  MIDI_INPUT_DEVICES              { $$ = LSCPSERVER->GetMidiInputDevices();             }                        |  MIDI_INPUT_DEVICES                                 { $$ = LSCPSERVER->GetMidiInputDevices();                }
520                        |  CHANNELS                        { $$ = LSCPSERVER->ListChannels();                    }                        |  CHANNELS                                           { $$ = LSCPSERVER->ListChannels();                       }
521                        |  AVAILABLE_ENGINES               { $$ = LSCPSERVER->ListAvailableEngines();            }                        |  CHANNEL SP MIDI_INPUTS SP sampler_channel          { $$ = LSCPSERVER->ListChannelMidiInputs($5);            }
522                        |  AVAILABLE_MIDI_INPUT_DRIVERS    { $$ = LSCPSERVER->ListAvailableMidiInputDrivers();   }                        |  AVAILABLE_ENGINES                                  { $$ = LSCPSERVER->ListAvailableEngines();               }
523                        |  AVAILABLE_AUDIO_OUTPUT_DRIVERS  { $$ = LSCPSERVER->ListAvailableAudioOutputDrivers(); }                        |  AVAILABLE_EFFECTS                                  { $$ = LSCPSERVER->ListAvailableEffects();               }
524                        |  MIDI_INSTRUMENTS SP midi_map    { $$ = LSCPSERVER->ListMidiInstrumentMappings($3);    }                        |  EFFECT_INSTANCES                                   { $$ = LSCPSERVER->ListEffectInstances();                }
525                        |  MIDI_INSTRUMENTS SP ALL         { $$ = LSCPSERVER->ListAllMidiInstrumentMappings();   }                        |  SEND_EFFECT_CHAINS SP number                       { $$ = LSCPSERVER->ListSendEffectChains($3);             }
526                        |  MIDI_INSTRUMENT_MAPS            { $$ = LSCPSERVER->ListMidiInstrumentMaps();          }                        |  AVAILABLE_MIDI_INPUT_DRIVERS                       { $$ = LSCPSERVER->ListAvailableMidiInputDrivers();      }
527                        |  FX_SENDS SP sampler_channel     { $$ = LSCPSERVER->ListFxSends($3);                   }                        |  AVAILABLE_AUDIO_OUTPUT_DRIVERS                     { $$ = LSCPSERVER->ListAvailableAudioOutputDrivers();    }
528                          |  MIDI_INSTRUMENTS SP midi_map                       { $$ = LSCPSERVER->ListMidiInstrumentMappings($3);       }
529                          |  MIDI_INSTRUMENTS SP ALL                            { $$ = LSCPSERVER->ListAllMidiInstrumentMappings();      }
530                          |  MIDI_INSTRUMENT_MAPS                               { $$ = LSCPSERVER->ListMidiInstrumentMaps();             }
531                          |  FX_SENDS SP sampler_channel                        { $$ = LSCPSERVER->ListFxSends($3);                      }
532                          |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP db_path  { $$ = LSCPSERVER->GetDbInstrumentDirectories($5, true); }
533                          |  DB_INSTRUMENT_DIRECTORIES SP db_path               { $$ = LSCPSERVER->GetDbInstrumentDirectories($3);       }
534                          |  DB_INSTRUMENTS SP RECURSIVE SP db_path             { $$ = LSCPSERVER->GetDbInstruments($5, true);           }
535                          |  DB_INSTRUMENTS SP db_path                          { $$ = LSCPSERVER->GetDbInstruments($3);                 }
536                          |  FILE SP INSTRUMENTS SP filename                    { $$ = LSCPSERVER->ListFileInstruments($5);              }
537                          ;
538    
539    send_instruction      :  CHANNEL SP MIDI_DATA SP string SP sampler_channel SP number SP number  { $$ = LSCPSERVER->SendChannelMidiData($5, $7, $9, $11); }
540                        ;                        ;
541    
542  load_instr_args       :  filename SP instrument_index SP sampler_channel               { $$ = LSCPSERVER->LoadInstrument($1, $3, $5);       }  load_instr_args       :  filename SP instrument_index SP sampler_channel               { $$ = LSCPSERVER->LoadInstrument($1, $3, $5);       }
# Line 299  instr_load_mode       :  ON_DEMAND Line 551  instr_load_mode       :  ON_DEMAND
551                        |  PERSISTENT      { $$ = MidiInstrumentMapper::PERSISTENT;     }                        |  PERSISTENT      { $$ = MidiInstrumentMapper::PERSISTENT;     }
552                        ;                        ;
553    
554    effect_instance           : number
555                              ;
556    
557  device_index              :  number  device_index              :  number
558                            ;                            ;
559    
# Line 334  volume_value              :  dotnum Line 589  volume_value              :  dotnum
589                            |  number  { $$ = $1; }                            |  number  { $$ = $1; }
590                            ;                            ;
591    
592    control_value             :  real
593                              ;
594    
595  sampler_channel           :  number  sampler_channel           :  number
596                            ;                            ;
597    
# Line 346  fx_send_id                :  number Line 604  fx_send_id                :  number
604  engine_name               :  string  engine_name               :  string
605                            ;                            ;
606    
607  filename                  :  stringval  filename                  :  path  {
608                                     #if WIN32
609                                     $$ = $1.toWindows();
610                                     #else
611                                     // assuming POSIX
612                                     $$ = $1.toPosix();
613                                     #endif
614                                 }
615                              ;
616    
617    db_path                   :  path  { $$ = $1.toDbPath(); }
618                              ;
619    
620    map_name                  :  stringval_escaped
621                              ;
622    
623    entry_name                :  stringval_escaped
624                              ;
625    
626    fx_send_name              :  stringval_escaped
627                              ;
628    
629    effect_name               :  stringval_escaped
630                              ;
631    
632    effect_index              :  number
633                            ;                            ;
634    
635  map_name                  :  stringval  effect_chain              :  number
636                            ;                            ;
637    
638  entry_name                :  stringval  chain_pos                 :  number
639                            ;                            ;
640    
641  fx_send_name              :  stringval  input_control             :  number
642                            ;                            ;
643    
644  param_val_list            :  param_val  param_val_list            :  param_val
645                            |  param_val_list','param_val  { $$ = $1 + "," + $3; }                            |  param_val_list','param_val  { $$ = $1 + "," + $3; }
646                            ;                            ;
647    
648  param_val                 :  string  //TODO: the re-encapsulation into apostrophes for string and strinval here is a hack, since we need a way for __parse_strings() (DeviceParameters.cpp) to distinguish a comma separated list of strings and a string which contains commas. A clean solution would be to move those parser jobs over here to lscp.y
649                            |  stringval  param_val                 :  string            { $$ = "\'" + $1 + "\'"; }
650                              |  stringval         { $$ = "\'" + $1 + "\'"; }
651                            |  number            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }                            |  number            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }
652                            |  dotnum            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }                            |  dotnum            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); } //TODO: maybe better using 'real' instead of 'number' and 'dotnum' rules
653                              ;
654    
655    query_val_list            :  string '=' query_val                    { $$[$1] = $3;          }
656                              |  query_val_list SP string '=' query_val  { $$ = $1; $$[$3] = $5; }
657                              ;
658    
659    query_val                 :  text_escaped
660                              |  stringval_escaped
661                              ;
662    
663    scan_mode                 :  RECURSIVE      { $$ = "RECURSIVE"; }
664                              |  NON_RECURSIVE  { $$ = "NON_RECURSIVE"; }
665                              |  FLAT           { $$ = "FLAT"; }
666                              ;
667    
668    effect_system             :  string
669                              ;
670    
671    module                    :  filename
672                            ;                            ;
673    
674  // GRAMMAR_BNF_END - do NOT delete or modify this line !!!  // GRAMMAR_BNF_END - do NOT delete or modify this line !!!
# Line 377  boolean               :  number  { $$ = Line 680  boolean               :  number  { $$ =
680                        |  string  { $$ = -1; }                        |  string  { $$ = -1; }
681                        ;                        ;
682    
683  string                :  char          { std::string s; s = $1; $$ = s; }  dotnum                :      digits '.' digits  { std::stringstream ss($1 + "." + $3); ss.imbue(std::locale::classic()); ss >> $$; }
684                        |  string char   { $$ = $1 + $2;                  }                        |  '+' digits '.' digits  { std::stringstream ss($2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
685                          |  '-' digits '.' digits  { std::stringstream ss("-" + $2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
686                        ;                        ;
687    
688  dotnum                :      digits '.' digits  { $$ = atof(String($1 + "." + $3).c_str());                         }  real                  :      digits '.' digits  { std::stringstream ss($1 + "." + $3); ss.imbue(std::locale::classic()); ss >> $$; }
689                        |  '+' digits '.' digits  { String s = "+"; s += $2; s += "."; s += $4; $$ = atof(s.c_str()); }                        |  '+' digits '.' digits  { std::stringstream ss($2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
690                        |  '-' digits '.' digits  { $$ = atof(String("-" + $2 + "." + $4).c_str());                   }                        |  '-' digits '.' digits  { std::stringstream ss("-" + $2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
691                          |      digits             { std::stringstream ss($1); ss.imbue(std::locale::classic()); ss >> $$;                  }
692                          |  '+' digits             { std::stringstream ss($2); ss.imbue(std::locale::classic()); ss >> $$;                  }
693                          |  '-' digits             { std::stringstream ss("-" + $2); ss.imbue(std::locale::classic()); ss >> $$;            }
694                        ;                        ;
695    
696    
# Line 403  digit                 :  '0'  { $$ = '0' Line 710  digit                 :  '0'  { $$ = '0'
710                        |  '9'  { $$ = '9'; }                        |  '9'  { $$ = '9'; }
711                        ;                        ;
712    
713    digit_oct             :  '0'  { $$ = '0'; }
714                          |  '1'  { $$ = '1'; }
715                          |  '2'  { $$ = '2'; }
716                          |  '3'  { $$ = '3'; }
717                          |  '4'  { $$ = '4'; }
718                          |  '5'  { $$ = '5'; }
719                          |  '6'  { $$ = '6'; }
720                          |  '7'  { $$ = '7'; }
721                          ;
722    
723    digit_hex             :  '0'  { $$ = '0'; }
724                          |  '1'  { $$ = '1'; }
725                          |  '2'  { $$ = '2'; }
726                          |  '3'  { $$ = '3'; }
727                          |  '4'  { $$ = '4'; }
728                          |  '5'  { $$ = '5'; }
729                          |  '6'  { $$ = '6'; }
730                          |  '7'  { $$ = '7'; }
731                          |  '8'  { $$ = '8'; }
732                          |  '9'  { $$ = '9'; }
733                          |  'a'  { $$ = 'a'; }
734                          |  'b'  { $$ = 'b'; }
735                          |  'c'  { $$ = 'c'; }
736                          |  'd'  { $$ = 'd'; }
737                          |  'e'  { $$ = 'e'; }
738                          |  'f'  { $$ = 'f'; }
739                          |  'A'  { $$ = 'a'; }
740                          |  'B'  { $$ = 'b'; }
741                          |  'C'  { $$ = 'c'; }
742                          |  'D'  { $$ = 'd'; }
743                          |  'E'  { $$ = 'e'; }
744                          |  'F'  { $$ = 'f'; }
745                          ;
746    
747  number                :  digit       { $$ = atoi(String(1, $1).c_str());      }  number                :  digit       { $$ = atoi(String(1, $1).c_str());      }
748                        |  '1' digits  { $$ = atoi(String(String("1") + $2).c_str()); }                        |  '1' digits  { $$ = atoi(String(String("1") + $2).c_str()); }
749                        |  '2' digits  { $$ = atoi(String(String("2") + $2).c_str()); }                        |  '2' digits  { $$ = atoi(String(String("2") + $2).c_str()); }
# Line 413  number                :  digit       { $ Line 754  number                :  digit       { $
754                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }
755                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }
756                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }
757                          ;
758    
759  char                  :  'A' { $$ = 'A'; } | 'B' { $$ = 'B'; } | 'C' { $$ = 'C'; } | 'D' { $$ = 'D'; } | 'E' { $$ = 'E'; } | 'F' { $$ = 'F'; } | 'G' { $$ = 'G'; } | 'H' { $$ = 'H'; } | 'I' { $$ = 'I'; } | 'J' { $$ = 'J'; } | 'K' { $$ = 'K'; } | 'L' { $$ = 'L'; } | 'M' { $$ = 'M'; } | 'N' { $$ = 'N'; } | 'O' { $$ = 'O'; } | 'P' { $$ = 'P'; } | 'Q' { $$ = 'Q'; } | 'R' { $$ = 'R'; } | 'S' { $$ = 'S'; } | 'T' { $$ = 'T'; } | 'U' { $$ = 'U'; } | 'V' { $$ = 'V'; } | 'W' { $$ = 'W'; } | 'X' { $$ = 'X'; } | 'Y' { $$ = 'Y'; } | 'Z' { $$ = 'Z'; }  path                  :  '\'' path_base '\''  { $$ = $2; }
760                        |  'a' { $$ = 'a'; } | 'b' { $$ = 'b'; } | 'c' { $$ = 'c'; } | 'd' { $$ = 'd'; } | 'e' { $$ = 'e'; } | 'f' { $$ = 'f'; } | 'g' { $$ = 'g'; } | 'h' { $$ = 'h'; } | 'i' { $$ = 'i'; } | 'j' { $$ = 'j'; } | 'k' { $$ = 'k'; } | 'l' { $$ = 'l'; } | 'm' { $$ = 'm'; } | 'n' { $$ = 'n'; } | 'o' { $$ = 'o'; } | 'p' { $$ = 'p'; } | 'q' { $$ = 'q'; } | 'r' { $$ = 'r'; } | 's' { $$ = 's'; } | 't' { $$ = 't'; } | 'u' { $$ = 'u'; } | 'v' { $$ = 'v'; } | 'w' { $$ = 'w'; } | 'x' { $$ = 'x'; } | 'y' { $$ = 'y'; } | 'z' { $$ = 'z'; }                        |  '\"' path_base '\"'  { $$ = $2; }
761                        |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }                        ;
762                        |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; } | '/' { $$ = '/'; }  
763                        |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }  path_base             :  path_prefix path_body  { $$ = $1 + $2; }
764                        |  '[' { $$ = '['; } | '\\' { $$ = '\\'; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }                        ;
765                        |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }  
766                        |  '\200' { $$ = '\200'; } | '\201' { $$ = '\201'; } | '\202' { $$ = '\202'; }  path_prefix           :  '/'                 { $$ = Path();                    }
767                        |  '\203' { $$ = '\203'; } | '\204' { $$ = '\204'; } | '\205' { $$ = '\205'; }                        |  alpha_char ':' '/'  { Path p; p.setDrive($1); $$ = p; }
768                        |  '\206' { $$ = '\206'; } | '\207' { $$ = '\207'; } | '\210' { $$ = '\210'; }                        ;
769                        |  '\211' { $$ = '\211'; } | '\212' { $$ = '\212'; } | '\213' { $$ = '\213'; }  
770                        |  '\214' { $$ = '\214'; } | '\215' { $$ = '\215'; } | '\216' { $$ = '\216'; }  path_body             :  /* epsilon (empty argument) */ { $$ = Path();                           }
771                        |  '\217' { $$ = '\217'; } | '\220' { $$ = '\220'; } | '\221' { $$ = '\221'; }                        |  path_body '/'                  { $$ = $1;                               }
772                        |  '\222' { $$ = '\222'; } | '\223' { $$ = '\223'; } | '\224' { $$ = '\224'; }                        |  path_body text_escaped_base    { Path p; p.appendNode($2); $$ = $1 + p; }
773                        |  '\225' { $$ = '\225'; } | '\226' { $$ = '\226'; } | '\227' { $$ = '\227'; }                        ;
774                        |  '\230' { $$ = '\230'; } | '\231' { $$ = '\231'; } | '\232' { $$ = '\232'; }  
775                        |  '\233' { $$ = '\233'; } | '\234' { $$ = '\234'; } | '\235' { $$ = '\235'; }  stringval             :  '\'' text '\''  { $$ = $2; }
776                        |  '\236' { $$ = '\236'; } | '\237' { $$ = '\237'; } | '\240' { $$ = '\240'; }                        |  '\"' text '\"'  { $$ = $2; }
777                        |  '\241' { $$ = '\241'; } | '\242' { $$ = '\242'; } | '\243' { $$ = '\243'; }                        ;
778                        |  '\244' { $$ = '\244'; } | '\245' { $$ = '\245'; } | '\246' { $$ = '\246'; }  
779                        |  '\247' { $$ = '\247'; } | '\250' { $$ = '\250'; } | '\251' { $$ = '\251'; }  stringval_escaped     :  '\'' text_escaped '\''  { $$ = $2; }
780                        |  '\252' { $$ = '\252'; } | '\253' { $$ = '\253'; } | '\254' { $$ = '\254'; }                        |  '\"' text_escaped '\"'  { $$ = $2; }
                       |  '\255' { $$ = '\255'; } | '\256' { $$ = '\256'; } | '\257' { $$ = '\257'; }  
                       |  '\260' { $$ = '\260'; } | '\261' { $$ = '\261'; } | '\262' { $$ = '\262'; }  
                       |  '\263' { $$ = '\263'; } | '\264' { $$ = '\264'; } | '\265' { $$ = '\265'; }  
                       |  '\266' { $$ = '\266'; } | '\267' { $$ = '\267'; } | '\270' { $$ = '\270'; }  
                       |  '\271' { $$ = '\271'; } | '\272' { $$ = '\272'; } | '\273' { $$ = '\273'; }  
                       |  '\274' { $$ = '\274'; } | '\275' { $$ = '\275'; } | '\276' { $$ = '\276'; }  
                       |  '\277' { $$ = '\277'; } | '\300' { $$ = '\300'; } | '\301' { $$ = '\301'; }  
                       |  '\302' { $$ = '\302'; } | '\303' { $$ = '\303'; } | '\304' { $$ = '\304'; }  
                       |  '\305' { $$ = '\305'; } | '\306' { $$ = '\306'; } | '\307' { $$ = '\307'; }  
                       |  '\310' { $$ = '\310'; } | '\311' { $$ = '\311'; } | '\312' { $$ = '\312'; }  
                       |  '\313' { $$ = '\313'; } | '\314' { $$ = '\314'; } | '\315' { $$ = '\315'; }  
                       |  '\316' { $$ = '\316'; } | '\317' { $$ = '\317'; } | '\320' { $$ = '\320'; }  
                       |  '\321' { $$ = '\321'; } | '\322' { $$ = '\322'; } | '\323' { $$ = '\323'; }  
                       |  '\324' { $$ = '\324'; } | '\325' { $$ = '\325'; } | '\326' { $$ = '\326'; }  
                       |  '\327' { $$ = '\327'; } | '\330' { $$ = '\330'; } | '\331' { $$ = '\331'; }  
                       |  '\332' { $$ = '\332'; } | '\333' { $$ = '\333'; } | '\334' { $$ = '\334'; }  
                       |  '\335' { $$ = '\335'; } | '\336' { $$ = '\336'; } | '\337' { $$ = '\337'; }  
                       |  '\340' { $$ = '\340'; } | '\341' { $$ = '\341'; } | '\342' { $$ = '\342'; }  
                       |  '\343' { $$ = '\343'; } | '\344' { $$ = '\344'; } | '\345' { $$ = '\345'; }  
                       |  '\346' { $$ = '\346'; } | '\347' { $$ = '\347'; } | '\350' { $$ = '\350'; }  
                       |  '\351' { $$ = '\351'; } | '\352' { $$ = '\352'; } | '\353' { $$ = '\353'; }  
                       |  '\354' { $$ = '\354'; } | '\355' { $$ = '\355'; } | '\356' { $$ = '\356'; }  
                       |  '\357' { $$ = '\357'; } | '\360' { $$ = '\360'; } | '\361' { $$ = '\361'; }  
                       |  '\362' { $$ = '\362'; } | '\363' { $$ = '\363'; } | '\364' { $$ = '\364'; }  
                       |  '\365' { $$ = '\365'; } | '\366' { $$ = '\366'; } | '\367' { $$ = '\367'; }  
                       |  '\370' { $$ = '\370'; } | '\371' { $$ = '\371'; } | '\372' { $$ = '\372'; }  
                       |  '\373' { $$ = '\373'; } | '\374' { $$ = '\374'; } | '\375' { $$ = '\375'; }  
                       |  '\376' { $$ = '\376'; } | '\377' { $$ = '\377'; }  
781                        ;                        ;
782    
783  text                  :  SP           { $$ = " ";      }  text                  :  SP           { $$ = " ";      }
# Line 472  text                  :  SP           { Line 786  text                  :  SP           {
786                        |  text string  { $$ = $1 + $2;  }                        |  text string  { $$ = $1 + $2;  }
787                        ;                        ;
788    
789  stringval             :  '\'' text '\''  { $$ = $2; }  // like text_escaped, but missing the slash ('/') character
790                        |  '\"' text '\"'  { $$ = $2; }  text_escaped_base     :  SP                                { $$ = " ";      }
791                          |  string_escaped
792                          |  text_escaped_base SP              { $$ = $1 + " "; }
793                          |  text_escaped_base string_escaped  { $$ = $1 + $2;  }
794                        ;                        ;
795    
796    text_escaped          :  '/'                              { $$ = "/";      }
797                          |  text_escaped_base
798                          |  text_escaped '/'                 { $$ = $1 + "/"; }
799                          |  text_escaped text_escaped_base   { $$ = $1 + $2;  }
800                          ;
801    
802    string                :  char          { std::string s; s = $1; $$ = s; }
803                          |  string char   { $$ = $1 + $2;                  }
804                          ;
805    
806    string_escaped        :  char_base                   { std::string s; s = $1; $$ = s; }
807                          |  escape_seq                  { std::string s; s = $1; $$ = s; }
808                          |  string_escaped char_base    { $$ = $1 + $2;                  }
809                          |  string_escaped escape_seq   { $$ = $1 + $2;                  }
810                          ;
811    
812    // full ASCII character set except space, quotation mark and apostrophe
813    char                  :  char_base
814                          |  '\\'  { $$ = '\\'; }
815                          |  '/'   { $$ = '/';  }
816                          ;
817    
818    // characters A..Z and a..z
819    alpha_char            :  'A' { $$ = 'A'; } | 'B' { $$ = 'B'; } | 'C' { $$ = 'C'; } | 'D' { $$ = 'D'; } | 'E' { $$ = 'E'; } | 'F' { $$ = 'F'; } | 'G' { $$ = 'G'; } | 'H' { $$ = 'H'; } | 'I' { $$ = 'I'; } | 'J' { $$ = 'J'; } | 'K' { $$ = 'K'; } | 'L' { $$ = 'L'; } | 'M' { $$ = 'M'; } | 'N' { $$ = 'N'; } | 'O' { $$ = 'O'; } | 'P' { $$ = 'P'; } | 'Q' { $$ = 'Q'; } | 'R' { $$ = 'R'; } | 'S' { $$ = 'S'; } | 'T' { $$ = 'T'; } | 'U' { $$ = 'U'; } | 'V' { $$ = 'V'; } | 'W' { $$ = 'W'; } | 'X' { $$ = 'X'; } | 'Y' { $$ = 'Y'; } | 'Z' { $$ = 'Z'; }
820                          |  'a' { $$ = 'a'; } | 'b' { $$ = 'b'; } | 'c' { $$ = 'c'; } | 'd' { $$ = 'd'; } | 'e' { $$ = 'e'; } | 'f' { $$ = 'f'; } | 'g' { $$ = 'g'; } | 'h' { $$ = 'h'; } | 'i' { $$ = 'i'; } | 'j' { $$ = 'j'; } | 'k' { $$ = 'k'; } | 'l' { $$ = 'l'; } | 'm' { $$ = 'm'; } | 'n' { $$ = 'n'; } | 'o' { $$ = 'o'; } | 'p' { $$ = 'p'; } | 'q' { $$ = 'q'; } | 'r' { $$ = 'r'; } | 's' { $$ = 's'; } | 't' { $$ = 't'; } | 'u' { $$ = 'u'; } | 'v' { $$ = 'v'; } | 'w' { $$ = 'w'; } | 'x' { $$ = 'x'; } | 'y' { $$ = 'y'; } | 'z' { $$ = 'z'; }
821                          ;
822    
823    // ASCII characters except space, quotation mark, apostrophe, backslash and slash
824    char_base             :  alpha_char
825                          |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }
826                          |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; }
827                          |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }
828                          |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }
829                          |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }
830                          |  EXT_ASCII_CHAR
831                          ;
832    
833    escape_seq            :  '\\' '\''  { $$ = '\''; }
834                          |  '\\' '\"'  { $$ = '\"'; }
835                          |  '\\' '\\'  { $$ = '\\'; }
836                          |  '\\' '/'   { $$ = '/';  }
837                          |  '\\' 'n'   { $$ = '\n'; }
838                          |  '\\' 'r'   { $$ = '\r'; }
839                          |  '\\' 'f'   { $$ = '\f'; }
840                          |  '\\' 't'   { $$ = '\t'; }
841                          |  '\\' 'v'   { $$ = '\v'; }
842                          |  escape_seq_octal
843                          |  escape_seq_hex
844                          ;
845    
846    escape_seq_octal      :  '\\' digit_oct                      { $$ = (char) octalsToNumber($2);       }
847                          |  '\\' digit_oct digit_oct            { $$ = (char) octalsToNumber($3,$2);    }
848                          |  '\\' digit_oct digit_oct digit_oct  { $$ = (char) octalsToNumber($4,$3,$2); }
849                          ;
850    
851    escape_seq_hex        :  '\\' 'x' digit_hex            { $$ = (char) hexsToNumber($3);    }
852                          |  '\\' 'x' digit_hex digit_hex  { $$ = (char) hexsToNumber($4,$3); }
853                          ;
854    
855  // rules which are more or less just terminal symbols  // rules which are more or less just terminal symbols
856    
# Line 503  UNMAP                 :  'U''N''M''A''P' Line 878  UNMAP                 :  'U''N''M''A''P'
878  CLEAR                 :  'C''L''E''A''R'  CLEAR                 :  'C''L''E''A''R'
879                        ;                        ;
880    
881    FIND                  :  'F''I''N''D'
882                          ;
883    
884    FILE_AS_DIR           :  'F''I''L''E''_''A''S''_''D''I''R'
885                          ;
886    
887    MOVE                  :  'M''O''V''E'
888                          ;
889    
890    COPY                  :  'C''O''P''Y'
891                          ;
892    
893  CREATE                :  'C''R''E''A''T''E'  CREATE                :  'C''R''E''A''T''E'
894                        ;                        ;
895    
# Line 533  REMOVE                :  'R''E''M''O''V' Line 920  REMOVE                :  'R''E''M''O''V'
920  SET                   :  'S''E''T'  SET                   :  'S''E''T'
921                        ;                        ;
922    
923  SUBSCRIBE             :  'S''U''B''S''C''R''I''B''E'  APPEND                :  'A''P''P''E''N''D'
924                        ;                        ;
925    
926  UNSUBSCRIBE           :  'U''N''S''U''B''S''C''R''I''B''E'  INSERT                :  'I''N''S''E''R''T'
927                        ;                        ;
928    
929  SELECT                :  'S''E''L''E''C''T'  SUBSCRIBE             :  'S''U''B''S''C''R''I''B''E'
930                          ;
931    
932    UNSUBSCRIBE           :  'U''N''S''U''B''S''C''R''I''B''E'
933                        ;                        ;
934    
935  CHANNEL               :  'C''H''A''N''N''E''L'  CHANNEL               :  'C''H''A''N''N''E''L'
# Line 558  INFO                 :  'I''N''F''O' Line 948  INFO                 :  'I''N''F''O'
948                       ;                       ;
949    
950  AUDIO_OUTPUT_DEVICE_COUNT :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E''_''C''O''U''N''T'  AUDIO_OUTPUT_DEVICE_COUNT :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E''_''C''O''U''N''T'
951                       ;                            ;
952    
953  AUDIO_OUTPUT_DEVICE_INFO  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E''_''I''N''F''O'  AUDIO_OUTPUT_DEVICE_INFO  :  'A''U''D''I''O''_''O''U''T''P''U''T''_''D''E''V''I''C''E''_''I''N''F''O'
954                       ;                            ;
955    
956  MIDI_INPUT_DEVICE_COUNT   :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E''_''C''O''U''N''T'  MIDI_INPUT_DEVICE_COUNT   :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E''_''C''O''U''N''T'
957                       ;                            ;
958    
959  MIDI_INPUT_DEVICE_INFO    :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E''_''I''N''F''O'  MIDI_INPUT_DEVICE_INFO    :  'M''I''D''I''_''I''N''P''U''T''_''D''E''V''I''C''E''_''I''N''F''O'
960                       ;                            ;
961    
962  MIDI_INSTRUMENT_MAP_COUNT :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''M''A''P''_''C''O''U''N''T'  MIDI_INSTRUMENT_MAP_COUNT :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''M''A''P''_''C''O''U''N''T'
963                       ;                            ;
964    
965  MIDI_INSTRUMENT_MAP_INFO  :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''M''A''P''_''I''N''F''O'  MIDI_INSTRUMENT_MAP_INFO  :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''M''A''P''_''I''N''F''O'
966                       ;                            ;
967    
968  MIDI_INSTRUMENT_COUNT     :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''C''O''U''N''T'  MIDI_INSTRUMENT_COUNT     :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''C''O''U''N''T'
969                       ;                            ;
970    
971  MIDI_INSTRUMENT_INFO      :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O'  MIDI_INSTRUMENT_INFO      :  'M''I''D''I''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O'
972                       ;                            ;
973    
974    DB_INSTRUMENT_DIRECTORY_COUNT :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''D''I''R''E''C''T''O''R''Y''_''C''O''U''N''T'
975                                  ;
976    
977    DB_INSTRUMENT_DIRECTORY_INFO  :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''D''I''R''E''C''T''O''R''Y''_''I''N''F''O'
978                                  ;
979    
980    DB_INSTRUMENT_COUNT           :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''C''O''U''N''T'
981                                  ;
982    
983    DB_INSTRUMENT_INFO            :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''I''N''F''O'
984                                  ;
985    
986    DB_INSTRUMENT_FILES           :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''F''I''L''E''S'
987                                  ;
988    
989    DB_INSTRUMENTS_JOB_INFO       :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B''_''I''N''F''O'
990                                  ;
991    
992  CHANNEL_COUNT        :  'C''H''A''N''N''E''L''_''C''O''U''N''T'  CHANNEL_COUNT        :  'C''H''A''N''N''E''L''_''C''O''U''N''T'
993                       ;                       ;
994    
995    CHANNEL_MIDI         :  'C''H''A''N''N''E''L''_''M''I''D''I'
996                         ;
997    
998    DEVICE_MIDI          :  'D''E''V''I''C''E''_''M''I''D''I'
999                         ;
1000    
1001  CHANNEL_INFO         :  'C''H''A''N''N''E''L''_''I''N''F''O'  CHANNEL_INFO         :  'C''H''A''N''N''E''L''_''I''N''F''O'
1002                       ;                       ;
1003    
1004    FX_SEND_COUNT        :  'F''X''_''S''E''N''D''_''C''O''U''N''T'
1005                         ;
1006    
1007    FX_SEND_INFO         :  'F''X''_''S''E''N''D''_''I''N''F''O'
1008                         ;
1009    
1010  BUFFER_FILL          :  'B''U''F''F''E''R''_''F''I''L''L'  BUFFER_FILL          :  'B''U''F''F''E''R''_''F''I''L''L'
1011                       ;                       ;
1012    
# Line 596  STREAM_COUNT         :  'S''T''R''E''A'' Line 1016  STREAM_COUNT         :  'S''T''R''E''A''
1016  VOICE_COUNT          :  'V''O''I''C''E''_''C''O''U''N''T'  VOICE_COUNT          :  'V''O''I''C''E''_''C''O''U''N''T'
1017                       ;                       ;
1018    
1019    TOTAL_STREAM_COUNT   :  'T''O''T''A''L''_''S''T''R''E''A''M''_''C''O''U''N''T'
1020                         ;
1021    
1022  TOTAL_VOICE_COUNT    :  'T''O''T''A''L''_''V''O''I''C''E''_''C''O''U''N''T'  TOTAL_VOICE_COUNT    :  'T''O''T''A''L''_''V''O''I''C''E''_''C''O''U''N''T'
1023                       ;                       ;
1024    
1025  TOTAL_VOICE_COUNT_MAX:  'T''O''T''A''L''_''V''O''I''C''E''_''C''O''U''N''T''_''M''A''X'  TOTAL_VOICE_COUNT_MAX:  'T''O''T''A''L''_''V''O''I''C''E''_''C''O''U''N''T''_''M''A''X'
1026                       ;                       ;
1027    
1028    GLOBAL_INFO          :  'G''L''O''B''A''L''_''I''N''F''O'
1029                         ;
1030    
1031    EFFECT_INSTANCE_COUNT   :  'E''F''F''E''C''T''_''I''N''S''T''A''N''C''E''_''C''O''U''N''T'
1032                            ;
1033    
1034    EFFECT_INSTANCE_INFO    :  'E''F''F''E''C''T''_''I''N''S''T''A''N''C''E''_''I''N''F''O'
1035                            ;
1036    
1037    SEND_EFFECT_CHAIN_COUNT :  'S''E''N''D''_''E''F''F''E''C''T''_''C''H''A''I''N''_''C''O''U''N''T'
1038                            ;
1039    
1040    SEND_EFFECT_CHAIN_INFO  :  'S''E''N''D''_''E''F''F''E''C''T''_''C''H''A''I''N''_''I''N''F''O'
1041                            ;
1042    
1043  INSTRUMENT           :  'I''N''S''T''R''U''M''E''N''T'  INSTRUMENT           :  'I''N''S''T''R''U''M''E''N''T'
1044                       ;                       ;
1045    
1046    INSTRUMENTS          :  'I''N''S''T''R''U''M''E''N''T''S'
1047                         ;
1048    
1049  ENGINE               :  'E' 'N' 'G' 'I' 'N' 'E'  ENGINE               :  'E' 'N' 'G' 'I' 'N' 'E'
1050                       ;                       ;
1051    
# Line 641  AUDIO_OUTPUT_CHANNEL  :  'A''U''D''I''O' Line 1082  AUDIO_OUTPUT_CHANNEL  :  'A''U''D''I''O'
1082  AUDIO_OUTPUT_TYPE     :  'A''U''D''I''O''_''O''U''T''P''U''T''_''T''Y''P''E'  AUDIO_OUTPUT_TYPE     :  'A''U''D''I''O''_''O''U''T''P''U''T''_''T''Y''P''E'
1083                        ;                        ;
1084    
1085    AVAILABLE_EFFECTS :  'A''V''A''I''L''A''B''L''E''_''E''F''F''E''C''T''S'
1086                      ;
1087    
1088    EFFECT :  'E''F''F''E''C''T'
1089           ;
1090    
1091    EFFECT_INSTANCE :  'E''F''F''E''C''T''_''I''N''S''T''A''N''C''E'
1092                    ;
1093    
1094    EFFECT_INSTANCES :  'E''F''F''E''C''T''_''I''N''S''T''A''N''C''E''S'
1095                     ;
1096    
1097    EFFECT_INSTANCE_INPUT_CONTROL :  'E''F''F''E''C''T''_''I''N''S''T''A''N''C''E''_''I''N''P''U''T''_''C''O''N''T''R''O''L'
1098                                  ;
1099    
1100    SEND_EFFECT_CHAIN :  'S''E''N''D''_''E''F''F''E''C''T''_''C''H''A''I''N'
1101                      ;
1102    
1103    SEND_EFFECT_CHAINS :  'S''E''N''D''_''E''F''F''E''C''T''_''C''H''A''I''N''S'
1104                       ;
1105    
1106  AVAILABLE_MIDI_INPUT_DRIVERS  :  'A''V''A''I''L''A''B''L''E''_''M''I''D''I''_''I''N''P''U''T''_''D''R''I''V''E''R''S'  AVAILABLE_MIDI_INPUT_DRIVERS  :  'A''V''A''I''L''A''B''L''E''_''M''I''D''I''_''I''N''P''U''T''_''D''R''I''V''E''R''S'
1107                                ;                                ;
1108    
# Line 686  MIDI_INPUT_TYPE       :  'M''I''D''I''_' Line 1148  MIDI_INPUT_TYPE       :  'M''I''D''I''_'
1148  MIDI_INPUT            :  'M''I''D''I''_''I''N''P''U''T'  MIDI_INPUT            :  'M''I''D''I''_''I''N''P''U''T'
1149                        ;                        ;
1150    
1151    MIDI_INPUTS           :  'M''I''D''I''_''I''N''P''U''T''S'
1152                          ;
1153    
1154    MIDI_CONTROLLER       :  'M''I''D''I''_''C''O''N''T''R''O''L''L''E''R'
1155                          ;
1156    
1157    SEND                  :  'S''E''N''D'
1158                          ;
1159    
1160  FX_SEND               :  'F''X''_''S''E''N''D'  FX_SEND               :  'F''X''_''S''E''N''D'
1161                        ;                        ;
1162    
1163  FX_SENDS              :  'F''X''_''S''E''N''D''S'  FX_SENDS              :  'F''X''_''S''E''N''D''S'
1164                        ;                        ;
1165    
1166    DB_INSTRUMENT_DIRECTORY    :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''D''I''R''E''C''T''O''R''Y'
1167                               ;
1168    
1169    DB_INSTRUMENT_DIRECTORIES  :  'D''B''_''I''N''S''T''R''U''M''E''N''T''_''D''I''R''E''C''T''O''R''I''E''S'
1170                               ;
1171    
1172    DB_INSTRUMENTS             :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S'
1173                               ;
1174    
1175    DB_INSTRUMENT              :  'D''B''_''I''N''S''T''R''U''M''E''N''T'
1176                               ;
1177    
1178    DB_INSTRUMENTS_JOB         :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B'
1179                               ;
1180    
1181    INSTRUMENTS_DB             :  'I''N''S''T''R''U''M''E''N''T''S''_''D''B'
1182                               ;
1183    
1184    DESCRIPTION                :  'D''E''S''C''R''I''P''T''I''O''N'
1185                               ;
1186    
1187    FORCE                      :  'F''O''R''C''E'
1188                               ;
1189    
1190    FLAT                       :  'F''L''A''T'
1191                               ;
1192    
1193    RECURSIVE                  :  'R''E''C''U''R''S''I''V''E'
1194                               ;
1195    
1196    NON_RECURSIVE              :  'N''O''N''_''R''E''C''U''R''S''I''V''E'
1197                               ;
1198    
1199    LOST                       :  'L''O''S''T'
1200                               ;
1201    
1202    FILE_PATH                  :  'F''I''L''E''_''P''A''T''H'
1203                               ;
1204    
1205  SERVER                :  'S''E''R''V''E''R'  SERVER                :  'S''E''R''V''E''R'
1206                        ;                        ;
1207    
1208  VOLUME                :  'V''O''L''U''M''E'  VOLUME                :  'V''O''L''U''M''E'
1209                        ;                        ;
1210    
1211    LEVEL                 :  'L''E''V''E''L'
1212                          ;
1213    
1214    VALUE                 :  'V''A''L''U''E'
1215                          ;
1216    
1217  MUTE                  :  'M''U''T''E'  MUTE                  :  'M''U''T''E'
1218                        ;                        ;
1219    
1220  SOLO                  :  'S''O''L''O'  SOLO                  :  'S''O''L''O'
1221                        ;                        ;
1222    
1223    VOICES                :  'V''O''I''C''E''S'
1224                          ;
1225    
1226    STREAMS               :  'S''T''R''E''A''M''S'
1227                          ;
1228    
1229  BYTES                 :  'B''Y''T''E''S'  BYTES                 :  'B''Y''T''E''S'
1230                        ;                        ;
1231    
1232  PERCENTAGE            :  'P''E''R''C''E''N''T''A''G''E'  PERCENTAGE            :  'P''E''R''C''E''N''T''A''G''E'
1233                        ;                        ;
1234    
1235    FILE                  :  'F''I''L''E'
1236                          ;
1237    
1238    EDIT                  :  'E''D''I''T'
1239                          ;
1240    
1241    FORMAT                :  'F''O''R''M''A''T'
1242                          ;
1243    
1244    MIDI_DATA             :  'M''I''D''I''_''D''A''T''A'
1245                          ;
1246    
1247  RESET                 :  'R''E''S''E''T'  RESET                 :  'R''E''S''E''T'
1248                        ;                        ;
1249    
# Line 727  QUIT                  :  'Q''U''I''T' Line 1261  QUIT                  :  'Q''U''I''T'
1261    
1262  %%  %%
1263    
1264    #define DEBUG_BISON_SYNTAX_ERROR_WALKER 0
1265    
1266  /**  /**
1267   * Will be called when an error occured (usually syntax error).   * Internal function, only called by yyExpectedSymbols(). It is given a Bison
1268     * parser state stack, reflecting the parser's entire state at a certain point,
1269     * i.e. when a syntax error occured. This function will then walk ahead the
1270     * potential parse tree starting from the current head of the given state
1271     * stack. This function will call itself recursively to scan the individual
1272     * parse tree branches. As soon as it hits on the next non-terminal grammar
1273     * symbol in one parse tree branch, it adds the found non-terminal symbol to
1274     * @a expectedSymbols and aborts scanning the respective tree branch further.
1275     * If any local parser state is reached a second time, the respective parse
1276     * tree is aborted to avoid any endless recursion.
1277     *
1278     * @param stack - Bison (yacc) state stack
1279     * @param expectedSymbols - will be filled with next expected grammar symbols
1280     * @param depth - just for internal debugging purposes
1281   */   */
1282  void yyerror(const char* s) {  static void walkAndFillExpectedSymbols(std::vector<YYTYPE_INT16>& stack, std::set<String>& expectedSymbols, int depth = 0) {
1283      dmsg(2,("LSCPParser: %s\n", s));  #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1284        printf("\n");
1285        for (int i = 0; i < depth; ++i) printf("\t");
1286        printf("State stack:");
1287        for (int i = 0; i < stack.size(); ++i) {
1288            printf(" %d", stack[i]);
1289        }
1290        printf("\n");
1291    #endif
1292    
1293        if (stack.empty()) return;
1294    
1295        int state = stack[stack.size() - 1];
1296        int n = yypact[state];
1297        if (n == YYPACT_NINF) { // default reduction required ...
1298            // get default reduction rule for this state
1299            n = yydefact[state];
1300            if (n <= 0 || n >= YYNRULES) return; // no rule, something is wrong
1301            // return the new resolved expected symbol (left-hand symbol of grammar
1302            // rule), then we're done in this state
1303            expectedSymbols.insert(yytname[yyr1[n]]);
1304            return;
1305        }
1306        if (!(YYPACT_NINF < n && n <= YYLAST)) return;
1307    
1308    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1309        for (int i = 0; i < depth; ++i) printf("\t");
1310        printf("Expected tokens:");
1311    #endif
1312        int begin = n < 0 ? -n : 0;
1313        int checklim = YYLAST - n + 1;
1314        int end = checklim < YYNTOKENS ? checklim : YYNTOKENS;
1315        int rule, action, stackSize;
1316        for (int token = begin; token < end; ++token) {
1317            if (token == YYTERROR || yycheck[n + token] != token) continue;
1318    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1319            printf(" %s", yytname[token]);
1320    #endif
1321    
1322            //if (yycheck[n + token] != token) goto default_reduction;
1323    
1324            action = yytable[n + token];
1325            if (action == 0 || action == YYTABLE_NINF) {
1326    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1327                printf(" (invalid action) "); fflush(stdout);
1328    #endif
1329                continue; // error, ignore
1330            }
1331            if (action < 0) { // reduction with rule -action required ...
1332    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1333                printf(" (reduction) "); fflush(stdout);
1334    #endif
1335                rule = -action;
1336                goto reduce;
1337            }
1338            if (action == YYFINAL) continue; // "accept" state, we don't care about it here
1339    
1340            // "shift" required ...
1341    
1342            if (std::find(stack.begin(), stack.end(), action) != stack.end())
1343                continue; // duplicate state, ignore it to avoid endless recursions
1344    
1345            // "shift" / push the new state on the state stack and call this
1346            // function recursively, and restore the stack after the recurse return
1347            stackSize = stack.size();
1348            stack.push_back(action);
1349            walkAndFillExpectedSymbols( //FIXME: could cause stack overflow (should be a loop instead), is probably fine with our current grammar though
1350                stack, expectedSymbols, depth + 1
1351            );
1352            stack.resize(stackSize); // restore stack
1353            continue;
1354    
1355        //default_reduction: // resolve default reduction for this state
1356        //    printf(" (default red.) "); fflush(stdout);
1357        //    rule = yydefact[state];
1358    
1359        reduce: // "reduce" required
1360    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1361            printf(" (reduce by %d) ", rule); fflush(stdout);
1362    #endif
1363            if (rule == 0 || rule >= YYNRULES) continue; // invalid rule, something is wrong
1364            // store the left-hand symbol of the grammar rule
1365            expectedSymbols.insert(yytname[yyr1[rule]]);
1366    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1367            printf(" (SYM %s) ", yytname[yyr1[rule]]); fflush(stdout);
1368    #endif
1369        }
1370    #if DEBUG_BISON_SYNTAX_ERROR_WALKER
1371        printf("\n");
1372    #endif
1373  }  }
1374    
1375  /**  /**
1376     * Should only be called on syntax errors: returns a set of non-terminal
1377     * symbols expected to appear now/next, just at the point where the syntax
1378     * error appeared.
1379     */
1380    static std::set<String> yyExpectedSymbols() {
1381        std::set<String> result;
1382        yyparse_param_t* param = GetCurrentYaccSession();
1383        YYTYPE_INT16* ss = (*param->ppStackBottom);
1384        YYTYPE_INT16* sp = (*param->ppStackTop);
1385        int iStackSize   = sp - ss + 1;
1386        // copy and wrap parser's state stack into a convenient STL container
1387        std::vector<YYTYPE_INT16> stack;
1388        for (int i = 0; i < iStackSize; ++i) {
1389            stack.push_back(ss[i]);
1390        }
1391        // do the actual parser work
1392        walkAndFillExpectedSymbols(stack, result);
1393        return result;
1394    }
1395    
1396    namespace LinuxSampler {
1397    
1398    /**
1399   * Clears input buffer.   * Clears input buffer.
1400   */   */
1401  void restart(yyparse_param_t* pparam, int& yychar) {  void restart(yyparse_param_t* pparam, int& yychar) {
1402      bytes = 0;      bytes = 0;
1403      ptr   = 0;      ptr   = 0;
1404        sLastError = "";
1405        sParsed = "";
1406    }
1407    
1408  }  }

Legend:
Removed from v.1001  
changed lines
  Added in v.2510

  ViewVC Help
Powered by ViewVC