Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 7b2a4a47 authored by bguillaum's avatar bguillaum
Browse files

Fix incompatibilities in last merge (change of the way identifiers are considered in the lexer)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8715 7838e531-6607-4d57-9587-6c381814729c
parent 4a3d1c8a
......@@ -17,6 +17,7 @@ open Grew_types
module Ast = struct
(* general function for checking that an identifier is of the right kind *)
(* allowed is a char list which is a sub set of ['#'; '.'; ':'; '*'] *)
let check_special name allowed s =
let sp = Str.full_split (Str.regexp "#\\|\\.\\|:\\|\\*") s in
try
......
......@@ -42,7 +42,7 @@ let localize t = (t,get_loc ())
%token EQUAL /* = */
%token DISEQUAL /* <> */
%token BANG /* ! */
%token STAR /* * */
%token LT /* < */
%token GT /* > */
%token LE /* <= or */
......@@ -50,7 +50,7 @@ let localize t = (t,get_loc ())
%token PIPE /* | */
%token EDGE /* -> */
%token EDGE /* -> */
%token LTR_EDGE_LEFT /* -[ */
%token LTR_EDGE_LEFT_NEG /* -[^ */
%token LTR_EDGE_RIGHT /* ]-> */
......@@ -132,9 +132,6 @@ let localize t = (t,get_loc ())
/* BASIC DEFINITIONS */
/*=============================================================================================*/
id_with_loc:
| id=ID { localize id }
label_ident:
| x=ID { Ast.parse_label_ident x }
......@@ -238,17 +235,19 @@ features:
| LACC x=separated_nonempty_list_final_opt(SEMIC,feature) RACC { x }
feature:
(* phon:* *)
(* pos=# *)
(* m: ind,inf,part,subj,imp *)
| feature_name=feature_name DDOT feature_values=features_values
{
match feature_values with
| ["*"] -> Domain.Open feature_name
| ["#"] -> Domain.Num feature_name
| _ -> Domain.Closed (feature_name, List.sort Pervasives.compare feature_values)
}
(* phon:* *)
| feature_name=feature_name DDOT STAR
{ Domain.Open feature_name }
feature_name:
| ci=ID { ci }
......@@ -419,38 +418,42 @@ pat_edge_or_const:
| id_loc=simple_id_with_loc DDOT n1=simple_id labels=delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2=simple_id
{ let (id,loc) = id_loc in Pat_edge ({Ast.edge_id = Some id; src=n1; edge_label_cst=(labels,false); tar=n2}, loc) }
(* "A -> B" *)
| n1_loc=simple_id_with_loc EDGE n2=simple_id
{ let (n1,loc) = n1_loc in Pat_edge ({Ast.edge_id = None; src=n1; edge_label_cst=([],true); tar=n2}, loc) }
(* "A -> *" *)
(* "* -> A" *)
| n1_loc=id_with_loc EDGE n2=ID
{ let (n1,loc) = n1_loc in
match (n1,n2) with
| ("*", "*") -> Error.build ~loc "Source and target cannot be both underspecified"
| ("*", _) -> Pat_const (Ast.Cst_in (n2,([],true)), loc)
| (_, "*") -> Pat_const (Ast.Cst_out (n1,([],true)), loc)
| _ -> Pat_edge ({Ast.edge_id = None; src=n1; edge_label_cst=([],true); tar=n2}, loc)
}
| n1_loc=simple_id_with_loc EDGE STAR
{ let (n1,loc) = n1_loc in Pat_const (Ast.Cst_out (n1,([],true)), loc) }
(* "* -> B" *)
| STAR EDGE n2_loc=simple_id_with_loc
{ let (n2,loc) = n2_loc in Pat_const (Ast.Cst_in (n2,([],true)), loc) }
(* "A -[X|Y]-> B" *)
(* "* -[X|Y]-> A" *)
| n1_loc=simple_id_with_loc labels=delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2=simple_id
{ let (n1,loc) = n1_loc in Pat_edge ({Ast.edge_id = None; src=n1; edge_label_cst=(labels,false); tar=n2}, loc) }
(* "A -[X|Y]-> *" *)
| n1_loc=id_with_loc labels=delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2=ID
{ let (n1,loc) = n1_loc in
match (n1,n2) with
| ("*", "*") -> Error.build ~loc "Source and target cannot be both underspecified"
| ("*", _) -> Pat_const (Ast.Cst_in (n2,(labels,false)), loc)
| (_, "*") -> Pat_const (Ast.Cst_out (n1,(labels,false)), loc)
| _ -> Pat_edge ({Ast.edge_id = None; src=n1; edge_label_cst=(labels,false); tar=n2}, loc) }
(* "A -[^X|Y]-> B"*)
| n1_loc=id_with_loc labels=delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2=ID
{ let (n1,loc) = n1_loc in
match (n1,n2) with
| ("*", "*") -> Error.build ~loc "Source and target cannot be both underspecified"
| ("*", _) -> Pat_const (Ast.Cst_in (n2,(labels,true)), loc)
| (_, "*") -> Pat_const (Ast.Cst_out (n1,(labels,true)), loc)
| _ -> Pat_edge ({Ast.edge_id = None; src=n1; edge_label_cst=(labels,true); tar=n2}, loc) }
| n1_loc=simple_id_with_loc labels=delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) STAR
{ let (n1,loc) = n1_loc in Pat_const (Ast.Cst_out (n1,(labels,false)), loc) }
(* "* -[X|Y]-> B" *)
| STAR labels=delimited(LTR_EDGE_LEFT,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2_loc=simple_id_with_loc
{ let (n2,loc) = n2_loc in Pat_const (Ast.Cst_in (n2,(labels,false)), loc) }
(* "A -[^X|Y]-> B" *)
| n1_loc=simple_id_with_loc labels=delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2=simple_id
{ let (n1,loc) = n1_loc in Pat_edge ({Ast.edge_id = None; src=n1; edge_label_cst=(labels,true); tar=n2}, loc) }
(* "A -[^X|Y]-> *" *)
| n1_loc=simple_id_with_loc labels=delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) STAR
{ let (n1,loc) = n1_loc in Pat_const (Ast.Cst_out (n1,(labels,true)), loc) }
(* "* -[^X|Y]-> B" *)
| STAR labels=delimited(LTR_EDGE_LEFT_NEG,separated_nonempty_list(PIPE,pattern_label_ident),LTR_EDGE_RIGHT) n2_loc=simple_id_with_loc
{ let (n2,loc) = n2_loc in Pat_const (Ast.Cst_in (n2,(labels,true)), loc) }
(* "X.cat = Y.cat" *)
| feat_id1_loc=feature_ident_with_loc EQUAL feat_id2=feature_ident
......@@ -591,10 +594,10 @@ sequence:
{ Ast.seq_name = fst id_loc;
seq_mod = mod_names;*/
| doc = option(COMMENT) id_loc=simple_id_with_loc mod_names=delimited(LACC,separated_list_final_opt(SEMIC,COMPLEX_ID),RACC)
| doc = option(COMMENT) id_loc=simple_id_with_loc mod_names=delimited(LACC,separated_list_final_opt(SEMIC,simple_id),RACC)
{
Ast.Old { Ast.seq_name = fst id_loc;
seq_mod = List.map (fun x -> Ast.simple_id_of_ci x) mod_names ;
seq_mod = mod_names ;
seq_doc = begin match doc with Some d -> d | None -> [] end;
seq_loc = snd id_loc;
}
......@@ -602,7 +605,7 @@ sequence:
| doc = option(COMMENT) id_loc=simple_id_with_loc EQUAL s=op_seq { Ast.New (id_loc, s) }
op_seq:
| m=COMPLEX_ID { Ast.Ref (Ast.simple_id_of_ci m) }
| m=simple_id { Ast.Ref m }
| LPAREN s=op_seq RPAREN { s }
| s=op_seq STAR { Ast.Star (s) }
| s1=op_seq PLUS s2=op_seq { Ast.Plus [s1; s2] }
......
......@@ -53,7 +53,7 @@ let label_ident =
(letter | '_' | '-' | '.' | '*') (letter | digit | '_' | '\'' | '-' | '.' | ':' | '*')*
let general_ident =
(letter | '_' | '*') |
(letter | '_' ) |
(letter | '_' | '.' ) (letter | digit | '_' | '\'' | '-' | '.' | '#')* (letter | digit | '_' | '\'' | '.')
let hex = ['0'-'9' 'a'-'f' 'A'-'F']
......@@ -115,6 +115,7 @@ and lp_lex target = parse
Difference are:
- a label_ident may contain ':' (like in D:suj:obj) and ':' is a token elsewhere
- a label_ident may contain '-' anywhere (like "--" in Tiger) but '-' is fordiden as the first or last character elsewhere
- the string "*" is lexed as ID by [label_parser] and as STAR by [standard]
*)
and global = parse
| "" { if !Parser_global.label_flag
......@@ -193,7 +194,7 @@ and standard target = parse
| '@' general_ident as cmd_var { AROBAS_ID cmd_var }
| "@#" color as col { COLOR col }
(* the string "*" is lexed as a ID *)
| '*' { STAR }
| general_ident as id { ID id }
| '{' { LACC }
......
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