Commit af0ba680 authored by bguillaum's avatar bguillaum
Browse files

0.19.1: accept "#89abCD" as a color in label declaration

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@7820 7838e531-6607-4d57-9587-6c381814729c
parent 41764446
VERSION = 0.19.0
VERSION = 0.19.1
INSTALL_DIR_LIB = @OCAMLLIB@
INSTALL_DIR = @prefix@/bin/
......
......@@ -82,14 +82,6 @@ module G_edge = struct
then "bottom; "
else ""
let to_dep ?(deco=false) l =
let pos = position_of_option (Label.get_options l) in
match (deco,color_of_option (Label.get_options l)) with
| (false,None) -> Printf.sprintf "{ label = \"%s\"%s}" (Label.to_string l) pos
| (false,Some c) -> Printf.sprintf "{ label = \"%s\"; forecolor=%s; color=%s%s}" (Label.to_string l) c c pos
| (true,None) -> Printf.sprintf "{ label = \"%s\"; color=red%s}" (Label.to_string l) pos
| (true,Some c) -> Printf.sprintf "{ label = \"%s\"; forecolor=%s; color=red%s}" (Label.to_string l) c pos
let to_dep ?(deco=false) l =
let string = Label.to_string l in
let options = Label.get_options l in
......@@ -100,7 +92,7 @@ module G_edge = struct
let pos = if List.mem "@bottom" options || prefix = Some "D" then "; bottom" else "" in
let style = if deco then "; style=dot" else "" in
let color = match (List.filter (fun x -> x <> "@bottom") options, prefix) with
| (c::_, _) -> "; color="^(rm_first_char c)
| (c::_, _) -> let col = rm_first_char c in sprintf "; color=%s; forecolor=%s" col col
| ([], Some "S") -> "; color=red; forecolor=red"
| ([], Some "D") -> "; color=blue; forecolor=blue"
| _ -> "" in
......
......@@ -73,8 +73,9 @@ let localize t = (t,get_loc ())
%token ADD_NODE /* add_node */
%token DEL_FEAT /* del_feat */
%token <string> PAT /* $id */
%token <string> CMD /* @id */
%token <string> DOLLAR_ID /* $id */
%token <string> AROBAS_ID /* @id */
%token <string> COLOR /* @#89abCD */
%token <string> IDENT /* indentifier */
%token <Grew_ast.Ast.qfn> QFN /* ident.ident */
......@@ -234,9 +235,11 @@ features_values:
| x = delimited(LACC,separated_nonempty_list_final_opt(COMA,label),RACC) { x }
%inline label:
(* | x = IDENT color = option(ddot_color) { (x, color) } *)
| x = label_ident display_list = list(display) { (x, display_list) }
| x = label_ident display = list(CMD) { (x, display) }
display:
| dis = AROBAS_ID { dis }
| col = COLOR { col }
global_labels:
| LABELS x = labels { x }
......@@ -351,8 +354,8 @@ param:
file:
| FILE f=STRING {f}
var:
| i = PAT {i}
| i = CMD {i}
| i = DOLLAR_ID {i}
| i = AROBAS_ID {i}
pos_item:
| MATCH i = pn_item { i }
......@@ -407,7 +410,7 @@ node_features:
{ localize {Ast.kind = Ast.Equality values; name=name; } }
| name = IDENT DISEQUAL values = separated_nonempty_list(PIPE,value)
{ localize {Ast.kind = Ast.Disequality values; name=name; } }
| name = IDENT EQUAL p = PAT
| name = IDENT EQUAL p = DOLLAR_ID
{ localize {Ast.kind = Ast.Param p; name=name; } }
pat_edge:
......@@ -531,11 +534,11 @@ command:
{ localize (Ast.Update_feat (qfn, items)) }
concat_item:
| qfn = QFN { Ast.Qfn_item qfn }
| s = IDENT { Ast.String_item s }
| s = STRING { Ast.String_item s }
| p = CMD { Ast.Param_item p }
| p = PAT { Ast.Param_item p }
| qfn = QFN { Ast.Qfn_item qfn }
| s = IDENT { Ast.String_item s }
| s = STRING { Ast.String_item s }
| p = AROBAS_ID { Ast.Param_item p }
| p = DOLLAR_ID { Ast.Param_item p }
/*=============================================================================================*/
/* */
......
......@@ -24,10 +24,12 @@
let digit = ['0'-'9']
let letter = ['a'-'z' 'A'-'Z']
let hex = ['0'-'9' 'a'-'f' 'A'-'F']
(* an identifier is either a single letter or its lenght is >=2 and it doesn't end with a '-' *)
let ident = letter | (letter | '_') (letter | digit | '_' | '\'' | '-')* (letter | digit | '_' | '\'')
let color = hex hex hex hex hex hex
rule comment target = parse
| '\n' { incr Parser_global.current_line; Lexing.new_line lexbuf; target lexbuf }
| _ { comment target lexbuf }
......@@ -103,8 +105,10 @@ and global = parse
| digit+ as number { INT (int_of_string number) }
| ident ['.'] ident as qfn { QFN (parse_qfn qfn) }
| ident as id { IDENT id }
| '$' ident as pat_var { PAT pat_var}
| '@' ident as cmd_var { CMD cmd_var }
| '$' ident as pat_var { DOLLAR_ID pat_var}
| '@' ident as cmd_var { AROBAS_ID cmd_var }
| "@#" color as col { COLOR col }
| '{' { LACC }
| '}' { RACC }
......
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