codefrags.cpp

来自「用于词法分析的词法分析器」· C++ 代码 · 共 61 行

CPP
61
字号
/*  $Id: CodeFrags.cpp,v 1.4 1997/02/02 01:31:02 matt Exp $  Code frags handler class.  (c) Matt Phillips 1996.  */#include <ctype.h>#include "CodeFrags.h"static const string sectionSep ("*");int CodeFrags::nextFrag (){  nextSection ();    atFrag = 0;			// pessimistic!  // look for language  while (!input.eof () && line.length () != 0 && line != lang)  {    if (line == sectionSep)      return 0;    getline (input, line);  }  atFrag = !input.eof ();  getline (input, line);  return atFrag;}void CodeFrags::nextSection (){  while (line != sectionSep && !input.eof ())  {    getline (input, line);  };  getline (input, line);}void CodeFrags::outputFrag (ostream &output){  if (hasFrag)  {    while (line [0] == '>' && !input.eof ())    {      if (line.length () > 1)	output << line.substr (1, line.length () - 1) << endl;      else	output << endl;      getline (input, line);     }  }  atFrag = 0;}

⌨️ 快捷键说明

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