/[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 1245 by schoenebeck, Tue Jun 19 15:54:13 2007 UTC revision 1389 by schoenebeck, Sun Oct 7 14:05:04 2007 UTC
# Line 37  Line 37 
37    
38  // to save us typing work in the rules action definitions  // to save us typing work in the rules action definitions
39  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer  #define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer
40    #define SESSION_PARAM ((yyparse_param_t*) yyparse_param)
41    #define INCREMENT_LINE { SESSION_PARAM->iLine++; SESSION_PARAM->iColumn = 0; }
42    
43  // clears input buffer  // clears input buffer
44  void restart(yyparse_param_t* pparam, int& yychar);  void restart(yyparse_param_t* pparam, int& yychar);
# Line 48  void yyerror(const char* s); Line 50  void yyerror(const char* s);
50  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
51  static int bytes = 0;  // current number of characters in the input buffer  static int bytes = 0;  // current number of characters in the input buffer
52  static int ptr   = 0;  // current position in the input buffer  static int ptr   = 0;  // current position in the input buffer
53    static String sLastError; // error message of the last error occured
54    
55  // external reference to the function which actually reads from the socket  // external reference to the function which actually reads from the socket
56  extern int GetLSCPCommand( void *buf, int max_size);  extern int GetLSCPCommand( void *buf, int max_size);
57    
58    // external reference to the function in lscpserver.cpp which returns the
59    // current session (only works because the server runs as singleton)
60    extern yyparse_param_t* GetCurrentYaccSession();
61    
62  // returns true if supplied characters has an ASCII code of 128 or higher  // returns true if supplied characters has an ASCII code of 128 or higher
63  inline bool isExtendedAsciiChar(const char c) {  inline bool isExtendedAsciiChar(const char c) {
64      return (c < 0);      return (c < 0);
# Line 72  int yylex(YYSTYPE* yylval) { Line 79  int yylex(YYSTYPE* yylval) {
79      }      }
80      // this is the next character in the input stream      // this is the next character in the input stream
81      const char c = buf[ptr++];      const char c = buf[ptr++];
82        // increment current reading position (just for verbosity / messages)
83        GetCurrentYaccSession()->iColumn++;
84      // we have to handle "normal" and "extended" ASCII characters separately      // we have to handle "normal" and "extended" ASCII characters separately
85      if (isExtendedAsciiChar(c)) {      if (isExtendedAsciiChar(c)) {
86          // workaround for characters with ASCII code higher than 127          // workaround for characters with ASCII code higher than 127
# Line 123  int hexsToNumber(char hex_digit0, char h Line 132  int hexsToNumber(char hex_digit0, char h
132    
133  // reentrant parser  // reentrant parser
134  %pure_parser  %pure_parser
135    
136    // tell bison to spit out verbose syntax error messages
137  %error-verbose  %error-verbose
138    
139  %token <Char> EXT_ASCII_CHAR  %token <Char> EXT_ASCII_CHAR
140    
141  %type <Char> char digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex  %type <Char> char char_base digit digit_oct digit_hex escape_seq escape_seq_octal escape_seq_hex
142  %type <Dotnum> dotnum volume_value boolean  %type <Dotnum> dotnum volume_value boolean
143  %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  %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
144  %type <String> string string_escaped text text_escaped stringval stringval_escaped digits param_val_list param_val query_val pathname dirname 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 find_instruction move_instruction copy_instruction scan_mode edit_instruction  %type <String> string string_escaped text text_escaped text_escaped_base stringval stringval_escaped digits param_val_list param_val query_val filename db_path 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 find_instruction move_instruction copy_instruction scan_mode edit_instruction format_instruction
145  %type <FillResponse> buffer_size_type  %type <FillResponse> buffer_size_type
146  %type <KeyValList> key_val_list query_val_list  %type <KeyValList> key_val_list query_val_list
147  %type <LoadMode> instr_load_mode  %type <LoadMode> instr_load_mode
148  %type <Bool> modal_arg  %type <Bool> modal_arg
149    %type <UniversalPath> path path_base
150    
151  %start input  %start input
152    
# Line 155  input                 : line LF Line 167  input                 : line LF
167                        | line CR LF                        | line CR LF
168                        ;                        ;
169    
170  line                  :  /* epsilon (empty line ignored) */ { return LSCP_DONE; }  line                  :  /* epsilon (empty line ignored) */ { INCREMENT_LINE; return LSCP_DONE; }
171                        |  comment  { return LSCP_DONE; }                        |  comment  { INCREMENT_LINE; return LSCP_DONE; }
172                        |  command  { LSCPSERVER->AnswerClient($1); return LSCP_DONE; }                        |  command  { INCREMENT_LINE; LSCPSERVER->AnswerClient($1); return LSCP_DONE; }
173                        |  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; }
174                        ;                        ;
175    
176  comment               :  '#'  comment               :  '#'
# Line 186  command               :  ADD SP add_inst Line 198  command               :  ADD SP add_inst
198                        |  MOVE SP move_instruction              { $$ = $3;                                                }                        |  MOVE SP move_instruction              { $$ = $3;                                                }
199                        |  COPY SP copy_instruction              { $$ = $3;                                                }                        |  COPY SP copy_instruction              { $$ = $3;                                                }
200                        |  EDIT SP edit_instruction              { $$ = $3;                                                }                        |  EDIT SP edit_instruction              { $$ = $3;                                                }
201                          |  FORMAT SP format_instruction          { $$ = $3;                                                }
202                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }                        |  RESET                                 { $$ = LSCPSERVER->ResetSampler();                        }
203                        |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }                        |  QUIT                                  { LSCPSERVER->AnswerClient("Bye!\r\n"); return LSCP_QUIT; }
204                        ;                        ;
205    
206  add_instruction       :  CHANNEL                               { $$ = LSCPSERVER->AddChannel();                          }  add_instruction       :  CHANNEL                               { $$ = LSCPSERVER->AddChannel();                  }
207                        |  DB_INSTRUMENT_DIRECTORY SP pathname   { $$ = LSCPSERVER->AddDbInstrumentDirectory($3);          }                        |  DB_INSTRUMENT_DIRECTORY SP db_path    { $$ = LSCPSERVER->AddDbInstrumentDirectory($3);  }
208                        |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP pathname SP pathname        { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);  }                        |  DB_INSTRUMENTS SP NON_MODAL SP scan_mode SP db_path SP filename         { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);  }
209                        |  DB_INSTRUMENTS SP scan_mode SP pathname SP pathname                     { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);        }                        |  DB_INSTRUMENTS SP scan_mode SP db_path SP filename                      { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);        }
210                        |  DB_INSTRUMENTS SP NON_MODAL SP pathname SP pathname                     { $$ = LSCPSERVER->AddDbInstruments($5,$7, -1, true); }                        |  DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename                      { $$ = LSCPSERVER->AddDbInstruments($5,$7, -1, true); }
211                        |  DB_INSTRUMENTS SP NON_MODAL SP pathname SP pathname SP instrument_index { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);  }                        |  DB_INSTRUMENTS SP NON_MODAL SP db_path SP filename SP instrument_index  { $$ = LSCPSERVER->AddDbInstruments($5,$7,$9, true);  }
212                        |  DB_INSTRUMENTS SP pathname SP pathname                                  { $$ = LSCPSERVER->AddDbInstruments($3,$5);           }                        |  DB_INSTRUMENTS SP db_path SP filename                                   { $$ = LSCPSERVER->AddDbInstruments($3,$5);           }
213                        |  DB_INSTRUMENTS SP pathname SP pathname SP instrument_index              { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);        }                        |  DB_INSTRUMENTS SP db_path SP filename SP instrument_index               { $$ = LSCPSERVER->AddDbInstruments($3,$5,$7);        }
214                        |  MIDI_INSTRUMENT_MAP                   { $$ = LSCPSERVER->AddMidiInstrumentMap();                }                        |  MIDI_INSTRUMENT_MAP                   { $$ = LSCPSERVER->AddMidiInstrumentMap();                }
215                        |  MIDI_INSTRUMENT_MAP SP map_name       { $$ = LSCPSERVER->AddMidiInstrumentMap($3);              }                        |  MIDI_INSTRUMENT_MAP SP map_name       { $$ = LSCPSERVER->AddMidiInstrumentMap($3);              }
216                        ;                        ;
# Line 261  map_instruction       :  MIDI_INSTRUMENT Line 274  map_instruction       :  MIDI_INSTRUMENT
274  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); }
275                        ;                        ;
276    
277  remove_instruction    :  CHANNEL SP sampler_channel                    { $$ = LSCPSERVER->RemoveChannel($3);                     }  remove_instruction    :  CHANNEL SP sampler_channel                   { $$ = LSCPSERVER->RemoveChannel($3);                      }
278                        |  MIDI_INSTRUMENT_MAP SP midi_map               { $$ = LSCPSERVER->RemoveMidiInstrumentMap($3);           }                        |  MIDI_INSTRUMENT_MAP SP midi_map              { $$ = LSCPSERVER->RemoveMidiInstrumentMap($3);            }
279                        |  MIDI_INSTRUMENT_MAP SP ALL                    { $$ = LSCPSERVER->RemoveAllMidiInstrumentMaps();         }                        |  MIDI_INSTRUMENT_MAP SP ALL                   { $$ = LSCPSERVER->RemoveAllMidiInstrumentMaps();          }
280                        |  DB_INSTRUMENT_DIRECTORY SP FORCE SP pathname  { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($5, true); }                        |  DB_INSTRUMENT_DIRECTORY SP FORCE SP db_path  { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($5, true);  }
281                        |  DB_INSTRUMENT_DIRECTORY SP pathname           { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($3);       }                        |  DB_INSTRUMENT_DIRECTORY SP db_path           { $$ = LSCPSERVER->RemoveDbInstrumentDirectory($3);        }
282                        |  DB_INSTRUMENT SP pathname                     { $$ = LSCPSERVER->RemoveDbInstrument($3);                }                        |  DB_INSTRUMENT SP db_path                     { $$ = LSCPSERVER->RemoveDbInstrument($3);                 }
283                        ;                        ;
284    
285  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }  get_instruction       :  AVAILABLE_ENGINES                                                          { $$ = LSCPSERVER->GetAvailableEngines();                          }
# Line 302  get_instruction       :  AVAILABLE_ENGIN Line 315  get_instruction       :  AVAILABLE_ENGIN
315                        |  MIDI_INSTRUMENT_MAP SP INFO SP midi_map                                    { $$ = LSCPSERVER->GetMidiInstrumentMap($5);                       }                        |  MIDI_INSTRUMENT_MAP SP INFO SP midi_map                                    { $$ = LSCPSERVER->GetMidiInstrumentMap($5);                       }
316                        |  FX_SENDS SP sampler_channel                                                { $$ = LSCPSERVER->GetFxSends($3);                                 }                        |  FX_SENDS SP sampler_channel                                                { $$ = LSCPSERVER->GetFxSends($3);                                 }
317                        |  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);                           }
318                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP pathname                         { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($5, true);        }                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP db_path                          { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($5, true);        }
319                        |  DB_INSTRUMENT_DIRECTORIES SP pathname                                      { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($3, false);       }                        |  DB_INSTRUMENT_DIRECTORIES SP db_path                                       { $$ = LSCPSERVER->GetDbInstrumentDirectoryCount($3, false);       }
320                        |  DB_INSTRUMENT_DIRECTORY SP INFO SP pathname                                { $$ = LSCPSERVER->GetDbInstrumentDirectoryInfo($5);               }                        |  DB_INSTRUMENT_DIRECTORY SP INFO SP db_path                                 { $$ = LSCPSERVER->GetDbInstrumentDirectoryInfo($5);               }
321                        |  DB_INSTRUMENTS SP RECURSIVE SP pathname                                    { $$ = LSCPSERVER->GetDbInstrumentCount($5, true);                 }                        |  DB_INSTRUMENTS SP RECURSIVE SP db_path                                     { $$ = LSCPSERVER->GetDbInstrumentCount($5, true);                 }
322                        |  DB_INSTRUMENTS SP pathname                                                 { $$ = LSCPSERVER->GetDbInstrumentCount($3, false);                }                        |  DB_INSTRUMENTS SP db_path                                                  { $$ = LSCPSERVER->GetDbInstrumentCount($3, false);                }
323                        |  DB_INSTRUMENT SP INFO SP pathname                                          { $$ = LSCPSERVER->GetDbInstrumentInfo($5);                        }                        |  DB_INSTRUMENT SP INFO SP db_path                                           { $$ = LSCPSERVER->GetDbInstrumentInfo($5);                        }
324                        |  DB_INSTRUMENTS_JOB SP INFO SP number                                       { $$ = LSCPSERVER->GetDbInstrumentsJobInfo($5);                    }                        |  DB_INSTRUMENTS_JOB SP INFO SP number                                       { $$ = LSCPSERVER->GetDbInstrumentsJobInfo($5);                    }
325                        |  VOLUME                                                                     { $$ = LSCPSERVER->GetGlobalVolume();                              }                        |  VOLUME                                                                     { $$ = LSCPSERVER->GetGlobalVolume();                              }
326                        ;                        ;
# Line 315  get_instruction       :  AVAILABLE_ENGIN Line 328  get_instruction       :  AVAILABLE_ENGIN
328  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);      }
329                        |  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); }
330                        |  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);        }
331                          |  MIDI_INPUT_PORT_PARAMETER SP number SP number SP string '=' NONE                 { $$ = LSCPSERVER->SetMidiInputPortParameter($3, $5, $7, "");      }
332                        |  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);      }
333                        |  CHANNEL SP set_chan_instruction                                                  { $$ = $3;                                                         }                        |  CHANNEL SP set_chan_instruction                                                  { $$ = $3;                                                         }
334                        |  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);               }
# Line 322  set_instruction       :  AUDIO_OUTPUT_DE Line 336  set_instruction       :  AUDIO_OUTPUT_DE
336                        |  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); }
337                        |  FX_SEND SP MIDI_CONTROLLER SP sampler_channel SP fx_send_id SP midi_ctrl         { $$ = LSCPSERVER->SetFxSendMidiController($5,$7,$9);              }                        |  FX_SEND SP MIDI_CONTROLLER SP sampler_channel SP fx_send_id SP midi_ctrl         { $$ = LSCPSERVER->SetFxSendMidiController($5,$7,$9);              }
338                        |  FX_SEND SP LEVEL SP sampler_channel SP fx_send_id SP volume_value                { $$ = LSCPSERVER->SetFxSendLevel($5,$7,$9);                       }                        |  FX_SEND SP LEVEL SP sampler_channel SP fx_send_id SP volume_value                { $$ = LSCPSERVER->SetFxSendLevel($5,$7,$9);                       }
339                        |  DB_INSTRUMENT_DIRECTORY SP NAME SP pathname SP dirname                           { $$ = LSCPSERVER->SetDbInstrumentDirectoryName($5,$7);            }                        |  DB_INSTRUMENT_DIRECTORY SP NAME SP db_path SP stringval_escaped                  { $$ = LSCPSERVER->SetDbInstrumentDirectoryName($5,$7);            }
340                        |  DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP pathname SP stringval                  { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7);     }                        |  DB_INSTRUMENT_DIRECTORY SP DESCRIPTION SP db_path SP stringval_escaped           { $$ = LSCPSERVER->SetDbInstrumentDirectoryDescription($5,$7);     }
341                        |  DB_INSTRUMENT SP NAME SP pathname SP dirname                                     { $$ = LSCPSERVER->SetDbInstrumentName($5,$7);                     }                        |  DB_INSTRUMENT SP NAME SP db_path SP stringval_escaped                            { $$ = LSCPSERVER->SetDbInstrumentName($5,$7);                     }
342                        |  DB_INSTRUMENT SP DESCRIPTION SP pathname SP stringval                            { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7);              }                        |  DB_INSTRUMENT SP DESCRIPTION SP db_path SP stringval_escaped                     { $$ = LSCPSERVER->SetDbInstrumentDescription($5,$7);              }
343                        |  ECHO SP boolean                                                                  { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }                        |  ECHO SP boolean                                                                  { $$ = LSCPSERVER->SetEcho((yyparse_param_t*) yyparse_param, $3);  }
344                        |  VOLUME SP volume_value                                                           { $$ = LSCPSERVER->SetGlobalVolume($3);                            }                        |  VOLUME SP volume_value                                                           { $$ = LSCPSERVER->SetGlobalVolume($3);                            }
345                        ;                        ;
# Line 345  clear_instruction     :  MIDI_INSTRUMENT Line 359  clear_instruction     :  MIDI_INSTRUMENT
359                        |  MIDI_INSTRUMENTS SP ALL        { $$ = LSCPSERVER->ClearAllMidiInstrumentMappings(); }                        |  MIDI_INSTRUMENTS SP ALL        { $$ = LSCPSERVER->ClearAllMidiInstrumentMappings(); }
360                        ;                        ;
361    
362  find_instruction      :  DB_INSTRUMENTS SP NON_RECURSIVE SP pathname SP query_val_list             { $$ = LSCPSERVER->FindDbInstruments($5,$7, false);           }  find_instruction      :  DB_INSTRUMENTS SP NON_RECURSIVE SP db_path SP query_val_list              { $$ = LSCPSERVER->FindDbInstruments($5,$7, false);           }
363                        |  DB_INSTRUMENTS SP pathname SP query_val_list                              { $$ = LSCPSERVER->FindDbInstruments($3,$5, true);            }                        |  DB_INSTRUMENTS SP db_path SP query_val_list                               { $$ = LSCPSERVER->FindDbInstruments($3,$5, true);            }
364                        |  DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP pathname SP query_val_list  { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); }                        |  DB_INSTRUMENT_DIRECTORIES SP NON_RECURSIVE SP db_path SP query_val_list   { $$ = LSCPSERVER->FindDbInstrumentDirectories($5,$7, false); }
365                        |  DB_INSTRUMENT_DIRECTORIES SP pathname SP query_val_list                   { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true);  }                        |  DB_INSTRUMENT_DIRECTORIES SP db_path SP query_val_list                    { $$ = LSCPSERVER->FindDbInstrumentDirectories($3,$5, true);  }
366                        ;                        ;
367    
368  move_instruction      :  DB_INSTRUMENT_DIRECTORY SP pathname SP pathname  { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); }  move_instruction      :  DB_INSTRUMENT_DIRECTORY SP db_path SP db_path    { $$ = LSCPSERVER->MoveDbInstrumentDirectory($3,$5); }
369                        |  DB_INSTRUMENT SP pathname SP pathname            { $$ = LSCPSERVER->MoveDbInstrument($3,$5);          }                        |  DB_INSTRUMENT SP db_path SP db_path              { $$ = LSCPSERVER->MoveDbInstrument($3,$5);          }
370                        ;                        ;
371    
372  copy_instruction      :  DB_INSTRUMENT_DIRECTORY SP pathname SP pathname  { $$ = LSCPSERVER->CopyDbInstrumentDirectory($3,$5); }  copy_instruction      :  DB_INSTRUMENT_DIRECTORY SP db_path SP db_path    { $$ = LSCPSERVER->CopyDbInstrumentDirectory($3,$5); }
373                        |  DB_INSTRUMENT SP pathname SP pathname            { $$ = LSCPSERVER->CopyDbInstrument($3,$5);          }                        |  DB_INSTRUMENT SP db_path SP db_path              { $$ = LSCPSERVER->CopyDbInstrument($3,$5);          }
374                        ;                        ;
375    
376  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }  destroy_instruction   :  AUDIO_OUTPUT_DEVICE SP number  { $$ = LSCPSERVER->DestroyAudioOutputDevice($3); }
# Line 387  set_chan_instruction  :  AUDIO_OUTPUT_DE Line 401  set_chan_instruction  :  AUDIO_OUTPUT_DE
401  edit_instruction      :  INSTRUMENT SP sampler_channel  { $$ = LSCPSERVER->EditSamplerChannelInstrument($3); }  edit_instruction      :  INSTRUMENT SP sampler_channel  { $$ = LSCPSERVER->EditSamplerChannelInstrument($3); }
402                        ;                        ;
403    
404    format_instruction    :  INSTRUMENTS_DB  { $$ = LSCPSERVER->FormatInstrumentsDb(); }
405                          ;
406    
407  modal_arg             :  /* epsilon (empty argument) */  { $$ = true;  }  modal_arg             :  /* epsilon (empty argument) */  { $$ = true;  }
408                        |  NON_MODAL SP                    { $$ = false; }                        |  NON_MODAL SP                    { $$ = false; }
409                        ;                        ;
# Line 409  list_instruction      :  AUDIO_OUTPUT_DE Line 426  list_instruction      :  AUDIO_OUTPUT_DE
426                        |  MIDI_INSTRUMENTS SP ALL                            { $$ = LSCPSERVER->ListAllMidiInstrumentMappings();      }                        |  MIDI_INSTRUMENTS SP ALL                            { $$ = LSCPSERVER->ListAllMidiInstrumentMappings();      }
427                        |  MIDI_INSTRUMENT_MAPS                               { $$ = LSCPSERVER->ListMidiInstrumentMaps();             }                        |  MIDI_INSTRUMENT_MAPS                               { $$ = LSCPSERVER->ListMidiInstrumentMaps();             }
428                        |  FX_SENDS SP sampler_channel                        { $$ = LSCPSERVER->ListFxSends($3);                      }                        |  FX_SENDS SP sampler_channel                        { $$ = LSCPSERVER->ListFxSends($3);                      }
429                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP pathname { $$ = LSCPSERVER->GetDbInstrumentDirectories($5, true); }                        |  DB_INSTRUMENT_DIRECTORIES SP RECURSIVE SP db_path  { $$ = LSCPSERVER->GetDbInstrumentDirectories($5, true); }
430                        |  DB_INSTRUMENT_DIRECTORIES SP pathname              { $$ = LSCPSERVER->GetDbInstrumentDirectories($3);       }                        |  DB_INSTRUMENT_DIRECTORIES SP db_path               { $$ = LSCPSERVER->GetDbInstrumentDirectories($3);       }
431                        |  DB_INSTRUMENTS SP RECURSIVE SP pathname            { $$ = LSCPSERVER->GetDbInstruments($5, true);           }                        |  DB_INSTRUMENTS SP RECURSIVE SP db_path             { $$ = LSCPSERVER->GetDbInstruments($5, true);           }
432                        |  DB_INSTRUMENTS SP pathname                         { $$ = LSCPSERVER->GetDbInstruments($3);                 }                        |  DB_INSTRUMENTS SP db_path                          { $$ = LSCPSERVER->GetDbInstruments($3);                 }
433                        ;                        ;
434    
435  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 474  fx_send_id                :  number Line 491  fx_send_id                :  number
491  engine_name               :  string  engine_name               :  string
492                            ;                            ;
493    
494  pathname                  :  stringval  filename                  :  path  { $$ = $1.toPosix(); /*TODO: assuming POSIX*/ }
495                            ;                            ;
496    
497  dirname                   :  stringval  db_path                   :  path  { $$ = $1.toDbPath(); }
498                            ;                            ;
499    
500  filename                  :  stringval_escaped  map_name                  :  stringval_escaped
501                            ;                            ;
502    
503  map_name                  :  stringval  entry_name                :  stringval_escaped
504                            ;                            ;
505    
506  entry_name                :  stringval  fx_send_name              :  stringval_escaped
                           ;  
   
 fx_send_name              :  stringval  
507                            ;                            ;
508    
509  param_val_list            :  param_val  param_val_list            :  param_val
510                            |  param_val_list','param_val  { $$ = $1 + "," + $3; }                            |  param_val_list','param_val  { $$ = $1 + "," + $3; }
511                            ;                            ;
512    
513  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
514                            |  stringval  param_val                 :  string            { $$ = "\'" + $1 + "\'"; }
515                              |  stringval         { $$ = "\'" + $1 + "\'"; }
516                            |  number            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }                            |  number            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }
517                            |  dotnum            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }                            |  dotnum            { std::stringstream ss; ss << "\'" << $1 << "\'"; $$ = ss.str(); }
518                            ;                            ;
# Line 506  query_val_list            :  string '=' Line 521  query_val_list            :  string '='
521                            |  query_val_list SP string '=' query_val  { $$ = $1; $$[$3] = $5; }                            |  query_val_list SP string '=' query_val  { $$ = $1; $$[$3] = $5; }
522                            ;                            ;
523    
524  query_val                 :  string  query_val                 :  text_escaped
525                            |  stringval                            |  stringval_escaped
526                            ;                            ;
527    
528  scan_mode                 :  RECURSIVE      { $$ = "RECURSIVE"; }  scan_mode                 :  RECURSIVE      { $$ = "RECURSIVE"; }
# Line 524  boolean               :  number  { $$ = Line 539  boolean               :  number  { $$ =
539                        |  string  { $$ = -1; }                        |  string  { $$ = -1; }
540                        ;                        ;
541    
542  string                :  char          { std::string s; s = $1; $$ = s; }  dotnum                :      digits '.' digits  { std::stringstream ss($1 + "." + $3); ss.imbue(std::locale::classic()); ss >> $$; }
543                        |  '\\'          { $$ = "\\";                     } // we have to place this rule here, because we currently distinguish between escaped and unescaped strings                        |  '+' digits '.' digits  { std::stringstream ss($2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
544                        |  string char   { $$ = $1 + $2;                  }                        |  '-' digits '.' digits  { std::stringstream ss("-" + $2 + "." + $4); ss.imbue(std::locale::classic()); ss >> $$; }
                       ;  
   
 string_escaped        :  char                        { std::string s; s = $1; $$ = s; }  
                       |  escape_seq                  { std::string s; s = $1; $$ = s; }  
                       |  string_escaped char         { $$ = $1 + $2;                  }  
                       |  string_escaped escape_seq   { $$ = $1 + $2;                  }  
                       ;  
   
 dotnum                :      digits '.' digits  { $$ = atof(String($1 + "." + $3).c_str());                         }  
                       |  '+' digits '.' digits  { String s = "+"; s += $2; s += "."; s += $4; $$ = atof(s.c_str()); }  
                       |  '-' digits '.' digits  { $$ = atof(String("-" + $2 + "." + $4).c_str());                   }  
545                        ;                        ;
546    
547    
# Line 601  number                :  digit       { $ Line 605  number                :  digit       { $
605                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }
606                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }
607                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }
608                          ;
609    
610  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; }
611                        |  '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; }
612                        |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }                        ;
613                        |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; } | '/' { $$ = '/'; }  
614                        |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }  path_base             :  '/'                          { $$ = Path();                           }
615                        |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }                        |  path_base '/'                { $$ = $1;                               }
616                        |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }                        |  path_base text_escaped_base  { Path p; p.appendNode($2); $$ = $1 + p; }
617                        |  EXT_ASCII_CHAR                        ;
618    
619    stringval             :  '\'' text '\''  { $$ = $2; }
620                          |  '\"' text '\"'  { $$ = $2; }
621                          ;
622    
623    stringval_escaped     :  '\'' text_escaped '\''  { $$ = $2; }
624                          |  '\"' text_escaped '\"'  { $$ = $2; }
625                        ;                        ;
626    
627  text                  :  SP           { $$ = " ";      }  text                  :  SP           { $$ = " ";      }
# Line 618  text                  :  SP           { Line 630  text                  :  SP           {
630                        |  text string  { $$ = $1 + $2;  }                        |  text string  { $$ = $1 + $2;  }
631                        ;                        ;
632    
633  text_escaped          :  SP                           { $$ = " ";      }  // like text_escaped, but missing the slash ('/') character
634    text_escaped_base     :  SP                                { $$ = " ";      }
635                        |  string_escaped                        |  string_escaped
636                        |  text_escaped SP              { $$ = $1 + " "; }                        |  text_escaped_base SP              { $$ = $1 + " "; }
637                        |  text_escaped string_escaped  { $$ = $1 + $2;  }                        |  text_escaped_base string_escaped  { $$ = $1 + $2;  }
638                        ;                        ;
639    
640  stringval             :  '\'' text '\''  { $$ = $2; }  text_escaped          :  '/'                              { $$ = "/";      }
641                        |  '\"' text '\"'  { $$ = $2; }                        |  text_escaped_base
642                          |  text_escaped '/'                 { $$ = $1 + "/"; }
643                          |  text_escaped text_escaped_base   { $$ = $1 + $2;  }
644                        ;                        ;
645    
646  stringval_escaped     :  '\'' text_escaped '\''  { $$ = $2; }  string                :  char          { std::string s; s = $1; $$ = s; }
647                        |  '\"' text_escaped '\"'  { $$ = $2; }                        |  string char   { $$ = $1 + $2;                  }
648                          ;
649    
650    string_escaped        :  char_base                   { std::string s; s = $1; $$ = s; }
651                          |  escape_seq                  { std::string s; s = $1; $$ = s; }
652                          |  string_escaped char_base    { $$ = $1 + $2;                  }
653                          |  string_escaped escape_seq   { $$ = $1 + $2;                  }
654                          ;
655    
656    // full ASCII character set except space, quotation mark and apostrophe
657    char                  :  char_base
658                          |  '\\'  { $$ = '\\'; }
659                          |  '/'   { $$ = '/';  }
660                          ;
661    
662    // ASCII characters except space, quotation mark, apostrophe, backslash and slash
663    char_base             :  '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'; }
664                          |  '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'; }
665                          |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }
666                          |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; }
667                          |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }
668                          |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }
669                          |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }
670                          |  EXT_ASCII_CHAR
671                        ;                        ;
672    
673  escape_seq            :  '\\' '\''  { $$ = '\''; }  escape_seq            :  '\\' '\''  { $$ = '\''; }
674                        |  '\\' '\"'  { $$ = '\"'; }                        |  '\\' '\"'  { $$ = '\"'; }
675                        |  '\\' '\\'  { $$ = '\\'; }                        |  '\\' '\\'  { $$ = '\\'; }
676                          |  '\\' '/'   { $$ = '/';  }
677                        |  '\\' 'n'   { $$ = '\n'; }                        |  '\\' 'n'   { $$ = '\n'; }
678                        |  '\\' 'r'   { $$ = '\r'; }                        |  '\\' 'r'   { $$ = '\r'; }
679                        |  '\\' 'f'   { $$ = '\f'; }                        |  '\\' 'f'   { $$ = '\f'; }
# Line 916  DB_INSTRUMENT              :  'D''B''_'' Line 955  DB_INSTRUMENT              :  'D''B''_''
955  DB_INSTRUMENTS_JOB         :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B'  DB_INSTRUMENTS_JOB         :  'D''B''_''I''N''S''T''R''U''M''E''N''T''S''_''J''O''B'
956                             ;                             ;
957    
958    INSTRUMENTS_DB             :  'I''N''S''T''R''U''M''E''N''T''S''_''D''B'
959                               ;
960    
961  DESCRIPTION                :  'D''E''S''C''R''I''P''T''I''O''N'  DESCRIPTION                :  'D''E''S''C''R''I''P''T''I''O''N'
962                             ;                             ;
963    
# Line 955  PERCENTAGE            :  'P''E''R''C''E' Line 997  PERCENTAGE            :  'P''E''R''C''E'
997  EDIT                  :  'E''D''I''T'  EDIT                  :  'E''D''I''T'
998                        ;                        ;
999    
1000    FORMAT                :  'F''O''R''M''A''T'
1001                          ;
1002    
1003  RESET                 :  'R''E''S''E''T'  RESET                 :  'R''E''S''E''T'
1004                        ;                        ;
1005    
# Line 976  QUIT                  :  'Q''U''I''T' Line 1021  QUIT                  :  'Q''U''I''T'
1021   * Will be called when an error occured (usually syntax error).   * Will be called when an error occured (usually syntax error).
1022   */   */
1023  void yyerror(const char* s) {  void yyerror(const char* s) {
1024      dmsg(2,("LSCPParser: %s\n", s));      yyparse_param_t* param = GetCurrentYaccSession();
1025        String msg = s
1026            + (" (line:"   + ToString(param->iLine+1))
1027            + ( ",column:" + ToString(param->iColumn))
1028            + ")";
1029        dmsg(2,("LSCPParser: %s\n", msg.c_str()));
1030        sLastError = msg;
1031  }  }
1032    
1033  /**  /**
# Line 985  void yyerror(const char* s) { Line 1036  void yyerror(const char* s) {
1036  void restart(yyparse_param_t* pparam, int& yychar) {  void restart(yyparse_param_t* pparam, int& yychar) {
1037      bytes = 0;      bytes = 0;
1038      ptr   = 0;      ptr   = 0;
1039        sLastError = "";
1040  }  }

Legend:
Removed from v.1245  
changed lines
  Added in v.1389

  ViewVC Help
Powered by ViewVC