|
|
|
|
|
by LoSboccacc
2477 days ago
|
|
yeah, and you can have a grammar with a single production using ALL : .* - you're missing the forest for the tree. regex are ok for text that's context free, so they match perfectly for the lexing°. once you need context then are back to whacky hacks, layers and loops of regexes or preparser that remove the hard part out of the content - basically you're rolling your own grammar except manually, on the wrong toolchain and on your own. "can I build my raster engine to draw poligons on screen" "well yes but is going to cost a lot of time, be error prone and miss a lot of features from ready to use solutions" °you can actually put token production in the lexer itself between expressions, so they can already handle more than plain rexeg even in lexing. |
|
Great if you can recommend a tool which can solve the task easier. But saying it is "not possible" is unhelpful and confusing. It is just giving lots of people really confused ideas about what is possible and not possible using regexes.
To use your own example: "Can I build my raster engine to draw polygons on screen?"
Not helpful: "No that is simply not logically possible due to the laws of geometry, and you are an idiot for even thinking such a thing is possible"
Helpful: "Yeas, but it is a lot of work if you want to support anti-aliasing, smooth scaling and so on. Using a library like XYZ would probably save you a lot of work in the long run".