Skip to main content

Crate bern_syntax

Crate bern_syntax 

Source
Expand description

The one parser for Bern declarations.

Procedural macros use it to expand declarations for rustc, and the metadata collector uses it to read the same source files without running application code. Keeping a single parser means both sides always agree on what a declaration means.

Re-exports§

pub use items::CommandItem;
pub use items::CommandParam;
pub use items::CommandRef;
pub use items::CommandsItem;
pub use items::ComponentItem;
pub use items::EventItem;
pub use items::EventsItem;
pub use items::FeatureItem;
pub use items::FeaturesItem;
pub use items::FieldItem;
pub use items::Param;
pub use items::ParamKind;
pub use items::PlayerField;
pub use items::PlayersItem;
pub use items::ProtocolArgs;
pub use items::ProtocolItem;
pub use items::QueriesItem;
pub use items::QueryItem;
pub use items::SessionItem;
pub use items::SourceItems;
pub use items::StateItem;
pub use items::ValueItem;
pub use items::ValueKind;
pub use items::VariantItem;
pub use items::doc_comment;
pub use items::is_bern_attr;
pub use items::parse_component;
pub use items::parse_component_args;
pub use items::parse_component_with;
pub use items::parse_features;
pub use items::parse_players;
pub use items::parse_protocol;
pub use items::parse_protocol_args;
pub use items::parse_session;
pub use items::parse_source_file;
pub use items::parse_value;
pub use items::parse_value_args;
pub use items::type_ref;
pub use style::CornerBlock;
pub use style::MotionDecl;
pub use style::StyleArg;
pub use style::StyleItem;
pub use style::StyleProp;
pub use style::StyleRuleItem;
pub use style::StyleValue;
pub use style::parse_style;
pub use ast::*;

Modules§

ast
Syntax tree for Bern declarations. Spans are kept so diagnostics from both the macros and the build tool point at the developer’s source.
build
Compile-time module selection, shared by the metadata compiler and Rust macros.
items
Item-level declarations: protocol modules, value types, session state and components. The macros and the collector parse them identically.
lower
Lowering of declarations to protocol schema, shared by the macros and the build tool so both derive identical descriptors.
style
style!: the application’s style overrides and motion tokens.

Functions§

camel_case
Convert snake_case to camelCase.
mentions
Whether a type mentions the named type anywhere.
named
Call visit with the name of each named type ty refers to.
parse_tr
Parse a standalone tr! invocation body.
parse_ui
Parse the body of a ui! invocation.
pascal_case
Convert snake_case to PascalCase.
valid_id
Lower snake case identifiers used for ids: preview, main_window.