⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calc++-scanner.ll

📁 GNU的词法/语法分析器bison源码
💻 LL
字号:
%{                                            /* -*- C++ -*- */# include <cstdlib># include <errno.h># include <limits.h># include <string># include "calc++-driver.hh"# include "calc++-parser.hh"%}%option noyywrap nounput batch debugid    [a-zA-Z][a-zA-Z_0-9]*int   [0-9]+blank [ \t]%{# define YY_USER_ACTION  yylloc->columns (yyleng);%}%%%{  yylloc->step ();%}{blank}+   yylloc->step ();[\n]+      yylloc->lines (yyleng); yylloc->step ();[-+*/]     return yytext[0];":="       return TOKEN_ASSIGN;{int}      {  errno = 0;  long n = strtol (yytext, NULL, 10);  if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))    driver.error (*yylloc, "integer is out of range");  yylval->ival = n;  return TOKEN_NUMBER;}{id}       yylval->sval = new std::string (yytext); return TOKEN_IDENTIFIER;.          driver.error (*yylloc, "invalid character");%%voidcalcxx_driver::scan_begin (){  yy_flex_debug = trace_scanning;  if (!(yyin = fopen (file.c_str (), "r")))    error (std::string ("cannot open ") + file);}voidcalcxx_driver::scan_end (){  fclose (yyin);}

⌨️ 快捷键说明

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