A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::flow::Token Struct Reference

One token: what it is, where it is, and what it holds. More...

#include <cpp/a11/flow/token.h>

Public Member Functions

bool IsWord () const
 
bool EndsStatement () const
 Whether a line break, a } or the end of the file is here: the three ways a statement can end.
 

Public Attributes

TokenKind kind = TokenKind::kEnd
 
std::string_view text
 The source slice, exactly as written.
 
size_t start = 0
 
size_t end = 0
 
int line = 1
 1-based, as a11.flow.lexer has always reported them.
 
int column = 1
 
std::string string_value
 A kString's value, with escapes resolved.
 
double number = 0.0
 A kNumber's value.
 
bool is_integer = false
 
absl::Duration duration
 A kDuration's value.
 

Detailed Description

One token: what it is, where it is, and what it holds.

text borrows the source, so a token lives no longer than the text it was lexed from – which is how every caller uses it: lex, use, discard.

Member Function Documentation

◆ EndsStatement()

bool a11::flow::Token::EndsStatement ( ) const
inline

Whether a line break, a } or the end of the file is here: the three ways a statement can end.

◆ IsWord()

bool a11::flow::Token::IsWord ( ) const
inline

Member Data Documentation

◆ column

int a11::flow::Token::column = 1

◆ duration

absl::Duration a11::flow::Token::duration

A kDuration's value.

◆ end

size_t a11::flow::Token::end = 0

◆ is_integer

bool a11::flow::Token::is_integer = false

◆ kind

TokenKind a11::flow::Token::kind = TokenKind::kEnd

◆ line

int a11::flow::Token::line = 1

1-based, as a11.flow.lexer has always reported them.

◆ number

double a11::flow::Token::number = 0.0

A kNumber's value.

is_integer says whether it was written without a fractional part, which is what the counted forms of the grammar require.

◆ start

size_t a11::flow::Token::start = 0

◆ string_value

std::string a11::flow::Token::string_value

A kString's value, with escapes resolved.

◆ text

std::string_view a11::flow::Token::text

The source slice, exactly as written.


The documentation for this struct was generated from the following file: