/[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 1331 by iliev, Wed Aug 15 17:43:34 2007 UTC revision 1332 by schoenebeck, Sun Sep 9 12:22:34 2007 UTC
# Line 138  int hexsToNumber(char hex_digit0, char h Line 138  int hexsToNumber(char hex_digit0, char h
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 stringval 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
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 492  pathname                  :  stringval Line 493  pathname                  :  stringval
493  dirname                   :  stringval  dirname                   :  stringval
494                            ;                            ;
495    
496  filename                  :  stringval_escaped  filename                  :  path  { $$ = $1.toPosix(); /*TODO: assuming POSIX*/ }
497                            ;                            ;
498    
499  map_name                  :  stringval  map_name                  :  stringval
# Line 536  boolean               :  number  { $$ = Line 537  boolean               :  number  { $$ =
537                        |  string  { $$ = -1; }                        |  string  { $$ = -1; }
538                        ;                        ;
539    
 string                :  char          { std::string s; s = $1; $$ = s; }  
                       |  '\\'          { $$ = "\\";                     } // we have to place this rule here, because we currently distinguish between escaped and unescaped strings  
                       |  string char   { $$ = $1 + $2;                  }  
                       ;  
   
 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;                  }  
                       ;  
   
540  dotnum                :      digits '.' digits  { $$ = atof(String($1 + "." + $3).c_str());                         }  dotnum                :      digits '.' digits  { $$ = atof(String($1 + "." + $3).c_str());                         }
541                        |  '+' digits '.' digits  { String s = "+"; s += $2; s += "."; s += $4; $$ = atof(s.c_str()); }                        |  '+' digits '.' digits  { String s = "+"; s += $2; s += "."; s += $4; $$ = atof(s.c_str()); }
542                        |  '-' digits '.' digits  { $$ = atof(String("-" + $2 + "." + $4).c_str());                   }                        |  '-' digits '.' digits  { $$ = atof(String("-" + $2 + "." + $4).c_str());                   }
# Line 613  number                :  digit       { $ Line 603  number                :  digit       { $
603                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }                        |  '7' digits  { $$ = atoi(String(String("7") + $2).c_str()); }
604                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }                        |  '8' digits  { $$ = atoi(String(String("8") + $2).c_str()); }
605                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }                        |  '9' digits  { $$ = atoi(String(String("9") + $2).c_str()); }
606                          ;
607    
608  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; }
609                        |  '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; }
610                        |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }                        ;
611                        |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; } | '/' { $$ = '/'; }  
612                        |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }  path_base             :  '/'                     { $$ = Path();                           }
613                        |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }                        |  path_base '/'           { $$ = $1;                               }
614                        |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }                        |  path_base text_escaped  { Path p; p.appendNode($2); $$ = $1 + p; }
615                        |  EXT_ASCII_CHAR                        ;
616    
617    stringval             :  '\'' text '\''  { $$ = $2; }
618                          |  '\"' text '\"'  { $$ = $2; }
619                        ;                        ;
620    
621  text                  :  SP           { $$ = " ";      }  text                  :  SP           { $$ = " ";      }
# Line 636  text_escaped          :  SP Line 630  text_escaped          :  SP
630                        |  text_escaped string_escaped  { $$ = $1 + $2;  }                        |  text_escaped string_escaped  { $$ = $1 + $2;  }
631                        ;                        ;
632    
633  stringval             :  '\'' text '\''  { $$ = $2; }  string                :  char          { std::string s; s = $1; $$ = s; }
634                        |  '\"' text '\"'  { $$ = $2; }                        |  string char   { $$ = $1 + $2;                  }
635                          ;
636    
637    string_escaped        :  char_base                   { std::string s; s = $1; $$ = s; }
638                          |  escape_seq                  { std::string s; s = $1; $$ = s; }
639                          |  string_escaped char_base    { $$ = $1 + $2;                  }
640                          |  string_escaped escape_seq   { $$ = $1 + $2;                  }
641                          ;
642    
643    // full ASCII character set except space, quotation mark and apostrophe
644    char                  :  char_base
645                          |  '\\'  { $$ = '\\'; }
646                          |  '/'   { $$ = '/';  }
647                        ;                        ;
648    
649  stringval_escaped     :  '\'' text_escaped '\''  { $$ = $2; }  // ASCII characters except space, quotation mark, apostrophe, backslash and slash
650                        |  '\"' text_escaped '\"'  { $$ = $2; }  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'; }
651                          |  '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'; }
652                          |  '0' { $$ = '0'; } | '1' { $$ = '1'; } | '2' { $$ = '2'; } | '3' { $$ = '3'; } | '4' { $$ = '4'; } | '5' { $$ = '5'; } | '6' { $$ = '6'; } | '7' { $$ = '7'; } | '8' { $$ = '8'; } | '9' { $$ = '9'; }
653                          |  '!' { $$ = '!'; } | '#' { $$ = '#'; } | '$' { $$ = '$'; } | '%' { $$ = '%'; } | '&' { $$ = '&'; } | '(' { $$ = '('; } | ')' { $$ = ')'; } | '*' { $$ = '*'; } | '+' { $$ = '+'; } | '-' { $$ = '-'; } | '.' { $$ = '.'; } | ',' { $$ = ','; }
654                          |  ':' { $$ = ':'; } | ';' { $$ = ';'; } | '<' { $$ = '<'; } | '=' { $$ = '='; } | '>' { $$ = '>'; } | '?' { $$ = '?'; } | '@' { $$ = '@'; }
655                          |  '[' { $$ = '['; } | ']' { $$ = ']'; } | '^' { $$ = '^'; } | '_' { $$ = '_'; }
656                          |  '{' { $$ = '{'; } | '|' { $$ = '|'; } | '}' { $$ = '}'; } | '~' { $$ = '~'; }
657                          |  EXT_ASCII_CHAR
658                        ;                        ;
659    
660  escape_seq            :  '\\' '\''  { $$ = '\''; }  escape_seq            :  '\\' '\''  { $$ = '\''; }
661                        |  '\\' '\"'  { $$ = '\"'; }                        |  '\\' '\"'  { $$ = '\"'; }
662                        |  '\\' '\\'  { $$ = '\\'; }                        |  '\\' '\\'  { $$ = '\\'; }
663                          |  '\\' '/'   { $$ = '/';  }
664                        |  '\\' 'n'   { $$ = '\n'; }                        |  '\\' 'n'   { $$ = '\n'; }
665                        |  '\\' 'r'   { $$ = '\r'; }                        |  '\\' 'r'   { $$ = '\r'; }
666                        |  '\\' 'f'   { $$ = '\f'; }                        |  '\\' 'f'   { $$ = '\f'; }

Legend:
Removed from v.1331  
changed lines
  Added in v.1332

  ViewVC Help
Powered by ViewVC