dmd.parse
Takes a token stream from the lexer, and parses it into an abstract syntax tree.
Specification: D Grammar
License
Source: parse.d
Documentation: https://dlang.org/phobos/dmd_parse.html
-
Declaration
classParser(AST, Lexer = dmd.lexer.Lexer): Lexer;-
Declaration
this(const ref Locloc, AST.Module_module, const(char)[]input, booldoDocComment);Use this constructor for string mixins.
Input:
loclocation in source file of mixin -
Declaration
AST.Dsymbols*parseModule();Parse a module, i.e. the optional
module x.y.zdeclaration and all declarations found in the current file.Return Value
the list of declarations or an empty list in case of malformed declarations, the module declaration will be stored as
this.mdif found -
Declaration
final boolparseModuleDeclaration();Parse the optional module declaration
Return Value
falseif a malformed module declaration was found -
Declaration
final AST.Dsymbols*parseModuleContent();Parse the content of a module, i.e. all declarations found until the end of file.
Return Value
the list of declarations or an empty list in case of malformed declarations
-
Declaration
AST.Dsymbols*parseDeclDefs(intonce, AST.Dsymbol*pLastDecl= null, PrefixAttributes!AST*pAttrs= null);Parse declarations and definitions
Parameters
intonce!=0 means parse exactly one decl or def
AST.Dsymbol*pLastDeclset to last decl or def parsed
PrefixAttributes!AST*pAttrskeep track of attributes
Return Value
array of declared symbols
-
Declaration
RootObjectparseTypeOrAssignExp(TOKendtoken= TOK.reserved);Parse a Type or an Expression
Return Value
RootObject representing the AST
-
Declaration
AST.ParameterparseAssignCondition();Parse an assignment condition for if or while statements.
Return Value
The variable that is declared inside the condition
-
Declaration
AST.StatementparseStatement(intflags, const(char)**endPtr= null, Loc*pEndloc= null);Input:
flagsPSxxxxOutput:
pEndlocif { ... statements ... }, store location of closing brace, otherwise loc of last token of statement -
Declaration
AST.StatementparseAsm();Parse inline assembler block.
Return Value
inline assembler block as a Statement
-
Declaration
voidcheck(Locloc, TOKvalue);Issue error if the current token is not
, advance to next token.valueParameters
Locloclocation for error message
TOKvaluetoken
valueto compare with -
Declaration
voidcheck(TOKvalue);Issue error if the current token is not
, advance to next token.valueParameters
TOKvaluetoken
valueto compare with -
Declaration
voidcheck(TOKvalue, const(char)*string);Issue error if the current token is not
, advance to next token.valueParameters
TOKvaluetoken
valueto compare withconst(char)*stringfor error message
-
Declaration
enumNeedDeclaratorId; -
Declaration
boolskipParens(Token*t, Token**pt);Skip parentheses.
Parameters
Token*ton opening (
Token**pt*
ptis set to token past ')' ontrueReturn Value
truesuccessfulfalsesome parsing error -
Declaration
AST.ExpressionparsePrimaryExp();Expression Parser
-
Declaration
static StorageClassisBuiltinAtAttribute(Identifierident);Recognize builtin @ attributes
Parameters
Identifieridentidentifier
Return Value
storage class for attribute, 0 if not
-
-
Declaration
immutable PREC[EXP.max + 1]precedence;Set operator
precedencefor each operator.Discussion
Used by hdrgen
-
Declaration
structParsedLinkage(AST);The result of the
ParseLinkagefunction-
Declaration
LINKlink;What linkage was specified
-
Declaration
CPPMANGLEcppmangle;If
extern(C++, class|struct), contains theclass|struct -
Declaration
AST.Identifiers*idents;If
extern(C++, some.identifier), will be the identifiers -
Declaration
AST.Expressions*identExps;If `extern(C++, (some_tuple_expression)|"string"), will be the expressions
-