diff --git a/fcore/search-list/nfa.sml b/fcore/search-list/dfa-gen.sml similarity index 97% rename from fcore/search-list/nfa.sml rename to fcore/search-list/dfa-gen.sml index 9d5eeb8..45b439a 100644 --- a/fcore/search-list/nfa.sml +++ b/fcore/search-list/dfa-gen.sml @@ -1,4 +1,4 @@ -structure Nfa = +structure DfaGen = struct datatype regex = CHAR_LITERAL of {char: char, position: int} @@ -100,7 +100,7 @@ struct fun toCharsAndPositionsList tree = helpToCharsAndPositionsList (tree, []) end - structure ParseNfa = + structure ParseDfa = struct (* parsing through precedence climbing algorithm. *) val postfixLevel = 1 @@ -375,7 +375,7 @@ struct end | _ => raise Fail - "nfa.sml 310: should only have loops and concats \ + "dfa-gen.sml 310: should only have loops and concats \ \in list to filter") | [] => acc @@ -487,15 +487,10 @@ struct end end - fun parse str = - case ParseNfa.parse (str, 0) of - SOME (ast, _) => SOME ast - | NONE => NONE - - fun firstposWithChar regex = ToDfa.firstposWithChar (regex, []) - - fun lastpos regex = ToDfa.lastpos (regex, []) - val test = ToDfa.convert + fun fromString str = + case ParseDfa.parse (str, 0) of + SOME (ast, _) => ToDfa.convert ast + | NONE => Vector.fromList [] end -val SOME nfa = Nfa.parse "(a|b)*abb\^@" +val dfa = DfaGen.fromString "(a|b)*abb#" diff --git a/fcore/search-list/nfa b/fcore/search-list/nfa deleted file mode 100755 index 5a61596..0000000 Binary files a/fcore/search-list/nfa and /dev/null differ diff --git a/shf.mlb b/shf.mlb index 5f88385..79630e8 100644 --- a/shf.mlb +++ b/shf.mlb @@ -14,7 +14,7 @@ ann in fcore/persistent-vector.sml end -fcore/search-list/nfa.sml +fcore/search-list/dfa-gen.sml fcore/search-list.sml message-types/input-msg.sml