1 |
/* |
/* |
2 |
* Copyright (c) 2015-2016 Christian Schoenebeck |
* Copyright (c) 2015-2017 Christian Schoenebeck |
3 |
* |
* |
4 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
5 |
* |
* |
42 |
return n; |
return n; |
43 |
} |
} |
44 |
|
|
45 |
|
// shut up warning that 'register' keyword is deprecated as of C++11 |
46 |
|
#if defined(__cplusplus) && __cplusplus >= 201103L |
47 |
|
# define register |
48 |
|
#endif |
49 |
|
|
50 |
|
// Since this parser is solely used by script code editors, thus not used in a |
51 |
|
// real-time context, always throw an exception instead of exiting on fatal |
52 |
|
// lexer errors (so the debugger may pause with the appropriate back trace) |
53 |
|
#include <stdexcept> |
54 |
|
#define YY_FATAL_ERROR(msg) throw std::runtime_error(msg) |
55 |
|
|
56 |
%} |
%} |
57 |
|
|
58 |
/* generate a reentrant safe scanner */ |
/* generate a reentrant safe scanner */ |
70 |
%x PREPROC_SET_COND PREPROC_RESET_COND PREPROC_IF PREPROC_IF_NOT PREPROC_BODY_EAT PREPROC_PRE_BODY_USE PREPROC_PRE_BODY_EAT PREPROC_EVENT_NAME PREPROC_END_NAME |
%x PREPROC_SET_COND PREPROC_RESET_COND PREPROC_IF PREPROC_IF_NOT PREPROC_BODY_EAT PREPROC_PRE_BODY_USE PREPROC_PRE_BODY_EAT PREPROC_EVENT_NAME PREPROC_END_NAME |
71 |
|
|
72 |
DIGIT [0-9] |
DIGIT [0-9] |
73 |
ID [a-zA-Z0-9_]* |
ID [a-zA-Z0-9_]+ |
74 |
|
END_ID on|while|if|select|function|synchronized |
75 |
|
|
76 |
%% |
%% |
77 |
|
|
85 |
return yyextra->token.baseType; |
return yyextra->token.baseType; |
86 |
} |
} |
87 |
|
|
88 |
{DIGIT}+"."{DIGIT}* { |
/* there is currently no support for floating point numbers in NKSP yet */ |
89 |
|
/*{DIGIT}+"."{DIGIT}* { |
90 |
yyextra->token = NumberLiteralToken(yytext); |
yyextra->token = NumberLiteralToken(yytext); |
91 |
return yyextra->token.baseType; |
return yyextra->token.baseType; |
92 |
} |
}*/ |
93 |
|
|
94 |
|
|
95 |
/* Preprocessor statement: SET_CONDITION(name) */ |
/* Preprocessor statement: SET_CONDITION(name) */ |
226 |
return yyextra->token.baseType; |
return yyextra->token.baseType; |
227 |
} |
} |
228 |
|
|
229 |
<PREPROC_END_NAME>[ \t]*{ID} { |
<PREPROC_END_NAME>[ \t]*{END_ID}? { |
230 |
yy_pop_state(yyscanner); |
yy_pop_state(yyscanner); |
231 |
yyextra->token = KeywordToken(yytext); |
yyextra->token = KeywordToken(yytext); |
232 |
return yyextra->token.baseType; |
return yyextra->token.baseType; |
233 |
} |
} |
234 |
|
|
235 |
declare|while|if|or|and|not|else|case|select|to|mod|const|polyphonic { |
".or."|".and."|".not." { |
236 |
|
yyextra->token = KeywordToken(yytext); |
237 |
|
return yyextra->token.baseType; |
238 |
|
} |
239 |
|
|
240 |
|
declare|while|if|or|and|not|else|case|select|to|mod|const|polyphonic|function|call|synchronized { |
241 |
yyextra->token = KeywordToken(yytext); |
yyextra->token = KeywordToken(yytext); |
242 |
return yyextra->token.baseType; |
return yyextra->token.baseType; |
243 |
} |
} |