- change the modified flags of ASM instruction from '1' to $status_flags,
[libfirm] / ir / libcore / lc_config_lexer.l
1
2 %option prefix="_lc_opt_"
3
4 %{
5
6 /*
7   libcore: library for basic data structures and algorithms.
8   Copyright (C) 2005  IPD Goos, Universit"at Karlsruhe, Germany
9
10   This library is free software; you can redistribute it and/or
11   modify it under the terms of the GNU Lesser General Public
12   License as published by the Free Software Foundation; either
13   version 2.1 of the License, or (at your option) any later version.
14
15   This library is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public
21   License along with this library; if not, write to the Free Software
22   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 */
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27
28 #include <stdio.h>
29
30 #include "lc_parser_t.h"
31 #include "lc_config_parser.h"
32
33 static int _lc_opt_wrap(void)
34 {
35         return 1;
36 }
37
38 %}
39
40 num             [0-9]+
41 hexnum          0x[0-9a-fA-F]+
42 idcharsbegin    [a-zA-Z$_]
43 idchars         ({idcharsbegin}|[0-9])
44 ident           {idcharsbegin}{idchars}*
45 ws              [\t ]*
46 nl              \n
47
48 %x LINE_COMMENT
49 %x BIG_COMMENT
50 %x DAT
51 %x DAT_CONT
52 %x STR
53
54
55 %%
56
57 "/*"                { BEGIN(BIG_COMMENT); }
58 <BIG_COMMENT>"*/"   { BEGIN(INITIAL); }
59 <BIG_COMMENT>\n     PMANGLE(linenr)++;
60 <BIG_COMMENT>.      ;
61
62 ("#"|"//")          { BEGIN(LINE_COMMENT); }
63 <LINE_COMMENT>\n    { BEGIN(INITIAL); PMANGLE(linenr)++; }
64 <LINE_COMMENT>.     ;
65
66
67 <INITIAL>[=:]{ws}   { BEGIN(DAT); }
68 <DAT>\"             { BEGIN(STR); }
69 <DAT>\\             { BEGIN(DAT_CONT); }
70 <DAT>.              { _lc_opt_add_to_data_char(PMANGLE(text)[0]); }
71 <DAT>\n             {
72                                                 BEGIN(INITIAL);
73                                                 PMANGLE(linenr)++;
74                                                 _lc_opt_add_to_data_char('\0');
75                                                 return DATA;
76                                         }
77 <DAT_CONT>\n        { BEGIN(DAT); PMANGLE(linenr)++; }
78 <DAT_CONT>.         ;
79
80
81 <STR>\"             {
82                                                 BEGIN(INITIAL);
83                                                 _lc_opt_add_to_data_char('\0');
84                                                 return DATA;
85                                         }
86
87 <STR>\\n            _lc_opt_add_to_data_char('\n');
88 <STR>\\r            _lc_opt_add_to_data_char('\r');
89 <STR>\\t            _lc_opt_add_to_data_char('\t');
90 <STR>\\b            _lc_opt_add_to_data_char('\b');
91 <STR>\\f            _lc_opt_add_to_data_char('\f');
92 <STR>\\.            _lc_opt_add_to_data_char(yytext[1]);
93 <STR>[^\"]          _lc_opt_add_to_data_char(yytext[0]);
94
95 {ident}                         {
96                                                 PMANGLE(lval).text.str = PMANGLE(text);
97                                                 PMANGLE(lval).text.len = PMANGLE(leng);
98                                                 return IDENT;
99                                         }
100 [/.]                { return SEP; }
101
102 {ws}                ;
103 {nl}                PMANGLE(linenr)++;
104
105 .                   return yytext[0];
106
107 %%