Warning, /frameworks/kuserfeedback/src/common/surveytargetexpressionlexer.l is written in an unsupported language. File is not indexed.

0001 %{
0002 /*
0003     SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
0004 
0005     SPDX-License-Identifier: MIT
0006 */
0007 
0008 #include "surveytargetexpression.h"
0009 #include "surveytargetexpressionparser_p.h"
0010 
0011 extern char* unquoteString(const char *str);
0012 
0013 %}
0014 %option warn nodefault
0015 
0016 %option reentrant
0017 %option noyywrap
0018 %option nounput
0019 %option never-interactive
0020 %option bison-bridge
0021 
0022 
0023 SPACE       [ \t\r\n]+
0024 
0025 DOUBLE      [-+]?([0-9]+[.][0-9]*|[0-9]*[.][0-9]+)([eE][-+]?[0-9]+)?
0026 INTEGER     [-+]?[0-9]+
0027 STRING_ELEMENT  [^\\"]|"\\\""|"\\\\"|"\\n"|"\\t"
0028 STRING      ["]{STRING_ELEMENT}*["]
0029 
0030 INITIAL     [[:alpha:]]|"_"
0031 SUBSEQUENT  {INITIAL}|[0-9]
0032 IDENTIFIER  {INITIAL}{SUBSEQUENT}*
0033 
0034 %%
0035 
0036 {SPACE} {}
0037 
0038 "("  { return T_LPAREN; }
0039 ")"  { return T_RPAREN; }
0040 "\." { return T_DOT; }
0041 "["  { return T_LBRACKET; }
0042 "]"  { return T_RBRACKET; }
0043 
0044 {DOUBLE} {
0045     yylval->doubleVal = strtod(yytext, nullptr);
0046     return T_DOUBLE;
0047 }
0048 {INTEGER} {
0049     yylval->intVal = atoi(yytext);
0050     return T_INTEGER;
0051 }
0052 {STRING} {
0053     yylval->str = unquoteString(yytext);
0054     return T_STRING;
0055 }
0056 "true"  { yylval->boolVal = true; return T_BOOLEAN; }
0057 "false" { yylval->boolVal = false; return T_BOOLEAN; }
0058 
0059 {IDENTIFIER} {
0060     yylval->str = strdup(yytext);
0061     return T_IDENTIFIER;
0062 }
0063 
0064 "&&" { return T_OP_AND; }
0065 "||" { return T_OP_OR; }
0066 "==" { return T_OP_EQ; }
0067 "!=" { return T_OP_NEQ; }
0068 ">"  { return T_OP_GT; }
0069 ">=" { return T_OP_GE; }
0070 "<"  { return T_OP_LT; }
0071 "<=" { return T_OP_LE; }
0072 
0073 . {
0074     printf("unexpected character: %s\n", yytext);
0075 }
0076 
0077 %%
0078 
0079 void yyerror(char const* s)
0080 {
0081     printf("ERROR: %s\n", s);
0082 }