BadVPN – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * This program is free software; you can redistribute it and/or modify |
||
3 | * it under the terms of the GNU General Public License as published by |
||
4 | * the Free Software Foundation; either version 2 of the License, or |
||
5 | * (at your option) any later version. |
||
6 | * |
||
7 | * This program is distributed in the hope that it will be useful, |
||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
10 | * GNU Library General Public License for more details. |
||
11 | * |
||
12 | * You should have received a copy of the GNU General Public License |
||
13 | * along with this program; if not, write to the Free Software |
||
14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
15 | */ |
||
16 | %{ |
||
17 | void out(char*t, char*v); |
||
18 | void lit(); |
||
19 | void tok(char*t); |
||
20 | void php(); |
||
21 | %} |
||
22 | |||
23 | %option stack |
||
24 | %option yylineno |
||
25 | %option main |
||
26 | |||
27 | %x code |
||
28 | %x dquote |
||
29 | %x squote |
||
30 | |||
31 | CHAR \n|. |
||
32 | |||
33 | ALPHA [a-zA-Z] |
||
34 | DIGIT [0-9] |
||
35 | ALNUM {ALPHA}|{DIGIT} |
||
36 | WORD {ALNUM}|_ |
||
37 | STOP "." |
||
38 | |||
39 | SYM {ALPHA}{WORD}*'* |
||
40 | LIT '.' |
||
41 | |||
42 | ESC "\"{CHAR} |
||
43 | SCHAR [^\']|ESC |
||
44 | DCHAR [^\"]|ESC |
||
45 | COM "//"|"#" |
||
46 | |||
47 | CC [^*\n] |
||
48 | CX "*"+{CC}+ |
||
49 | CT "*"+"/" |
||
50 | BLOCKCMT "/*"({CC}|{CX})*{CT} |
||
51 | |||
52 | %x pragma |
||
53 | |||
54 | |||
55 | %% |
||
56 | |||
57 | [[:space:]]+ {} |
||
58 | #.* {} |
||
59 | |||
60 | {STOP} out("stop", "."); |
||
61 | {SYM} tok("sym"); |
||
62 | {LIT} tok("lit"); |
||
63 | "/"{WORD}+ | |
||
64 | "/$" out("lambda", yytext+1); |
||
65 | "%"{WORD}+ { |
||
66 | out("pragma", yytext+1); |
||
67 | yy_push_state(pragma); |
||
68 | } |
||
69 | |||
70 | <*>"{" { |
||
71 | lit(); |
||
72 | yy_push_state(code); |
||
73 | } |
||
74 | |||
75 | . lit(); |
||
76 | |||
77 | |||
78 | <pragma>{ |
||
79 | \n { |
||
80 | out("stop", "."); |
||
81 | yy_pop_state(); |
||
82 | } |
||
83 | [[:space:]] {} |
||
84 | {SYM} tok("sym"); |
||
85 | {LIT} tok("lit"); |
||
86 | . lit(); |
||
87 | } |
||
88 | |||
89 | <code>{ |
||
90 | "}" { |
||
91 | lit(); |
||
92 | yy_pop_state(); |
||
93 | } |
||
94 | '{SCHAR}*' php(); |
||
95 | \"{DCHAR}*\" php(); |
||
96 | {COM}.* php(); |
||
97 | {BLOCKCMT} php(); |
||
98 | [^{}'"#/]+ php(); |
||
99 | . php(); |
||
100 | } |
||
101 | |||
102 | %% |
||
103 | |||
104 | void lit() { |
||
105 | char lit[] = "'.'"; |
||
106 | lit[1] = *yytext; |
||
107 | out(lit, yytext); |
||
108 | } |
||
109 | |||
110 | void tok(char*t) { |
||
111 | out(t, yytext); |
||
112 | } |
||
113 | |||
114 | void php() { |
||
115 | out("php", yytext); |
||
116 | } |
||
117 | |||
118 | void out(char*type, char*value) { |
||
119 | printf("%d\001%s\001%s", yylineno, type, value); |
||
120 | fputc(0, stdout); |
||
121 | } |