Skip to main content Crate cpp_parser Copy item path Source features The syntax a parse accepts , as a set of standards and vendors — see [eatures].
What syntax a parse may accept, as a bitmask. node The typed AST layer. token Typed token wrappers and the token predicates the grammar and AST both rely on. traits The typed AST layer on top of the untyped rowan tree. BodyFacts One replacement list that only the in-force channel has — see MacroFacts::for_each_body_in_force . Checkpoint A resumable point in the parse. CppAccessSpecifier An access specifier section header: public:. CppArgList An argument list: (a, b, c). CppArrayType An array declarator: arr[10]. CppAstChildren An iterator over the child nodes of a particular AST type. CppAstTokenChildren An iterator over the child tokens of a particular AST type. CppBaseSpecifier A base class in a class definition’s base clause. CppBinaryExpr A binary expression: a + b, x == y, a && b, and the member-access forms. CppBuiltinType A built-in type specifier: int, const char, decltype(x). CppCallExpr A function call: f(x), obj.method(x), T{}. CppCaseStat One case label, including the statements that follow it. CppCastExpr A cast : (int)x, (Widget*)p, and the C++ named casts, which the parser also builds as CastExpr.CppCatchStat A catch handler. CppClassBody The { ... } of a class definition. CppClassDef A class, struct or union definition: class Foo : public Bar { ... };. CppCommentToken A comment token. CppCompoundStat A compound statement: { ... }. CppDeclSpecifierSeq The decl-specifier-seq of a declaration. CppDeclaration One declaration: specifiers declarators ;, a function definition, a class, a namespace, … CppDeclarator A declarator: the part that names the entity, possibly wrapped in pointers, references, arrays,
function parameter lists and template argument lists. CppDefaultStat The default: label. CppDesignatedInitExpr A designated initializer: .field = value or [index] = value. CppDoWhileStat A do ... while loop. CppDocCodeBlock A code block: the lines between @code and @endcode. CppDocCommand One Doxygen command and everything it owns: @param[in] x the x. CppDocCommandArg One argument of a command: the x of @param x, the [in] of @param[in] x. CppDocCommandBody A command’s payload: what the command says, without its own syntax. CppDocComment One run of consecutive comments, parsed as documentation. CppDocCommentBody The body of a documentation comment: everything that is not part of a command. CppDocInline An inline reference inside a description: @ref Foo, @p name, #member. CppElseStat An else clause. CppEmptyStat An empty statement: ;. CppEnumDef An enum definition: enum class Color : int { Red, Green };. CppEnumerator One enumerator: Red or Green = 2. CppExportBlock An export block: export { ... }. CppExpressionStat An expression statement: f(x);. CppForStat A for loop. Check is_range_for to tell the two forms apart. CppGeneralToken Any token. The fallback for tokens with no special behaviour. CppGenericSelectionExpr C11’s generic selection — _Generic(expr, type: value, …, default: value).CppGotoStat A goto statement. CppGreenNodeBuilder A builder for a rowan green tree specialised for C++. CppHeaderName A header unit name: <iostream> or "local.h". CppIfStat An if statement, including any else. CppImportDecl An import declaration: import std;, import :part;, import <iostream>;. CppIndexExpr An index expression: arr[i]. CppInitDeclarator An init-declarator: a declarator plus an optional initializer. CppInitListExpr A braced initializer list: {1, 2, 3}. CppInitializer What follows =, or a brace-or-equal initializer. CppJumpStat A break or continue statement. CppKeywordToken A keyword token, for the handful of places that need to look at one directly. CppLabelStat A label: again:. CppLambdaExpr A lambda: [capture](params) -> ret { body }. CppLanguage CppLexer CppLiteralExpr A literal: number, character, string, boolean or nullptr. CppLiteralToken A literal token: a number, character, string, boolean or nullptr. CppMemberExpr A member access: obj.member or ptr->member. CppModuleDecl A module declaration: export module my.mod;. CppModuleName A dotted module name: my.mod. CppModulePartition A module partition: :part. CppNameExpr A name used as an expression: foo, ns::foo, Foo<int>, operator+. CppNameToken An identifier: a name being declared or referenced. CppNamespaceDecl A namespace definition or an alias: namespace a { ... }, namespace fs = std::filesystem;. CppOperatorToken An operator token, in either a unary or a binary position. CppParam One function parameter. CppParamList A function parameter list, including its parentheses. CppParenExpr A parenthesized expression. Also what the parser produces for an if/while/switch
condition, so check the parent before assuming it is an expression. CppParseError CppParser CppPointerType A pointer or reference operator in a declarator. CppPreprocessorDirective A # directive, kept as a leaf of the tree. CppPunctuationToken A punctuation token. CppReturnStat A return statement. CppScopeToken The :: in a qualified name. CppStructuredBinding A structured binding’s name list: the [a, b] of auto [a, b] = pair;. CppSwitchStat A switch statement. CppSyntaxId A cheap, storable pointer to a syntax node or token: (kind, range). CppSyntaxTree The parse result for one source file. CppTemplateArg One template argument: a type or a constant expression. CppTemplateArgList A template argument list, including its angle brackets. CppTemplateDecl A template head: template <typename T, int N>. CppTemplateParam One template parameter. CppTemplateParamList A template parameter list, including its angle brackets. CppTernaryExpr A conditional expression: cond ? a : b. CppThisExpr this.CppThrowStat A throw statement. CppTokenData CppTranslationUnit The root of a parsed file. CppTreeBuilder Turns the parser’s flat event stream into a rowan green tree. CppTryStat A try block with its handlers. CppTypeId The type-id of a cast, sizeof, parameter or template argument. CppUnaryExpr A unary expression: -x, !flag, *ptr, &var, ++i, i++. CppUnknownExpr An expression the parser could not classify. CppUnknownStat A statement the parser could not classify. CppWhileStat A while loop. DefinitionFacts One definition a MacroFacts environment contributes, in the form a caller that builds a table needs it. DocCommandSpec A command the parser knows. DocToken One token of a documentation comment. EventStreamAudit Health of an event stream, used by tests to assert that recovery left the node stack balanced. InForceBody One body a caller contributes to the in-force channel of a MacroEnvironment . IncludedMacro A macro the file includes rather than writes, with the offset it becomes visible at. LexerConfig Lexer configuration. LineIndex MacroEnvironment The macros a file’s includes contribute, each with the offset it applies from. NoSymbols A table that knows nothing. NothingAtAll A body reader that answers None for every name: nobody says anything expands to nothing. ParserConfig PriorityTable Reader SourceRange SymbolMap A table backed by a map — the reference implementation, for tests and for a caller whose index is simple
enough that it does not need a type of its own. BodyShape What a macro’s replacement list stands for , when it stands for one of the shapes a construct can be read
from — see shape_of_a_body . CppAst Every node type in the tree, for callers that want to dispatch on what a node is without knowing
where in the grammar it came from. CppBinaryOperator CppCommentKind The kind of a comment token, for the comment section of the AST. CppDocItem Any item inside a documentation comment. CppExpr Any expression. CppKind CppLanguageLevel C++ language standard level
Defines the supported C++ standard versions, used to control the behavior of the parser CppOpKind CppParseErrorKind CppStat Any statement, including a declaration. CppSyntaxKind C++ Syntax Kind Enumeration CppTokenKind C++ Token Kind Enumeration CppUnaryOperator C++ Operator Kind Definitions CppVarExpr An expression that can name something: the left-hand side of an assignment, and the target of a
“go to definition”. Dialect Which compiler’s own spellings this parse should recognise. DocCommandArgs What kind of thing a command’s arguments are. DocCommandKind What a command is known as. DocCommentStyle How a comment is written. DocTokenKind A token within a comment. MacroBody What a macro’s body expands to — the part of a macro the grammar cares about. MarkEvent SymbolKind What a name is. BODY_CHAIN_LIMIT How many #define A B hops MacroFacts::body_text_resolved follows before giving up. TRIVIA_KINDS The token kinds that may appear as trivia, in the order the lexer emits them. VERSION The version of this crate, as Cargo.toml states it. CppAstNode A typed syntax node . CppAstToken A typed syntax token . MacroBodies What a name in a macro’s body expands to , for the one question a shape reader has to ask about it.MacroFacts The macro facts a file can see — every question a consumer asks of an environment, and the two ways of
answering them.SymbolTable What a caller can tell the parser about a name it has already resolved. a_body_opens_an_inline_namespace Whether a namespace head is spelled inline — the inline in inline namespace X {. command_args The argument shape a command’s name implies, or [UNKNOWN_COMMAND_ARGS] for a name that is not
in the table. command_kind What a command is for, or None when the name is not one this parser knows. documentation_of The comment that documents node, if one does. every_command Every command the parser understands. first_child_of_kind The first child node with one of kinds. first_significant_token The first significant token of a node, skipping trivia. is_block_comment Is this comment written as a block comment? is_comment Is this token kind a comment? is_doc_whitespace Whitespace as a comment sees it. Not char::is_whitespace: that includes the newline, which the
lexer has to keep separate because it ends a line-oriented construct. is_documentation_comment Is this C++ comment token written as documentation? is_keyword Is this token kind one of the keyword kinds? is_literal Is this token kind a literal? is_operator Is this token kind an operator? is_punctuation Is this token kind a delimiter? is_trivia Is this token trivia (invisible to the grammar)? is_type_keyword Is this token kind a type specifier keyword? lex The one lexer entry point : every token of text, plus whatever the lexer could not read.lex_comment Lex one comment into its doc tokens. node_kind_in Is this node covered by one of kinds? normalise_locale The tag a locale file is named with — zh-cn/zh_CN/ZH-CN all answer zh-CN.set_locale Use locale for every message from now on — the parser’s, the analysis’s and the server’s.shape_of_a_body shape_of_a_body_at shape_of_a_body for a caller that can say what a word in the body expands to , and where.significant_children The significant children of a node, with trivia skipped. source_range Convert a rowan range into the parser’s own range type. subtree_text The text of a node’s whole subtree , with trivia removed. subtree_text_spaced The text of a node’s subtree, with whitespace collapsed to single spaces. token_at The token at a byte offset , if any: the one that starts there, or the one after it. tokens_range The byte range covered by a run of tokens, or None for an empty run. CppExprDeclarator A declarator seen through an expression: the parser reuses Declarator inside expressions in a
few places (parenthesized declarators), and this lets callers reach it. CppSyntaxElement CppSyntaxElementChildren CppSyntaxNode CppSyntaxNodeChildren CppSyntaxNodePtr CppSyntaxToken CppTokenParentKind Nodes have no tokens of their own; this alias exists so CppAstToken implementations can name
the syntax kind of a token’s parent without importing rowan.