Skip to content

feat: introduce aggregate parsers#522

Merged
Citymonstret merged 7 commits into2.0.0-devfrom
feature/2.0.0/aggregate-parsers
Nov 29, 2023
Merged

feat: introduce aggregate parsers#522
Citymonstret merged 7 commits into2.0.0-devfrom
feature/2.0.0/aggregate-parsers

Conversation

@Citymonstret
Copy link
Copy Markdown
Member

@Citymonstret Citymonstret commented Nov 25, 2023

Aggregate parsers is a more flexible version of the compound parser.

Example:

final AggregateCommandParser<CommandSender, Location> locationParser = AggregateCommandParser<CommandSender>builder()
    .withComponent("world", worldParser())
    .withComponent("x", integerParser())
    .withComponent("y", integerParser())
    .withComponent("z", integerParser())
    .withMapper(Location.class, (commandContext, aggregateCommandContext) -> {
        final World world = aggregateCommandContext.get("world");
        final int x = aggregateCommandContext.get("x");
        final int y = aggregateCommandContext.get("y");
        final int z = aggregateCommandContext.get("z");
        return CompletableFuture.completedFuture(new Location(world, x, y, z));
     }).build();

@Citymonstret Citymonstret added this to the 2.0.0 milestone Nov 25, 2023
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 25, 2023

Test Results

  69 files  +1    69 suites  +1   13s ⏱️ -7s
447 tests +4  447 ✔️ +4  0 💤 ±0  0 ±0 
459 runs  +4  459 ✔️ +4  0 💤 ±0  0 ±0 

Results for commit 6fe16ce. ± Comparison against base commit eb3631e.

♻️ This comment has been updated with latest results.

@Citymonstret Citymonstret marked this pull request as ready for review November 25, 2023 22:50
@Citymonstret Citymonstret mentioned this pull request Nov 26, 2023
@Citymonstret Citymonstret self-assigned this Nov 26, 2023
@Citymonstret Citymonstret force-pushed the feature/2.0.0/aggregate-parsers branch from cd1966e to 6fe16ce Compare November 26, 2023 13:51
@Citymonstret Citymonstret merged commit 7166c04 into 2.0.0-dev Nov 29, 2023
@Citymonstret Citymonstret deleted the feature/2.0.0/aggregate-parsers branch November 29, 2023 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant