17#ifndef A11_FLOW_VOCABULARY_H_
18#define A11_FLOW_VOCABULARY_H_
25#include <absl/base/nullability.h>
26#include <absl/container/flat_hash_set.h>
27#include <absl/types/span.h>
45std::string
Canonical(std::string_view word);
98absl::Span<const std::string_view>
Stages();
101std::optional<StageArgument>
StageTakes(std::string_view canonical_name);
136 std::string_view canonical_name);
146 std::string_view canonical_name);
212const WordDoc* absl_nullable
AnyDocumentation(std::string_view canonical_name);
235 std::string_view canonical_name);
249const absl::flat_hash_set<std::string_view>&
BareStages();
271const absl::flat_hash_set<std::string_view>&
Builtins();
278const absl::flat_hash_set<std::string_view>&
TypeNames();
284absl::Span<const int>
TypeParameters(std::string_view canonical_name);
307const absl::flat_hash_set<std::string_view>&
ClauseWords();
327const absl::flat_hash_set<std::string_view>&
SourceWords();
356absl::Span<const std::string_view>
LogLevels();
362const absl::flat_hash_set<std::string_view>&
StatusFields();
const absl::flat_hash_set< std::string_view > & StatementWords()
Words that open a statement, and so are not read as a name there.
Definition vocabulary.cc:2093
absl::Span< const std::string_view > OrderedDeclarations()
The declarations in the order they are written in a flow.
Definition vocabulary.cc:2116
absl::Span< const std::string_view > OrderedModifiers()
The modifiers in the order they read after a call, forward headers being the one that is two words.
Definition vocabulary.cc:2126
std::string_view WordRoleName(WordRole role)
The name a role travels under in flow.vocabulary/v1: port_modifier.
Definition vocabulary.cc:1940
bool IsStatusCode(std::string_view word)
Whether a word names a canonical status code, in either case.
Definition vocabulary.cc:2175
bool IsShouted(std::string_view word)
Whether the word, canonicalised, is written entirely in upper case.
Definition vocabulary.cc:1768
std::vector< std::string_view > WordsOf(WordRole role)
The words role documents, in the order a listing reads them.
Definition vocabulary.cc:1980
const absl::flat_hash_set< std::string_view > & StatusFields()
The fields of a status record: what reading an outcome gives.
Definition vocabulary.cc:2193
std::string_view StageArgumentName(StageArgument argument)
The spelling of a stage argument kind in the output formats.
Definition vocabulary.cc:1806
absl::Span< const std::string_view > StatusCodes()
Abseil's canonical status codes, lower case, which is what fail names.
Definition vocabulary.cc:2171
absl::Span< const std::string_view > OrderedStatements()
The same, in the order they read: what a statement may begin with, most common first.
Definition vocabulary.cc:2098
absl::Span< const std::string_view > OrderedStatusFields()
The same, in the order a status record is written and read.
Definition vocabulary.cc:2198
const WordDoc *absl_nullable AnyDocumentation(std::string_view canonical_name)
What one word does under whichever role documents it, or nullptr.
Definition vocabulary.cc:1915
const WordDoc *absl_nullable BuiltinDocumentation(std::string_view canonical_name)
What a built-in function does, or nullptr where the name is not one.
Definition vocabulary.cc:1842
const absl::flat_hash_set< std::string_view > & ClauseWords()
Words that stand inside a statement without opening one.
Definition vocabulary.cc:2102
std::optional< double > DurationUnitSeconds(std::string_view unit)
The seconds one of that unit is, or nullopt if it is not a unit.
Definition vocabulary.cc:2217
const absl::flat_hash_set< std::string_view > & PortModifierWords()
What a port says about itself after its type: stream, required.
Definition vocabulary.cc:2137
absl::Span< const EntryPort > EntryPorts()
The ports the entry flow has without declaring them, in declaration order.
Definition vocabulary.cc:1781
const WordDoc *absl_nullable Documentation(WordRole role, std::string_view canonical_name)
What one word of role does, or nullptr where that table has no entry.
Definition vocabulary.cc:1848
const absl::flat_hash_set< std::string_view > & ParallelStages()
The stages a value may pass through several at a time.
Definition vocabulary.cc:2050
bool IsLogLevel(std::string_view word)
Whether a word names a log level, in either case.
Definition vocabulary.cc:2161
const absl::flat_hash_set< std::string_view > & SourceWords()
Words that open a pipeline source rather than naming one: status, zip.
Definition vocabulary.cc:2130
const absl::flat_hash_set< std::string_view > & OperatorWords()
Operators that are words: and, or, not.
Definition vocabulary.cc:2208
absl::Span< const std::string_view > OrderedSymbols()
Every punctuation mark and non-word operator the language gives meaning to, in the order a listing re...
Definition vocabulary.cc:1911
const absl::flat_hash_set< std::string_view > & Builtins()
The language's fixed function set. No user code, ever: a flow stays data.
Definition vocabulary.cc:2060
absl::Span< const std::string_view > OrderedTypeNames()
The built-in port type names, in the order a listing reads them.
Definition vocabulary.cc:2074
absl::Span< const std::string_view > OrderedFieldModifiers()
The same, in the order a field writes them, which is the order they are required to be written in.
Definition vocabulary.cc:2152
const absl::flat_hash_set< std::string_view > & DeclarationWords()
Words that declare something inside a flow.
Definition vocabulary.cc:2111
const absl::flat_hash_set< std::string_view > & ReducingStages()
The stages that read a whole stream and yield exactly one value.
Definition vocabulary.cc:2037
const absl::flat_hash_set< std::string_view > & FieldModifierWords()
What a struct field says about itself after its type.
Definition vocabulary.cc:2147
absl::Span< const std::string_view > OrderedPortModifiers()
The same, in the order a port writes them.
Definition vocabulary.cc:2142
absl::Span< const std::string_view > DurationUnits()
Duration suffixes a number may carry, shortest unit first.
Definition vocabulary.cc:2213
const absl::flat_hash_set< std::string_view > & ConstantWords()
Literals that are words: true, false, null, it.
Definition vocabulary.cc:2203
const absl::flat_hash_set< std::string_view > & PositionalStages()
The stages that choose which values of a stream to keep, or group them, rather than reshaping each on...
Definition vocabulary.cc:2043
WordRole
Which table a word is documented in.
Definition vocabulary.h:162
@ kConstant
A literal that is a word: true, it. [ConstantWords].
@ kDeclaration
A word that declares something: flow, in, header.
@ kStatement
A word that opens a statement: run, let, for. [StatementWords].
@ kSymbol
Punctuation and the operators that are not words, keyed by the symbol itself: |, ->,...
@ kClause
A word that continues a statement: else, parallel. [ClauseWords].
@ kFieldModifier
What a struct field says about itself after its type.
@ kLogLevel
The severity a log or logf may name. [LogLevels].
@ kDurationUnit
A duration suffix: ms, h. [DurationUnits].
@ kStage
A pipeline stage: | first 3. Same table as [StageDocumentation].
@ kModifier
A word that may follow a call's ): via, timeout. [ModifierWords].
@ kOperatorWord
An operator that is a word: and, not. [OperatorWords].
@ kSource
A word that opens a pipeline source rather than naming one: status, zip.
@ kBuiltin
A built-in function, where it is called.
@ kType
A built-in port type name. [TypeNames].
@ kStatusCode
One of Abseil's canonical status codes. [StatusCodes].
@ kStatusField
A field of a status record, read after a .. [StatusFields].
@ kPortModifier
What a port says about itself after its type. [PortModifierWords].
absl::Span< const std::string_view > OrderedBuiltins()
The fixed function set, in the order a listing reads it.
Definition vocabulary.cc:2065
const absl::flat_hash_set< std::string_view > & BareStages()
The two stages that may be written without their leading |.
Definition vocabulary.cc:2032
const absl::flat_hash_set< std::string_view > & ModifierWords()
Words that may follow a call's closing parenthesis.
Definition vocabulary.cc:2121
const WordDoc *absl_nullable StageDocumentation(std::string_view canonical_name)
What a stage does, or nullptr where the name is not a stage.
Definition vocabulary.cc:1836
absl::Span< const WordRole > WordRoles()
Every role, for something walking all of them.
Definition vocabulary.cc:1925
const absl::flat_hash_set< std::string_view > & TypeNames()
The built-in port type names.
Definition vocabulary.cc:2069
std::optional< StageArgument > StageTakes(std::string_view canonical_name)
What a stage takes, or nullopt if the name is not a stage.
Definition vocabulary.cc:1798
absl::Span< const std::string_view > OrderedClauseWords()
The same, in the order they read.
Definition vocabulary.cc:2107
absl::Span< const int > TypeParameters(std::string_view canonical_name)
How many type parameters a built-in type may be given.
Definition vocabulary.cc:2078
std::string Canonical(std::string_view word)
The lower-case form of a uniformly-cased word, or the word unchanged.
Definition vocabulary.cc:1745
absl::Span< const std::string_view > LogLevels()
The severities a log or logf may name, quietest first.
Definition vocabulary.cc:2157
StageArgument
What a stage takes after its name.
Definition vocabulary.h:51
@ kOptionalExpression
An expression, optional, with it bound: | sum, | sum it.price.
@ kLogFormat
An optional level word, a format string, and the values to fill it with, with it bound to the value i...
@ kString
A string, required: | strformat "took {}".
@ kFold
A literal to start from, a name for what is carried, and the expression that folds one value into it:...
@ kNone
Nothing: | collect, | count.
@ kSortKey
An optional by key with it bound, and an optional desc: | sort, | sort by it.score desc.
@ kNumber
A whole number of values: | first 3.
@ kDuration
A length of time: | timeout 30s, | pace 100ms.
@ kStream
Another stream to read after this one: | then other.
@ kOptionalString
A string, optional: | join, | join ", ".
@ kExpression
An expression, with it bound to the value in hand: | where it.ok.
@ kLog
An optional level word and an optional expression, with it bound to the value in hand: | log,...
absl::Span< const std::string_view > Stages()
Definition vocabulary.cc:1794
Definition boundary.cc:32
Every pipeline stage, in the order they read best in a listing.
Definition vocabulary.h:84
std::string_view type
Definition vocabulary.h:86
std::string_view name
Definition vocabulary.h:85
std::string_view description
Definition vocabulary.h:89
bool unary
Whether it carries one value rather than a stream.
Definition vocabulary.h:88
What one word of the language does, as reference an editor can show.
Definition vocabulary.h:116
std::string_view example
One line of Flow showing it in use.
Definition vocabulary.h:127
std::string_view takes
What it takes, spelled the way a reader writes it rather than as a type name: "a count",...
Definition vocabulary.h:122
std::string_view detail
How it behaves, and the caveat if it has one. Markdown, a short paragraph.
Definition vocabulary.h:124
std::string_view summary
One line: what it does. A sentence, because it is shown as one.
Definition vocabulary.h:118