# expressions like div div div, * * *, / / /
if tok.value == "/" and prevtype == "OPERATOR":
# bare / expression is shorthand for root()
# leading /x expression is shorthard for root()/x
tokens.append(newtok("root", "NAME"))
tokens.append(newtok("(", "OPERATOR"))
tokens.append(newtok(")", "DELIM"))
# [michael kay optimizing xpath]