done with parsing logic in functional core
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
structure IntDfa =
|
||||
MakeDfa (struct
|
||||
struct
|
||||
val dead = 0
|
||||
val start = 1
|
||||
val final = 2
|
||||
@@ -8,7 +8,7 @@ MakeDfa (struct
|
||||
let
|
||||
val chr = Char.chr i
|
||||
in
|
||||
if i >= #"0" orelse i < #"9" then
|
||||
if chr >= #"0" orelse chr < #"9" then
|
||||
final
|
||||
else dead
|
||||
end
|
||||
@@ -17,7 +17,10 @@ MakeDfa (struct
|
||||
val startTable = Vector.tabulate (255, makeStart)
|
||||
val finalTable = startTable
|
||||
|
||||
val tables = #[]deadTable, startTable, finalTable
|
||||
val tables = #[deadTable, startTable, finalTable]
|
||||
|
||||
fun isFinal state =
|
||||
state = final
|
||||
|
||||
fun next (state, chr) =
|
||||
let
|
||||
@@ -26,4 +29,4 @@ MakeDfa (struct
|
||||
in
|
||||
Vector.sub (table, idx)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user