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

Contents of /linuxsampler/trunk/src/network/lscp.l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 170 - (show annotations) (download)
Sat Jul 3 20:08:07 2004 UTC (19 years, 9 months ago) by senkov
File size: 6160 byte(s)
* moved ToString to common
* Implemented handling of multiple connections
* Implemented guts for event subscription/unsubscription
* Illustrated event notification sending by sending MISC events
when connections are established or terminated.

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 %{
24
25 #include "lscpparser.h"
26 #include "lscpsymbols.h"
27
28 %}
29
30 %option reentrant
31
32 %x INSTRING
33
34 DIGIT [0-9]
35
36 %%
37
38 " " { return SP; }
39 \n { return LF; }
40 \r { return CR; }
41 "#" { return HASH; }
42 "=" { return EQ; }
43 ("+"|"-")?{DIGIT}+"."{DIGIT}+ { yylval->Dotnum = atof(yytext); return DOTNUM; }
44 ADD { return ADD; }
45 GET { return GET; }
46 CREATE { return CREATE; }
47 DESTROY { return DESTROY; }
48 LIST { return LIST; }
49 LOAD { return LOAD; }
50 NON_MODAL { return NON_MODAL; }
51 REMOVE { return REMOVE; }
52 SET { return SET; }
53 SUBSCRIBE { return SUBSCRIBE; }
54 UNSUBSCRIBE { return UNSUBSCRIBE; }
55 CHANNEL { return CHANNEL; }
56 NOTIFICATION { return NOTIFICATION; }
57 AVAILABLE_ENGINES { return AVAILABLE_ENGINES; }
58 AVAILABLE_AUDIO_OUTPUT_DRIVERS { return AVAILABLE_AUDIO_OUTPUT_DRIVERS; }
59 CHANNELS { return CHANNELS; }
60 INFO { return INFO; }
61 BUFFER_FILL { return BUFFER_FILL; }
62 STREAM_COUNT { return STREAM_COUNT; }
63 VOICE_COUNT { return VOICE_COUNT; }
64 INSTRUMENT { return INSTRUMENT; }
65 ENGINE { return ENGINE; }
66 AUDIO_OUTPUT_DEVICE_PARAMETER { return AUDIO_OUTPUT_DEVICE_PARAMETER; }
67 AUDIO_OUTPUT_DEVICES { return AUDIO_OUTPUT_DEVICES; }
68 AUDIO_OUTPUT_DEVICE { return AUDIO_OUTPUT_DEVICE; }
69 AUDIO_OUTPUT_DRIVER_PARAMETER { return AUDIO_OUTPUT_DRIVER_PARAMETER; }
70 AUDIO_OUTPUT_DRIVER { return AUDIO_OUTPUT_DRIVER; }
71 AUDIO_OUTPUT_CHANNEL_PARAMETER { return AUDIO_OUTPUT_CHANNEL_PARAMETER; }
72 AUDIO_OUTPUT_CHANNEL { return AUDIO_OUTPUT_CHANNEL; }
73 AUDIO_OUTPUT_TYPE { return AUDIO_OUTPUT_TYPE; }
74 AVAILABLE_MIDI_INPUT_DRIVERS { return AVAILABLE_MIDI_INPUT_DRIVERS; }
75 MIDI_INPUT_DEVICE_PARAMETER { return MIDI_INPUT_DEVICE_PARAMETER; }
76 MIDI_INPUT_PORT_PARAMETER { return MIDI_INPUT_PORT_PARAMETER; }
77 MIDI_INPUT_DEVICES { return MIDI_INPUT_DEVICES; }
78 MIDI_INPUT_DEVICE { return MIDI_INPUT_DEVICE; }
79 MIDI_INPUT_DRIVER_PARAMETER { return MIDI_INPUT_DRIVER_PARAMETER; }
80 MIDI_INPUT_DRIVER { return MIDI_INPUT_DRIVER; }
81 MIDI_INPUT_PORT { return MIDI_INPUT_PORT; }
82 MIDI_INPUT_CHANNEL { return MIDI_INPUT_CHANNEL; }
83 MIDI_INPUT_TYPE { return MIDI_INPUT_TYPE; }
84 MIDI_INPUT { return MIDI_INPUT; }
85 VOLUME { return VOLUME; }
86 BYTES { return BYTES; }
87 PERCENTAGE { return PERCENTAGE; }
88 RESET { return RESET; }
89 MISCELLANEOUS { return MISCELLANEOUS; }
90 QUIT { return QUIT; }
91 0|([1-9]{DIGIT}*) { yylval->Number = atoi(yytext); return NUMBER; }
92 "\'" { yylval->String = ""; BEGIN(INSTRING); }
93 <INSTRING>[^\'\\]+ { yylval->String += yytext; }
94 <INSTRING>"\\n" { yylval->String += '\n'; }
95 <INSTRING>"\\r" { yylval->String += '\r'; }
96 <INSTRING>"\\t" { yylval->String += '\t'; }
97 <INSTRING>"\\\\" { yylval->String += '\\'; }
98 <INSTRING>"\\\"" { yylval->String += '\"'; }
99 <INSTRING>"\\\'" { yylval->String += '\''; }
100 <INSTRING>"\\"[^nrt\"\\] { yylval->String += yytext; }
101 <INSTRING>"\'" { BEGIN(INITIAL); return STRINGVAL; }
102 . { yylval->Char = yytext[0]; return CHAR; }
103
104 %%
105
106 /**
107 * We provide our own version of yywrap() so we don't have to link against
108 * the lex library.
109 */
110 int yywrap(yyscan_t yyscanner) {
111 return 1; // continue scanning
112 }

  ViewVC Help
Powered by ViewVC