lex-parse.l

来自「读写Smart卡加解密接口的程序」· L 代码 · 共 93 行

L
93
字号
%{/* * $Id: lex-parse.l,v 1.7 2003/08/25 09:29:42 aet Exp $ * * Copyright (C) 2002 *  Antti Tapaninen <aet@cc.hut.fi> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.h>#include "scconf.h"#include "internal.h"static scconf_parser *parser;%}%option noyywrap%option nounput%%"#"[^\r\n]*	scconf_parse_token(parser, TOKEN_TYPE_COMMENT, yytext);\n		scconf_parse_token(parser, TOKEN_TYPE_NEWLINE, NULL);[ \t\r]+	/* eat up whitespace */[,{}=;]		scconf_parse_token(parser, TOKEN_TYPE_PUNCT, yytext);\"[^\"\n\r]*\r*[\"\n] scconf_parse_token(parser, TOKEN_TYPE_STRING, yytext);[^;, \t\r\n]+  	scconf_parse_token(parser, TOKEN_TYPE_STRING, yytext);%%#ifndef YY_CURRENT_BUFFER_LVALUE# define YY_CURRENT_BUFFER_LVALUE	yy_current_buffer#endifstatic void do_lex(scconf_parser *p){	parser = p;	yylex();#if 1	/* For non-reentrant C scanner only. */	if (YY_CURRENT_BUFFER) {		yy_delete_buffer(YY_CURRENT_BUFFER);		YY_CURRENT_BUFFER_LVALUE = NULL;		yy_init = 1;		yy_start = 0;	}#endif}int scconf_lex_parse(scconf_parser *p, const char *filename){	yyin = fopen(filename, "r");	if (yyin == NULL)		return 0;	do_lex(p);	fclose(yyin);	yyin = NULL;	return 1;}int scconf_lex_parse_string(scconf_parser *p, const char *conf_string){	yy_scan_string(conf_string);	do_lex(p);	return 1;}

⌨️ 快捷键说明

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