1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-14 11:23:02 +02:00
ferret/pkg/drivers/type.go
Tim Voronov 34c8c02258
Refactoring/externalized html (#234)
* Externalized HTML drivers

* Fixed unit tests

* Updated logging

* Added support to set default driver

* Updated GetIn and SetIn helpers
2019-02-19 18:10:18 -05:00

39 lines
554 B
Go

package drivers
import "github.com/MontFerret/ferret/pkg/runtime/core"
var (
HTMLElementType = core.NewType("HTMLElement")
HTMLDocumentType = core.NewType("HTMLDocument")
)
// Comparison table of builtin types
var typeComparisonTable = map[core.Type]uint64{
HTMLElementType: 0,
HTMLDocumentType: 1,
}
func Compare(first, second core.Type) int64 {
f, ok := typeComparisonTable[first]
if !ok {
return -1
}
s, ok := typeComparisonTable[second]
if !ok {
return -1
}
if f == s {
return 0
}
if f > s {
return 1
}
return -1
}