Verified Commit 34730858 authored by Camil Staps's avatar Camil Staps 🙂

Adapt to new API in CleanRegex

parent 91bd10e0
Subproject commit 44591c3d9744386a8886265f258b18a7124e8ee2
Subproject commit f1a793beafbc4e5848e2a6097dd977a6cfbf9bdf
......@@ -16,7 +16,7 @@ from Database.Native import :: NativeDB, :: Entry, :: Index
from System.FilePath import :: FilePath
from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNode
from Regex import :: Regex
from Regex import :: CompiledRegex
from Clean.Doc import :: FunctionDoc, :: TypeDoc, :: ClassDoc, :: ModuleDoc
......@@ -188,7 +188,7 @@ location :: !Library !String !FilePath !LineNr !LineNr !Name -> Location
*/
:: SyntaxEntry =
{ syntax_title :: !String //* The name of the construct
, syntax_patterns :: ![Regex] //* Patterns to search for the construct
, syntax_patterns :: ![CompiledRegex] //* Patterns to search for the construct
, syntax_code :: ![String] //* Strings describing the construct, as short as possible
, syntax_description :: !String //* A description for documentation
, syntax_doc_locations :: ![CleanLangReportLocation] //* Where to find documentation on the construct
......
......@@ -43,7 +43,7 @@ from Text import class Text(concat), instance Text String
import Text.GenJSON
import qualified Regex
from Regex import :: Regex, :: GroupId
from Regex import :: CompiledRegex
import Clean.Types
import Clean.Types.Tree
......@@ -69,14 +69,14 @@ derive JSONEncode ClassDoc, ClassEntry, ClassMemberDoc, CloogleEntry,
SyntaxEntry, Type, TypeDef, TypeDefEntry, TypeDefRhs, TypeDoc, ParamDoc,
TypeContext, TypeRestriction, ABCInstructionEntry, PropertyBootstrapDoc,
Property, PropertyVarInstantiation, MultiLineString, NGramIndex,
PropertyTestGenerator, Regex, GroupId
PropertyTestGenerator
derive JSONDecode ClassDoc, ClassEntry, ClassMemberDoc, CloogleEntry,
Constructor, ConstructorDoc, DeriveEntry, FunctionDoc, FunctionEntry,
InstanceEntry, Location, ModuleDoc, ModuleEntry, Priority, RecordField,
SyntaxEntry, Type, TypeDef, TypeDefEntry, TypeDefRhs, TypeDoc, ParamDoc,
TypeContext, TypeRestriction, ABCInstructionEntry, PropertyBootstrapDoc,
Property, PropertyVarInstantiation, MultiLineString, NGramIndex,
PropertyTestGenerator, Regex, GroupId
PropertyTestGenerator
printersperse :: Bool a [b] -> [String] | print a & print b
printersperse ia a bs = intercalate (print False a) (map (print ia) bs)
......@@ -420,8 +420,7 @@ filterName :: !String !*CloogleDB -> *CloogleDB
filterName query wrap=:{db,name_ngrams,syntax,abc_instrs}
# (indices,db) = mapSt (uncurry getIndexWithDistance) ('Data.NGramIndex'.search query name_ngrams) db
# db = 'Database.Native'.searchIndices Intersect (catMaybes indices) db
#! querycs = [c \\ c <-: query]
# db = 'Database.Native'.searchWithIndices` (syntaxSearch querycs) syntax db
# db = 'Database.Native'.searchWithIndices` (syntaxSearch query) syntax db
# db = 'Database.Native'.searchWithIndices` (abcSearch query) abc_instrs db
= {wrap & db=db}
where
......@@ -447,14 +446,13 @@ where
filterExactName :: !String !*CloogleDB -> *CloogleDB
filterExactName name wrap=:{db,name_map,syntax,abc_instrs}
# db = 'Database.Native'.searchIndices Intersect [(i,[!ExactResult!]) \\ i <-: idxs] db
#! namecs = [c \\ c <-: name]
# db = 'Database.Native'.searchWithIndices` (syntaxSearch namecs) syntax db
# db = 'Database.Native'.searchWithIndices` (syntaxSearch name) syntax db
# db = 'Database.Native'.searchWithIndices` (abcSearch name) abc_instrs db
= {wrap & db=db}
where
idxs = fromMaybe {} $ get name name_map
syntaxSearch :: ![Char] !CloogleEntry -> (!Bool, ![!Annotation!])
syntaxSearch :: !String !CloogleEntry -> (!Bool, ![!Annotation!])
syntaxSearch query (SyntaxEntry se)
= (any (not o isEmpty o flip 'Regex'.match query) se.syntax_patterns, [!!])
syntaxSearch _ _ = (False, [!!])
......
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