aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing/tok.ml
diff options
context:
space:
mode:
authorGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2016-10-02 12:02:53 +0200
committerGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2016-10-02 12:02:53 +0200
commit466b7e69e49a5f4bba36b834a2e046f120ece07c (patch)
tree10cca3b0d569527afd3741aaebe202b82cb9198e /parsing/tok.ml
parent527d3525b726f8136b64c7c1cf770c702f966cad (diff)
Move bullet detection from lexer to parser (bug #5102).
That way, bullet detection no longer depends on a global variable indicating whether a line is starting. This causes a small change in the recognized language. Before the commit, "--++" was recognized as a bullet "--" followed by a keyword "++" when at the start of a line; now it is always recognized as a keyword "--++". This also fixes a bug in Tok.to_string as a side-effect.
Diffstat (limited to 'parsing/tok.ml')
-rw-r--r--parsing/tok.ml7
1 files changed, 0 insertions, 7 deletions
diff --git a/parsing/tok.ml b/parsing/tok.ml
index 8ae106512..99d5c972c 100644
--- a/parsing/tok.ml
+++ b/parsing/tok.ml
@@ -18,7 +18,6 @@ type t =
| INT of string
| STRING of string
| LEFTQMARK
- | BULLET of string
| EOI
let equal t1 t2 = match t1, t2 with
@@ -30,7 +29,6 @@ let equal t1 t2 = match t1, t2 with
| INT s1, INT s2 -> string_equal s1 s2
| STRING s1, STRING s2 -> string_equal s1 s2
| LEFTQMARK, LEFTQMARK -> true
-| BULLET s1, BULLET s2 -> string_equal s1 s2
| EOI, EOI -> true
| _ -> false
@@ -42,7 +40,6 @@ let extract_string = function
| FIELD s -> s
| INT s -> s
| LEFTQMARK -> "?"
- | BULLET s -> s
| EOI -> ""
let to_string = function
@@ -53,7 +50,6 @@ let to_string = function
| INT s -> Format.sprintf "INT %s" s
| STRING s -> Format.sprintf "STRING %S" s
| LEFTQMARK -> "LEFTQMARK"
- | BULLET s -> Format.sprintf "STRING %S" s
| EOI -> "EOI"
let match_keyword kwd = function
@@ -75,7 +71,6 @@ let of_pattern = function
| "INT", s -> INT s
| "STRING", s -> STRING s
| "LEFTQMARK", _ -> LEFTQMARK
- | "BULLET", s -> BULLET s
| "EOI", _ -> EOI
| _ -> failwith "Tok.of_pattern: not a constructor"
@@ -87,7 +82,6 @@ let to_pattern = function
| INT s -> "INT", s
| STRING s -> "STRING", s
| LEFTQMARK -> "LEFTQMARK", ""
- | BULLET s -> "BULLET", s
| EOI -> "EOI", ""
let match_pattern =
@@ -100,7 +94,6 @@ let match_pattern =
| "INT", "" -> (function INT s -> s | _ -> err ())
| "STRING", "" -> (function STRING s -> s | _ -> err ())
| "LEFTQMARK", "" -> (function LEFTQMARK -> "" | _ -> err ())
- | "BULLET", "" -> (function BULLET s -> s | _ -> err ())
| "EOI", "" -> (function EOI -> "" | _ -> err ())
| pat ->
let tok = of_pattern pat in