From 03be9f241c1f4040ae5936f43c25b801f9bc7708 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 23 Jun 2014 10:36:42 +0200 Subject: [PATCH] Docs on Racc operator precedence. --- lib/oga/xpath/parser.y | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/oga/xpath/parser.y b/lib/oga/xpath/parser.y index 19054ec..765257d 100644 --- a/lib/oga/xpath/parser.y +++ b/lib/oga/xpath/parser.y @@ -10,6 +10,15 @@ token T_SUB T_MUL options no_result_var +# Token precedence according to the XPath 1.0 specification. The precedence of +# tokens such as T_PIPE and T_MOD is not mentioned in the official +# specification. Instead this precedence was based on an online excerpt of the +# book "XSLT 1.0". +# +# Each `left` or `right` line adds a new precedence rule in descending order. +# In other words, the tokens at the top have a higher precedence than those at +# the bottom. +# prechigh left T_PIPE T_MOD T_DIV T_MUL T_SUB T_ADD left T_LT T_LTE T_GT T_GTE