mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Allow variable whitespace in arrow rules
This commit is contained in:
parent
f897d7c2e1
commit
a6fdf05ee9
@ -285,7 +285,7 @@ For this task, the name arrows can be used. They are variants of the normal
|
|||||||
arrows that only look at the file name instead of the entire path.
|
arrows that only look at the file name instead of the entire path.
|
||||||
|
|
||||||
```
|
```
|
||||||
\..* -name-re-> !
|
\..* -name-re-> !
|
||||||
__pycache__ -name-> !
|
__pycache__ -name-> !
|
||||||
.*\.md -name-re-> !
|
.*\.md -name-re-> !
|
||||||
```
|
```
|
||||||
|
@ -255,6 +255,12 @@ def parse_arrow(line: Line) -> str:
|
|||||||
return "".join(name)
|
return "".join(name)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_whitespace(line: Line) -> None:
|
||||||
|
line.expect(" ")
|
||||||
|
while line.get() == " ":
|
||||||
|
line.advance()
|
||||||
|
|
||||||
|
|
||||||
def parse_rule(line: Line) -> Rule:
|
def parse_rule(line: Line) -> Rule:
|
||||||
# Parse left side
|
# Parse left side
|
||||||
leftindex = line.index
|
leftindex = line.index
|
||||||
@ -264,13 +270,13 @@ def parse_rule(line: Line) -> Rule:
|
|||||||
raise RuleParseException(line, "Left side can't be '!'")
|
raise RuleParseException(line, "Left side can't be '!'")
|
||||||
|
|
||||||
# Parse arrow
|
# Parse arrow
|
||||||
line.expect(" ")
|
parse_whitespace(line)
|
||||||
arrowindex = line.index
|
arrowindex = line.index
|
||||||
arrowname = parse_arrow(line)
|
arrowname = parse_arrow(line)
|
||||||
|
|
||||||
# Parse right side
|
# Parse right side
|
||||||
if line.get():
|
if line.get():
|
||||||
line.expect(" ")
|
parse_whitespace(line)
|
||||||
right = parse_string(line)
|
right = parse_string(line)
|
||||||
else:
|
else:
|
||||||
right = False
|
right = False
|
||||||
|
Loading…
Reference in New Issue
Block a user