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
immutable PREC[TOK.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
-
Declaration
class
Parser(AST): 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
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