gr_grs_parser.mly 22.7 KB
Newer Older
pj2m's avatar
pj2m committed
1
2
%{

bguillaum's avatar
bguillaum committed
3
4
open Grew_ast
open Grew_utils
pj2m's avatar
pj2m committed
5

6
(* Some intermediate sum types used in sub-functions when building the ast *)
pj2m's avatar
pj2m committed
7
type pat_item = 
bguillaum's avatar
bguillaum committed
8
9
10
  | Pat_node of Ast.node
  | Pat_edge of Ast.edge
  | Pat_const of Ast.const
pj2m's avatar
pj2m committed
11
12

type graph_item =
bguillaum's avatar
bguillaum committed
13
14
  | Graph_node of Ast.node
  | Graph_edge of Ast.edge
pj2m's avatar
pj2m committed
15
16
17
18
19

let get_loc () = (!Parser_global.current_file,!Parser_global.current_line+1)
let localize t = (t,get_loc ())
%}

20
21
22
23
24
25
26
27
28
29
%token LACC                        /* { */
%token RACC                        /* } */
%token LBRACKET                    /* [ */
%token RBRACKET                    /* ] */
%token LPAREN                      /* ( */
%token RPAREN                      /* ) */
%token DDOT                        /* : */
%token COMA                        /* , */
%token SEMIC                       /* ; */
%token STAR                        /* * */
bguillaum's avatar
bguillaum committed
30
%token PLUS                        /* + */
31
32
33
34
35
36
37
38
39
40
41
%token EQUAL                       /* = */
%token DISEQUAL                    /* <> */
%token PIPE                        /* | */
%token GOTO_NODE                   /* -> */
%token LTR_EDGE_LEFT               /* -[ */
%token LTR_EDGE_LEFT_NEG           /* -[^ */
%token LTR_EDGE_RIGHT              /* ]-> */
%token RTL_EDGE_LEFT               /* <-[ */
%token RTL_EDGE_RIGHT              /* ]- */
%token LONGARROW                   /* ==> */

42
%token INCLUDE                     /* include */
43
%token FEATURES                    /* features */
bguillaum's avatar
bguillaum committed
44
45
%token FEATURE                     /* feature */
%token FILE                        /* file */
46
47
48
49
50
51
52
53
%token LABELS                      /* labels */
%token BAD_LABELS                  /* bad_labels */
%token MATCH                       /* match */
%token WITHOUT                     /* without */
%token COMMANDS                    /* commands */
%token MODULE                      /* module */
%token CONFLUENT                   /* confluent */
%token RULE                        /* rule */
bguillaum's avatar
bguillaum committed
54
%token LEX_RULE                    /* lex_rule */
55
56
57
58
59
60
%token SEQUENCES                   /* sequences */
%token GRAPH                       /* graph */

%token DEL_EDGE                    /* del_edge */
%token ADD_EDGE                    /* add_edge */
%token MERGE                       /* merge */
61
62
%token SHIFT_IN                    /* shift_in */
%token SHIFT_OUT                   /* shift_out */
63
64
65
66
67
%token SHIFT                       /* shift */
%token DEL_NODE                    /* del_node */
%token ADD_NODE                    /* add_node */
%token DEL_FEAT                    /* del_feat */

bguillaum's avatar
bguillaum committed
68
69
70
%token <string> PAT                         /* $id */
%token <string> CMD                         /* @id */

71
%token <string>  IDENT             /* indentifier */
bguillaum's avatar
bguillaum committed
72
%token <Grew_ast.Ast.qfn> QFN               /* ident.ident */
73
74
75
%token <string>  STRING
%token <int>     INT
%token <string>  COMMENT
pj2m's avatar
pj2m committed
76

77
%token EOF                         /* end of file */
pj2m's avatar
pj2m committed
78

bguillaum's avatar
bguillaum committed
79
80
81
%start <Grew_ast.Ast.grs_with_include> grs_with_include
%start <Grew_ast.Ast.grs> grs
%start <Grew_ast.Ast.gr> gr
82
%start <Grew_ast.Ast.module_or_include list> included
pj2m's avatar
pj2m committed
83
84
85
86
87
88
89
%%

/*=============================================================================================*/
/*  GREW GRAPH                                                                                 */
/*=============================================================================================*/

gr: 
90
91
92
        | GRAPH LACC items = separated_list(SEMIC,option(gr_item)) RACC EOF 
            {
             {
bguillaum's avatar
bguillaum committed
93
94
              Ast.nodes = List_.opt_map (function Some (Graph_node n) -> Some n | _ -> None) items;
              Ast.edges = List_.opt_map (function Some (Graph_edge n) -> Some n | _ -> None) items;
95
96
97
            }
           }
                  
pj2m's avatar
pj2m committed
98
gr_item:
99
        | id = IDENT position = option(delimited(LPAREN,index,RPAREN)) feats = delimited(LBRACKET,separated_list(COMA,node_features),RBRACKET) 
bguillaum's avatar
bguillaum committed
100
            { Graph_node (localize {Ast.node_id = id; position=position; fs=feats}) }
pj2m's avatar
pj2m committed
101

102
        | n1 = IDENT labels = delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
103
            { Graph_edge (localize {Ast.edge_id = None; src=n1; edge_labels=labels; tar=n2; negative=true; }) }
pj2m's avatar
pj2m committed
104

105
        | n1 = IDENT labels = delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
106
            { Graph_edge (localize {Ast.edge_id = None; src=n1; edge_labels=labels; tar=n2; negative=false; }) }
pj2m's avatar
pj2m committed
107
108

index:
109
        | INT { $1 }
pj2m's avatar
pj2m committed
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124










/*=============================================================================================*/
/*  GREW GRAPH SYSTEM REWRITING                                                                */
/*=============================================================================================*/


125
126
127
128
129
130
131
132
133
134
grs_with_include:
        | f = features_group g = global_labels m = module_or_include_list s = sequences EOF 
            {
             { Ast.domain_wi=List_.opt f; 
               labels_wi=g; 
               modules_wi=m; 
               sequences_wi=s;
             }
           }
     
pj2m's avatar
pj2m committed
135
grs:
136
137
138
139
140
141
142
143
        | f = features_group g = global_labels m = modules s = sequences EOF 
            {
             { Ast.domain=List_.opt f; 
               labels=g; 
               modules=m; 
               sequences=s;
             }
           }
144
145
146
147
148
       
module_or_include_list:
        | x = list(module_or_include) { x }

module_or_include:
bguillaum's avatar
bguillaum committed
149
        | m = grew_module        { Ast.Modul m }
150
        | INCLUDE sub = subfile SEMIC { Ast.Includ sub } 
pj2m's avatar
pj2m committed
151

152
153
subfile:
        | f = STRING  { localize f }
pj2m's avatar
pj2m committed
154
155
156
157
158
159
160
161
162
163
164
165
166
167

/*=============================================================================================*/
/*                                                                                             */
/* FEATURES DOMAIN DEFINITION                                                                  */
/*                                                                                             */
/* features {                                                                                  */
/*      cat: n, np, v, adj;                                                                    */
/*      mood: inf, ind, subj, pastp, presp;                                                    */
/*      lemma: *; phon: *                                                                      */
/* }                                                                                           */
/*                                                                                             */
/*=============================================================================================*/

features_group:
168
169
        | FEATURES x = features { x }
        
pj2m's avatar
pj2m committed
170
%inline features:
171
172
        | LACC x = separated_nonempty_list(SEMIC,option(feature)) RACC { x }
        
pj2m's avatar
pj2m committed
173
%inline feature:
174
175
176
        | name = feature_name DDOT values = features_values 
            { 
              if List.length values == 1 && List.hd values = "*"
bguillaum's avatar
bguillaum committed
177
178
              then Ast.Open name 
              else Ast.Closed (name,List.sort Pervasives.compare values)
179
            }
pj2m's avatar
pj2m committed
180
181

feature_name:
182
        | word = IDENT { word }
pj2m's avatar
pj2m committed
183
184

features_values:
185
186
        | STAR { ["*"] }
        | x = separated_nonempty_list(COMA,feature_value) { x }
pj2m's avatar
pj2m committed
187
188
189
190
191
192
193
194
195
196
197


/*=============================================================================================*/
/*                                                                                             */
/* GLOBAL LABELS DEFINITION                                                                    */
/*                                                                                             */
/* labels { OBJ, SUBJ, DE_OBJ, ANT }                                                           */
/*                                                                                             */
/*=============================================================================================*/

%inline labels:
198
199
        | x = delimited(LACC,separated_nonempty_list(COMA,label),RACC) { x }
        
pj2m's avatar
pj2m committed
200
%inline label:
201
        | x = IDENT color = option(ddot_color)  { (x, color) }
pj2m's avatar
pj2m committed
202
203

ddot_color:
204
        | DDOT color = IDENT { color }
pj2m's avatar
pj2m committed
205
206

global_labels:
207
        | LABELS x = labels { x }
pj2m's avatar
pj2m committed
208
209
210
211
212
213
214
215
216
217
218
219


/*=============================================================================================*/
/*                                                                                             */
/* MODULE DEFINITION                                                                           */
/*                                                                                             */
/* module p7_to_p7p-mc {                                                                       */
/*   ...                                                                                       */
/* }                                                                                           */
/*                                                                                             */
/*=============================================================================================*/

220
included:
221
        | x = list (module_or_include) EOF { x }
222

pj2m's avatar
pj2m committed
223
modules:
224
225
        | x = list(grew_module) { x }
        
pj2m's avatar
pj2m committed
226
grew_module: 
227
228
229
230
231
232
233
234
        | doc = option(module_doc) MODULE conf = boption(CONFLUENT) id = module_id LACC l = option(local_labels) b = option(local_bad_labels) r = option(rules) RACC 
           {
            { Ast.module_id = fst id; 
              local_labels = begin match l with None -> [] | Some l -> l; end;
              bad_labels = begin match b with None -> [] | Some b -> b; end;
              rules = begin match r with None -> [] | Some r -> r; end;
              confluent = conf;
              module_doc = (match doc with Some d -> d | None -> "");
235
              mod_loc = (!Parser_global.current_file, snd id); 
236
237
            }
          }
pj2m's avatar
pj2m committed
238
239

module_id:
240
        | id = IDENT { (id,!Parser_global.current_line+1) }
pj2m's avatar
pj2m committed
241
242

module_doc:
243
        | comment = COMMENT { comment } 
pj2m's avatar
pj2m committed
244
245
246
247
248
249
250
251
252
253
254
255
256

/*=============================================================================================*/
/*                                                                                             */
/* LOCAL LABELS DEFINITION                                                                     */
/*                                                                                             */
/* labels {ANT_TMP}                                                                            */
/*                                                                                             */
/* bad_labels { SUJ, OBJ }                                                                     */
/*=============================================================================================*/



local_labels:
257
        | LABELS x = labels { x }
pj2m's avatar
pj2m committed
258
259

local_bad_labels:
260
261
        | BAD_LABELS x = bad_labels { x }
         
pj2m's avatar
pj2m committed
262
%inline bad_labels:
263
        | x = delimited(LACC,separated_nonempty_list(COMA,IDENT),RACC) { x }
pj2m's avatar
pj2m committed
264
265
266
267
268
269
270
271
272
273
274
275
276



/*=============================================================================================*/
/*                                                                                             */
/* RULES DEFINITION                                                                            */
/*                                                                                             */
/* rule ant_prorel_init {                                                                      */
/*   ...                                                                                       */
/* }                                                                                           */
/*=============================================================================================*/

rules:
277
        | r = list(rule) { r }
pj2m's avatar
pj2m committed
278
279

rule: 
280
281
        | doc = option(rule_doc) RULE id = rule_id LACC p = pos_item n = list(neg_item) cmds = commands RACC 
            { 
bguillaum's avatar
bguillaum committed
282
              { Ast.rule_id = fst id;
283
284
                pos_pattern = p;
                neg_patterns = n;
bguillaum's avatar
bguillaum committed
285
286
                commands = List_.opt cmds;
                param = None;
287
288
289
290
                rule_doc = begin match doc with Some d -> d | None -> "" end;
                rule_loc = (!Parser_global.current_file,snd id);
              }
            }         
bguillaum's avatar
bguillaum committed
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
        | doc = option(rule_doc) LEX_RULE id = rule_id param=option(param) LACC p = pos_item n = list(neg_item) cmds = commands RACC 
            { 
              { Ast.rule_id = fst id;
                pos_pattern = p;
                neg_patterns = n;
                commands = List_.opt cmds;
                param = param;
                rule_doc = begin match doc with Some d -> d | None -> "" end;
                rule_loc = (!Parser_global.current_file,snd id);
              }
            }         
     
param:
        | LPAREN FEATURE vars = separated_nonempty_list(COMA,var) SEMIC FILE file=STRING RPAREN { (file,vars) }

var:
        | i = PAT {i}
        | i = CMD {i}

pj2m's avatar
pj2m committed
310
pos_item:
311
        | MATCH i = pn_item { i }
pj2m's avatar
pj2m committed
312
313

neg_item:
314
315
        | WITHOUT i = pn_item { i }
          
pj2m's avatar
pj2m committed
316
pn_item: 
317
318
319
320
321
322
323
324
325
        | l = delimited(LACC,separated_nonempty_list(SEMIC,option(pat_item)),RACC)
            {
             {
              Ast.pat_nodes = List_.opt_map (function Some (Pat_node n) -> Some n | _ -> None) l;
              Ast.pat_edges = List_.opt_map (function Some (Pat_edge n) -> Some n | _ -> None) l;
              Ast.pat_const = List_.opt_map (function Some (Pat_const n) -> Some n | _ -> None) l;
            }
           }
        
pj2m's avatar
pj2m committed
326
rule_id:
327
        | id = IDENT { (id,!Parser_global.current_line+1) }
pj2m's avatar
pj2m committed
328
329

rule_doc:
330
331
        | comment = COMMENT { comment } 
        
pj2m's avatar
pj2m committed
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/*=============================================================================================*/
/*                                                                                             */
/* MATCH DEFINITION                                                                            */
/*                                                                                             */
/* match {                                                                                     */
/*      P [cat = prorel];                                                                      */
/*      N -> P;                                                                                */
/*                                                                                             */
/*      without { P -[ANT]-> * }                                                               */
/*      without { P -[ANT_TMP]-> * }                                                           */
/*    }                                                                                        */
/*                                                                                             */
/*=============================================================================================*/


pat_item:
348
349
350
        | n = pat_node { Pat_node n }
        | e = pat_edge { Pat_edge e }
        | c = pat_const { Pat_const c }
pj2m's avatar
pj2m committed
351

352
pat_node:
353
        | id = IDENT feats = delimited(LBRACKET,separated_list(COMA,node_features),RBRACKET) 
bguillaum's avatar
bguillaum committed
354
            { localize ({Ast.node_id = id; position=None; fs= feats}) }
pj2m's avatar
pj2m committed
355
356
357
358
359




node_features:
360
        | name = IDENT EQUAL STAR 
bguillaum's avatar
bguillaum committed
361
            { localize {Ast.kind = Ast.Disequality []; name=name; } } 
362
        | name = IDENT EQUAL values = separated_nonempty_list(PIPE,feature_value) 
bguillaum's avatar
bguillaum committed
363
            { localize {Ast.kind = Ast.Equality values; name=name; } } 
364
        | name = IDENT DISEQUAL values = separated_nonempty_list(PIPE,feature_value) 
bguillaum's avatar
bguillaum committed
365
366
367
            { localize {Ast.kind = Ast.Disequality values; name=name; } } 
        | name = IDENT EQUAL p = PAT
            { localize {Ast.kind = Ast.Param p; name=name; } } 
pj2m's avatar
pj2m committed
368
369

feature_value:
370
371
        | v = IDENT { v }
        | v = STRING { v }
372
        | v = INT { string_of_int v }
pj2m's avatar
pj2m committed
373

374
pat_edge:
375
        (* "e: A -> B" OR "e: A -[*]-> B" *)
376
        | id = edge_id n1 = IDENT GOTO_NODE n2 = IDENT
bguillaum's avatar
bguillaum committed
377
        | id = edge_id n1 = IDENT LTR_EDGE_LEFT_NEG STAR LTR_EDGE_RIGHT n2 = IDENT
bguillaum's avatar
bguillaum committed
378
               { localize ({Ast.edge_id = Some id; src=n1; edge_labels=[]; tar=n2; negative=true}) }
379
380
381

        (* "A -> B" *)
        | n1 = IDENT GOTO_NODE n2 = IDENT
bguillaum's avatar
bguillaum committed
382
               { localize ({Ast.edge_id = None; src=n1; edge_labels=[]; tar=n2; negative=true}) }
383
384
385

        (* "e: A -[^X|Y]-> B" *)
        | id = edge_id n1 = IDENT labels = delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
386
            { localize ({Ast.edge_id = Some id; src=n1; edge_labels=labels; tar=n2; negative=true}) }
387
388
389
            
        (* "A -[^X|Y]-> B"*)
        | n1 = IDENT labels = delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
390
            { localize ({Ast.edge_id = None; src=n1; edge_labels=labels; tar=n2; negative=true}) }
pj2m's avatar
pj2m committed
391

392
393
        (* "e: A -[X|Y]-> B" *)
        | id = edge_id n1 = IDENT labels = delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
394
            { localize ({Ast.edge_id = Some id; src=n1; edge_labels=labels; tar=n2; negative=false}) }       
pj2m's avatar
pj2m committed
395

396
397
        (* "A -[X|Y]-> B" *)
        | n1 = IDENT labels = delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
398
            { localize ({Ast.edge_id = None; src=n1; edge_labels=labels; tar=n2; negative=false}) }
pj2m's avatar
pj2m committed
399
400
401


edge_id:
402
403
        | id = IDENT DDOT { id }
                
pj2m's avatar
pj2m committed
404

405
pat_const:
bguillaum's avatar
bguillaum committed
406
        (* "A -[X|Y]-> *" *)
407
        | n1 = IDENT labels = delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) STAR
bguillaum's avatar
bguillaum committed
408
            { localize (Ast.Start (n1,labels)) }
bguillaum's avatar
bguillaum committed
409
410
411

        (* "A -> *" *)
        | n1 = IDENT GOTO_NODE STAR
bguillaum's avatar
bguillaum committed
412
            { localize (Ast.No_out n1) }
bguillaum's avatar
bguillaum committed
413
414

        (* "* -[X|Y]-> A" *)
415
        | STAR labels = delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,IDENT),LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
416
            { localize (Ast.End (n2,labels)) }
pj2m's avatar
pj2m committed
417

bguillaum's avatar
bguillaum committed
418
419
        (* "* -> A" *)
        | STAR GOTO_NODE n2 = IDENT
bguillaum's avatar
bguillaum committed
420
            { localize (Ast.No_in n2) }
pj2m's avatar
pj2m committed
421

422
        | qfn1 = QFN EQUAL qfn2 = QFN
bguillaum's avatar
bguillaum committed
423
            { localize (Ast.Feature_eq (qfn1, qfn2)) }
424

pj2m's avatar
pj2m committed
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
/*=============================================================================================*/
/*                                                                                             */
/* COMMANDS DEFINITION                                                                         */
/*                                                                                             */
/* commands {                                                                                  */
/*      del_edge A -[OBJ]-> B;                                                                 */
/*      del_edge e;                                                                            */
/*                                                                                             */
/*      add_edge A -[ATS]-> B;                                                                 */
/*                                                                                             */
/*      shift A ==> B;                                                                         */
/*                                                                                             */
/*      del_node A;                                                                            */
/*                                                                                             */
/*      add_node D: <-[SUJ]- A;                                                                */
/*                                                                                             */
/*      A.mood = inf;                                                                          */
/*                                                                                             */
/*      B.tense = A.tense;                                                                     */
/*                                                                                             */
/*      del_feat A.tense;                                                                      */
/* }                                                                                           */
/*                                                                                             */
/*=============================================================================================*/


commands:
452
        | COMMANDS x = delimited(LACC,separated_nonempty_list(SEMIC,option(command)),RACC) { x }
pj2m's avatar
pj2m committed
453
454

command:
455
        | DEL_EDGE n = IDENT
bguillaum's avatar
bguillaum committed
456
            { localize (Ast.Del_edge_name n) }
457
        | DEL_EDGE n1 = IDENT label = delimited(LTR_EDGE_LEFT,IDENT,LTR_EDGE_RIGHT) n2 = IDENT 
bguillaum's avatar
bguillaum committed
458
            { localize (Ast.Del_edge_expl (n1,n2,label)) }
459
        | ADD_EDGE n1 = IDENT label = delimited(LTR_EDGE_LEFT,IDENT,LTR_EDGE_RIGHT) n2 = IDENT
bguillaum's avatar
bguillaum committed
460
            { localize (Ast.Add_edge (n1,n2,label)) }
461
        | SHIFT_IN n1 = IDENT LONGARROW n2 = IDENT 
bguillaum's avatar
bguillaum committed
462
            { localize (Ast.Shift_in (n1,n2)) }
463
        | SHIFT_OUT n1 = IDENT LONGARROW n2 = IDENT 
bguillaum's avatar
bguillaum committed
464
            { localize (Ast.Shift_out (n1,n2)) }
465
        | SHIFT n1 = IDENT LONGARROW n2 = IDENT 
bguillaum's avatar
bguillaum committed
466
            { localize (Ast.Shift_edge (n1,n2)) }
467
        | MERGE n1 = IDENT LONGARROW n2 = IDENT 
bguillaum's avatar
bguillaum committed
468
            { localize (Ast.Merge_node (n1,n2)) }
bguillaum's avatar
bguillaum committed
469
        | DEL_NODE n = IDENT
bguillaum's avatar
bguillaum committed
470
            { localize (Ast.Del_node n) }
471
        | ADD_NODE n1 = IDENT DDOT label = delimited(RTL_EDGE_LEFT,IDENT,RTL_EDGE_RIGHT) n2 = IDENT 
bguillaum's avatar
bguillaum committed
472
            { localize (Ast.New_neighbour (n1,n2,label)) }
473
        | DEL_FEAT qfn = QFN 
bguillaum's avatar
bguillaum committed
474
            { localize (Ast.Del_feat qfn) }
bguillaum's avatar
bguillaum committed
475
476
        | qfn = QFN EQUAL p = CMD
            { localize (Ast.Param_feat (qfn, p)) }
477
        | qfn = QFN EQUAL items = separated_nonempty_list (PLUS, concat_item)
bguillaum's avatar
bguillaum committed
478
            { localize (Ast.Update_feat (qfn, items)) }
479
480

concat_item:
bguillaum's avatar
bguillaum committed
481
482
483
        | qfn = QFN  { Ast.Qfn_item qfn }
        | s = IDENT   { Ast.String_item s }
        | s = STRING   { Ast.String_item s }
pj2m's avatar
pj2m committed
484
485
486
487
488
489
490
491
492
493

/*=============================================================================================*/
/*                                                                                             */
/* SEQUENCE DEFINITION                                                                         */
/*                                                                                             */
/* sequence { ant; p7_to_p7p-mc}                                                               */
/*                                                                                             */
/*=============================================================================================*/

sequences:
494
        | SEQUENCES seq = delimited(LACC,list(sequence),RACC) { seq }
pj2m's avatar
pj2m committed
495
496

sequence:
497
498
499
500
501
502
503
504
        | doc = option(COMMENT) id = sequence_id mod_names = delimited(LACC,separated_nonempty_list(SEMIC,option( IDENT)),RACC) 
            { 
              { Ast.seq_name = fst id; 
                seq_mod = List_.opt mod_names ; 
                seq_doc = begin match doc with Some d -> d | None -> "" end; 
                seq_loc = (!Parser_global.current_file,snd id);
              } 
            }
pj2m's avatar
pj2m committed
505
506

sequence_id:
507
        | id = IDENT { (id,!Parser_global.current_line+1) }
pj2m's avatar
pj2m committed
508
509

%%