Serilization and caching the table works!
This commit is contained in:
@@ -5,6 +5,7 @@ import mem
|
||||
import set
|
||||
import util
|
||||
import conversions
|
||||
import serialize
|
||||
|
||||
fun regex(in: *char):regex {
|
||||
return regex(string::string(in))
|
||||
@@ -40,7 +41,7 @@ obj regexState (Object) {
|
||||
}
|
||||
}
|
||||
|
||||
obj regex (Object) {
|
||||
obj regex (Object, Serializable) {
|
||||
var regexString: string::string
|
||||
var begin: *regexState
|
||||
var referenceCounter: *int
|
||||
@@ -85,6 +86,15 @@ obj regex (Object) {
|
||||
mem::delete(referenceCounter)
|
||||
}
|
||||
}
|
||||
fun serialize(): vector::vector<char> {
|
||||
return serialize::serialize(regexString)
|
||||
}
|
||||
fun unserialize(it: ref vector::vector<char>, pos: int): int {
|
||||
var temp = string::string()
|
||||
util::unpack(temp, pos) = serialize::unserialize<string::string>(it, pos)
|
||||
construct(temp)
|
||||
return pos
|
||||
}
|
||||
|
||||
fun operator==(other: regex):bool {
|
||||
return regexString == other.regexString
|
||||
|
||||
Reference in New Issue
Block a user