📄 printyylex.sed
字号:
#/***************************************************************************# 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -