11%option bison-locations
12%option extra-type="unoidl::detail::SourceProviderScannerData *"
13%option never-interactive
24#include "sal/config.h"
36#include <rtl/string.hxx>
37#include <rtl/ustring.hxx>
38#include <rtl/textenc.h>
43#include <sourceprovider-parser.hxx>
51 assert(data !=
nullptr);
64#define YY_INPUT(buf, result, max_size) ((result) = \
65 ::unoidl::detail::sourceProviderScannerInput(yyextra, (buf), (max_size)))
69int nonZeroIntegerLiteral(
70 char const *
text, std::size_t
length, sal_Int16 radix, sal_uInt64 *
value,
73 assert(
text !=
nullptr);
75 assert(
value !=
nullptr);
76 assert(data !=
nullptr);
91 + OUString(
text,
length, RTL_TEXTENCODING_ASCII_US);
static std::size_t sourceProviderScannerInput(SourceProviderScannerData *data, char *buffer, std::size_t size)
char const * sourcePosition
101%x comment1 comment2 doc docdepr
112\n *yylloc = yylineno;
121"/***" BEGIN comment2;
127<comment2,doc,docdepr>\n *yylloc = yylineno;
128<comment2,doc,docdepr><<EOF>> {
129 yyextra->errorMessage =
"unterminated comment";
134<doc>"@deprecated" BEGIN docdepr;
138[%&()*+,\-/:;<=>[\]^{|}~] return yytext[0];
140"..." return TOK_ELLIPSIS;
141"::" return TOK_COLONS;
142"<<" return TOK_LEFTSHIFT;
143">>" return TOK_RIGHTSHIFT;
145"FALSE" return TOK_FALSE;
146"False" return TOK_FALSE;
147"TRUE" return TOK_TRUE;
148"True" return TOK_TRUE;
150"attribute" return TOK_ATTRIBUTE;
151"boolean" return TOK_BOOLEAN;
152"bound" return TOK_BOUND;
153"byte" return TOK_BYTE;
154"char" return TOK_CHAR;
155"const" return TOK_CONST;
156"constants" return TOK_CONSTANTS;
157"constrained" return TOK_CONSTRAINED;
158"double" return TOK_DOUBLE;
159"enum" return TOK_ENUM;
160"exception" return TOK_EXCEPTION;
161"float" return TOK_FLOAT;
163"hyper" return TOK_HYPER;
165"inout" return TOK_INOUT;
166"interface" return TOK_INTERFACE;
167"long" return TOK_LONG;
168"maybeambiguous" return TOK_MAYBEAMBIGUOUS;
169"maybedefault" return TOK_MAYBEDEFAULT;
170"maybevoid" return TOK_MAYBEVOID;
171"module" return TOK_MODULE;
172"optional" return TOK_OPTIONAL;
174"property" return TOK_PROPERTY;
175"published" return TOK_PUBLISHED;
176"raises" return TOK_RAISES;
177"readonly" return TOK_READONLY;
178"removable" return TOK_REMOVABLE;
179"sequence" return TOK_SEQUENCE;
180"service" return TOK_SERVICE;
182"short" return TOK_SHORT;
183"singleton" return TOK_SINGLETON;
184"string" return TOK_STRING;
185"struct" return TOK_STRUCT;
186"transient" return TOK_TRANSIENT;
187"type" return TOK_TYPE;
188"typedef" return TOK_TYPEDEF;
189"unsigned" return TOK_UNSIGNED;
190"void" return TOK_VOID;
192{UPPER}("_"?{ALNUM})*|{LOWER}{ALNUM}* {
193 yylval->sval =
new OString(yytext);
194 return TOK_IDENTIFIER;
197({ALPHA}|"_")({ALNUM}|"_")* {
198 yyextra->errorMessage =
"illegal identifier "
199 + OUString(yytext, yyleng, RTL_TEXTENCODING_ASCII_US);
210 return nonZeroIntegerLiteral(yytext, yyleng, 8, &
yylval->ival, yyextra);
213[1-9]{DIGIT}*[LUlu]? {
214 return nonZeroIntegerLiteral(yytext, yyleng, 10, &
yylval->ival, yyextra);
2170[Xx][0-9A-Fa-f]+[LUlu]? {
218 return nonZeroIntegerLiteral(
219 yytext + 2, yyleng - 2, 16, &
yylval->ival, yyextra);
222{DIGIT}+[Ee][+\-]?{DIGIT}+[Ff]? |
223{DIGIT}*"."{DIGIT}+([Ee][+\-]?{DIGIT}+)?[Ff]? {
224 rtl_math_ConversionStatus s;
225 yylval->fval = rtl_math_stringToDouble(
226 yytext, yytext + yyleng,
'.', 0, &s,
nullptr);
227 if (s == rtl_math_ConversionStatus_OutOfRange) {
228 yyextra->errorMessage =
"out-of-range floating-point literal "
229 + OUString(yytext, yyleng, RTL_TEXTENCODING_ASCII_US);
235{DIGIT}({ALNUM}|"_")* {
236 yyextra->errorMessage =
"illegal numeric literal "
237 + OUString(yytext, yyleng, RTL_TEXTENCODING_ASCII_US);
243 yyextra->errorMessage = c >=
' ' && c <=
'~'
244 ? OUString(
"invalid character \"" + OUStringChar(c) +
"\"")
247 + OUString::number(static_cast<unsigned char>(c), 16).toAsciiUpperCase());