update changelog
[profile/ivi/genivi/genivi-audio-manager.git] / domain-manager / ini-lex.l
1 /*
2 Copyright (c) 2014, Intel Corporation
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are
6 met:
7
8     * Redistributions of source code must retain the above copyright
9       notice, this list of conditions and the following disclaimer.
10
11     * Redistributions in binary form must reproduce the above copyright
12       notice, this list of conditions and the following disclaimer in
13       the documentation and/or other materials provided with the
14       distribution.
15
16     * Neither the name of Intel Corporation nor the names of its
17       contributors may be used to endorse or promote products derived
18       from this software without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
24 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33
34 %{
35 #include <stdio.h>
36 #include "ini-parser.h"
37 #include "ini.tab.h"
38
39 #define YY_EXTRA_TYPE ini_parser_context_t *
40
41 %}
42
43 %option noyywrap
44 %option reentrant
45 %option bison-bridge
46 %option prefix="ini_parser_"
47
48 %%
49 \#.*\n                  /* comment */
50 \n                      /* newline */
51 [ \t]+                  /* whitespace */
52 \[                      return OBRACKET;
53 \]                      return EBRACKET;
54 \=                      return EQUAL;
55 \".*\"                  {
56                             char *res = new_parser_str(yyextra, yytext);
57                             if (!res) {
58                                 printf("Parser OOM error!\n");
59                             }
60                             yylval->string = res;
61                             return STRING;
62                         }
63 [-]?[0-9]+              {
64                             char *res = new_parser_str(yyextra, yytext);
65                             if (!res) {
66                                 printf("Parser OOM error!\n");
67                             }
68                             yylval->string = res;
69                             return NUMBER;
70                         }
71 TRUE|FALSE              {
72                             char *res = new_parser_str(yyextra, yytext);
73                             if (!res) {
74                                 printf("Parser OOM error!\n");
75                             }
76                             yylval->string = res;
77                             return BOOLEAN;
78                         }
79 [a-zA-Z0-9_]+           {
80                             char *res = new_parser_str(yyextra, yytext);
81                             if (!res) {
82                                 printf("Parser OOM error!\n");
83                             }
84                             yylval->string = res;
85                             return WORD;
86                         }
87 <*>.                    /* unrecognized input */
88 %%
89