Closed ricilake closed 2 years ago
I think it should default to no flags like it is. So perhaps just update the documentation?
This is probably a documentation hold-over from the days of PLY. Fixed the docs. If different reflags
are desired, they can be specified on the Lexer class itself.
class MyLexer(Lexer):
reflags = re.VERBOSE
...
At https://github.com/dabeaz/sly/blob/master/docs/sly.rst?plain=1#L141 the documentation says:
That matches the Ply documentation and practice. But the Sly Lexer class sets
reflags
to 0 at construction, so that the patterns are actually compiled with no flags set.I don't know what the intention was, and really it doesn't much matter to me whether or not the
re.VERBOSE
flag is the default, but I do think that the documentation should match the behaviour. Otherwise, it's confusing, particularly when the behaviour is a change from Ply.Noticed while responding to a question on SO; it's not relevant to the question, which is about Ply, but it did confuse another responder: https://stackoverflow.com/a/71369713/1566221.