]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/cppinternals/overview.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / cppinternals / overview.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6Overview
7********
8
9The lexer is contained in the file :samp:`lex.cc`. It is a hand-coded
10lexer, and not implemented as a state machine. It can understand C, C++
11and Objective-C source code, and has been extended to allow reasonably
12successful preprocessing of assembly language. The lexer does not make
13an initial pass to strip out trigraphs and escaped newlines, but handles
14them as they are encountered in a single pass of the input file. It
15returns preprocessing tokens individually, not a line at a time.
16
17It is mostly transparent to users of the library, since the library's
18interface for obtaining the next token, ``cpp_get_token``, takes care
19of lexing new tokens, handling directives, and expanding macros as
20necessary. However, the lexer does expose some functionality so that
21clients of the library can easily spell a given token, such as
22``cpp_spell_token`` and ``cpp_token_len``. These functions are
23useful when generating diagnostics, and for emitting the preprocessed
3ed1b4ce 24output.