Parser

Constructors

this
this(Loc loc, AST.Module _module, const(char)[] input, bool doDocComment, ErrorSink errorSink, CompileEnv* compileEnv, bool doUnittests)

Use this constructor for string mixins. Input: loc = location in source file of mixin

this
this(AST.Module _module, const(char)[] input, bool doDocComment, ErrorSink errorSink, CompileEnv* compileEnv, bool doUnittests)

Main Parser constructor.

Members

Enums

NeedDeclaratorId
enum NeedDeclaratorId

Functions

check
void check(Loc loc, TOK value)

Issue error if the current token is not value, advance to next token.

check
void check(TOK value)

Issue error if the current token is not value, advance to next token.

check
void check(TOK value, const(char)* string)

Issue error if the current token is not value, advance to next token.

parseAsm
AST.Statement parseAsm(bool endOfLine)

Parse inline assembler block. Enters with token on the asm. https://dlang.org/spec/iasm.html

parseAssignCondition
AST.Parameter parseAssignCondition()

Parse an assignment condition for if or while statements.

parseDeclDefs
AST.Dsymbols* parseDeclDefs(int once, AST.Dsymbol* pLastDecl, PrefixAttributes!AST* pAttrs)

Parse declarations and definitions

parseModule
AST.Dsymbols* parseModule()

Parse a module, i.e. the optional module x.y.z declaration and all declarations found in the current file.

parseModuleContent
AST.Dsymbols* parseModuleContent()

Parse the content of a module, i.e. all declarations found until the end of file.

parseModuleDeclaration
bool parseModuleDeclaration()

Parse the optional module declaration

parsePrimaryExp
AST.Expression parsePrimaryExp()

Expression Parser **************************

parseStatement
AST.Statement parseStatement(int flags, const(char)** endPtr, Loc* pEndloc)

Input: flags PSxxxx Output: pEndloc if { ... statements ... }, store location of closing brace, otherwise loc of last token of statement

parseTypeOrAssignExp
RootObject parseTypeOrAssignExp(TOK endtoken)

Parse a Type or an Expression

skipParens
bool skipParens(Token* t, Token** pt)

Skip parentheses.

Static functions

isBuiltinAtAttribute
StorageClass isBuiltinAtAttribute(Identifier ident)

Recognize builtin @ attributes

Variables

transitionIn
bool transitionIn;

-transition=in is active, in parameters are listed

Inherited Members

From Lexer

Ccompile
bool Ccompile;

true if compiling ImportC

boolsize
ubyte boolsize;

size of a C _Bool, default 1

shortsize
ubyte shortsize;

size of a C short, default 2

intsize
ubyte intsize;

size of a C int, default 4

longsize
ubyte longsize;

size of C long, 4 or 8

long_longsize
ubyte long_longsize;

size of a C long long, default 8

long_doublesize
ubyte long_doublesize;

size of C long double, 8 or D real.sizeof

wchar_tsize
ubyte wchar_tsize;

size of C wchar_t, 2 or 4

eSink
ErrorSink eSink;

send error messages through this interface

compileEnv
CompileEnv compileEnv;

environment

resetDefineLines
void resetDefineLines(const(char)[] slice)

Reset lexer to lex #define's

nextDefineLine
void nextDefineLine()

Set up for next #define line. p should be at start of next line.

empty
bool empty()

Range interface

allocateToken
Token* allocateToken()
peekNext
TOK peekNext()

Look ahead at next token's value.

peekNext2
TOK peekNext2()

Look 2 tokens ahead at value.

scan
void scan(Token* t)

Turn next token in buffer into a token.

peekPastParen
Token* peekPastParen(Token* tk)

tk is on the opening (. Look ahead and return token that is past the closing ).

hexStringConstant
TOK hexStringConstant(Token* t)

Lex hex strings: x"0A ae 34FE BD"

parseSpecialTokenSequence
bool parseSpecialTokenSequence()

Parse special token sequence:

poundLine
void poundLine(Token tok, bool linemarker)

Parse line/file preprocessor directive: #line linnum filespec Allow __LINE__ for linnum, and __FILE__ for filespec. Accept linemarker format: # linnum filespec {flags} There can be zero or more flags, which are one of the digits 1..4, and must be in ascending order. The flags are ignored.

skipToNextLine
void skipToNextLine(OutBuffer* defines)

Scan forward to start of next line.

combineComments
const(char)* combineComments(const(char)[] c1, const(char)[] c2, bool newParagraph)

Combine two document comments into one, separated by an extra newline if newParagraph is true.

Meta