Commit Graph

73 Commits

Author SHA1 Message Date
cmounce 84cec642a3 Use section numbers when resolving local labels
This changes the semantics of local labels. Previously, local labels
were just shorthand for writing out `name.local`, which meant if there
were multiple sections named "name", there could potentially be name
collisions.

This commit adds a unique numeric suffix to each section's ID string.
This guarantees that locals in one section won't interfere with those in
a different section.
2025-06-21 22:14:02 -07:00
cmounce 34f808e042 Refactor Registry to take &str, not &LabelName 2025-06-20 02:15:58 -07:00
cmounce 71906cf4b8 Add support for local labels 2025-06-20 02:14:13 -07:00
cmounce 0f59dd668a Finish adding anonymous labels, unit tests 2025-06-18 00:40:43 -07:00
cmounce b5c817d64d Partial implementation of anonymous labels 2025-06-17 02:34:26 -07:00
cmounce 73ca64e4e9 Add helper for generating anonymous labels 2025-06-17 01:36:23 -07:00
cmounce 0b2fc58fae Refactor parse_stat_labels() 2025-06-17 00:40:45 -07:00
cmounce 68938b5e00 Wire together initial label sanitization pass 2025-06-15 12:48:44 -07:00
cmounce 30e81381ff Write label sanitizer 2025-06-15 11:44:30 -07:00
cmounce 0f7616a5a9 Add ability to walk the capture group tree 2025-06-14 13:26:50 -07:00
cmounce bdb5650904 Write initial code for parsing stats into chunks 2025-06-14 12:48:55 -07:00
cmounce 979eeccfe8 Completely remove legacy combinator-based parser 2025-06-08 19:05:30 -07:00
cmounce 6ea50ac3f0 Switch unit tests to new label parser 2025-06-08 18:53:38 -07:00
cmounce c5df4e1ce0 Reimplement label parser using grammar! macro 2025-06-08 14:04:16 -07:00
cmounce c3917a62b7 Fix codegen for ordered choice operator 2025-06-08 12:51:08 -07:00
cmounce 26a38742f8 Fix bug with literal_i() going beyond EOI 2025-06-07 13:18:49 -07:00
cmounce ea0c5ff7ad Hide low-level parser code in backend module 2025-06-07 12:26:44 -07:00
cmounce 75315499bc Add capture groups to proc macro
- Add capture syntax to grammar!
- Generate Tag enum
- Add ParserState helpers, code generation
2025-06-07 02:13:07 -07:00
cmounce 7940183c70 Port capture group implementation to ParseState 2025-06-01 19:43:48 -07:00
cmounce 96b6733dcb Add @icase decorator 2025-06-01 11:29:31 -07:00
cmounce 4a065db1e6 Track icase with booleans, not separate enum vals 2025-06-01 10:16:25 -07:00
cmounce ad6d8e182b Add case-insensitive matching 2025-05-30 00:41:05 -07:00
cmounce df99d78a64 Add special matchers, lookahead operators 2025-05-28 01:11:41 -07:00
cmounce ee5451e2b5 Add support for compound groups to grammar! macro 2025-05-27 01:30:34 -07:00
cmounce 02a3e9b267 Add grammar! matching on character ranges 2025-05-26 23:43:29 -07:00
cmounce 0994054291 Clean up old code, add option/star/plus ops 2025-05-26 20:56:14 -07:00
cmounce ff9d471e00 Clean up grammar! code generation 2025-05-26 02:00:46 -07:00
cmounce 2a935840fd Add grammar! support for choice operator 2025-05-26 00:42:11 -07:00
cmounce 1e90a68ee8 Generate actual parsing code in grammar! macro 2025-05-26 00:18:15 -07:00
cmounce 63dc9790ed Refactor Term to allow sequences 2025-05-25 21:17:34 -07:00
cmounce 2305e6453f Hacking on grammar! proc macro
- Generated functions take parser state as input
- Start of code generation
- WIP modeling of sequences
2025-05-25 19:52:16 -07:00
cmounce 6933ae47b4 Add basic rule definitions to grammar proc macro 2025-05-25 03:18:56 -07:00
cmounce 1d8c939400 Try generating named functions via proc macros 2025-05-25 02:20:03 -07:00
cmounce 59392ccad2 Playing with proc macros 2025-05-23 23:21:51 -07:00
cmounce 856f817dbe Add parsing for label refs, shorthand sends 2025-05-23 21:46:55 -07:00
cmounce 773ee19158 WIP Progress on parsing labels
- Add parsing for motion at start of line
- Start parsing if statements
- Add first file-based parsing test
- Implement Rule for `Box<dyn Rule>`
2025-05-19 01:25:29 -07:00
cmounce cd8cc1dd57 Add parsing for conditions, directions, tile kinds 2025-05-12 00:02:20 -07:00
cmounce d895bd27ab WIP parsing sends 2025-05-11 18:37:02 -07:00
cmounce b21fe8b5e3 Tighten label name parsing
This includes some custom syntax I'm pretty sure about, such as
namespaces and local labels.
2025-05-11 02:19:28 -07:00
cmounce 0c5bacc341 Add combinator NoCase 2025-05-11 01:47:04 -07:00
cmounce b685e4e657 Add combinator Plus 2025-05-11 01:14:52 -07:00
cmounce dec8213638 Implement nested capture groups, iterators 2025-05-10 20:08:22 -07:00
cmounce c027089936 Clean up PEG parser code
- Reorder Parser-centric structs
- Rename fields for consistency
- Make RawCapture private
2025-05-10 20:04:28 -07:00
cmounce dbe4e8963e Proof of concept parsing: print all labels 2025-05-10 17:43:17 -07:00
cmounce 6d33bd5838 Add a very basic capture group iterator
- Add a basic iterator over Event
- Use single struct per capture group to store capture info
2025-05-10 17:43:17 -07:00
cmounce 4be8add5c0 Add basic capture groups 2025-05-09 23:55:38 -07:00
cmounce 661a9aa286 Revise trait Rule to return bool 2025-05-09 23:21:32 -07:00
cmounce f3ab9679cc Refactor parser tests to be more consistent 2025-05-09 23:13:02 -07:00
cmounce b52da476f0 Flesh out grammar for parsing labels 2025-05-09 22:46:38 -07:00
cmounce 5d59f5b31f Add some more PEG parser features
- Add combinators: Dot, Opt
- Add lookahead combinators: And, Not
- Make more things `pub`
2025-05-09 21:56:26 -07:00