sentenceParserAux.ml 502 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
open Grammar

type terminals =
  Terminal.t list

type sentence =
  Nonterminal.t option * terminals

type located_sentence =
  Positions.positions * sentence

type comment =
  string

type 'a or_comment =
16
| Thing of 'a
17 18
| Comment of comment

POTTIER Francois's avatar
POTTIER Francois committed
19 20 21 22 23 24
let or_comment_iter f = function
  | Thing s ->
      f s
  | Comment _ ->
      ()

25
let or_comment_map f = function
26 27
  | Thing s ->
      Thing (f s)
28 29 30
  | Comment c ->
      Comment c

31 32
let unThing = function
  | Thing x ->
33 34 35
      [ x ]
  | Comment _ ->
      []