1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# 13 "src/autofonce_m4/m4Lexer.mll"
open M4Types
let debug_lexer = match Sys.getenv "DEBUG_LEXER" with
| exception Not_found -> false
| _ -> true
let first_arg = ref true
let quoted_buffer = Buffer.create 1000
let opened_quotes = ref 0
let opened_parens = ref 0
let translate_quadrigraphs = ref false
let location lexbuf =
let pos = Lexing.lexeme_start_p lexbuf in
let file = pos.Lexing.pos_fname in
let line = pos.Lexing.pos_lnum in
let char = pos.Lexing.pos_cnum - pos.Lexing.pos_bol in
{ file ; line ; char }
let saved_loc = ref ( None : location option )
let with_saved_loc token =
match !saved_loc with
| None -> assert false
| Some loc -> loc, token
let save_loc lexbuf =
saved_loc := Some ( location lexbuf )
let in_macro = ref 0
let init ?loc lexbuf =
in_macro := 0 ;
opened_quotes := 0 ;
translate_quadrigraphs := false ;
match loc with
| None -> ()
| Some loc ->
let open Lexing in
let pos = { lexbuf.lex_curr_p with
pos_fname = loc.file ;
pos_lnum = loc.line ;
pos_cnum = loc.char ;
}
in
lexbuf.lex_curr_p <- pos ;
lexbuf.lex_start_p <- pos ;
()
let init_token lexbuf =
opened_quotes := 0 ;
opened_parens := 0 ;
translate_quadrigraphs := false ;
Buffer.clear quoted_buffer ;
save_loc lexbuf
let count_newlines lexbuf =
let s = Lexing.lexeme lexbuf in
for i = 0 to String.length s - 1 do
if s.[i] = '\n' then Lexing.new_line lexbuf
done
let debug lexbuf =
if debug_lexer then begin
Printf.eprintf " lexeme=%S quotes=%d parens=%d\n%!"
(Lexing.lexeme lexbuf) !opened_quotes !opened_parens
end
# 76 "src/autofonce_m4/m4Lexer.ml"
let __ocaml_lex_tables = {
Lexing.lex_base =
"\000\000\249\255\002\000\075\000\252\255\005\000\006\000\255\255\
\007\000\252\255\009\000\254\255\010\000\011\000\253\255\254\255\
\255\255\188\000\247\255\014\000\249\255\250\255\251\255\252\255\
\253\255\254\255\255\255\156\000\246\255\247\255\248\255\249\255\
\167\000\255\255\017\000\000\000\010\000\000\000\001\000\000\000\
\254\255\027\000\253\255\028\000\252\255\029\000\251\255\030\000\
\250\255";
Lexing.lex_backtrk =
"\255\255\255\255\005\000\004\000\255\255\002\000\001\000\255\255\
\000\000\255\255\002\000\255\255\000\000\255\255\255\255\255\255\
\255\255\255\255\255\255\007\000\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\009\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255";
Lexing.lex_default =
"\001\000\000\000\255\255\255\255\000\000\255\255\006\000\000\000\
\012\000\000\000\010\000\000\000\012\000\014\000\000\000\000\000\
\000\000\018\000\000\000\255\255\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\028\000\000\000\000\000\000\000\000\000\
\255\255\000\000\255\255\255\255\255\255\255\255\255\255\255\255\
\000\000\255\255\000\000\255\255\000\000\255\255\000\000\255\255\
\000\000";
Lexing.lex_trans =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\005\000\004\000\002\000\002\000\005\000\005\000\002\000\
\255\255\011\000\005\000\255\255\255\255\016\000\000\000\019\000\
\019\000\000\000\000\000\019\000\000\000\000\000\000\000\000\000\
\005\000\000\000\002\000\006\000\000\000\005\000\000\000\000\000\
\002\000\000\000\010\000\000\000\000\000\255\255\019\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\045\000\039\000\000\000\000\000\041\000\000\000\
\040\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\042\000\044\000\046\000\048\000\000\000\
\000\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\047\000\043\000\000\000\
\000\000\000\000\000\000\000\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\031\000\000\000\
\000\000\000\000\003\000\000\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\024\000\000\000\
\000\000\000\000\000\000\000\000\035\000\034\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\032\000\000\000\000\000\026\000\
\000\000\037\000\000\000\038\000\021\000\020\000\000\000\000\000\
\019\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\030\000\
\000\000\029\000\036\000\000\000\000\000\000\000\000\000\000\000\
\007\000\000\000\000\000\000\000\000\000\000\000\255\255\009\000\
\000\000\255\255\255\255\015\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\023\000\
\000\000\022\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\033\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\025\000";
Lexing.lex_check =
"\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\000\000\000\000\002\000\002\000\000\000\005\000\002\000\
\006\000\008\000\005\000\010\000\012\000\013\000\255\255\019\000\
\019\000\255\255\255\255\019\000\255\255\255\255\255\255\255\255\
\000\000\255\255\002\000\000\000\255\255\005\000\255\255\255\255\
\000\000\255\255\008\000\255\255\255\255\012\000\019\000\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\035\000\038\000\255\255\255\255\037\000\255\255\
\039\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\041\000\043\000\045\000\047\000\255\255\
\255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\034\000\036\000\255\255\
\255\255\255\255\255\255\255\255\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\027\000\255\255\
\255\255\255\255\003\000\255\255\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
\003\000\003\000\003\000\003\000\003\000\003\000\017\000\255\255\
\255\255\255\255\255\255\255\255\032\000\032\000\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\027\000\255\255\255\255\017\000\
\255\255\032\000\255\255\032\000\017\000\017\000\255\255\255\255\
\017\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\027\000\
\255\255\027\000\032\000\255\255\255\255\255\255\255\255\255\255\
\000\000\255\255\255\255\255\255\255\255\255\255\006\000\008\000\
\255\255\010\000\012\000\013\000\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\017\000\
\255\255\017\000\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\027\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\017\000";
Lexing.lex_base_code =
"";
Lexing.lex_backtrk_code =
"";
Lexing.lex_default_code =
"";
Lexing.lex_trans_code =
"";
Lexing.lex_check_code =
"";
Lexing.lex_code =
"";
}
let rec shell lexbuf =
__ocaml_lex_shell_rec lexbuf 0
and __ocaml_lex_shell_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 94 "src/autofonce_m4/m4Lexer.mll"
( location lexbuf, EOF )
# 237 "src/autofonce_m4/m4Lexer.ml"
| 1 ->
# 95 "src/autofonce_m4/m4Lexer.mll"
( shell lexbuf )
# 242 "src/autofonce_m4/m4Lexer.ml"
| 2 ->
# 96 "src/autofonce_m4/m4Lexer.mll"
( shell lexbuf )
# 247 "src/autofonce_m4/m4Lexer.ml"
| 3 ->
# 97 "src/autofonce_m4/m4Lexer.mll"
( Lexing.new_line lexbuf; shell lexbuf )
# 252 "src/autofonce_m4/m4Lexer.ml"
| 4 ->
let
# 98 "src/autofonce_m4/m4Lexer.mll"
ident
# 258 "src/autofonce_m4/m4Lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 98 "src/autofonce_m4/m4Lexer.mll"
(
let loc = location lexbuf in
let token =
match ident.[0] with
| 'a'..'z' when ident <> "m4_include" ->
SHELL (ident ^ end_of_line lexbuf)
| _ ->
IDENT ( Lexing.lexeme lexbuf )
in
( loc, token )
)
# 272 "src/autofonce_m4/m4Lexer.ml"
| 5 ->
# 109 "src/autofonce_m4/m4Lexer.mll"
(
incr in_macro;
first_arg := true ;
init_token lexbuf;
count_newlines lexbuf ;
arg lexbuf )
# 282 "src/autofonce_m4/m4Lexer.ml"
| 6 ->
# 116 "src/autofonce_m4/m4Lexer.mll"
( Printf.kprintf failwith "Unexpected char %S" (Lexing.lexeme lexbuf) )
# 287 "src/autofonce_m4/m4Lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_shell_rec lexbuf __ocaml_lex_state
and end_of_line lexbuf =
__ocaml_lex_end_of_line_rec lexbuf 8
and __ocaml_lex_end_of_line_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 119 "src/autofonce_m4/m4Lexer.mll"
line
# 300 "src/autofonce_m4/m4Lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 119 "src/autofonce_m4/m4Lexer.mll"
( line )
# 304 "src/autofonce_m4/m4Lexer.ml"
| 1 ->
# 120 "src/autofonce_m4/m4Lexer.mll"
( Lexing.new_line lexbuf; "" )
# 309 "src/autofonce_m4/m4Lexer.ml"
| 2 ->
# 121 "src/autofonce_m4/m4Lexer.mll"
( "" )
# 314 "src/autofonce_m4/m4Lexer.ml"
| 3 ->
# 122 "src/autofonce_m4/m4Lexer.mll"
( "" )
# 319 "src/autofonce_m4/m4Lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_end_of_line_rec lexbuf __ocaml_lex_state
and lexbuf =
__ocaml_lex_comment_rec lexbuf 13
and lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 125 "src/autofonce_m4/m4Lexer.mll"
( Lexing.new_line lexbuf )
# 331 "src/autofonce_m4/m4Lexer.ml"
| 1 ->
# 126 "src/autofonce_m4/m4Lexer.mll"
()
# 336 "src/autofonce_m4/m4Lexer.ml"
| 2 ->
# 127 "src/autofonce_m4/m4Lexer.mll"
( comment lexbuf )
# 341 "src/autofonce_m4/m4Lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_comment_rec lexbuf __ocaml_lex_state
and arg lexbuf =
__ocaml_lex_arg_rec lexbuf 17
and __ocaml_lex_arg_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 130 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
if !opened_quotes > 0 then
Buffer.add_char quoted_buffer '#'
else
comment lexbuf ;
arg lexbuf
)
# 360 "src/autofonce_m4/m4Lexer.ml"
| 1 ->
# 138 "src/autofonce_m4/m4Lexer.mll"
( failwith "Unexpected end of file in macro" )
# 365 "src/autofonce_m4/m4Lexer.ml"
| 2 ->
# 139 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
Lexing.new_line lexbuf;
Buffer.add_char quoted_buffer '\n';
arg lexbuf )
# 374 "src/autofonce_m4/m4Lexer.ml"
| 3 ->
# 144 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
if !opened_quotes > 0 then Buffer.add_char quoted_buffer '[';
incr opened_quotes;
arg lexbuf
)
# 384 "src/autofonce_m4/m4Lexer.ml"
| 4 ->
# 150 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
if !opened_quotes = 0 then failwith "unbalanced ]";
decr opened_quotes;
if !opened_quotes > 0 then Buffer.add_char quoted_buffer ']';
arg lexbuf
)
# 395 "src/autofonce_m4/m4Lexer.ml"
| 5 ->
# 157 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
if !opened_quotes == 0 then incr opened_parens ;
Buffer.add_char quoted_buffer '(';
arg lexbuf
)
# 405 "src/autofonce_m4/m4Lexer.ml"
| 6 ->
# 163 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
if !opened_quotes > 0 then begin
Buffer.add_char quoted_buffer ')';
arg lexbuf
end else
if !opened_parens > 0 then begin
decr opened_parens ;
Buffer.add_char quoted_buffer ')';
arg lexbuf
end else
begin
decr in_macro;
let s = Buffer.contents quoted_buffer in
let token = if !first_arg then
ONE_ARG s
else
LAST_ARG s
in
with_saved_loc token
end
)
# 431 "src/autofonce_m4/m4Lexer.ml"
| 7 ->
# 185 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
count_newlines lexbuf ;
if !opened_quotes > 0 || !opened_parens > 0 then begin
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf );
arg lexbuf
end else begin
let s = Buffer.contents quoted_buffer in
let token = if !first_arg then
FIRST_ARG s
else
NEXT_ARG s
in
first_arg := false;
with_saved_loc token
end
)
# 452 "src/autofonce_m4/m4Lexer.ml"
| 8 ->
# 202 "src/autofonce_m4/m4Lexer.mll"
(
debug lexbuf ;
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf );
arg lexbuf
)
# 461 "src/autofonce_m4/m4Lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_arg_rec lexbuf __ocaml_lex_state
and unescape lexbuf =
__ocaml_lex_unescape_rec lexbuf 27
and __ocaml_lex_unescape_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 209 "src/autofonce_m4/m4Lexer.mll"
( () )
# 473 "src/autofonce_m4/m4Lexer.ml"
| 1 ->
# 210 "src/autofonce_m4/m4Lexer.mll"
( if not !translate_quadrigraphs then
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf)
else
Buffer.add_char quoted_buffer '['
;
unescape lexbuf
)
# 484 "src/autofonce_m4/m4Lexer.ml"
| 2 ->
# 217 "src/autofonce_m4/m4Lexer.mll"
( if not !translate_quadrigraphs then
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf)
else
Buffer.add_char quoted_buffer ']';
unescape lexbuf )
# 493 "src/autofonce_m4/m4Lexer.ml"
| 3 ->
# 222 "src/autofonce_m4/m4Lexer.mll"
( if not !translate_quadrigraphs then
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf)
else
Buffer.add_char quoted_buffer '$';
unescape lexbuf )
# 502 "src/autofonce_m4/m4Lexer.ml"
| 4 ->
# 227 "src/autofonce_m4/m4Lexer.mll"
( if not !translate_quadrigraphs then
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf)
else
Buffer.add_char quoted_buffer '#';
unescape lexbuf )
# 511 "src/autofonce_m4/m4Lexer.ml"
| 5 ->
# 232 "src/autofonce_m4/m4Lexer.mll"
( if not !translate_quadrigraphs then
Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf)
else
();
unescape lexbuf )
# 520 "src/autofonce_m4/m4Lexer.ml"
| 6 ->
# 237 "src/autofonce_m4/m4Lexer.mll"
( Lexing.new_line lexbuf;
Buffer.add_char quoted_buffer '\n';
unescape lexbuf )
# 527 "src/autofonce_m4/m4Lexer.ml"
| 7 ->
# 240 "src/autofonce_m4/m4Lexer.mll"
(
if !opened_quotes > 0 then Buffer.add_char quoted_buffer '[';
incr opened_quotes;
unescape lexbuf
)
# 536 "src/autofonce_m4/m4Lexer.ml"
| 8 ->
# 245 "src/autofonce_m4/m4Lexer.mll"
(
if !opened_quotes = 0 then failwith "unbalanced ]";
decr opened_quotes;
if !opened_quotes > 0 then Buffer.add_char quoted_buffer ']';
unescape lexbuf
)
# 546 "src/autofonce_m4/m4Lexer.ml"
| 9 ->
# 251 "src/autofonce_m4/m4Lexer.mll"
( Buffer.add_string quoted_buffer ( Lexing.lexeme lexbuf );
unescape lexbuf;
)
# 553 "src/autofonce_m4/m4Lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_unescape_rec lexbuf __ocaml_lex_state
;;
# 255 "src/autofonce_m4/m4Lexer.mll"
let token lexbuf =
let (loc, token) =
if !in_macro > 0 then begin
init_token lexbuf ;
arg lexbuf
end else
shell lexbuf
in
if debug_lexer then
Printf.eprintf "token [%s] at %s\n%!"
(M4Printer.string_of_token token)
(M4Printer.string_of_location loc);
loc, token
let unescape ?(last=false) lexbuf =
Buffer.clear quoted_buffer ;
opened_quotes := 0 ;
translate_quadrigraphs := last ;
unescape lexbuf ;
Buffer.contents quoted_buffer
# 583 "src/autofonce_m4/m4Lexer.ml"