Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating SWEET parser #265

Merged
merged 11 commits into from
Aug 25, 2024
Merged

Conversation

lavafroth
Copy link
Contributor

@lavafroth lavafroth commented Jul 14, 2024

Google Summer of Code Final Submission

Overview

  • Keysym and modifier structs are replaced with respective structs from the crates
  • evdev keys are automatically parsed in a single pass of the parser
  • Commands
    • Command chunks inside shorthands must be escaped as and when needed. For example {a-program, b-program} is invalid since the dash will be considered a range. The only correct syntax is {a\-program, b\-program} when using shorthands with commands.
    • Commands sprinked with &&-mode instructions extract the instructions as an attribute of the Definition struct during parsing
  • Removed manual implementation of logical errors (handled by new parser) grammar errors (handled by pest.rs)
  • Added small match block to translate sweet::Modifier variants to local Modifier variants
  • Unified shorthand syntax: there's at most one way to do shorthands correct
    • A shorthand must contain at least two variants. One should not use shorthands otherwise
    • Any literal like a comma or a curly brace inside a shorthand must be escaped
    • Literals do not need to be escaped outside shorthand contexts.
    • Shorthands with omissions (underscore elements) must always have a concatenator appended to each non-empty element. For example, unlike {control, super} + a, in {_, super + } a adding a plus to super inside the shorthand is the only valid syntax. This can be compared to expansions in bash
  • There's a 50 MiB filesize cap for the config file as a precaution against accidental actions on the user end. This filesize cap can be changed by passing an environment variable or modifying the build.rs.
  • The parser only accepts regular files so that the user does accidentally feed in block devices like their entire drives
  • All of the tests for the daemon are ported to use the grammar and are moved to the grammar crate. See tests/tests.rs
    • Some tests are stricter than the previous iteration due to the strict nature of the EBNF grammar itself. For example: commented out binding definitions with dangling commands are no longer valid
    • Temporary files for tests are handled using the temporary file architecture for the respective platform

swhkd/src/config.rs Fixed Show fixed Hide fixed
swhkd/src/config.rs Fixed Show fixed Hide fixed
@lavafroth lavafroth marked this pull request as ready for review August 1, 2024 02:22
Shinyzenith
Shinyzenith previously approved these changes Aug 24, 2024
@Shinyzenith
Copy link
Member

Minor issue, we need the sweet stuff in tree. After that this pr is good to go r🚀🚢🚢🚢🚢🚢⚓

@Shinyzenith Shinyzenith merged commit f2bee30 into waycrate:main Aug 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants