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
class
Parser
(AST): Lexer;-
Declaration
this(const ref Loc
loc
, AST.Module_module
, const(char)[]input
, booldoDocComment
);Use this constructor for string mixins.
Input:
loc
location in source file of mixin -
Declaration
AST.Dsymbols*
parseModule
();Parse a module, i.e. the optional
module x.y.z
declaration 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.md
if found -
Declaration
final bool
parseModuleDeclaration
();Parse the optional module declaration
Return Value
false
if 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
RootObject
parseTypeOrAssignExp
(TOKendtoken
= TOK.reserved);Parse a Type or an Expression
Return Value
RootObject representing the AST
-
Declaration
AST.Parameter
parseAssignCondition
();Parse an assignment condition for if or while statements.
Return Value
The variable that is declared inside the condition
-
Declaration
AST.Statement
parseStatement
(intflags
, const(char)**endPtr
= null, Loc*pEndloc
= null);Input:
flags
PSxxxxOutput:
pEndloc
if { ... statements ... }, store location of closing brace, otherwise loc of last token of statement -
Declaration
AST.Statement
parseAsm
();Parse inline assembler block.
Return Value
inline assembler block as a Statement
-
Declaration
void
check
(Locloc
, TOKvalue
);Issue error if the current token is not
, advance to next token.value
Parameters
Loc
loc
location for error message
TOK
value
token
value
to compare with -
Declaration
void
check
(TOKvalue
);Issue error if the current token is not
, advance to next token.value
Parameters
TOK
value
token
value
to compare with -
Declaration
void
check
(TOKvalue
, const(char)*string
);Issue error if the current token is not
, advance to next token.value
Parameters
TOK
value
token
value
to compare withconst(char)*
string
for error message
-
Declaration
enum
NeedDeclaratorId
; -
Declaration
bool
skipParens
(Token*t
, Token**pt
);Skip parentheses.
Parameters
Token*
t
on opening (
Token**
pt
*
pt
is set to token past ')' ontrue
Return Value
true
successfulfalse
some parsing error -
Declaration
AST.Expression
parsePrimaryExp
();Expression Parser
-
Declaration
static StorageClass
isBuiltinAtAttribute
(Identifierident
);Recognize builtin @ attributes
Parameters
Identifier
ident
identifier
Return Value
storage class for attribute, 0 if not
-
-
Declaration
immutable PREC[EXP.max + 1]
precedence
;Set operator
precedence
for each operator.Discussion
Used by hdrgen
-
Declaration
struct
ParsedLinkage
(AST);The result of the
ParseLinkage
function-
Declaration
LINK
link
;What linkage was specified
-
Declaration
CPPMANGLE
cppmangle
;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
-