grew_command.mli 2.41 KB
Newer Older
bguillaum's avatar
bguillaum committed
1 2 3
(**********************************************************************************)
(*    Libcaml-grew - a Graph Rewriting library dedicated to NLP applications      *)
(*                                                                                *)
Bruno Guillaume's avatar
Bruno Guillaume committed
4
(*    Copyright 2011-2018 Inria, Université de Lorraine                           *)
bguillaum's avatar
bguillaum committed
5
(*                                                                                *)
Bruno Guillaume's avatar
Bruno Guillaume committed
6
(*    Webpage: http://grew.fr                                                     *)
bguillaum's avatar
bguillaum committed
7 8 9 10
(*    License: CeCILL (see LICENSE folder or "http://www.cecill.info")            *)
(*    Authors: see AUTHORS file                                                   *)
(**********************************************************************************)

bguillaum's avatar
bguillaum committed
11
open Grew_ast
12
open Grew_base
13
open Grew_types
14
open Grew_domain
pj2m's avatar
pj2m committed
15 16
open Grew_edge

bguillaum's avatar
bguillaum committed
17
(* ================================================================================ *)
pj2m's avatar
pj2m committed
18
module Command : sig
19
  type command_node =       (* a command node is either: *)
bguillaum's avatar
bguillaum committed
20 21
    | Pat of Pid.t          (* a node identified in the pattern *)
    | New of string         (* a node introduced by a new_neighbour *)
pj2m's avatar
pj2m committed
22

23
  type item =
24
    | Feat of (command_node * string)
25
    | String of string
26
    | Lexical_field of (string * string)
27

28
  type p =
29 30
    | DEL_NODE of command_node
    | DEL_EDGE_EXPL of (command_node * command_node *G_edge.t)
pj2m's avatar
pj2m committed
31
    | DEL_EDGE_NAME of string
32
    | ADD_EDGE of (command_node * command_node * G_edge.t)
33
    | ADD_EDGE_EXPL of (command_node * command_node * string)
34
    | ADD_EDGE_ITEMS of (command_node * command_node * (string * string) list)
35
    | DEL_FEAT of (command_node * string)
36
    | DEL_EDGE_FEAT of (string * string) (* (edge identifier, feature_name) *)
37
    | UPDATE_FEAT of (command_node * string * item list)
38 39
    | UPDATE_EDGE_FEAT of (string * string * string) (* edge identifier, feat_name, new_value *)

bguillaum's avatar
bguillaum committed
40 41 42
    | NEW_NODE of string
    | NEW_BEFORE of (string * command_node)
    | NEW_AFTER of (string * command_node)
43

44 45 46
    | SHIFT_EDGE of (command_node * command_node * Label_cst.t)
    | SHIFT_IN of (command_node * command_node * Label_cst.t)
    | SHIFT_OUT of (command_node * command_node * Label_cst.t)
pj2m's avatar
pj2m committed
47

48
  type t = (p * Loc.t)
Bruno Guillaume's avatar
Bruno Guillaume committed
49
  val to_json: ?domain:Domain.t -> t -> Yojson.Basic.t
50

pj2m's avatar
pj2m committed
51

52
  val build:
bguillaum's avatar
bguillaum committed
53
      ?domain: Domain.t ->
Bruno Guillaume's avatar
Bruno Guillaume committed
54
      Lexicons.t ->
bguillaum's avatar
bguillaum committed
55
      (Id.name list * string list) ->
56 57
      Id.table ->
      Ast.command ->
bguillaum's avatar
bguillaum committed
58
        t * (Id.name list * string list)
59
end (* module Command *)