mirror of
				https://github.com/Garmelon/PFERD.git
				synced 2025-11-04 14:42:49 +01:00 
			
		
		
		
	Allow variable whitespace in arrow rules
This commit is contained in:
		@@ -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.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
\..* -name-re-> !
 | 
			
		||||
__pycache__ -name-> !
 | 
			
		||||
.*\.md -name-re-> !
 | 
			
		||||
\..*        -name-re-> !
 | 
			
		||||
__pycache__ -name->    !
 | 
			
		||||
.*\.md      -name-re-> !
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -255,6 +255,12 @@ def parse_arrow(line: Line) -> str:
 | 
			
		||||
    return "".join(name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def parse_whitespace(line: Line) -> None:
 | 
			
		||||
    line.expect(" ")
 | 
			
		||||
    while line.get() == " ":
 | 
			
		||||
        line.advance()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def parse_rule(line: Line) -> Rule:
 | 
			
		||||
    # Parse left side
 | 
			
		||||
    leftindex = line.index
 | 
			
		||||
@@ -264,13 +270,13 @@ def parse_rule(line: Line) -> Rule:
 | 
			
		||||
        raise RuleParseException(line, "Left side can't be '!'")
 | 
			
		||||
 | 
			
		||||
    # Parse arrow
 | 
			
		||||
    line.expect(" ")
 | 
			
		||||
    parse_whitespace(line)
 | 
			
		||||
    arrowindex = line.index
 | 
			
		||||
    arrowname = parse_arrow(line)
 | 
			
		||||
 | 
			
		||||
    # Parse right side
 | 
			
		||||
    if line.get():
 | 
			
		||||
        line.expect(" ")
 | 
			
		||||
        parse_whitespace(line)
 | 
			
		||||
        right = parse_string(line)
 | 
			
		||||
    else:
 | 
			
		||||
        right = False
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user