-
-
Notifications
You must be signed in to change notification settings - Fork 46
Enhance code quality and robustness: fixes for pattern context, parser loop, namespace validation, week validation, and bitflags #287
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
Changes from all commits
413deab
c4ebe28
38a5012
12a0b80
1876e43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1091,16 +1091,20 @@ def parse_selectors( | |
| # Some patterns require additional logic, such as default. We try to make these the | ||
| # last pattern, and append the appropriate flag to that selector which communicates | ||
| # to the matcher what additional logic is required. | ||
| # Preserve any flags that were set during parsing (e.g. :empty, :root) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would need to see evidence via new test(s), showing why this is needed. |
||
| # by combining them with these special processing flags. Using | ||
| # assignment here would overwrite previously-set flags and break | ||
| # matching logic that depends on combined bitflags. | ||
| if is_default: | ||
| selectors[-1].flags = ct.SEL_DEFAULT | ||
| selectors[-1].flags |= ct.SEL_DEFAULT | ||
| if is_indeterminate: | ||
| selectors[-1].flags = ct.SEL_INDETERMINATE | ||
| selectors[-1].flags |= ct.SEL_INDETERMINATE | ||
| if is_in_range: | ||
| selectors[-1].flags = ct.SEL_IN_RANGE | ||
| selectors[-1].flags |= ct.SEL_IN_RANGE | ||
| if is_out_of_range: | ||
| selectors[-1].flags = ct.SEL_OUT_OF_RANGE | ||
| selectors[-1].flags |= ct.SEL_OUT_OF_RANGE | ||
| if is_placeholder_shown: | ||
| selectors[-1].flags = ct.SEL_PLACEHOLDER_SHOWN | ||
| selectors[-1].flags |= ct.SEL_PLACEHOLDER_SHOWN | ||
|
|
||
| # Return selector list | ||
| return ct.SelectorList([s.freeze() for s in selectors], is_not, is_html) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,7 +95,7 @@ def get_pattern_context(pattern: str, index: int) -> tuple[str, int, int]: | |
| col = index - last + 1 | ||
| elif last <= index < m.end(0): | ||
| indent = '--> ' | ||
| offset = (-1 if index > m.start(0) else 0) + 3 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced this fixes anything, but tests show it regresses one of our tests. I'm open to making a change if a real case can be demonstrated, but it seems like the logic would have to be altered to keep the existing tests working and solve the new test case, if one was shown to need fixing. |
||
| offset = (-1 if index > m.start(0) else 0) + 2 | ||
| col = index - last + 1 | ||
| else: | ||
| indent = ' ' | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.