Class Parser
D Parser.
class Parser
;
It is sometimes useful to sub-class Parser to skip over things that are not interesting. For example, DCD skips over function bodies when caching symbols from imported files.
Fields
Name | Type | Description |
---|---|---|
allocator
|
RollbackAllocator* | Allocator used for creating AST nodes |
errorCount
|
uint | Current error count |
fileName
|
string | Name used when reporting warnings and errors |
messageDelegate
|
void delegate(string, ulong, ulong, string, bool) | Function or delegate that is called when a warning or error is encountered. The parameters are the file name, line number, column number, and the error or warning message. |
messageFunction
|
void function(string, ulong, ulong, string, bool) | Function or delegate that is called when a warning or error is encountered. The parameters are the file name, line number, column number, and the error or warning message. |
tokens
|
const(TokenStructure!(ubyte,"import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;"))[] | Tokens to parse |
warningCount
|
uint | Current warning count |
_traceDepth
|
int | |
cachedAAChecks
|
bool[ulong] | |
cachedTypeChecks
|
bool[ulong] | |
comment
|
string | |
index
|
ulong | |
REGISTER_NAMES
|
immutable(char[][]) | |
suppressMessages
|
dparse |
Properties
Name | Type | Description |
---|---|---|
current [get]
|
TokenStructure!(ubyte,"import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;") | |
previous [get]
|
TokenStructure!(ubyte,"import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;") |
Methods
Name | Description |
---|---|
moreTokens
()
|
|
parseAddExpression
()
|
Parses an AddExpression. |
parseAliasAssign
()
|
Parses an AliasAssign. |
parseAliasDeclaration
()
|
Parses an AliasDeclaration. |
parseAliasInitializer
()
|
Parses an AliasInitializer. |
parseAliasThisDeclaration
()
|
Parses an AliasThisDeclaration. |
parseAlignAttribute
()
|
Parses an AlignAttribute. |
parseAndAndExpression
()
|
Parses an AndAndExpression. |
parseAndExpression
()
|
Parses an AndExpression. |
parseAnonymousEnumDeclaration
()
|
anonymousEnumDeclaration: 'enum' (':' type)? '{' anonymousEnumMember+ '}' ; |
parseAnonymousEnumMember
(typeAllowed)
|
anonymousEnumMember: type identifier '=' assignExpression | identifier '=' assignExpression | identifier ; |
parseArgumentList
()
|
Parses an ArgumentList. |
parseArguments
()
|
Parses Arguments. |
parseArrayInitializer
()
|
Parses an ArrayInitializer. |
parseArrayLiteral
()
|
Parses an ArrayLiteral. |
parseArrayMemberInitialization
()
|
Parses an ArrayMemberInitialization. |
parseAsmAddExp
()
|
Parses an AsmAddExp |
parseAsmAndExp
()
|
Parses an AsmAndExp |
parseAsmBrExp
()
|
Parses an AsmBrExp |
parseAsmEqualExp
()
|
Parses an AsmEqualExp |
parseAsmExp
()
|
Parses an AsmExp |
parseAsmInstruction
(maybeGccASm)
|
Parses an AsmInstruction |
parseAsmLogAndExp
()
|
Parses an AsmLogAndExp |
parseAsmLogOrExp
()
|
Parses an AsmLogOrExp |
parseAsmMulExp
()
|
Parses an AsmMulExp |
parseAsmOrExp
()
|
Parses an AsmOrExp |
parseAsmPrimaryExp
()
|
Parses an AsmPrimaryExp |
parseAsmRelExp
()
|
Parses an AsmRelExp |
parseAsmShiftExp
()
|
Parses an AsmShiftExp |
parseAsmStatement
()
|
Parses an AsmStatement |
parseAsmTypePrefix
()
|
Parses an AsmTypePrefix |
parseAsmUnaExp
()
|
Parses an AsmUnaExp |
parseAsmXorExp
()
|
Parses an AsmXorExp |
parseAssertArguments
()
|
Parses an AssertArguments |
parseAssertExpression
()
|
Parses an AssertExpression |
parseAssignExpression
()
|
Parses an AssignExpression |
parseAssocArrayLiteral
()
|
Parses an AssocArrayLiteral |
parseAtAttribute
()
|
Parses an AtAttribute |
parseAttribute
()
|
Parses an Attribute |
parseAttributeDeclaration
(attribute)
|
Parses an AttributeDeclaration |
parseAutoDeclaration
()
|
Parses an AutoDeclaration |
parseAutoDeclarationPart
()
|
Parses an AutoDeclarationPart |
parseBaseClass
()
|
Parses a BaseClass |
parseBaseClassList
()
|
Parses a BaseClassList |
parseBitfieldWidth
()
|
Parses a BitfieldWidth |
parseBlockStatement
()
|
Parses a BlockStatement |
parseBreakStatement
()
|
Parses a BreakStatement |
parseBuiltinType
()
|
Parses an BuiltinType |
parseCaseRangeStatement
(low, startIndex)
|
Parses a CaseRangeStatement |
parseCaseStatement
(argumentList, startIndex)
|
Parses an CaseStatement |
parseCastExpression
()
|
Parses a CastExpression |
parseCastQualifier
()
|
Parses a CastQualifier |
parseCatch
()
|
Parses a Catch |
parseCatches
()
|
Parses a Catches |
parseClassDeclaration
()
|
Parses a ClassDeclaration |
parseCmpExpression
()
|
Parses a CmpExpression |
parseCompileCondition
()
|
Parses a CompileCondition |
parseConditionalDeclaration
(strict, inTemplateDeclaration)
|
Parses a ConditionalDeclaration |
parseConditionalStatement
()
|
Parses a ConditionalStatement |
parseConstraint
()
|
Parses a Constraint |
parseConstructor
()
|
Parses a Constructor |
parseContinueStatement
()
|
Parses an ContinueStatement |
parseDebugCondition
()
|
Parses a DebugCondition |
parseDebugSpecification
()
|
Parses a DebugSpecification |
parseDeclaration
(strict, mustBeDeclaration, inTemplateDeclaration)
|
Parses a Declaration |
parseDeclarationOrStatement
()
|
Parses a DeclarationOrStatement |
parseDeclarationsAndStatements
(includeCases)
|
Parses DeclarationsAndStatements |
parseDeclarator
()
|
Parses a Declarator |
parseDeclaratorIdentifierList
()
|
Parses a DeclaratorIdentifierList |
parseDefaultStatement
()
|
Parses a DefaultStatement |
parseDeleteExpression
()
|
Parses a DeleteExpression |
parseDeprecated
()
|
Parses a Deprecated attribute |
parseDestructor
()
|
Parses a Destructor |
parseDoStatement
()
|
Parses a DoStatement |
parseEnumBody
()
|
Parses an EnumBody |
parseEnumDeclaration
()
|
Parses an EnumDeclaration |
parseEnumMember
()
|
Parses an EnumMember |
parseEnumMemberAttribute
()
|
Parses an EnumMemberAttribute |
parseEponymousTemplateDeclaration
()
|
Parses an EponymousTemplateDeclaration |
parseEqualExpression
(shift)
|
Parses an EqualExpression |
parseExpression
()
|
Parses an Expression |
parseExpressionStatement
(expression)
|
Parses an ExpressionStatement |
parseFinally
()
|
Parses a Finally |
parseFinalSwitchStatement
()
|
Parses a FinalSwitchStatement |
parseForeach
(inTemplateDeclaration)
|
|
parseForeachStatement
()
|
Parses a ForeachStatement |
parseForeachType
()
|
Parses a ForeachType |
parseForeachTypeList
()
|
Parses a ForeachTypeList |
parseForStatement
()
|
Parses a ForStatement |
parseFunctionAttribute
(validate)
|
Parses a FunctionAttribute |
parseFunctionBody
()
|
Parses a FunctionBody. Note that any change of this function must also be applied in dsymbol SimpleParser, which can be found here. |
parseFunctionCallExpression
(unary)
|
Parses a FunctionCallExpression |
parseFunctionContract
(allowStatement)
|
Parses a FunctionContract |
parseFunctionDeclaration
(type, isAuto, attributes)
|
Parses a FunctionDeclaration |
parseFunctionLiteralExpression
()
|
Parses a FunctionLiteralExpression |
parseGccAsmInstruction
()
|
Parses an AsmInstruction using GCC Assembler |
parseGccAsmOperand
()
|
Parses a GccAsmOperand |
parseGccAsmOperandList
()
|
Parses a GccAsmOperandList |
parseGotoStatement
()
|
Parses a GotoStatement |
parseIdentifierChain
()
|
Parses an IdentifierChain |
parseIdentifierOrTemplateChain
()
|
Parses an IdentifierOrTemplateChain |
parseIdentifierOrTemplateInstance
()
|
Parses an IdentifierOrTemplateInstance |
parseIdentityExpression
(shift)
|
Parses an IdentityExpression |
parseIfCondition
()
|
Parses an IfCondition |
parseIfStatement
()
|
Parses an IfStatement |
parseImportBind
()
|
Parses an ImportBind |
parseImportBindings
(singleImport)
|
Parses ImportBindings |
parseImportDeclaration
()
|
Parses an ImportDeclaration |
parseImportExpression
()
|
Parses an ImportExpression |
parseInContractExpression
()
|
Parses an InContractExpression |
parseIndex
()
|
Parses an Index |
parseIndexExpression
(unaryExpression)
|
Parses an IndexExpression |
parseInExpression
(shift)
|
Parses an InExpression |
parseInitializer
()
|
Parses an Initializer |
parseInOutContractExpression
()
|
Parses an InOutContractExpression |
parseInOutStatement
()
|
Parses an InOutStatement |
parseInStatement
()
|
Parses an InStatement |
parseInterfaceDeclaration
()
|
Parses an InterfaceDeclaration |
parseInvariant
()
|
Parses an Invariant |
parseIsExpression
()
|
Parses an IsExpression |
parseKeyValuePair
()
|
Parses a KeyValuePair |
parseKeyValuePairs
()
|
Parses KeyValuePairs |
parseLabeledStatement
()
|
Parses a LabeledStatement |
parseLastCatch
()
|
Parses a LastCatch |
parseLinkageAttribute
()
|
Parses a LinkageAttribute |
parseMemberFunctionAttribute
()
|
Parses a MemberFunctionAttribute |
parseMissingFunctionBody
()
|
Parses a MissingFunctionBody |
parseMixinDeclaration
()
|
Parses a MixinDeclaration |
parseMixinExpression
()
|
Parses a MixinExpression |
parseMixinTemplateDeclaration
()
|
Parses a MixinTemplateDeclaration |
parseMixinTemplateName
()
|
Parses a MixinTemplateName |
parseModule
()
|
Parses a Module |
parseModuleDeclaration
()
|
Parses a ModuleDeclaration |
parseMulExpression
()
|
Parses a MulExpression. |
parseNamedArgument
()
|
Parses a NamedArgument. |
parseNamedArgumentList
()
|
Parses a NamedArgumentList. |
parseNamedTemplateArgument
()
|
Parses a NamedTemplateArgument |
parseNamedTemplateArgumentList
()
|
Parses a NamedTemplateArgumentList |
parseNamespaceList
()
|
Parses a NamespaceList. |
parseNewAnonClassExpression
()
|
Parses a NewAnonClassExpression |
parseNewExpression
()
|
Parses a NewExpression |
parseNonVoidInitializer
()
|
Parses a NonVoidInitializer |
parseOperands
()
|
Parses Operands |
parseOrExpression
()
|
Parses an OrExpression |
parseOrOrExpression
()
|
Parses an OrOrExpression |
parseOutContractExpression
()
|
Parses an OutContractExpression |
parseOutStatement
()
|
Parses an OutStatement |
parseParameter
()
|
Parses a Parameter |
parseParameterAttribute
(validate)
|
Parses a ParameterAttribute |
parseParameters
()
|
Parses Parameters |
parsePostblit
()
|
Parses a Postblit |
parsePowExpression
()
|
Parses a PowExpression |
parsePragmaDeclaration
()
|
Parses a PragmaDeclaration |
parsePragmaExpression
()
|
Parses a PragmaExpression |
parsePragmaStatement
()
|
Parses a PragmaStatement |
parsePrimaryExpression
()
|
Parses a PrimaryExpression |
parseRegister
()
|
Parses a Register |
parseRelExpression
(shift)
|
Parses a RelExpression |
parseReturnStatement
()
|
Parses a ReturnStatement |
parseScopeGuardStatement
()
|
Parses a ScopeGuardStatement |
parseSharedStaticConstructor
()
|
Parses a SharedStaticConstructor |
parseSharedStaticDestructor
()
|
Parses a SharedStaticDestructor |
parseShiftExpression
()
|
Parses a ShiftExpression |
parseShortenedFunctionBody
()
|
Parses a ShortenedFunctionBody |
parseSingleImport
()
|
Parses a SingleImport |
parseSpecifiedFunctionBody
()
|
Parses a SpecifiedFunctionBody |
parseStatement
()
|
Parses a Statement |
parseStatementNoCaseNoDefault
()
|
Parses a StatementNoCaseNoDefault |
parseStaticAssertDeclaration
()
|
Parses a StaticAssertDeclaration |
parseStaticAssertStatement
()
|
Parses a StaticAssertStatement |
parseStaticConstructor
()
|
Parses a StaticConstructor |
parseStaticDestructor
()
|
Parses a StaticDestructor |
parseStaticForeachDeclaration
(inTemplateDeclaration)
|
Parses a StaticForeachDeclaration |
parseStaticForeachStatement
()
|
Parses a StaticForeachStatement |
parseStaticIfCondition
()
|
Parses an StaticIfCondition |
parseStorageClass
()
|
Parses a StorageClass |
parseStructBody
()
|
Parses a StructBody |
parseStructDeclaration
()
|
Parses a StructDeclaration |
parseStructInitializer
()
|
Parses an StructInitializer |
parseStructMemberInitializer
()
|
Parses a StructMemberInitializer |
parseStructMemberInitializers
()
|
Parses StructMemberInitializers |
parseSwitchStatement
()
|
Parses a SwitchStatement |
parseSymbol
()
|
Parses a Symbol |
parseSynchronizedStatement
()
|
Parses a SynchronizedStatement |
parseTemplateAliasParameter
()
|
Parses a TemplateAliasParameter |
parseTemplateArgument
()
|
Parses a TemplateArgument |
parseTemplateArgumentList
()
|
Parses a TemplateArgumentList |
parseTemplateArguments
()
|
Parses TemplateArguments |
parseTemplateDeclaration
()
|
Parses a TemplateDeclaration |
parseTemplateInstance
()
|
Parses a TemplateInstance |
parseTemplateMixinExpression
()
|
Parses a TemplateMixinExpression |
parseTemplateParameter
()
|
Parses a TemplateParameter |
parseTemplateParameterList
()
|
Parses a TemplateParameterList |
parseTemplateParameters
()
|
Parses TemplateParameters |
parseTemplateSingleArgument
()
|
Parses a TemplateSingleArgument |
parseTemplateThisParameter
()
|
Parses a TemplateThisParameter |
parseTemplateTupleParameter
()
|
Parses an TemplateTupleParameter |
parseTemplateTypeParameter
()
|
Parses a TemplateTypeParameter |
parseTemplateValueParameter
()
|
Parses a TemplateValueParameter |
parseTemplateValueParameterDefault
()
|
Parses a TemplateValueParameterDefault |
parseTernaryExpression
()
|
Parses a TernaryExpression |
parseThrowExpression
()
|
Parses a ThrowExpression |
parseTraitsExpression
()
|
Parses an TraitsExpression |
parseTryStatement
()
|
Parses a TryStatement |
parseType
()
|
Parses a Type |
parseType2
()
|
Parses a Type2 |
parseTypeConstructor
(validate)
|
Parses a TypeConstructor |
parseTypeConstructors
()
|
Parses TypeConstructors |
parseTypeIdentifierPart
()
|
Parses a TypeIdentifierPart. |
parseTypeidExpression
()
|
Parses a TypeidExpression |
parseTypeofExpression
()
|
Parses a TypeofExpression |
parseTypeSpecialization
()
|
Parses a TypeSpecialization |
parseTypeSuffix
()
|
Parses a TypeSuffix |
parseUnaryExpression
()
|
Parses a UnaryExpression |
parseUnionDeclaration
()
|
Parses an UnionDeclaration |
parseUnittest
()
|
Parses a Unittest |
parseVariableDeclaration
(type, isAuto)
|
Parses a VariableDeclaration |
parseVariadicArgumentsAttribute
()
|
Parses an attribute of C-style variadic parameters. |
parseVariadicArgumentsAttributes
()
|
Parses attributes of C-style variadic parameters. |
parseVector
()
|
Parses a Vector |
parseVersionCondition
()
|
Parses a VersionCondition |
parseVersionSpecification
()
|
Parses a VersionSpecification |
parseWhileStatement
()
|
Parses a WhileStatement |
parseWithStatement
()
|
Parses a WithStatement |
parseXorExpression
()
|
Parses an XorExpression |
setTokens
(tokens)
|
|
abandonBookmark
(__param_0)
|
|
advance
()
|
Advances to the next token and returns the current token |
attachComment
(node, comment)
|
|
attachCommentFromSemicolon
(node, startIndex)
|
|
currentIs
(type)
|
|
currentIsMemberFunctionAttribute
()
|
|
currentIsOneOf
(types)
|
|
error
(message, shouldAdvance, includeCurrentToken)
|
|
expect
(type)
|
|
goToBookmark
(bookmark, popStack)
|
Goes back to a parser bookmark and optionally invalidates it. |
hasMagicDelimiter
()
|
|
isAssociativeArrayLiteral
()
|
|
isAttribute
()
|
|
isAutoDeclaration
(beginIndex)
|
|
isCastQualifier
()
|
|
isDeclaration
()
|
|
isMemberFunctionAttribute
(t)
|
|
isStorageClass
()
|
|
isType
()
|
Only use this in template parameter parsing |
isTypeCtor
(t)
|
|
moveStartIndexBefore
(startIndex, child, func)
|
|
ownArray
(arr, sb)
|
|
parseCommaSeparatedRule
(allowTrailingComma)
|
|
parseInterfaceOrClass
(node, startIndex)
|
|
parseLeftAssocBinaryExpression
(part)
|
|
parseStaticCtorDtorCommon
(node, startIndex)
|
|
peek
()
|
|
peekAre
(types)
|
|
peekIs
(t)
|
|
peekIsOneOf
(types)
|
|
peekNIs
(t, offset)
|
|
peekNIsOneOf
(offset, types)
|
|
peekPast
()
|
|
peekPastBraces
()
|
|
peekPastBrackets
()
|
|
peekPastParens
()
|
|
setBookmark
()
|
|
skip
(token)
|
Skips token if present and returns whether token was skipped |
skip
()
|
|
skipBraces
()
|
|
skipBrackets
()
|
|
skipParens
()
|
|
startsWith
(types)
|
|
suppressedErrorCount
()
|
|
trace
(__param_0)
|
|
warn
(message)
|
Enums
Name | Description |
---|---|
DecType
|
Aliases
Name | Description |
---|---|
messageDg
|
|
Bookmark
|