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

Using named subpatterns #121

Closed
gocom opened this issue Oct 31, 2013 · 3 comments
Closed

Using named subpatterns #121

gocom opened this issue Oct 31, 2013 · 3 comments

Comments

@gocom
Copy link
Member

gocom commented Oct 31, 2013

This would make parts of the code more readable (the patterns itself) and remove those order dependent list() statements.

The numeric subpattern and list() export is somewhat error prone; the are in two different places. If the order ever happens to change, the list statement will also need updating. But if you accidentally miss one of them, that list statement breaks on the offset change position, which might go unnoticed if a test doesn't use that attribute on some very specific tag.

@netcarver
Copy link
Contributor

Yes, I totally agree. In fact I'm working on a significantly improved link parser (links() and fLink()) at the moment that does use named patterns in the regular expression. Gradually migrating the existing regexes over to named patterns would be helpful.

gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
gocom pushed a commit that referenced this issue Oct 31, 2013
@gocom
Copy link
Member Author

gocom commented Oct 31, 2013

Why is there "after" sub-pattern in Parser::doSpecial()? Its optional (? repetition), so it doesn't really do anything. The after symbol is neither shelved so it must not be about interfering with parsing either. fbb5e91

@gocom
Copy link
Member Author

gocom commented Oct 31, 2013

I suppose it has been used in the past, or for just consistency purposes. I've decided to drop it since it doesn't do anything at this point, and can actually be missing leading to additional code. If the sub-pattern is ever needed back it probably should be changed to a dot, if there must be no restriction on the tag ending.

gocom pushed a commit that referenced this issue Oct 31, 2013
netcarver pushed a commit that referenced this issue Jan 1, 2014
netcarver pushed a commit that referenced this issue Jan 1, 2014
netcarver pushed a commit that referenced this issue Jan 1, 2014
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

2 participants