class Token
Defined at line 21 of file ../../tools/fidl/fidlc/src/token.h
A Token represents a typed view into a source buffer. That is, it
has a TokenKind, and it has a buffer representing the data
corresponding to the token. No processing is done on the data:
string or numeric literals aren't further parsed, identifiers
uniqued, and so on.
Public Methods
void Token (SourceSpan span, uint16_t leading_newlines, Kind kind, Subkind subkind)
Defined at line 59 of file ../../tools/fidl/fidlc/src/token.h
void Token ()
Defined at line 64 of file ../../tools/fidl/fidlc/src/token.h
const char * Name (KindAndSubkind kind_and_subkind)
Defined at line 66 of file ../../tools/fidl/fidlc/src/token.h
const SourceSpan & span ()
Defined at line 83 of file ../../tools/fidl/fidlc/src/token.h
std::string_view data ()
Defined at line 84 of file ../../tools/fidl/fidlc/src/token.h
const char * ptr ()
Defined at line 85 of file ../../tools/fidl/fidlc/src/token.h
uint16_t leading_newlines ()
Defined at line 86 of file ../../tools/fidl/fidlc/src/token.h
Kind kind ()
Defined at line 87 of file ../../tools/fidl/fidlc/src/token.h
Subkind subkind ()
Defined at line 88 of file ../../tools/fidl/fidlc/src/token.h
KindAndSubkind kind_and_subkind ()
Defined at line 89 of file ../../tools/fidl/fidlc/src/token.h
void set_leading_newlines (uint16_t leading_newlines)
Defined at line 91 of file ../../tools/fidl/fidlc/src/token.h
Enumerations
enum Kind
| Name | Value |
|---|---|
| kNotAToken | 0 |
| kEndOfFile | 1 |
| kStartOfFile | 2 |
| kComment | 3 |
| kDocComment | 4 |
| kIdentifier | 5 |
| kNumericLiteral | 6 |
| kStringLiteral | 7 |
| kLeftParen | 8 |
| kRightParen | 9 |
| kLeftSquare | 10 |
| kRightSquare | 11 |
| kLeftCurly | 12 |
| kRightCurly | 13 |
| kLeftAngle | 14 |
| kRightAngle | 15 |
| kAt | 16 |
| kDot | 17 |
| kComma | 18 |
| kSemicolon | 19 |
| kColon | 20 |
| kQuestion | 21 |
| kEqual | 22 |
| kAmpersand | 23 |
| kArrow | 24 |
| kPipe | 25 |
Defined at line 23 of file ../../tools/fidl/fidlc/src/token.h
enum Subkind
| Name | Value |
|---|---|
| kNone | 0 |
| kAs | 1 |
| kAlias | 2 |
| kLibrary | 3 |
| kUsing | 4 |
| kArray | 5 |
| kRequest | 6 |
| kString | 7 |
| kStringArray | 8 |
| kVector | 9 |
| kAjar | 10 |
| kBits | 11 |
| kClosed | 12 |
| kConst | 13 |
| kEnum | 14 |
| kOpen | 15 |
| kProtocol | 16 |
| kResource | 17 |
| kResourceDefinition | 18 |
| kService | 19 |
| kStrict | 20 |
| kStruct | 21 |
| kTable | 22 |
| kFlexible | 23 |
| kType | 24 |
| kUnion | 25 |
| kOverlay | 26 |
| kError | 27 |
| kTrue | 28 |
| kFalse | 29 |
| kCompose | 30 |
| kReserved | 31 |
| kProperties | 32 |
Each identifier token is assigned a subkind, which are defined below, or a sentinel value if
the token does not match one of the subkinds, to make it simple for the parser to either
consume a generic identifier or one that matches a specific subkind. This design makes it so
that there are no "reserved keywords" and any identifier can be defined by the user.
Defined at line 33 of file ../../tools/fidl/fidlc/src/token.h