diff options
| author | 夏音 / natsuoto.exe <[email protected]> | 2026-07-01 16:55:53 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-01 16:55:53 +0530 |
| commit | 3d5094a875fbfb167d53278585414fc7884ad521 (patch) | |
| tree | 11609e05d57cff55dbbe0b81f21c7e2363b7011e /tests/errors/formatting.test.py | |
| parent | e859ce24e5ffc95653023669f9edf4d3a0344a8e (diff) | |
| parent | a3a0b80effd34e1ee58e6644ea04e2df2f08dc4b (diff) | |
| download | edify-3d5094a875fbfb167d53278585414fc7884ad521.tar.xz edify-3d5094a875fbfb167d53278585414fc7884ad521.zip | |
feat: convenience char classes .letter() .uppercase() .lowercase() .alphanumeric() (#267)
Adds four convenience ASCII character-class shortcuts so callers don't
have to spell out `.range("a","z").range("A","Z")` for the common cases.
## What is new
- **Chain methods** on `ClassesMixin` — `.letter()` → `[a-zA-Z]`,
`.uppercase()` → `[A-Z]`, `.lowercase()` → `[a-z]`, `.alphanumeric()` →
`[a-zA-Z0-9]`.
- **Leaf elements** — `LetterElement`, `UppercaseElement`,
`LowercaseElement`, `AlphanumericElement` in
`edify.elements.types.leaves`, joined into `LeafElement` and `Element`
unions and rendered by `edify.compile.leaves.render_leaf`.
- **Module constants** — `LETTER`, `UPPERCASE`, `LOWERCASE`,
`ALPHANUMERIC` at both `edify.pattern` and the top-level `edify`
namespace.
## Example
```python
from edify import LETTER, ALPHANUMERIC, START, END, one_or_more
username = START + one_or_more(ALPHANUMERIC) + END
LETTER.test("Q") # True
LETTER.test("4") # False
```
Follows the same dedicated-leaf pattern the existing `.digit()` /
`.word()` / `.whitespace_char()` methods use.
Closes #132
Diffstat (limited to 'tests/errors/formatting.test.py')
0 files changed, 0 insertions, 0 deletions
