Verified Commit a18ebf4d authored by Camil Staps's avatar Camil Staps 🚀

Remove duplicate code

parent c3c019b3
......@@ -136,6 +136,7 @@ patternMatches p s = m [c \\ c <-: p] [c \\ c <-: s]
where
// %: any character
// *: any number of characters (inefficient!)
// \*: the character '*'
// \w: a word character (a-zA-Z_`)
// \e: a word or digit character (a-zA-Z0-9_`)
// other characters are matched literally
......@@ -422,23 +423,6 @@ where
abcSearch (ABCInstructionEntry ie) = (ie.aie_instruction == s, [])
abcSearch _ = (False, [])
patternMatches :: SyntaxPattern String -> Bool
patternMatches p s = m [c \\ c <-: p] [c \\ c <-: s]
where
// %: any character
// *: any number of characters (inefficient!)
// \w: a word character (a-zA-Z_`)
// \e: a word or digit character (a-zA-Z0-9_`)
// other characters are matched literally
m :: [Char] [Char] -> Bool
m [] [] = True
m ['%':p] [_:s] = m p s
m ['*':p] s = any (m p) (tails s)
m ['\\':'w':p] [x:s] = (isAlpha x || x == '_' || x == '`') && m p s
m ['\\':'e':p] [x:s] = (isAlpha x || isDigit x || x == '_' || x == '`') && m p s
m [c:p] [x:s] = c == x && m p s
m _ _ = False
filterExactName :: !String !*CloogleDB -> *CloogleDB
filterExactName n wrap=:{db,name_map}
# db = 'DB'.searchIndices Intersect [(i,[(ExactResult,1)]) \\ i <- idxs] db
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment