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