?? lexer.l
字號:
%{
/************************************************************
lexer.l
Lexical analyser for the multiple instance example. Note
that the lexical analyser now recognises illegal characters
on the input stream.
************************************************************/
/* multiple instance lex conversion file */
#include "milconv.h"
%}
%name calc_lexer // give the lexical analyser a name
digit [0-9]
exp ((e|E)("+"|"-")?{digit}+)
%%
%{
/*
This code goes at the top of our action routine. It allows
us to easily extract yylval for use later on in any
actions.
*/
YYSTYPE *yymlvalptr = (YYSTYPE *) yy->yymdata;
yyassert(yymlvalptr != NULL);
#define yylval (*yymlvalptr)
%}
{digit}+"."{digit}*{exp}? |
"."{digit}+{exp}? |
{digit}+{exp}? { sscanf(yytext, "%lf", &yylval); return NUMBER; }
"\n" { return '\n'; }
"+" { return '+'; }
"-" { return '-'; }
"*" { return '*'; }
"/" { return '/'; }
"(" { return '('; }
")" { return ')'; }
. { printf("invalid character\n"); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -