Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

dmd.parse

Takes a token stream from the lexer, and parses it into an abstract syntax tree.

SpecificationD Grammar

Authors:
Walter Bright
License:
Boost License 1.0

Sourceparse.d

Documentationhttps://dlang.org/phobos/dmd_parse.html

Coveragehttps://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/parse.d

classParser(AST, Lexer = dmd.lexer.Lexer): Lexer;
this(Locloc, AST.Module_module, const(char)[]input, booldoDocComment, ErrorSinkerrorSink, const CompileEnv*compileEnv, const booldoUnittests) scope;
Use this constructor for string mixins.

Inputloc = location in source file of mixin

this(AST.Module_module, const(char)[]input, booldoDocComment, ErrorSinkerrorSink, const CompileEnv*compileEnv, const booldoUnittests) scope;
Main Parser constructor.
AST.Dsymbols*parseModule();
Parse a module, i.e. the optionalmodule x.y.z declaration and all declarations found in the current file.
Returns:
the list of declarations or an empty list in case of malformed declarations, the module declaration will be stored asthis.md if found
final boolparseModuleDeclaration();
Parse the optional module declaration
Returns:
false if a malformed module declaration was found
final AST.Dsymbols*parseModuleContent();
Parse the content of a module, i.e. all declarations found until the end of file.
Returns:
the list of declarations or an empty list in case of malformed declarations
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
Returns:
array of declared symbols
RootObjectparseTypeOrAssignExp(TOKendtoken = TOK.reserved);
Parse a Type or an Expression
Returns:
RootObject representing the AST
AST.ParameterparseAssignCondition();
Parse an assignment condition forif,switch orwhile statements.
Returns:
The variable that is declared inside the condition
AST.StatementparseStatement(intflags, const(char)**endPtr = null, Loc*pEndloc = null);

Inputflags PSxxxx

OutputpEndloc if { ... statements ... }, store location of closing brace, otherwise loc of last token of statement

AST.StatementparseAsm(boolendOfLine);
Parse inline assembler block. Enters with token on theasm.https://dlang.org/spec/iasm.html

AsmStatementasm FunctionAttributes(opt) { AsmInstructionListopt }

AsmInstructionListAsmInstruction ; AsmInstruction ; AsmInstruction

Parameters:
boolendOfLinetrue if EOL means end of asm statement
Returns:
inline assembler block as a Statement
voidcheck(Locloc, TOKvalue);
Issue error if the current token is notvalue, advance to next token.
Parameters:
Locloclocation for error message
TOKvaluetoken value to compare with
voidcheck(TOKvalue);
Issue error if the current token is notvalue, advance to next token.
Parameters:
TOKvaluetoken value to compare with
voidcheck(TOKvalue, const(char)*string);
Issue error if the current token is notvalue, advance to next token.
Parameters:
TOKvaluetoken value to compare with
const(char)*stringfor error message
enumNeedDeclaratorId;
boolskipParens(Token*t, Token**pt);
Skip parentheses.
Parameters:
Token*ton opening (
Token**pt*pt is set to token past ')' on true
Returns:
true successful false some parsing error
AST.ExpressionparsePrimaryExp();
Expression Parser
static STCisBuiltinAtAttribute(Identifierident);
Recognize builtin @ attributes
Parameters:
Identifieridentidentifier
Returns:
storage class for attribute, 0 if not
immutable PREC[EXP.max + 1]precedence;
Set operator precedence for each operator.
Used by hdrgen
structParsedLinkage(AST);
The result of theParseLinkage function
LINKlink;
What linkage was specified
CPPMANGLEcppmangle;
Ifextern(C++, class|struct), contains theclass|struct
AST.Identifiers*idents;
Ifextern(C++, some.identifier), will be the identifiers
AST.Expressions*identExps;
If `extern(C++, (some_tuple_expression)|"string"), will be the expressions
)
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Fri Feb 20 06:40:53 2026

[8]ページ先頭

©2009-2026 Movatter.jp