View source code
Display the source code in dmd/parse.d from which this page was generated on github.
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 using local clone.

Class dmd.parse.Parser

class Parser(AST, Lexer) ;

Constructors

NameDescription
this (loc, _module, input, doDocComment, errorSink, compileEnv, doUnittests) Use this constructor for string mixins.
this (_module, input, doDocComment, errorSink, compileEnv, doUnittests) Main Parser constructor.

Fields

NameTypeDescription
transitionIn bool-transition=in is active, in parameters are listed

Methods

NameDescription
addComment (s, blockComment)
appendStorageClass (orig, added) Provide an error message if added contains storage classes which are redundant with those in orig; otherwise, return the combination.
check (loc, value) Issue error if the current token is not value, advance to next token.
check (value) Issue error if the current token is not value, advance to next token.
check (value, string) Issue error if the current token is not value, advance to next token.
checkDanglingElse (elseloc)
closeCondition (start, param, condition) Ad-hoc error message for missing or extra parens that close a condition.
errorReturn () Skips to the end of the current declaration - denoted by either ; or EOF
isBuiltinAtAttribute (ident) Recognize builtin @ attributes
isDeclaration (t, needId, endtok, pt) Determine if the scanner is sitting on the start of a declaration.
noIdentifierForDeclarator (t) Report an error that a declaration of type t is missing an identifier The parser is expected to sit on the next token after the type.
parseAggregate () Parse struct, union, interface, class.
parseAliasDeclarations (comment) Parse declarations that start with alias Parser is sitting on the alias.
parseAliasReassignment (comment) Parse AliasReassignment: identifier = type; Parser is sitting on the identifier.
parseArguments () Collect argument list. Assume current token is ',', '(' or '['.
parseAsm (endOfLine) Parse inline assembler block. Enters with token on the asm.
parseAssignCondition () Parse an assignment condition for if or while statements.
parseAttribute (udas) Parse attribute(s), lexer is on '@'.
parseAutoDeclarations (storageClass, comment) Parse auto declarations of the form: storageClass ident = init, ident = init, ... ; and return the array of them. Starts with token on the first ident. Ends with scanner past closing ';'
parseBaseClasses ()
parseBlock (pLastDecl, pAttrs) Parse declarations after an align, visibility, or extern decl.
parseConstraint () Parse constraint. Constraint is of the form: if ( ConstraintExpression )
parseContracts (f, isTemplateFunction) Parse contracts following function declaration.
parseCtor (pAttrs) Parse a constructor definition: this(parameters) { body } or postblit: this(this) { body } or constructor template: this(templateparameters)(parameters) { body } Current token is 'this'.
parseDebugCondition () Parse a debug conditional
parseDeclarations (autodecl, pAttrs, comment) Parse Declarations. These can be: 1. declarations at global/class level 2. declarations at statement level
parseDeclarator (t, palt, pident, tpl, storageClass, pdisable, pudas) Parse Declarator
parseDeclDefs (once, pLastDecl, pAttrs) Parse declarations and definitions
parseDefaultInitExp () Parses default argument initializer expression that is an assign expression, with special handling for _FILE__, _FILE_DIR__, _LINE__, _MODULE__, _FUNCTION__, and _PRETTY_FUNCTION__.
parseDeprecatedAttribute (msg) Parses a deprecated declaration
parseDtor (pAttrs) Parse a destructor definition: ~this() { body } Current token is '~'.
parseEnum ()
parseForeach (loc, pLastDecl) Parses foreach statements, static foreach statements and static foreach declarations.
parseInitializer () Parse initializer for variable declaration.
parseInvariant (pAttrs) Parse an invariant definition: invariant { statements... } invariant() { statements... } invariant (expression); Current token is 'invariant'.
parseLinkage ()
parseMixin () Parse template mixin. mixin Foo; mixin Foo!(args); mixin a.b.c!(args).Foo!(args); mixin Foo!(args) identifier; mixin typeof(expr).identifier!(args);
parseModule () Parse a module, i.e. the optional module x.y.z declaration and all declarations found in the current file.
parseModuleAttributes (msg, isdeprecated) Parse the ModuleAttributes preceding a module declaration.
parseModuleContent () Parse the content of a module, i.e. all declarations found until the end of file.
parseModuleDeclaration () Parse the optional module declaration
parseNamedArguments (arguments, names) Collect argument list. Assume current token is ',', '(' or '['.
parseNew (pAttrs) Parse a new definition: @disable new(); Current token is 'new'.
parseNewExp (thisexp)
parseParameterList (tpl) Parse parameter list.
parsePostfix (storageClass, pudas) Parse const/immutable/shared/inout/nothrow/pure postfix
parsePrimaryExp () Expression Parser
parseQualifiedIdentifier (entity) Parse ident1.ident2.ident3
parseSharedStaticCtor (pAttrs) Parse a shared static constructor definition: shared static this() { body } Current token is 'shared'.
parseSharedStaticDtor (pAttrs) Parse a shared static destructor definition: shared static ~this() { body } Current token is 'shared'.
parseStatement (flags, endPtr, pEndloc)
parseStaticAssert () Parse a static assertion. Current token is 'static'.
parseStaticCtor (pAttrs) Parse a static constructor definition: static this() { body } Current token is 'static'.
parseStaticDtor (pAttrs) Parse a static destructor definition: static ~this() { body } Current token is 'static'.
parseStaticIfCondition () static if (expression) body else body Current token is 'static'.
parseTemplateArgumentList () Parse template argument list.
parseTemplateArguments () Parse template arguments.
parseTemplateDeclaration (ismixin) Parse a TemplateDeclaration.
parseTemplateParameterList (flag) Parse template parameter list.
parseTemplateSingleArgument () Parse single template argument, to support the syntax: foo!arg
parseTypeof () Parse typeof(expression). Current token is on the 'typeof'.
parseTypeOrAssignExp (endtoken) Parse a Type or an Expression
parseTypeSuffixes (t) Parse suffixes to type t. * [] [AssignExpression] [AssignExpression .. AssignExpression] [Type] delegate Parameters MemberFunctionAttributes(opt) function Parameters FunctionAttributes(opt)
parseUnitTest (pAttrs) Parse a unittest definition: unittest { body } Current token is 'unittest'.
parseVector () Parse _vector(type). Current token is on the '_vector'.
parseVersionCondition () Parse a version conditional
parseVersionSpecification () Parse a version specification
skipAttributes (t, pt) Skip attributes.
skipParens (t, pt) Skip parentheses.
factory (classname) Create instance of class specified by the fully qualified name classname. The class must either have no constructors or have a default constructor.
opCmp (o) Compare with another Object obj.
opEquals (o) Test whether this is equal to o. The default implementation only compares by identity (using the is operator). Generally, overrides and overloads for opEquals should attempt to compare objects by their contents. A class will most likely want to add an overload that takes your specific type as the argument and does the content comparison. Then you can override this and forward it to your specific typed overload with a cast. Remember to check for null on the typed overload.
toHash () Compute hash function for Object.
toString () Convert Object to a human readable string.

Enums

NameDescription
NeedDeclaratorId

Authors

Walter Bright

License

Boost License 1.0