aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2010-12-07 11:44:43 +0100
committerLars Thorsen <[email protected]>2011-11-11 11:58:43 +0100
commit3979cefe5310319d6c7a8c57111c02d5e221486f (patch)
treef2c2e81eb3997b4c6d74da09a9399d7c8aebad49 /lib
parent6d841684ff63ff8cc6295ea4c4461385ab594136 (diff)
downloadotp-3979cefe5310319d6c7a8c57111c02d5e221486f.tar.gz
otp-3979cefe5310319d6c7a8c57111c02d5e221486f.tar.bz2
otp-3979cefe5310319d6c7a8c57111c02d5e221486f.zip
Support more top-level primary expressions
This change allows numbers and literals to be used as top-level primary expressions without failing: 1> xmerl_xpath:string("3", Doc). #xmlObj{type = number,value = 3} 2> xmerl_xpath:string("'foo'", Doc). #xmlObj{type = string,value = "foo"} We still need to allow arithmetic, comparative, boolean and negative expressions, as in `xmerl_xpath_pred:expr/2`.
Diffstat (limited to 'lib')
-rw-r--r--lib/xmerl/src/xmerl_xpath.erl8
-rw-r--r--lib/xmerl/src/xmerl_xpath_lib.erl4
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/xmerl/src/xmerl_xpath.erl b/lib/xmerl/src/xmerl_xpath.erl
index ee06f08029..e53d105ce7 100644
--- a/lib/xmerl/src/xmerl_xpath.erl
+++ b/lib/xmerl/src/xmerl_xpath.erl
@@ -338,13 +338,11 @@ eval_path(filter, {PathExpr, PredExpr}, C = #xmlContext{}) ->
S1 = path_expr(PathExpr, S),
pred_expr(PredExpr, S1).
-eval_primary_expr(FC = {function_call,_,_},S = #state{context = Context}) ->
+eval_primary_expr(PrimExpr, S = #state{context = Context}) ->
%% NewNodeSet = xmerl_xpath_pred:eval(FC, Context),
- NewNodeSet = xmerl_xpath_lib:eval(primary_expr, FC, Context),
+ NewNodeSet = xmerl_xpath_lib:eval(primary_expr, PrimExpr, Context),
NewContext = Context#xmlContext{nodeset = NewNodeSet},
- S#state{context = NewContext};
-eval_primary_expr(PrimExpr,_S) ->
- exit({primary_expression,{not_implemented, PrimExpr}}).
+ S#state{context = NewContext}.
%% axis(Axis,NodeTest,Context::xmlContext()) -> xmlContext()
diff --git a/lib/xmerl/src/xmerl_xpath_lib.erl b/lib/xmerl/src/xmerl_xpath_lib.erl
index cfd0e36667..096f54ec30 100644
--- a/lib/xmerl/src/xmerl_xpath_lib.erl
+++ b/lib/xmerl/src/xmerl_xpath_lib.erl
@@ -49,5 +49,7 @@ primary_expr({function_call, F, Args}, C) ->
%% here, we should look up the function in the context provided
%% by the caller, but we haven't figured this out yet.
exit({not_a_core_function, F})
- end.
+ end;
+primary_expr(PrimExpr, _C) ->
+ exit({primary_expression, {not_implemented, PrimExpr}}).