xref: /titanic_50/usr/src/cmd/cron/att2.l (revision 54925bf60766fbb4f1f2d7c843721406a7b7a3fb)
1 %{
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License, Version 1.0 only
7  * (the "License").  You may not use this file except in compliance
8  * with the License.
9  *
10  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11  * or http://www.opensolaris.org/os/licensing.
12  * See the License for the specific language governing permissions
13  * and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17  * If applicable, add the following below this CDDL HEADER, with the
18  * fields enclosed by brackets "[]" replaced with your own identifying
19  * information: Portions Copyright [yyyy] [name of copyright owner]
20  *
21  * CDDL HEADER END
22  */
23 %}
24 %{
25 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
26 %}
27 %{
28 /*	  All Rights Reserved  	*/
29 %}
30 
31 %{
32 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2	*/
33 %}
34 
35 %{
36 
37 #include "att1.h"
38 #include <ctype.h>
39 #define	LL(t,v)	return(yylval = v, t)
40 #undef getc
41 #define	getc(x)	(*argp?tolower(*argp++):EOF)
42 #undef feof
43 #define	feof(x)	(*argp?0:1)
44 extern	int yylval;
45 char	*argp = "";
46 %}
47 %%
48 [ \t\n]+		;
49 "jan"|"january"		{ LL(MONTH, 0); }
50 "feb"|"february"	{ LL(MONTH, 1); }
51 "mar"|"march"		{ LL(MONTH, 2); }
52 "apr"|"april"		{ LL(MONTH, 3); }
53 "may"			{ LL(MONTH, 4); }
54 "jun"|"june"		{ LL(MONTH, 5); }
55 "jul"|"july"		{ LL(MONTH, 6); }
56 "aug"|"august"		{ LL(MONTH, 7); }
57 "sep"|"september"	{ LL(MONTH, 8); }
58 "oct"|"october"		{ LL(MONTH, 9); }
59 "nov"|"november"	{ LL(MONTH, 10); }
60 "dec"|"december"	{ LL(MONTH, 11); }
61 "sun"|"sunday"		{ LL(DAY, 0); }
62 "mon"|"monday"		{ LL(DAY, 1); }
63 "tue"|"tuesday"		{ LL(DAY, 2); }
64 "wed"|"wednesday"	{ LL(DAY, 3); }
65 "thu"|"thursday"	{ LL(DAY, 4); }
66 "fri"|"friday"		{ LL(DAY, 5); }
67 "sat"|"saturday"	{ LL(DAY, 6); }
68 "today"			{ LL(DAY, 7); }
69 "tomorrow"		{ LL(DAY, 8); }
70 "noon"			{ LL(TIME, NOON); }
71 "midnight"		{ LL(TIME, MIDNIGHT); }
72 "now"			{ LL(TIME, NOW); }
73 "am"			{ LL(SUFF, AM); }
74 "pm"			{ LL(SUFF, PM); }
75 "zulu"			{ LL(ZONE, ZULU); }
76 "utc"			{ LL(ZONE, ZULU); }
77 "gmt"			{ LL(ZONE, ZULU); }
78 "next"			{ LL(NEXT, 1); }
79 "min"s?|"minute"s?		{ LL(UNIT, MINUTE); }
80 "hour"s?		{ LL(UNIT, HOUR); }
81 "day"s?			{ LL(UNIT, DAY); }
82 "week"s?		{ LL(UNIT, WEEK); }
83 "month"s?		{ LL(UNIT, MONTH); }
84 "year"s?		{ LL(UNIT, YEAR); }
85 [0-9]			{ yylval = yytext[0] - '0'; return(NUMB); }
86 [:]			{ LL(COLON, 0); }
87 [,]			{ LL(COMMA, 0); }
88 [+]			{ LL(PLUS, 0); }
89 .			{ LL(UNKNOWN, 0); }
90 %%
91