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 |
/// handle for a client connection (FIXME: doesn't work for more than one network connections of course) |
29 |
int hSession; |
30 |
|
31 |
%} |
32 |
|
33 |
%option reentrant |
34 |
|
35 |
%x INSTRING |
36 |
|
37 |
DIGIT [0-9] |
38 |
|
39 |
%% |
40 |
|
41 |
" " { return SP; } |
42 |
\n { return LF; } |
43 |
\r { return CR; } |
44 |
"#" { return HASH; } |
45 |
"=" { return EQ; } |
46 |
("+"|"-")?{DIGIT}+"."{DIGIT}+ { yylval->Dotnum = atof(yytext); return DOTNUM; } |
47 |
ADD { return ADD; } |
48 |
GET { return GET; } |
49 |
CREATE { return CREATE; } |
50 |
DESTROY { return DESTROY; } |
51 |
LIST { return LIST; } |
52 |
LOAD { return LOAD; } |
53 |
NON_MODAL { return NON_MODAL; } |
54 |
REMOVE { return REMOVE; } |
55 |
SET { return SET; } |
56 |
SUBSCRIBE { return SUBSCRIBE; } |
57 |
UNSUBSCRIBE { return UNSUBSCRIBE; } |
58 |
CHANNEL { return CHANNEL; } |
59 |
NOTIFICATION { return NOTIFICATION; } |
60 |
AVAILABLE_ENGINES { return AVAILABLE_ENGINES; } |
61 |
AVAILABLE_AUDIO_OUTPUT_DRIVERS { return AVAILABLE_AUDIO_OUTPUT_DRIVERS; } |
62 |
CHANNELS { return CHANNELS; } |
63 |
INFO { return INFO; } |
64 |
BUFFER_FILL { return BUFFER_FILL; } |
65 |
STREAM_COUNT { return STREAM_COUNT; } |
66 |
VOICE_COUNT { return VOICE_COUNT; } |
67 |
INSTRUMENT { return INSTRUMENT; } |
68 |
ENGINE { return ENGINE; } |
69 |
AUDIO_OUTPUT_DEVICE { return AUDIO_OUTPUT_DEVICE; } |
70 |
AUDIO_OUTPUT_DEVICES { return AUDIO_OUTPUT_DEVICES; } |
71 |
AUDIO_OUTPUT_DEVICE_PARAMETER { return AUDIO_OUTPUT_DEVICE_PARAMETER; } |
72 |
AUDIO_OUTPUT_DRIVER { return AUDIO_OUTPUT_DRIVER; } |
73 |
AUDIO_OUTPUT_DRIVER_PARAMETER { return AUDIO_OUTPUT_DRIVER_PARAMETER; } |
74 |
AUDIO_OUTPUT_CHANNEL { return AUDIO_OUTPUT_CHANNEL; } |
75 |
AUDIO_OUTPUT_CHANNEL_PARAMETER { return AUDIO_OUTPUT_CHANNEL_PARAMETER; } |
76 |
MIDI_INPUT_PORT { return MIDI_INPUT_PORT; } |
77 |
MIDI_INPUT_CHANNEL { return MIDI_INPUT_CHANNEL; } |
78 |
MIDI_INPUT_TYPE { return MIDI_INPUT_TYPE; } |
79 |
VOLUME { return VOLUME; } |
80 |
BYTES { return BYTES; } |
81 |
PERCENTAGE { return PERCENTAGE; } |
82 |
RESET { return RESET; } |
83 |
MISCELLANEOUS { return MISCELLANEOUS; } |
84 |
QUIT { return QUIT; } |
85 |
0|([1-9]{DIGIT}*) { yylval->Number = atoi(yytext); return NUMBER; } |
86 |
"\'" { yylval->String = ""; BEGIN(INSTRING); } |
87 |
<INSTRING>[^\'\\]+ { yylval->String += yytext; } |
88 |
<INSTRING>"\\n" { yylval->String += '\n'; } |
89 |
<INSTRING>"\\r" { yylval->String += '\r'; } |
90 |
<INSTRING>"\\t" { yylval->String += '\t'; } |
91 |
<INSTRING>"\\\\" { yylval->String += '\\'; } |
92 |
<INSTRING>"\\\"" { yylval->String += '\"'; } |
93 |
<INSTRING>"\\\'" { yylval->String += '\''; } |
94 |
<INSTRING>"\\"[^nrt\"\\] { yylval->String += yytext; } |
95 |
<INSTRING>"\'" { BEGIN(INITIAL); return STRINGVAL; } |
96 |
. { yylval->Char = yytext[0]; return CHAR; } |
97 |
|
98 |
%% |
99 |
|
100 |
/** |
101 |
* We provide our own version of yywrap() so we don't have to link against |
102 |
* the lex library. |
103 |
*/ |
104 |
int yywrap(yyscan_t yyscanner) { |
105 |
return 1; // continue scanning |
106 |
} |