Fixed parsing of | outside of groups in =~ regex
This commit is contained in:
parent
8a3d259ae6
commit
71bc26aefa
|
@ -357,7 +357,14 @@ readConditionContents single = do
|
||||||
<|> return False
|
<|> return False
|
||||||
readRegex = called "regex" $ do
|
readRegex = called "regex" $ do
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
parts <- many1 (readGroup <|> readSingleQuoted <|> readDoubleQuoted <|> readDollarExpression <|> readNormalLiteral "( " <|> readGlobLiteral)
|
parts <- many1 (
|
||||||
|
readGroup <|>
|
||||||
|
readSingleQuoted <|>
|
||||||
|
readDoubleQuoted <|>
|
||||||
|
readDollarExpression <|>
|
||||||
|
readNormalLiteral "( " <|>
|
||||||
|
readPipeLiteral <|>
|
||||||
|
readGlobLiteral)
|
||||||
disregard spacing
|
disregard spacing
|
||||||
return $ T_NormalWord id parts
|
return $ T_NormalWord id parts
|
||||||
where
|
where
|
||||||
|
@ -375,6 +382,10 @@ readConditionContents single = do
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
str <- readGenericLiteral1 (singleQuote <|> doubleQuotable <|> oneOf "()")
|
str <- readGenericLiteral1 (singleQuote <|> doubleQuotable <|> oneOf "()")
|
||||||
return $ T_Literal id str
|
return $ T_Literal id str
|
||||||
|
readPipeLiteral = do
|
||||||
|
id <- getNextId
|
||||||
|
str <- string "|"
|
||||||
|
return $ T_Literal id str
|
||||||
|
|
||||||
readCondTerm = readCondNot <|> readCondExpr
|
readCondTerm = readCondNot <|> readCondExpr
|
||||||
readCondNot = do
|
readCondNot = do
|
||||||
|
@ -571,6 +582,7 @@ prop_readCondition5a= isOk readCondition "[[ $c =~ a(b) ]]"
|
||||||
prop_readCondition5b= isOk readCondition "[[ $c =~ f( ($var ]]) )* ]]"
|
prop_readCondition5b= isOk readCondition "[[ $c =~ f( ($var ]]) )* ]]"
|
||||||
prop_readCondition6 = isOk readCondition "[[ $c =~ ^[yY]$ ]]"
|
prop_readCondition6 = isOk readCondition "[[ $c =~ ^[yY]$ ]]"
|
||||||
prop_readCondition7 = isOk readCondition "[[ ${line} =~ ^[[:space:]]*# ]]"
|
prop_readCondition7 = isOk readCondition "[[ ${line} =~ ^[[:space:]]*# ]]"
|
||||||
|
prop_readCondition8 = isOk readCondition "[[ $l =~ ogg|flac ]]"
|
||||||
readCondition = called "test expression" $ do
|
readCondition = called "test expression" $ do
|
||||||
opos <- getPosition
|
opos <- getPosition
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
|
|
Loading…
Reference in New Issue