Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor deref function #22

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions xpath/common_lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ func (x *CommonLex) LexName(c rune) (int, TokVal) {
}
case "current":
return xutils.CURRENTFUNC, nil
case "deref":
return xutils.DEREFFUNC, nil
default:
if x.nameIsNodeType(name.String()) {
return xutils.NODETYPE, name.String()
Expand Down
4 changes: 0 additions & 4 deletions xpath/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ type context struct {
xpathStmtLoc string // Module:line of original xpath statement.

current Entry
lastEvalPath Entry
actualPathStack *PathStack
predicatePathElemStack *PredicatePathElemStack

Expand Down Expand Up @@ -830,9 +829,6 @@ func (ctx *context) Run() (res *Result) {
for x, instr := range ctx.prog {
ctx.addDebugInstrAndStack(instr.fnName)
instr.fn(ctx)
if instr.fnName == "bltin\t\tderef()" {
ctx.stack = ctx.stack[:len(ctx.stack)-1]
}
ctx.addDebug(ctx.pfx + "----\n")
_ = x
}
Expand Down
2 changes: 2 additions & 0 deletions xpath/grammars/expr/expr_lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ var commonToExprTokenMap = map[int]int{
xutils.DIV: DIV,
xutils.TEXTFUNC: TEXTFUNC,
xutils.CURRENTFUNC: CURRENTFUNC,
xutils.DEREFFUNC: DEREFFUNC,
}

func mapCommonTokenValToExpr(val int) int {
Expand Down Expand Up @@ -143,6 +144,7 @@ var exprToCommonTokenMap = map[int]int{
DIV: xutils.DIV,
TEXTFUNC: xutils.TEXTFUNC,
CURRENTFUNC: xutils.CURRENTFUNC,
DEREFFUNC: xutils.DEREFFUNC,
}

func (expr *exprLex) MapTokenValToCommon(val int) int {
Expand Down
Loading