Skip to content

Conversation

@davesnx
Copy link
Owner

@davesnx davesnx commented Dec 15, 2025

Summary

  • Eliminate all reduce/reduce conflicts (4 states → 0)
  • Reduce shift/reduce conflicts (52 states → 28, -46%)
  • Add 264 comprehensive parser tests as a safety net for future refactoring

Key grammar changes

  • Merge overlapping rule alternatives (style_rule, keyframes, declarations)
  • Unify pseudo_class_selector FUNCTION alternatives using relative_selector_list
  • Factor attribute_selector using attr_matcher_part helper
  • Remove redundant SEMI_COLON? from brace_block and other rules
  • Simplify complex_selector using list() instead of two alternatives

Test coverage

New comprehensive tests covering:

  • Selectors (type, class, ID, universal, attribute, compound)
  • Combinators (descendant, child, adjacent, general sibling)
  • Pseudo-classes and pseudo-elements
  • CSS nesting with ampersand
  • At-rules (@media, @Keyframes, @charset, @import, @supports)
  • Declarations, CSS variables, and !important

Notes

The remaining 28 shift/reduce conflicts are structural - they stem from WS being both a meaningful token (value: | WS { Whitespace }) and an optional separator (WS?). Further reduction would require fundamental changes to whitespace handling.

Grammar refactoring to reduce Menhir conflicts:
- Eliminate all reduce/reduce conflicts (4 states → 0)
- Reduce shift/reduce conflicts (52 states → 28)

Key changes:
- Merge overlapping rule alternatives (style_rule, keyframes, declarations)
- Unify pseudo_class_selector FUNCTION alternatives
- Factor attribute_selector using attr_matcher_part helper
- Remove redundant SEMI_COLON? from brace_block and other rules
- Simplify complex_selector using list() instead of two alternatives

Add 264 comprehensive parser tests covering:
- Selectors (type, class, ID, universal, attribute, compound)
- Combinators (descendant, child, adjacent, general sibling)
- Pseudo-classes and pseudo-elements
- CSS nesting with ampersand
- At-rules (@media, @Keyframes, @charset, @import, @supports)
- Declarations, CSS variables, and !important
@cursor
Copy link

cursor bot commented Dec 15, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on January 5.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@vercel
Copy link

vercel bot commented Dec 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
styled-ppx Ignored Ignored Dec 15, 2025 7:52am

@davesnx davesnx closed this Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants