ed-cooper / Ebnf.Compiler

Compiles EBNF statements to C# DLLs
MIT License
2 stars 0 forks source link

Add ranges / RegEx syntax support #4

Open furesoft opened 5 years ago

furesoft commented 5 years ago

pls add ranges so its easier to use umbers and letters like:

num = [0-9] letter = ["a" - "z"]

ed-cooper commented 5 years ago

Development on this project has been mostly completed now except for mostly tidying things up. Despite this, I agree that it would be a useful addition. The simplest implementation for this would actually be to use Regex (although it might not quite comply with the ISO specification I was aiming to follow). Therefore, I'll leave this issue open for anyone who wants to contribute. Note that contributions must also update the documentation to show the new syntax.

furesoft commented 5 years ago

what about this syntax for regex?

range = /[a-zA-Z]+/;

or

range = !"[a-zA-Z]+";

or similar

furesoft commented 5 years ago

i have createt a pull request that converts !"pattern" to regex evaluation, im working on a real regex parser that can convert to c# code without using regex class

ed-cooper commented 5 years ago

My personal preference here is actually for the first syntax - this syntax is more standard and allows the option of considering adding RegEx flags support in the future.

Also, please reference pull requests by typing a # symbol followed by its id, e.g. #7.