Optimizations, regex character ranges
This commit is contained in:
@@ -179,22 +179,22 @@ obj grammer (Object, Serializable) {
|
||||
}
|
||||
fun first_vector(rhs: ref vector::vector<symbol::symbol>): set::set<symbol::symbol> {
|
||||
var toRet = set::set<symbol::symbol>()
|
||||
if (rhs.size) {
|
||||
for (var i = 0; i < rhs.size; i++;) {
|
||||
var lookahead = first_set_map[rhs[i]]
|
||||
if (lookahead.contains(symbol::null_symbol())) {
|
||||
// remove the null if this is not the last in the rule
|
||||
if (i != rhs.size-1)
|
||||
lookahead.remove(symbol::null_symbol())
|
||||
toRet.add(lookahead)
|
||||
} else {
|
||||
toRet.add(lookahead)
|
||||
break
|
||||
}
|
||||
if (rhs.size) {
|
||||
for (var i = 0; i < rhs.size; i++;) {
|
||||
var lookahead = first_set_map[rhs[i]]
|
||||
if (lookahead.contains(symbol::null_symbol())) {
|
||||
// remove the null if this is not the last in the rule
|
||||
if (i != rhs.size-1)
|
||||
lookahead.remove(symbol::null_symbol())
|
||||
toRet.add(lookahead)
|
||||
} else {
|
||||
toRet.add(lookahead)
|
||||
break
|
||||
}
|
||||
} else {
|
||||
toRet.add(symbol::null_symbol())
|
||||
}
|
||||
} else {
|
||||
toRet.add(symbol::null_symbol())
|
||||
}
|
||||
return toRet
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user