View source code
Display the source code in dmd/lexer.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.lexer.Lexer

class Lexer ;

Constructors

NameDescription
this Creates a Lexer for the source code base[begoffset..endoffset+1]. The last character, base[endoffset], must be null (0) or EOF (0x1A).

Methods

NameDescription
allocateToken
charConstant
combineComments Combine two document comments into one, separated by an extra newline if newParagraph is true.
decodeUTF Decode UTF character. Issue error messages for invalid sequences. Return decoded character, advance p to last character in UTF sequence.
delimitedStringConstant Lex a delimited string. Some examples of delimited strings are:
errors
escapeSequence Parse escape sequence.
escapeSequence Parse the given string literal escape sequence into a single character.
escapeStringConstant Scan a double-quoted string while building the processed string value by handling escape sequences. The result is returned in the given t token. This function assumes that p currently points to the opening double-quote of the string.
getDocComment 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.
hexStringConstant Lex hex strings: x"0A ae 34FE BD"
inreal Read in characters, converting them to real.
number 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.
peekNext Look ahead at next token's value.
peekNext2 Look 2 tokens ahead at value.
peekPastParen tk is on the opening (. Look ahead and return token that is past the closing ).
poundLine
releaseToken Frees the given token by returning it to the freelist.
scan Turn next token in buffer into a token.
stringPostfix Get postfix of string literal.
tokenStringConstant Lex a token string. Some examples of token strings are:
wysiwygStringConstant Lex a wysiwyg string. p must be pointing to the first character before the contents of the string literal. The character pointed to by p will be used as the terminating character (i.e. backtick or double-quote).
factory Create instance of class specified by the fully qualified name classname. The class must either have no constructors or have a default constructor.
opCmp Compare with another Object obj.
opEquals Test whether this is equal to o. The default implementation only compares by identity (using the is operator). Generally, overrides for opEquals should attempt to compare objects by their contents.
toHash Compute hash function for Object.
toString Convert Object to a human readable string.

Authors

Walter Bright

License

Boost License 1.0