Commit Graph

94 Commits

Author SHA1 Message Date
cmounce 84f35c8b44 Overhaul label sanitization logic
Besides code cleanup, this commit changes the sanitization logic to
avoid numeric digits altogether. Previously, they had been allowed at
the end of a label name, but this is susceptible to a ZZT parser bug:
`#foo` matches `:foo2` because ZZT allows a prefix match if the next
character is a digit.
2025-07-20 01:39:24 -07:00
cmounce 85ba7b63c8 Add license, description 2025-07-13 02:30:40 -07:00
cmounce f6df3222ab Rename macro crate, start prepping for publish 2025-07-13 02:15:22 -07:00
cmounce 8817cd8e2e Upgrade nom from 7.1 to 8.0 2025-07-11 03:28:26 -07:00
cmounce 3bddc3c85e Implement new algorithm for local label processing
This change allows qualified references to local labels from other
sections: you can do `#send section.local` and it will take you to the
appropriate `:.local` label. When `section.local` is ambiguous due to
sections/locals sharing the same names, the reference resolves to the
local in the first such section.
2025-07-11 02:18:17 -07:00
cmounce d751aade99 Document purposes of functions in encoding.rs 2025-07-10 22:15:20 -07:00
cmounce 051e08fba9 Fix serialization for stats with non-ASCII code 2025-07-07 11:53:49 -07:00
cmounce 3afc112810 Fix parser bug: icase literals and non-ASCII input 2025-07-07 11:18:15 -07:00
cmounce 10307f3861 Rename project 2025-07-06 22:02:11 -07:00
cmounce e560ce88b6 Remove Pest, update dependencies 2025-07-06 14:20:30 -07:00
cmounce 218700616c Clean up CLI, add arguments and some validation 2025-07-06 14:03:10 -07:00
cmounce 3ff40241ee Add more error messages for local/anonymous labels 2025-07-06 01:06:11 -07:00
cmounce eee57848e0 Add tests for label-processing diagnostics 2025-07-05 23:30:10 -07:00
cmounce 2e5999ef1e Add context lines to diagnostic messages 2025-07-05 22:01:13 -07:00
cmounce 9a245190d7 Shrink error Context and reduce cloning 2025-07-05 18:36:05 -07:00
cmounce 2b35fe30e9 Add errors for broken anonymous label references 2025-07-04 17:02:18 -07:00
cmounce a86c4f9e4a Add Context struct for locating compiler messages 2025-07-03 22:27:35 -07:00
cmounce 51efcdec18 Fix missing line/col info in warning message 2025-06-29 01:47:36 -07:00
cmounce 1deccaf9c8 Add first warning to compiler output 2025-06-29 01:46:07 -07:00
cmounce c29361214a Clean up main.rs, stdout, some compile warnings 2025-06-22 15:08:02 -07:00
cmounce b65e188cb9 Flesh out support for namespaces 2025-06-22 01:10:47 -07:00
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