17#ifndef A11_FLOW_HIGHLIGHT_H_
18#define A11_FLOW_HIGHLIGHT_H_
23#include <absl/types/span.h>
121std::vector<SemanticToken>
Highlight(absl::Span<const Token> tokens);
134void RefinePorts(std::string_view source, std::vector<SemanticToken>& semantic);
Definition boundary.cc:32
SemanticKind
What a token means where it stands, which is what a reader colours by.
Definition highlight.h:37
@ kFlowName
The name a flow declaration gives.
@ kNodeMapName
The name a nodes declaration, or a via, gives a node map.
@ kFlowOperator
->, <-, |: where a stream is going.
@ kOperator
=, ==, <, +, and the rest.
@ kIdentifier
Any other word: a node, a step, a loop variable, a let value.
@ kWordOperator
and, or, not.
@ kDeclarationKeyword
flow, in, out, header, node, nodes, as, default.
@ kMember
What follows a .: a port, a field, a node's id.
@ kModifierKeyword
tee, via, timeout, after, with, id, forward headers.
@ kPortName
A port of the flow: its declaration, and every mention of it.
@ kBad
Something the language has no meaning for.
@ kBuiltin
One of the fixed functions, where it is being called.
@ kStatementKeyword
run, call, try, wait, for, if, fail, and the rest.
@ kActionName
The action a run/call names.
@ kConstant
true, false, null, it.
@ kLogLevel
A log level, as log and logf name one.
@ kStage
A pipeline stage, offered after a |.
@ kStatusCode
A canonical status code, as fail names one.
std::vector< SemanticToken > Highlight(absl::Span< const Token > tokens)
Classify a token stream.
Definition highlight.cc:637
std::string_view SemanticKindName(SemanticKind kind)
The name of a semantic kind in the output formats, in kebab case.
Definition highlight.cc:539
SemanticKind SemanticKindFromName(std::string_view name)
The kind a name refers to, or kIdentifier if it is not one.
Definition highlight.cc:599
void RefinePorts(std::string_view source, std::vector< SemanticToken > &semantic)
Mark the identifiers that are ports of the flow they stand in.
Definition highlight.cc:641
One token, and what it means.
Definition highlight.h:94
SemanticKind kind
Definition highlight.h:95
size_t end
Definition highlight.h:97
int column
Definition highlight.h:99
size_t start
Definition highlight.h:96
int line
Definition highlight.h:98