📄 testscan.c
字号:
#define FLEX_DEBUG#define YY_CHAR unsigned char# line 1 "/u/coetmeur/tools/flex++2/flexskel.cc"/* A lexical scanner generated by flex *//* scanner skeleton version: * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $ *//* MODIFIED FOR C++ CLASS BY Alain Coetmeur: coetmeur(at)icdc.fr *//* Note that (at) mean the 'at' symbol that I cannot write *//* because it is expanded to the class name *//* made at Informatique-CDC, Research&development department *//* company from the Caisse Des Depots et Consignations *//* institutional financial group (say 'Cat Doc Cad') *//* theses symbols are added before this file *//* #define YY_CHAR 'unsigned char' if 8bit or 'char' if 7bit *//* #define FLEX_DEBUG if debug mode */#define FLEX_SCANNER/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */#ifdef c_plusplus#ifndef __cplusplus#define __cplusplus#endif#endif#ifdef __cplusplus#include <stdlib.h>#define YY_USE_CONSTchar *malloc();int free();int read();#define YY_USE_PROTOS#include <osfcn.h>#else /* ! __cplusplus */#ifdef __STDC__#ifdef __GNUC__#include <stddef.h>void *malloc( size_t );void free( void* );int read();#else#define YY_USE_CONST#include <stdlib.h>char *malloc();int free();int read();#endif /* __GNUC__ */#define YY_USE_PROTOS#endif /* __STDC__ */#endif /* ! __cplusplus */#ifdef __TURBOC__#define YY_USE_CONST#endif#include <stdio.h>/*********************************************//* COMPILER DEPENDENT MACROS *//*********************************************//* use prototypes in function declarations *//* the "const" storage-class-modifier is valid */#ifndef YY_USE_CONST#define const#endif/* use prototypes in function declarations */#ifndef YY_PROTO#ifdef YY_USE_PROTOS#define YY_PROTO(proto) proto#else#define YY_PROTO(proto) ()#endif#endif/*********************//* parameters *//* amount of stuff to slurp up with each read */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* size of default input buffer */#ifndef YY_BUF_SIZE#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) #endif/***********************************//* to be redefined for application *//* returned upon end-of-file */#define YY_END_TOK 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 )/* code executed at the end of each rule */#define YY_BREAK break;/* #define YY_USER_ACTION *//* #define YY_USER_INIT */#ifndef YY_USE_CLASS/* 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" );/* 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/* default declaration of generated scanner - a define so the user can * easily add parameters */#define YY_DECL int yylex YY_PROTO(( void )) #else /* c++ */#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )#define YY_INPUT(buf,result,max_size) \ if ( yy_input((char *)buf, result,max_size) < 0 ) \ YY_FATAL_ERROR( "yy_input() in flex scanner failed" );#define YY_FATAL_ERROR(msg) yy_fatal_error(msg)#define yywrap() yy_wrap()#endif/***********************************//* not to be changed */#define YY_NULL 0#define YY_END_OF_BUFFER_CHAR 0/* special action meaning "start processing a new file" */#define YY_NEW_FILE \ do \ { \ yy_init_buffer( yy_current_buffer, yyin ); \ yy_load_buffer_state(); \ } \ while ( 0 )/* 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)/* % section 1 definitions go here */ # line 1 "scan.l"#define INITIAL 0/* scan.l - scanner for flex input */# line 5 "scan.l"/*- * 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 copyright 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 lintstatic char rcsid[] = "@(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/scan.l,v 2.9 90/06/27 23:48:34 vern Exp $ (LBL)";#endif#undef yywrap#include "flexdef.h"#include "parse.h"#define HEADER_ECHO fprintf(headerfile,"%s",yytext )#define ACTION_ECHO fprintf( temp_action_file, "%s", yytext )#define MARK_END_OF_PROLOG fprintf( temp_action_file, "%%%% 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 ( all_upper( str ) ) \ reject = true;#define CHECK_YYMORE(str) \ if ( all_lower( str ) ) \ yymore_used = true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -