cppannotations/annotations/yo/concrete/scanmain.yo

16 lines
772 B
Text

The program using our tt(Scanner) is very simple. It expects a filename
indicating where to start the scanning process.
The program first checks the number of arguments. If at least one argument was
given, then that argument is passed to tt(Scanner)'s constructor, together
with a second argument tt("-"), indicating that the output should go to the
standard output stream.
If the program receives more than one argument debug output, extensively
documenting the lexical scanner's actions, is written to the standard output
stream as well.
Next the tt(Scanner)'s tt(lex) member is called. If anything fails, a
tt(std::exception) is thrown, which is caught by tt(main)'s try-block's catch
clause. Here is the program's source:
verbinclude(-a lexer/lexer.cc)