📄 elexd.cpp
字号:
/* $Id: elexd.cpp,v 1.5 1997/04/26 09:38:58 matt Exp $ Elex debugger application. (c) Matt Phillips 1996. */#include <iostream.h>#include <fstream.h>#include <errno.h>#include <foo/FooParser.h>#include <foo/FooObject.h>#include <cppscan/XInputStream.h>#include "DynamicScanner.h"void error (const string message, int abortcode = 0){ cerr << "elexd: " << message << endl; if (abortcode > 0) exit (abortcode);}// check stream <str> which should be a stream opened for file with// <name> is open.int checkStream (ios &str, const string &name){ if (!str) error ("could not open '" + name + "': " + strerror (errno), 1);}int main (int argc, char **argv){ if (argc != 2) { cerr << "usage: elexd <scanner_definition>\n"; return 1; } ifstream foofile (argv [1]); checkStream (foofile, argv [1]); BufferedInputStream fooinput (foofile); FooParser parser (fooinput); foofile.close (); if (parser.nErrors () == 0) { XInputStream input (cin, "stdin"); DynamicScanner scanner (parser.getObject (), input); scanner.getNext (); while (!scanner.eof ()) { cout << scanner.getTextLine () << ':' << scanner.getTextColumn () << ": " << scanner.getProduction () << ": \"" << scanner.getText () << "\"\n"; scanner.getNext (); } } else { error ("errors in scanner specification:"); cerr << parser.getErrors () << endl; return 1; } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -