Commit 69c104db authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

add the new_node field in module definitions

parent 4f553f70
......@@ -107,6 +107,7 @@ module Ast = struct
type modul = {
module_id:Id.name;
local_labels: (string * string option) list;
new_node_names: string list;
rules: rule list;
confluent: bool;
module_doc:string list;
......
......@@ -97,6 +97,7 @@ module Ast : sig
type modul = {
module_id:Id.name;
local_labels: (string * string option) list;
new_node_names: string list;
rules: rule list;
confluent: bool;
module_doc:string list;
......
......@@ -52,6 +52,7 @@ let localize t = (t,get_loc ())
%token FEATURE /* feature */
%token FILE /* file */
%token LABELS /* labels */
%token NEW_NODES /* labels */
%token MATCH /* match */
%token WITHOUT /* without */
%token COMMANDS /* commands */
......@@ -258,10 +259,11 @@ modules:
| x = list(grew_module) { x }
grew_module:
| doc = option(module_doc) MODULE conf = boption(CONFLUENT) id = module_id LACC l = option(local_labels) r = rules RACC
| doc=option(module_doc) MODULE conf=boption(CONFLUENT) id=module_id LACC l=option(local_labels) nn=option(new_nodes) r=rules RACC
{
{ Ast.module_id = fst id;
local_labels = (match l with None -> [] | Some x -> x);
new_node_names = (match nn with None -> [] | Some x -> x);
rules = r;
confluent = conf;
module_doc = (match doc with Some d -> d | None -> []);
......@@ -270,6 +272,10 @@ grew_module:
}
}
new_nodes:
(* "new_nodes {a, b, c}" *)
| NEW_NODES x = delimited(LACC,separated_nonempty_list_final_opt(COMA,IDENT),RACC) { x:string list }
module_id:
| id = IDENT { (id,!Parser_global.current_line+1) }
......
......@@ -77,6 +77,7 @@ and global = parse
| "feature" { FEATURE }
| "file" { FILE }
| "labels" { LABELS }
| "new_nodes" { NEW_NODES }
| "match" { MATCH }
| "without" { WITHOUT }
| "commands" { COMMANDS }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment