aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/deLexer.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2015-11-12 17:35:41 +0100
committerBernhard Schommer <bschommer@users.noreply.github.com>2015-11-12 17:35:41 +0100
commitd90ba4443294b80bd940daedfdcdc3d4334fdc7c (patch)
treed647ca2216c342c433c35783d32e1abe8545a72c /cparser/deLexer.ml
parent9054efbd25eedd5627b9e6e62bf1204e5fa0ae94 (diff)
parent0ebefc1d145f82783829174bad1f41bb319742b4 (diff)
downloadcompcert-d90ba4443294b80bd940daedfdcdc3d4334fdc7c.tar.gz
compcert-d90ba4443294b80bd940daedfdcdc3d4334fdc7c.zip
Merge pull request #69 from jhjourdan/parser_fix
Parser : duplicate identifier tokens, fix K&R definition parsing
Diffstat (limited to 'cparser/deLexer.ml')
-rw-r--r--cparser/deLexer.ml3
1 files changed, 3 insertions, 0 deletions
diff --git a/cparser/deLexer.ml b/cparser/deLexer.ml
index 00308e4b..3aa168da 100644
--- a/cparser/deLexer.ml
+++ b/cparser/deLexer.ml
@@ -65,6 +65,7 @@ let delex (symbol : string) : string =
| "WHILE" -> "while"
| "TYPEDEF_NAME" -> "t" (* this should be a type name *)
| "VAR_NAME" -> "x" (* this should be a variable name *)
+ | "PRE_NAME" -> ""
| "CONSTANT" -> "42"
| "STRING_LITERAL" -> "\"\""
| "ELLIPSIS" -> "..."
@@ -121,6 +122,8 @@ let delex (symbol : string) : string =
let delex sentence =
let symbols = Str.split (Str.regexp " ") sentence in
+ if List.nth symbols (List.length symbols - 1) = "PRE_NAME" then
+ failwith "token sequence terminating with PRE_NAME";
let symbols = List.map delex symbols in
List.iter (fun symbol ->
Printf.printf "%s " symbol