Use this constructor for string mixins. Input: loc location in source file of mixin
Give error on redundant/conflicting storage class.
Determine if the scanner is sitting on the start of a declaration.
Parse struct, union, interface, class.
Collect argument list. Assume current token is ',', '(' or '['.
Parse attribute, lexer is on '@'. Input: pudas array of UDAs to append to
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 ';'
Parse things that follow the initial type t. t * t [] t type t expression t [expression .. expression] t function t delegate
Parse declarations after an align, protection, or extern decl.
Parse constraint. Constraint is of the form: if ( ConstraintExpression )
Parse contracts following function declaration.
Parse a constructor definition: this(parameters) { body } or postblit: this(this) { body } or constructor template: this(templateparameters)(parameters) { body } Current token is 'this'.
Parse a debug conditional
Parse Declarations. These can be: 1. declarations at global/class level 2. declarations at statement level Return array of Declaration *'s.
Parses default argument initializer expression that is an assign expression, with special handling for __FILE__, __FILE_DIR__, __LINE__, __MODULE__, __FUNCTION__, and __PRETTY_FUNCTION__.
Parse a delete definition: delete(parameters) { body } Current token is 'delete'.
Parse a destructor definition: ~this() { body } Current token is '~'.
Parse initializer for variable declaration.
Parse an invariant definition: invariant() { body } Current token is 'invariant'.
Parse: extern (linkage) extern (C++, namespaces) The parser is on the 'extern' token.
Parse template mixin. mixin Foo; mixin Foo!(args); mixin a.b.c!(args).Foo!(args); mixin Foo!(args) identifier; mixin typeof(expr).identifier!(args);
Parse a new definition: new(parameters) { body } Current token is 'new'.
Parse parameter list.
Parse const/immutable/shared/inout/nothrow/pure postfix
Expression Parser
Parse ident1.ident2.ident3
Parse a shared static constructor definition: shared static this() { body } Current token is 'shared'.
Parse a shared static destructor definition: shared static ~this() { body } Current token is 'shared'.
Input: flags PSxxxx Output: pEndloc if { ... statements ... }, store location of closing brace, otherwise loc of first token of next statement
Parse a static assertion. Current token is 'static'.
Parse a static constructor definition: static this() { body } Current token is 'static'.
Parse a static destructor definition: static ~this() { body } Current token is 'static'.
static if (expression) body else body Current token is 'static'.
Parse template argument list. Input: current token is opening '(', or ',' for __traits Output: current token is one after closing ')'
Parse template arguments. Input: current token is opening '!' Output: current token is one after closing ')'
Parse a TemplateDeclaration.
Parse template parameter list. Input: flag 0: parsing "( list )" 1: parsing non-empty "list )"
Parse single template argument, to support the syntax: foo!arg Input: current token is the arg
Parse typeof(expression). Current token is on the 'typeof'.
Parse a unittest definition: unittest { body } Current token is 'unittest'.
Parse __vector(type). Current token is on the '__vector'.
Parse a version conditional
Skip attributes. Input: t is on a candidate attribute Output: *pt is set to first non-attribute token on success
Skip parens, brackets. Input: t is on opening ( Output: *pt is set to closing token, which is ')' on success
Look ahead at next token's value.
Look 2 tokens ahead at value.
Turn next token in buffer into a token.
tk is on the opening (. Look ahead and return token that is past the closing ).
Parse escape sequence.
Lex hex strings: x"0A ae 34FE BD"
Lex delimited strings: q"(foo(xxx))" // "foo(xxx)" q"[foo(]" // "foo(" q"/foo]/" // "foo]" q"HERE foo HERE" // "foo\n" Input: p is on the "
Lex delimited strings: q{ foo(xxx) } // " foo(xxx) " q{foo(} // "foo(" q{{foo}"}"} // "{foo}"}"" Input: p is on the q
Get postfix of string literal.
Read in a number. If it's an integer, store it in tok.TKutok.Vlong. integers can be decimal, octal or hex Handle the suffixes U, UL, LU, L, etc. If it's double, store it in tok.TKutok.Vdouble.
Read in characters, converting them to real.
parse: #line linnum filespec also allow __LINE__ for linnum, and __FILE__ for filespec
Decode UTF character. Issue error messages for invalid sequences. Return decoded character, advance p to last character in UTF sequence.
Parse doc comment embedded between t->ptr and p. Remove trailing blanks and tabs from lines. Replace all newlines with \n. Remove leading comment character from each line. Decide if it's a lineComment or a blockComment. Append to previous one for this token.
Combine two document comments into one, separated by a newline.