OSDN Git Service

Avoid segmentation faults in forwarder function checks.
[mingw/pexports.git] / hlex.l
1 D                       [0-9]
2 L                       [a-zA-Z_]
3 OS [ ]*
4
5 %{
6 #include <stdio.h>
7 #include <string.h>
8 #include "hparse.h"
9
10 static void comment(void);
11
12 %}
13
14 %%
15 "#".*                   { }
16 "//".*                  { }
17 "/*"                    { comment(); }
18
19 "__"{L}+                { return(ID); }
20 "__"{L}+{OS}*"("+{L}({L}|{D})*")"+ { return(ID); }
21 {L}({L}|{D})*           {
22                                 yylval.s = strdup(yytext);
23                                 return ID;
24                         }
25
26 ","                     { return(','); }
27 "*"                     { return('*'); }
28 "("                     { return('('); }
29 ")"                     { return(')'); }
30 ";"                     { return(';'); }
31
32 [ \t\v\n\f]             { }
33 .                       { }
34
35 %%
36
37 int
38 yywrap(void)
39 {
40         return(1);
41 }
42
43 static void
44 comment(void)
45 {
46         char c, c1;
47
48 loop:
49         while ((c = input()) != '*' && c != 0)
50                 putchar(c);
51
52         if ((c1 = input()) != '/' && c != 0)
53         {
54                 unput(c1);
55                 goto loop;
56         }
57
58         if (c != 0)
59                 putchar(c1);
60 }