%k 10000
%n 5000
%a 20000
%e 10000
%p 25000
%o 6000
Ident ([A-Za-z_][A-Za-z_0-9]*)
Number ([0-9]+)
String ([-/._$A-Za-z0-9]+)
QString (\"[^"\n]*\")
AString (\<[^>\n]*\>)
FileName ({QString}|{AString})
%{
/*
* Copyright (c) 1995, 1994, 1993, 1992, 1991, 1990
* Open Software Foundation, Inc.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation, and that the name of ("OSF") or Open Software
* Foundation not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
*
* OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL OSF BE LIABLE FOR ANY
* SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE
*/
/*
* OSF Research Institute MK6.1 (unencumbered) 1/31/1995
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* 92/03/03 16:25:00 jeffreyh
* Changes from TRUNK
* [92/02/26 12:31:19 jeffreyh]
*
* 92/01/23 15:21:24 rpd
* Fixed macros for STDC.
* [92/01/16 rpd]
*
* 92/01/03 20:29:25 dbg
* Add 'CountInOut' flag.
* [91/11/11 dbg]
*
* 91/08/28 11:17:01 jsb
* Added syServerDemux.
* [91/08/13 rpd]
*
* Removed syMsgKind, syCamelot, syCamelotRoutine, syTrapRoutine,
* syTrapSimpleRoutine. Added syMsgSeqno.
* [91/08/11 rpd]
*
* 91/07/31 18:09:31 dbg
* Add 'serverCopy' keyword.
* [91/06/05 dbg]
*
* Add 'c_string' keyword.
* [91/04/03 dbg]
*
* 91/02/05 17:54:51 mrt
* Changed to new Mach copyright
* [91/02/01 17:54:35 mrt]
*
* 90/06/02 15:04:54 rpd
* Created for new IPC.
* [90/03/26 21:11:34 rpd]
*
* 07-Apr-89 Richard Draves (rpd) at Carnegie-Mellon University
* Extensive revamping. Added polymorphic arguments.
* Allow multiple variable-sized inline arguments in messages.
*
* 27-May-87 Richard Draves (rpd) at Carnegie-Mellon University
* Created.
*/
#include "strdefs.h"
#include "type.h"
#include <mach/message.h>
#include "statement.h"
#include "global.h"
#include "parser.h"
#include "lexxer.h"
#ifdef __STDC__
#define stringize(x) #x
#else /* __STDC__ */
#define stringize(x) "x"
#endif /* __STDC__ */
#ifdef LDEBUG
#define RETURN(sym) \
{ \
printf("yylex: returning '%s' (%d)\n", stringize(sym), (sym)); \
return (sym); \
}
#else /* LDEBUG */
#define RETURN(sym) return (sym)
#endif /* LDEBUG */
#define TPRETURN(intype, outtype, tsize) \
{ \
yylval.symtype.innumber = (intype); \
yylval.symtype.instr = stringize(intype); \
yylval.symtype.outnumber = (outtype); \
yylval.symtype.outstr = stringize(outtype); \
yylval.symtype.size = (tsize); \
RETURN(sySymbolicType); \
}
#define TRETURN(type, tsize) TPRETURN(type,type,tsize)
#define SAVE(s) do {oldYYBegin = s; BEGIN s; } while (0)
#define RESTORE BEGIN oldYYBegin
#define FRETURN(val) \
{ \
yylval.flag = (val); \
RETURN(syIPCFlag); \
}
static int oldYYBegin = 0;
int lineno = 0; /* Replaces lex yylineno */
static void doSharp(); /* process body of # directives */
extern void yyerror();
%}
%Start Normal String FileName QString SkipToEOL
%%
<Normal>[Rr][Oo][Uu][Tt][Ii][Nn][Ee] RETURN(syRoutine);
<Normal>[Ss][Ii][Mm][Pp][Ll][Ee][Rr][Oo][Uu][Tt][Ii][Nn][Ee] RETURN(sySimpleRoutine);
<Normal>[Ss][Uu][Bb][Ss][Yy][Ss][Tt][Ee][Mm] RETURN(sySubsystem);
<Normal>[Mm][Ss][Gg][Oo][Pp][Tt][Ii][Oo][Nn] RETURN(syMsgOption);
<Normal>[Mm][Ss][Gg][Ss][Ee][Qq][Nn][Oo] RETURN(syMsgSeqno);
<Normal>[Ww][Aa][Ii][Tt][Tt][Ii][Mm][Ee] RETURN(syWaitTime);
<Normal>[Nn][Oo][Ww][Aa][Ii][Tt][Tt][Ii][Mm][Ee] RETURN(syNoWaitTime);
<Normal>[Ii][Nn] RETURN(syIn);
<Normal>[Oo][Uu][Tt] RETURN(syOut);
<Normal>[Uu][Ss][Ee][Rr][Ii][Mm][Pp][Ll] RETURN(syUserImpl);
<Normal>[Ss][Ee][Rr][Vv][Ee][Rr][Ii][Mm][Pp][Ll] RETURN(syServerImpl);
<Normal>[Ss][Ee][Rr][Vv][Ee][Rr][Ss][Ee][Cc][Tt][Oo][Kk][Ee][Nn] RETURN(syServerSecToken);
<Normal>[Uu][Ss][Ee][Rr][Ss][Ee][Cc][Tt][Oo][Kk][Ee][Nn] RETURN(syUserSecToken);
<Normal>[Ii][Nn][Oo][Uu][Tt] RETURN(syInOut);
<Normal>[Rr][Ee][Qq][Uu][Ee][Ss][Tt][Pp][Oo][Rr][Tt] RETURN(syRequestPort);
<Normal>[Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt] RETURN(syReplyPort);
<Normal>[Uu][Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt] RETURN(syUReplyPort);
<Normal>[Ss][Rr][Ee][Pp][Ll][Yy][Pp][Oo][Rr][Tt] RETURN(sySReplyPort);
<Normal>[Aa][Rr][Rr][Aa][Yy] RETURN(syArray);
<Normal>[Oo][Ff] RETURN(syOf);
<Normal>[Ee][Rr][Rr][Oo][Rr] RETURN(syErrorProc);
<Normal>[Ss][Ee][Rr][Vv][Ee][Rr][Pp][Rr][Ee][Ff][Ii][Xx] RETURN(syServerPrefix);
<Normal>[Uu][Ss][Ee][Rr][Pp][Rr][Ee][Ff][Ii][Xx] RETURN(syUserPrefix);
<Normal>[Ss][Ee][Rr][Vv][Ee][Rr][Dd][Ee][Mm][Uu][Xx] RETURN(syServerDemux);
<Normal>[Rr][Cc][Ss][Ii][Dd] RETURN(syRCSId);
<Normal>[Ii][Mm][Pp][Oo][Rr][Tt] RETURN(syImport);
<Normal>[Uu][Ii][Mm][Pp][Oo][Rr][Tt] RETURN(syUImport);
<Normal>[Ss][Ii][Mm][Pp][Oo][Rr][Tt] RETURN(sySImport);
<Normal>[Tt][Yy][Pp][Ee] RETURN(syType);
<Normal>[Kk][Ee][Rr][Nn][Ee][Ll][Ss][Ee][Rr][Vv][Ee][Rr] RETURN(syKernelServer);
<Normal>[Kk][Ee][Rr][Nn][Ee][Ll][Uu][Ss][Ee][Rr] RETURN(syKernelUser);
<Normal>[Ss][Kk][Ii][Pp] RETURN(sySkip);
<Normal>[Ss][Tt][Rr][Uu][Cc][Tt] RETURN(syStruct);
<Normal>[Ii][Nn][Tt][Rr][Aa][Nn] RETURN(syInTran);
<Normal>[Oo][Uu][Tt][Tt][Rr][Aa][Nn] RETURN(syOutTran);
<Normal>[Dd][Ee][Ss][Tt][Rr][Uu][Cc][Tt][Oo][Rr] RETURN(syDestructor);
<Normal>[Cc][Tt][Yy][Pp][Ee] RETURN(syCType);
<Normal>[Cc][Uu][Ss][Ee][Rr][Tt][Yy][Pp][Ee] RETURN(syCUserType);
<Normal>[Cc][Ss][Ee][Rr][Vv][Ee][Rr][Tt][Yy][Pp][Ee] RETURN(syCServerType);
<Normal>[Cc]_[Ss][Tt][Rr][Ii][Nn][Gg] RETURN(syCString);
<Normal>[Ss][Aa][Mm][Ee][Cc][Oo][Uu][Nn][Tt] FRETURN(flSameCount);
<Normal>[Rr][Ee][Tt][Cc][Oo][Dd][Ee] FRETURN(flRetCode);
<Normal>[Pp][Hh][Yy][Ss][Ii][Cc][Aa][Ll][Cc][Oo][Pp][Yy] FRETURN(flPhysicalCopy);
<Normal>[Oo][Vv][Ee][Rr][Ww][Rr][Ii][Tt][Ee] FRETURN(flOverwrite);
<Normal>[Dd][Ee][Aa][Ll][Ll][Oo][Cc] FRETURN(flDealloc);
<Normal>[Nn][Oo][Tt][Dd][Ee][Aa][Ll][Ll][Oo][Cc] FRETURN(flNotDealloc);
<Normal>[Cc][Oo][Uu][Nn][Tt][Ii][Nn][Oo][Uu][Tt] FRETURN(flCountInOut);
<Normal>[Pp][Oo][Ll][Yy][Mm][Oo][Rr][Pp][Hh][Ii][Cc] TPRETURN(MACH_MSG_TYPE_POLYMORPHIC, MACH_MSG_TYPE_POLYMORPHIC, 32);
<Normal>[Aa][Uu][Tt][Oo] FRETURN(flAuto);
<Normal>[Cc][Oo][Nn][Ss][Tt] FRETURN(flConst);
<Normal>"MACH_MSG_TYPE_UNSTRUCTURED" TRETURN(MACH_MSG_TYPE_UNSTRUCTURED,0);
<Normal>"MACH_MSG_TYPE_BIT" TRETURN(MACH_MSG_TYPE_BIT,1);
<Normal>"MACH_MSG_TYPE_BOOLEAN" TRETURN(MACH_MSG_TYPE_BOOLEAN,32);
<Normal>"MACH_MSG_TYPE_INTEGER_8" TRETURN(MACH_MSG_TYPE_INTEGER_8,8);
<Normal>"MACH_MSG_TYPE_INTEGER_16" TRETURN(MACH_MSG_TYPE_INTEGER_16,16);
<Normal>"MACH_MSG_TYPE_INTEGER_32" TRETURN(MACH_MSG_TYPE_INTEGER_32,32);
<Normal>"MACH_MSG_TYPE_INTEGER_64" TRETURN(MACH_MSG_TYPE_INTEGER_64,64);
<Normal>"MACH_MSG_TYPE_REAL_32" TRETURN(MACH_MSG_TYPE_REAL_32,32);
<Normal>"MACH_MSG_TYPE_REAL_64" TRETURN(MACH_MSG_TYPE_REAL_64,64);
<Normal>"MACH_MSG_TYPE_CHAR" TRETURN(MACH_MSG_TYPE_CHAR,8);
<Normal>"MACH_MSG_TYPE_BYTE" TRETURN(MACH_MSG_TYPE_BYTE,8);
<Normal>"MACH_MSG_TYPE_MOVE_RECEIVE" TPRETURN(MACH_MSG_TYPE_MOVE_RECEIVE,MACH_MSG_TYPE_PORT_RECEIVE,32);
<Normal>"MACH_MSG_TYPE_COPY_SEND" TPRETURN(MACH_MSG_TYPE_COPY_SEND,MACH_MSG_TYPE_PORT_SEND,32);
<Normal>"MACH_MSG_TYPE_MAKE_SEND" TPRETURN(MACH_MSG_TYPE_MAKE_SEND,MACH_MSG_TYPE_PORT_SEND,32);
<Normal>"MACH_MSG_TYPE_MOVE_SEND" TPRETURN(MACH_MSG_TYPE_MOVE_SEND,MACH_MSG_TYPE_PORT_SEND,32);
<Normal>"MACH_MSG_TYPE_MAKE_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_MAKE_SEND_ONCE,MACH_MSG_TYPE_PORT_SEND_ONCE,32);
<Normal>"MACH_MSG_TYPE_MOVE_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_MOVE_SEND_ONCE,MACH_MSG_TYPE_PORT_SEND_ONCE,32);
<Normal>"MACH_MSG_TYPE_PORT_NAME" TRETURN(MACH_MSG_TYPE_PORT_NAME,32);
<Normal>"MACH_MSG_TYPE_PORT_RECEIVE" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_RECEIVE,32);
<Normal>"MACH_MSG_TYPE_PORT_SEND" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_SEND,32);
<Normal>"MACH_MSG_TYPE_PORT_SEND_ONCE" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC,MACH_MSG_TYPE_PORT_SEND_ONCE,32);
<Normal>"MACH_MSG_TYPE_POLYMORPHIC" TPRETURN(MACH_MSG_TYPE_POLYMORPHIC, MACH_MSG_TYPE_POLYMORPHIC, 32);
<Normal>":" RETURN(syColon);
<Normal>";" RETURN(sySemi);
<Normal>"," RETURN(syComma);
<Normal>"+" RETURN(syPlus);
<Normal>"-" RETURN(syMinus);
<Normal>"*" RETURN(syStar);
<Normal>"/" RETURN(syDiv);
<Normal>"(" RETURN(syLParen);
<Normal>")" RETURN(syRParen);
<Normal>"=" RETURN(syEqual);
<Normal>"^" RETURN(syCaret);
<Normal>"~" RETURN(syTilde);
<Normal>"<" RETURN(syLAngle);
<Normal>">" RETURN(syRAngle);
<Normal>"[" RETURN(syLBrack);
<Normal>"]" RETURN(syRBrack);
<Normal>"|" RETURN(syBar);
<Normal>{Ident} { yylval.identifier = strmake(yytext);
RETURN(syIdentifier); }
<Normal>{Number} { yylval.number = atoi(yytext); RETURN(syNumber); }
<String>{String} { yylval.string = strmake(yytext);
SAVE(Normal); RETURN(syString); }
<FileName>{FileName} { yylval.string = strmake(yytext);
SAVE(Normal); RETURN(syFileName); }
<QString>{QString} { yylval.string = strmake(yytext);
SAVE(Normal); RETURN(syQString); }
^\#[ \t]*{Number}[ \t]*\"[^"]*\" { doSharp(yytext+1);
BEGIN SkipToEOL; }
^\#\ *{Number} { doSharp(yytext+1);
BEGIN SkipToEOL; }
^\# { yyerror("illegal # directive");
BEGIN SkipToEOL; }
<SkipToEOL>\n { RESTORE; lineno++; }
<SkipToEOL>. ;
[ \t] ;
\n lineno++;
. { SAVE(Normal); RETURN(syError); }
%%
extern void
LookNormal()
{
SAVE(Normal);
}
extern void
LookString()
{
SAVE(String);
}
extern void
LookQString()
{
SAVE(QString);
}
extern void
LookFileName()
{
SAVE(FileName);
}
static void
doSharp(body)
char *body;
{
register char *startName, *endName;
lineno = atoi(body);
startName = strchr(body, '"');
if (startName != NULL)
{
endName = strrchr(body, '"');
*endName = '\0';
strfree(yyinname);
yyinname = strmake(startName+1);
}
}
int
yywrap()
{
return 1;
}