]> granicus.if.org Git - graphviz/commitdiff
Fix (ac)graph scanner to only set the graph type at top level.
authorerg <devnull@localhost>
Mon, 4 Feb 2008 22:47:45 +0000 (22:47 +0000)
committererg <devnull@localhost>
Mon, 4 Feb 2008 22:47:45 +0000 (22:47 +0000)
lib/agraph/scan.l
lib/cgraph/scan.l

index e17e4936856231ea9c0ef8e322c0631115980028..8a8b6f9f2cb66ddfead4d451b149e6b8d0fff730 100644 (file)
@@ -44,7 +44,7 @@ void agsetfile(char* f) { InputFile = f; line_num = 1; }
  * requires pushing back whatever was previously read.
  * There probably is a right way of doing this.
  */
-void aglexinit(Agdisc_t *disc, void *ifile) { Disc = disc; Ifile = ifile;}
+void aglexinit(Agdisc_t *disc, void *ifile) { Disc = disc; Ifile = ifile; graphType = 0;}
 
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
@@ -175,8 +175,8 @@ ID          ({NAME}|{NUMBER})
 [\000-\040\177]                /* ignore whitespace */
 "node"                 return(T_node);         /* see tokens in agcanonstr */
 "edge"                 return(T_edge);
-"graph"                        graphType = T_graph; return(T_graph);
-"digraph"              graphType = T_digraph; return(T_digraph);
+"graph"                        if (!graphType) graphType = T_graph; return(T_graph);
+"digraph"              if (!graphType) graphType = T_digraph; return(T_digraph);
 "strict"               return(T_strict);
 "subgraph"             return(T_subgraph);
 "->"                   if (graphType == T_digraph) return(T_edgeop); else return ('-');
index 895872783acf0f38b7983741a78bef913ec1a08c..93185a27d2f10cb5d7a00b1538e7cf0434933358 100644 (file)
@@ -40,7 +40,7 @@ void agsetfile(char* f) { InputFile = f; line_num = 1; }
  * requires pushing back whatever was previously read.
  * There probably is a right way of doing this.
  */
-void aglexinit(Agdisc_t *disc, void *ifile) { Disc = disc; Ifile = ifile;}
+void aglexinit(Agdisc_t *disc, void *ifile) { Disc = disc; Ifile = ifile; graphType = 0;}
 
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
@@ -171,8 +171,8 @@ ID          ({NAME}|{NUMBER})
 [ \t\r]                                        /* ignore whitespace */
 "node"                                 return(T_node);                 /* see tokens in agcanonstr */
 "edge"                                 return(T_edge);
-"graph"                                        graphType = T_graph; return(T_graph);
-"digraph"                              graphType = T_digraph; return(T_digraph);
+"graph"                                        if (!graphType) graphType = T_graph; return(T_graph);
+"digraph"                              if (!graphType) graphType = T_digraph; return(T_digraph);
 "strict"                               return(T_strict);
 "subgraph"                             return(T_subgraph);
 "->"                           if (graphType == T_digraph) return(T_edgeop); else return('-');