Skip to content

Separate grammar for query syntax #14

Open
@DrSensor

Description

@DrSensor

Rather than having a bunch of helper function like this:

/// Filter by the current state
fn filter_from(self, state: &str) -> Self::Iter;
/// Filter by the target/next state
fn filter_to(self, state: &str) -> Self::Iter;
/// Group by the current state
fn group_by_from(self, state: &str) -> Self::Map;
/// Group by the target/next state
fn group_by_to(self, state: &str) -> Self::Map;
/// Remove duplicated current state
fn dedupe_from(self, state: &str) -> Self::Iter;
/// Remove duplicated target/next state
fn dedupe_to(self, state: &str) -> Self::Iter;

I think it would be efficient to create separate grammar specialize for querying the state machine. This might be handy when the declaration can be visualized and you want to filter it out using the query syntax.

The query syntax probably will rely on the globbing pattern and boolean operation. For example:

(* -> *) | (A -> * @ Power*) & (* -> C @ *)

☝️ Read as: seach all transient transition or all transition from state A with event name prefixed with Power and all transtition to state C on all event (including empty-event/transiten-transition)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions