Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / parsing_cocci / lexer_script.ml
1 # 0 "lexer_script.mll"
2
3 open Parser_cocci_menhir
4 module D = Data
5 module Ast = Ast_cocci
6 exception Lexical of string
7 let tok = Lexing.lexeme
8 let file = ref ""
9 let language = ref ""
10 let inc_line _ = Lexer_cocci.line := !Lexer_cocci.line + 1
11
12 # 13 "lexer_script.ml"
13 let __ocaml_lex_tables = {
14 Lexing.lex_base =
15 "\000\000\247\255\248\255\249\255\001\000\001\000\254\255\004\000\
16 \253\255\008\000\001\000\254\255\255\255\002\000\254\255\255\255\
17 ";
18 Lexing.lex_backtrk =
19 "\255\255\255\255\255\255\255\255\004\000\003\000\255\255\000\000\
20 \255\255\005\000\255\255\255\255\255\255\255\255\255\255\255\255\
21 ";
22 Lexing.lex_default =
23 "\007\000\000\000\000\000\000\000\255\255\255\255\000\000\007\000\
24 \000\000\009\000\011\000\000\000\000\000\014\000\000\000\000\000\
25 ";
26 Lexing.lex_trans =
27 "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
28 \000\000\000\000\006\000\006\000\006\000\006\000\255\255\255\255\
29 \255\255\255\255\255\255\000\000\000\000\000\000\000\000\000\000\
30 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
31 \000\000\000\000\003\000\012\000\000\000\000\000\255\255\002\000\
32 \000\000\015\000\000\000\255\255\000\000\000\000\000\000\004\000\
33 \009\000\000\000\000\000\255\255\000\000\000\000\000\000\000\000\
34 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
35 \005\000\008\000\000\000\000\000\255\255\000\000\000\000\000\000\
36 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
37 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
38 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
39 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
40 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
41 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
42 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
43 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
44 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
45 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
46 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
47 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
48 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
49 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
50 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
51 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
52 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
53 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
54 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
55 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
56 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
57 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
58 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
59 \001\000\255\255\255\255\000\000\255\255\000\000\000\000\000\000\
60 \255\255";
61 Lexing.lex_check =
62 "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
63 \255\255\255\255\000\000\000\000\000\000\000\000\007\000\007\000\
64 \007\000\007\000\009\000\255\255\255\255\255\255\255\255\255\255\
65 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
66 \255\255\255\255\000\000\010\000\255\255\255\255\007\000\000\000\
67 \255\255\013\000\255\255\007\000\255\255\255\255\255\255\000\000\
68 \004\000\255\255\255\255\007\000\255\255\255\255\255\255\255\255\
69 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
70 \000\000\005\000\255\255\255\255\007\000\255\255\255\255\255\255\
71 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
72 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
73 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
74 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
75 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
76 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
77 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
78 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
79 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
80 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
81 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
82 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
83 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
84 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
85 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
86 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
87 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
88 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
89 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
90 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
91 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
92 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
93 \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
94 \000\000\010\000\013\000\255\255\007\000\255\255\255\255\255\255\
95 \009\000";
96 Lexing.lex_base_code =
97 "";
98 Lexing.lex_backtrk_code =
99 "";
100 Lexing.lex_default_code =
101 "";
102 Lexing.lex_trans_code =
103 "";
104 Lexing.lex_check_code =
105 "";
106 Lexing.lex_code =
107 "";
108 }
109
110 let rec token lexbuf =
111 __ocaml_lex_token_rec lexbuf 0
112 and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
113 match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
114 | 0 ->
115 # 19 "lexer_script.mll"
116 ( TScriptData (tok lexbuf) )
117 # 118 "lexer_script.ml"
118
119 | 1 ->
120 # 21 "lexer_script.mll"
121 ( inc_line();
122 let text = tok lexbuf in
123 let text =
124 if !language = "ocaml"
125 then
126 Printf.sprintf "%s# %d \"%s\"%s"
127 text !Lexer_cocci.line !file text
128 else text in
129 TScriptData text )
130 # 131 "lexer_script.ml"
131
132 | 2 ->
133 # 30 "lexer_script.mll"
134 ( TArobArob )
135 # 136 "lexer_script.ml"
136
137 | 3 ->
138 # 31 "lexer_script.mll"
139 ( TArob )
140 # 141 "lexer_script.ml"
141
142 | 4 ->
143 # 32 "lexer_script.mll"
144 ( TScriptData (tok lexbuf) )
145 # 146 "lexer_script.ml"
146
147 | 5 ->
148 # 33 "lexer_script.mll"
149 ( token lexbuf )
150 # 151 "lexer_script.ml"
151
152 | 6 ->
153 # 34 "lexer_script.mll"
154 ( TScriptData (Printf.sprintf "\"%s\"" (string lexbuf)) )
155 # 156 "lexer_script.ml"
156
157 | 7 ->
158 # 35 "lexer_script.mll"
159 ( TScriptData (Printf.sprintf "'%s'" (cstring lexbuf)) )
160 # 161 "lexer_script.ml"
161
162 | 8 ->
163 # 36 "lexer_script.mll"
164 ( EOF )
165 # 166 "lexer_script.ml"
166
167 | 9 ->
168 # 37 "lexer_script.mll"
169 ( raise (Lexical ("unrecognised symbol, in token rule:"^tok lexbuf)) )
170 # 171 "lexer_script.ml"
171
172 | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state
173
174 and string lexbuf =
175 __ocaml_lex_string_rec lexbuf 10
176 and __ocaml_lex_string_rec lexbuf __ocaml_lex_state =
177 match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
178 | 0 ->
179 # 41 "lexer_script.mll"
180 ( "" )
181 # 182 "lexer_script.ml"
182
183 | 1 ->
184 let
185 # 42 "lexer_script.mll"
186 x
187 # 188 "lexer_script.ml"
188 = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
189 # 42 "lexer_script.mll"
190 ( (String.make 1 x) ^ string lexbuf )
191 # 192 "lexer_script.ml"
192
193 | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string_rec lexbuf __ocaml_lex_state
194
195 and cstring lexbuf =
196 __ocaml_lex_cstring_rec lexbuf 13
197 and __ocaml_lex_cstring_rec lexbuf __ocaml_lex_state =
198 match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
199 | 0 ->
200 # 45 "lexer_script.mll"
201 ( "" )
202 # 203 "lexer_script.ml"
203
204 | 1 ->
205 let
206 # 46 "lexer_script.mll"
207 x
208 # 209 "lexer_script.ml"
209 = Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
210 # 46 "lexer_script.mll"
211 ( (String.make 1 x) ^ cstring lexbuf )
212 # 213 "lexer_script.ml"
213
214 | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cstring_rec lexbuf __ocaml_lex_state
215
216 ;;
217