aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing/tok.ml
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2015-11-26 19:05:25 +0100
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2015-11-26 19:13:13 +0100
commit982460743a54ecfab1d601ba930d61c04972d17a (patch)
tree92c2527ce3f57556df6527a11e5e3351b316f73f /parsing/tok.ml
parent11ccb7333c2a82d59736027838acaea2237e2402 (diff)
Fixing the "parsing rules with idents later declared as keywords" problem.
The fix was actually elementary. The lexer comes with a function to compare parsed tokens against tokens of the parsing rules. It is enough to have this function considering an ident in a parsing rule to be equal to the corresponding string parsed as a keyword.
Diffstat (limited to 'parsing/tok.ml')
-rw-r--r--parsing/tok.ml1
1 files changed, 1 insertions, 0 deletions
diff --git a/parsing/tok.ml b/parsing/tok.ml
index efd57968d..12140f403 100644
--- a/parsing/tok.ml
+++ b/parsing/tok.ml
@@ -21,6 +21,7 @@ type t =
| EOI
let equal t1 t2 = match t1, t2 with
+| IDENT s1, KEYWORD s2 -> CString.equal s1 s2
| KEYWORD s1, KEYWORD s2 -> CString.equal s1 s2
| METAIDENT s1, METAIDENT s2 -> CString.equal s1 s2
| PATTERNIDENT s1, PATTERNIDENT s2 -> CString.equal s1 s2