-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #674 from lindsay-stevens/pyxform-576
576: fix _count suffix name clash with repeats targeting another item
- Loading branch information
Showing
4 changed files
with
78 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from typing import Iterable | ||
|
||
from pyxform.utils import parse_expression | ||
|
||
|
||
def is_single_token_expression(expression: str, token_types: Iterable[str]) -> bool: | ||
""" | ||
Does the expression contain single token of one of the provided token types? | ||
""" | ||
tokens, _ = parse_expression(text=expression.strip()) | ||
if 1 == len(tokens) and tokens[0].name in token_types: | ||
return True | ||
else: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters