17#ifndef A11_FLOW_HIGHLIGHT_H_
18#define A11_FLOW_HIGHLIGHT_H_
23#include <absl/types/span.h>
127std::vector<SemanticToken>
Highlight(absl::Span<const Token> tokens);
134void RefinePorts(std::string_view source, std::vector<SemanticToken>& semantic);
Definition catalogue.cc:29
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 value 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.
@ kBuiltinType
A standard type, using the primitive-type keyword palette.
@ 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.
@ kNamespaceName
A module declaration, alias, or qualifier before ::.
@ 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:783
std::string_view SemanticKindName(SemanticKind kind)
The name of a semantic kind in the output formats, in kebab case.
Definition highlight.cc:676
SemanticKind SemanticKindFromName(std::string_view name)
The kind a name refers to, or kIdentifier if it is not one.
Definition highlight.cc:742
void RefinePorts(std::string_view source, std::vector< SemanticToken > &semantic)
Refine lexical tokens using parsed type positions and resolved bindings.
Definition highlight.cc:811
One nonoverlapping semantic span; string escapes have their own spans.
Definition highlight.h:99
SemanticKind kind
Definition highlight.h:100
size_t end
Definition highlight.h:102
int column
Definition highlight.h:104
size_t start
Definition highlight.h:101
int line
Definition highlight.h:103