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 a local clone.

dmd.tokens

Defines lexical tokens.

Specification Tokens

Authors:

Source tokens.d

enum EXP: ubyte;
Expression nodes
static immutable TOK[TOK.max + 1] Ckeywords;
This is used to pick the C keywords out of the tokens. If it's not a C keyword, then it's an identifier.
struct Token;
nothrow void setString(const(char)* ptr, size_t length);
Set to contents of ptr[0..length]
Parameters:
const(char)* ptr pointer to string
size_t length length of string
nothrow void setString(const ref OutBuffer buf);
Set to contents of buf
Parameters:
OutBuffer buf string (not zero terminated)
nothrow void setString();
Set to empty string
const nothrow const(char)[] toString();
Returns:
a zero-terminated string representation of the token, sometimes reusing a static buffer, sometimes leaking memory
nothrow void writeCharLiteral(ref OutBuffer buf, dchar c);
Write a character, using a readable escape sequence if needed
Useful for printing "" string literals in e.g. error messages, ddoc, or the .stringof property
Parameters:
OutBuffer buf buffer to append character in
dchar c code point to write
nothrow void writeSingleCharLiteral(ref OutBuffer buf, dchar c);
Write a single-quoted character literal
Useful for printing '' char literals in e.g. error messages, ddoc, or the .stringof property
Parameters:
OutBuffer buf buffer to append character in
dchar c code point to write