4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
7 * Paul Borman at Krystal Technologies.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 6/6/93";
40 #include <sys/cdefs.h>
41 __FBSDID("$FreeBSD$");
51 #define YY_DECL int yylex(void)
60 \'.\' { yylval.rune = (unsigned char)yytext[1];
63 '\\a' { yylval.rune = '\a';
65 '\\b' { yylval.rune = '\b';
67 '\\f' { yylval.rune = '\f';
69 '\\n' { yylval.rune = '\n';
71 '\\r' { yylval.rune = '\r';
73 '\\t' { yylval.rune = '\t';
75 '\\v' { yylval.rune = '\v';
78 0x{XDIGIT}+ { yylval.rune = strtol(yytext, 0, 16);
80 0{ODIGIT}+ { yylval.rune = strtol(yytext, 0, 8);
82 {DIGIT}+ { yylval.rune = strtol(yytext, 0, 10);
86 MAPLOWER { return(MAPLOWER); }
87 MAPUPPER { return(MAPUPPER); }
88 TODIGIT { return(DIGITMAP); }
89 INVALID { return(INVALID); }
91 ALPHA { yylval.i = _CTYPE_A|_CTYPE_R|_CTYPE_G;
93 CONTROL { yylval.i = _CTYPE_C;
95 DIGIT { yylval.i = _CTYPE_D|_CTYPE_R|_CTYPE_G;
97 GRAPH { yylval.i = _CTYPE_G|_CTYPE_R;
99 LOWER { yylval.i = _CTYPE_L|_CTYPE_R|_CTYPE_G;
101 PUNCT { yylval.i = _CTYPE_P|_CTYPE_R|_CTYPE_G;
103 SPACE { yylval.i = _CTYPE_S;
105 UPPER { yylval.i = _CTYPE_U|_CTYPE_R|_CTYPE_G;
107 XDIGIT { yylval.i = _CTYPE_X|_CTYPE_R|_CTYPE_G;
109 BLANK { yylval.i = _CTYPE_B;
111 PRINT { yylval.i = _CTYPE_R;
113 IDEOGRAM { yylval.i = _CTYPE_I|_CTYPE_R|_CTYPE_G;
115 SPECIAL { yylval.i = _CTYPE_T|_CTYPE_R|_CTYPE_G;
117 PHONOGRAM { yylval.i = _CTYPE_Q|_CTYPE_R|_CTYPE_G;
119 SWIDTH0 { yylval.i = _CTYPE_SW0; return(LIST); }
120 SWIDTH1 { yylval.i = _CTYPE_SW1; return(LIST); }
121 SWIDTH2 { yylval.i = _CTYPE_SW2; return(LIST); }
122 SWIDTH3 { yylval.i = _CTYPE_SW3; return(LIST); }
124 VARIABLE[\t ] { static char vbuf[1024];
126 while ((*v = input()) && *v != '\n')
136 ENCODING { return(ENCODING); }
138 \".*\" { char *e = yytext + 1;
140 while (*e && *e != '"')
145 \<|\(|\[ { return(LBRK); }
147 \>|\)|\] { return(RBRK); }
150 \.\.\. { return(THRU); }
160 if ((lc = input()) == 0)
162 } while((lc = input()) != '/');
166 . { printf("Lex is skipping '%s'\n", yytext); }