printyylex.sed

来自「在Linux RedHat 6.0 下的 KDevelop 1.1上开发的表格驱」· SED 代码 · 共 74 行

SED
74
字号
#/***************************************************************************#  printyylex.sed  -  script for generating printyylex.cc from tablecomp.h#                             -------------------#    begin                : Mon Apr 17 2000##    copyright            : (C) 2000 by Jan Nikit靚ko#    email                : xnikit00@stud.fee.vutbr.cz# ***************************************************************************/##/***************************************************************************# *                                                                         *# *   This program is free software; you can redistribute it and/or modify  *# *   it under the terms of the GNU General Public License as published by  *# *   the Free Software Foundation; either version 2 of the License, or     *# *   (at your option) any later version.                                   *# *                                                                         *# ***************************************************************************/1 i\/***************************************************************************\      printyylex.cc  -  generated from tablecomp.h using printyylex.sed\                             -------------------\    begin                : Mon Apr 17 2000\    copyright            : (C) 2000 by Jan Nikit靚ko\    email                : xnikit00@stud.fee.vutbr.cz\ ***************************************************************************/\\/***************************************************************************\ *                                                                         *\ *   This program is free software; you can redistribute it and/or modify  *\ *   it under the terms of the GNU General Public License as published by  *\ *   the Free Software Foundation; either version 2 of the License, or     *\ *   (at your option) any later version.                                   *\ *                                                                         *\ ***************************************************************************/\#include <stdio.h> \#include <string> \#include <vector> \#include "tablecomp.h" \struct { \	int lx; \	const char *ls; \} lex2str[] = {$ i\	{ -1, 0 } \}; \extern int yylex(); \extern char yytext[]; \int printyylex() { \	int r = yylex(); \	if( r >= 0 && r < 256 ) \		fprintf(stderr, "yylex() == '%c' == %d\\n", r, r); \	else { \		for( int i=0; lex2str[i].ls!=0; i++ ) \			if( lex2str[i].lx == r ) { \				if( r == STRING ) \					fprintf(stderr, "yylex() == %s == %d == %s\\"\\n", lex2str[i].ls, r, yytext); \				else if( r == IDENT || r == NUMBER ) { \					fprintf(stderr, "yylex() == %s == %d == \\"%s\\"\\n", lex2str[i].ls, r, yytext); \				} else \					fprintf(stderr, "yylex() == %s == %d\\n", lex2str[i].ls, r); \				return r; \			} \		fprintf(stderr, "yylex() == %d\\n", r); \	} \	return r; \}/^[^#]/ Ds/^#define[ 	][ 	]*\(.*\)[ 	][ 	]*\(.*\)/	{ \2, \"\1\" },/

⌨️ 快捷键说明

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