⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initscan-mvs.c

📁 flex编译器的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/* A lexical scanner generated by flex */
 
/* scanner skeleton version:
 * $Header: flex.skel,v 2.13 90/05/26 17:24:13 ve
 */
 
#define FLEX_SCANNER
 
#include <stdio.h>
 
#ifdef __STDC__
 
#ifndef DONT_HAVE_STDLIB_H
#include <stdlib.h>
#else
void *malloc( unsigned );
void free( void* );
#endif
 
#define YY_USE_PROTOS
#define YY_USE_CONST
#endif
 
 
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
 
 
#ifdef __cplusplus
 
#ifndef __STDC__
#include <stdlib.h>
#endif
 
#include <osfcn.h>
 
/* use prototypes in function declarations */
#define YY_USE_PROTOS
 
/* the "const" storage-class-modifier is valid */
#define YY_USE_CONST
 
#endif
 
 
#ifdef __TURBOC__
#define YY_USE_CONST
#endif
 
 
#ifndef YY_USE_CONST
#define const
#endif
 
 
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
/* there's no standard place to get these definitions */
char *malloc();
int free();
int read();
#endif
 
 
/* amount of stuff to slurp up with each read */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
 
/* returned upon end-of-file */
#define YY_END_TOK 0
 
/* copy whatever the last rule matched to the standard output */
 
/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
/* this used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite()
 */
#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
 
/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#define YY_INPUT(buf,result,max_size) \
        if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
            YY_FATAL_ERROR( "read() in flex scanner failed" );
#define YY_NULL 0
 
/* no semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#define yyterminate() return ( YY_NULL )
 
/* report a fatal error */
 
/* The funky do-while is used to turn this macro definition into
 * a single C statement (which needs a semi-colon terminator).
 * This avoids problems with code like:
 *
 *      if ( something_happens )
 *              YY_FATAL_ERROR( "oops, the something happened" );
 *      else
 *              everything_okay();
 *
 * Prior to using the do-while the compiler would get upset at the
 * "else" because it interpreted the "if" statement as being all
 * done when it reached the ';' after the YY_FATAL_ERROR() call.
 */
 
#define YY_FATAL_ERROR(msg) \
        do \
                { \
                (void) fputs( msg, stderr ); \
                (void) putc( '\n', stderr ); \
                exit( 1 ); \
                } \
        while ( 0 )
 
/* default yywrap function - always treat EOF as an EOF */
#define yywrap() 1
 
/* enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN
 */
#define BEGIN yy_start = 1 + 2 *
 
/* action number for EOF rule of a given start state */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
/* special action meaning "start processing a new file" */
#define YY_NEW_FILE \
        do \
                { \
                yyinbffr( yy_current_buffer, yyin ); \
                yyldbfst(); \
                } \
        while ( 0 )
 
/* default declaration of generated scanner - a define so the user can
 * easily add parameters
 */
#define YY_DECL int yylex YY_PROTO(( void ))
 
/* code executed at the end of each rule */
#define YY_BREAK break;
 
#define YY_END_OF_BUFFER_CHAR 0
 
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
#endif
 
typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
#define YY_CHAR unsigned char
# line 1 "<stdin>"
#define INITIAL 0
/* scan.l - scanner for flex input */
# line 5 "<stdin>"
/*-
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Vern Paxson.
 *
 * The United States Government has rights in this work pursuant
 * to contract no. DE-AC03-76SF00098 between the United States
 * Department of Energy and the University of California.
 *
 * Redistribution and use in source and binary forms are permitted provided
 * that: (1) source distributions retain this entire cpyrght notice and
 * comment, and (2) distributions including binaries display the following
 * acknowledgement:  ``This product includes software developed by the
 * University of California, Berkeley and its contributors'' in the
 * documentation or other materials provided with the distribution and in
 * all advertising materials mentioning features or use of this software.
 * Neither the name of the University nor the names of its contributors may
 * be used to endorse or promote products derived from this software without
 * specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */
 
#ifndef lint
static char rcsid[] =
    "@(#) $Header: scan.l,v 2.9 90/06/27 23:48:34 vern Exp $ (LBL)";
#endif
 
#undef yywrap
 
#include <flexdef.h>
#include <parse.h>
 
#define ACTION_ECHO fprintf( tmpactfl, "%s", yytext )
#define MARK_END_OF_PROLOG fprintf( tmpactfl, "%%%% end of prolog\n" );
 
#undef YY_DECL
#define YY_DECL \
        int flexscan()
 
#define RETURNCHAR \
        yylval = yytext[0]; \
        return ( CHAR );
 
#define RETURNNAME \
        (void) strcpy( nmstr, (char *) yytext ); \
        return ( NAME );
 
#define PUT_BACK_STRING(str, start) \
        for ( i = strlen( (char *) (str) ) - 1; i >= start; --i ) \
            unput((str)[i])
 
#define CHECK_REJECT(str) \
        if ( allupper( str ) ) \
            reject = true;
 
#define CHECK_YYMORE(str) \
        if ( alllower( str ) ) \
            yymrused = true;
#define SECT2 1
#define SECT2PROLOG 2
#define SECT3 3
#define CODEBLOCK 4
#define PICKUPDEF 5
#define SC 6
#define CARETISBOL 7
#define NUM 8
#define QUOTE 9
#define FIRSTCCL 10
#define CCL 11
#define ACTION 12
#define RECOVER 13
#define BRACEERROR 14
#define C_COMMENT 15
#define ACTION_COMMENT 16
#define ACTION_STRING 17
#define PERCENT_BRACE_ACTION 18
#define USED_LIST 19
#define CODEBLOCK_2 20
#define XLATION 21
# line 84 "<stdin>"
 
/* done after the current pattern has been matched and before the
 * corresponding action - sets up yytext
 */
#define YY_DO_BEFORE_ACTION \
        yytext = yy_bp; \
	yyleng = yy_cp - yy_bp; \
        yy_hold_char = *yy_cp; \
        *yy_cp = '\0'; \
        yy_c_buf_p = yy_cp;
 
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
 
/* return all but the first 'n' matched characters back to the input stream */
#define yyless(n) \
        do \
                { \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -