OSDN Git Service

Initial import from mingw-utils-0.3
[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
11 %}
12
13 %%
14 "#".*                   { }
15 "//".*                  { }
16 "/*"                    {
17         char c, c1;
18
19 loop:
20         while ((c = input()) != '*' && c != 0)
21                 putchar(c);
22
23         if ((c1 = input()) != '/' && c != 0)
24         {
25                 unput(c1);
26                 goto loop;
27         }
28
29         if (c != 0)
30                 putchar(c1);
31 }
32
33 "__"{L}+                { return(ID); }
34 "__"{L}+{OS}*"("+{L}({L}|{D})*")"+ { return(ID); }
35 {L}({L}|{D})*           {
36                                 yylval.s = strdup(yytext);
37                                 return ID;
38                         }
39
40 ","                     { return(','); }
41 "*"                     { return('*'); }
42 "("                     { return('('); }
43 ")"                     { return(')'); }
44 ";"                     { return(';'); }
45
46 [ \t\v\n\f]             { }
47 .                       { }
48
49 %%
50
51 yywrap()
52 {
53         return(1);
54 }