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

is it an issue ? #12

Closed
PGDataHome opened this issue Mar 30, 2024 · 0 comments
Closed

is it an issue ? #12

PGDataHome opened this issue Mar 30, 2024 · 0 comments

Comments

@PGDataHome
Copy link

It seems i cannot do some elementary parsing

is it me ? or ?


#!/bin/env python

import asyncio
from bite import Parser, CharacterSet, Combine, Group, Literal, parse_bytes, Suppress, Opt, ZeroOrMore

upper_case= CharacterSet(b'ABCDEFGHIJKLMNOPQRSTUVWXZ')

lower_case= CharacterSet(b'abcdefghijklmnopqrstuvwxz')

upper_case= CharacterSet(bytes(range(ord(b'A'),1+ord(b'Z'))))
lower_case= CharacterSet(bytes(range(ord(b'a'),1+ord(b'z'))))

digit = CharacterSet(b'0123456789')
digits = digit[1, ...]

integer = Combine(digits)
letter=lower_case|upper_case
char=letter|digit

ident = Combine(letter + (char | '_')[0, ...])

obj = parse_bytes( ident, "un")
result = asyncio.run( obj )
print(result


Input: 'un'
^ location of error

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

No branches or pull requests

1 participant