From: Howard T. <how...@di...> - 2007-08-22 00:11:14
|
Hi Eric, In working on my Eiffel comparison code, I found that the process_features feature of ET_AST_ITERATOR fails to process features in some classes. According to feedback from my EDP project, this feature is not part of the reachable feature set of the Eiffel compilation process in 'gec' and is therfeore untested in that environment. I append a reimplementation that seems to work somewhat better, although not yet proven correct: process_features (a_class: ET_CLASS) is -- Process feature clauses of `a_class'. require a_class_not_void: a_class /= Void local a_feature_clauses: ET_FEATURE_CLAUSE_LIST a_feature_clause: ET_FEATURE_CLAUSE l_queries: ET_QUERY_LIST l_query: ET_QUERY l_procedures: ET_PROCEDURE_LIST l_procedure: ET_PROCEDURE i, nb: INTEGER j, nb_queries: INTEGER k, nb_procedures: INTEGER do a_feature_clauses := a_class.feature_clauses if a_feature_clauses /= Void then from -- Setup for 'feature' sequence i := 1 nb := a_feature_clauses.count -- Setup for 'queries' sequence j := 1 l_queries := a_class.queries nb_queries := l_queries.count if j <= nb_queries then l_query := l_queries.item (j) else l_query := Void end -- Setup for 'procedures' sequence k := 1 l_procedures := a_class.procedures nb_procedures := l_procedures.count if k <= nb_procedures then l_procedure := l_procedures.item (k) else l_procedure := Void end until i > nb loop -- Set feature clause for this iteration a_feature_clause := a_feature_clauses.item (i) -- Process either the next query, or the next procedure -- and select the next query or procedure ... if l_query /= Void and then l_query.feature_clause = a_feature_clause then if l_procedure /= Void and then l_procedure.feature_clause = a_feature_clause then if l_query.name.position < l_procedure.name.position then -- Here, both the current query and the current procedure lie within -- the current feature, and the query comes first l_query.process (Current) j := j + 1 if j <= nb_queries then l_query := l_queries.item (j) else l_query := Void end else -- Here, both the current query and the current procedure lie within -- the current feature, and the procedure comes first l_procedure.process (Current) k := k + 1 if k <= nb_procedures then l_procedure := l_procedures.item (k) else l_procedure := Void end end -- if else -- Here, only the query lies in the current feature clause l_query.process (Current) j := j + 1 if j <= nb_queries then l_query := l_queries.item (j) else l_query := Void end end -- if elseif l_procedure /= Void and then l_procedure.feature_clause = a_feature_clause then -- Here, only the current procedure lies within the current feature clause l_procedure.process (Current) k := k + 1 if k <= nb_procedures then l_procedure := l_procedures.item (k) else l_procedure := Void end end -- if -- If both the current query and procedure are not in -- the current feature clause, then select the next feature clause if (l_query = Void or else l_query.feature_clause /= a_feature_clause) and then (l_procedure = Void or else l_procedure.feature_clause /= a_feature_clause) then i := i + 1 end -- if end -- loop end -- if end Cheers, Howard Thomson By the way, did you get my previous e-mail about waiting for me to update SF svn ? -- "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein |
From: Eric B. <er...@go...> - 2007-08-22 07:30:48
|
Howard Thomson wrote: > In working on my Eiffel comparison code, I found that the process_features feature of ET_AST_ITERATOR > fails to process features in some classes. > > According to feedback from my EDP project, this feature is not part of the reachable feature set of the Eiffel > compilation process in 'gec' and is therfeore untested in that environment. It is in fact tested by $GOBO/test/tools. > I append a reimplementation that seems to work somewhat better, although not yet proven correct: It is in fact proven not correct when running the test $GOBO/test/tools. Can you be more explicit about what ET_AST_ITERATOR.process_features fails to process? Is your AST well formed with synonyms correctly chained? > By the way, did you get my previous e-mail about waiting for me to update SF svn ? Yes. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |
From: Howard T. <how...@di...> - 2007-08-22 09:25:59
|
Hi Eric, It doesn't work, as you say ! My gecmp program uses Gobo tools to parse pairs of class files, uses a derivation of ET_AST_PRINTER to accumulate the sequence of ET_AST_LEAF elements that were parsed, does a 'diff' pass over the pair of sequences (arrays) of leaf elements, marks the elements according to whether they are equal, not-equal, or excluded, and uses a derivation of ET_AST_PRINTER to print the sequence of elements tagged with the "== ","/= "," " marking. The process worked fine on my initial test pair of classes with just a single feature clause and one feature. When I started processing all classes in the Universe for the EDP project, modified to add the current $GOBO/library/tools/eiffel class set to provide pairs of class files for comparison, I ended up with (some) classes with feature clauses with only the word 'feature' and no features at all. I don't yet fully understand the implications of the presence of synonyms in a class, and I am unsure as to what assumptions one can make about the ordering of features in ET_CLASS.queries and ET_CLASS.procedures. I need it to work for all valid class texts, so I will find the problem, eventually ! Howard On Wednesday 22 August 2007 08:29, you wrote: > Howard Thomson wrote: > > In working on my Eiffel comparison code, I found that the > > process_features feature of ET_AST_ITERATOR fails to process features in > > some classes. > > > > According to feedback from my EDP project, this feature is not part of > > the reachable feature set of the Eiffel compilation process in 'gec' and > > is therfeore untested in that environment. > > It is in fact tested by $GOBO/test/tools. > > > I append a reimplementation that seems to work somewhat better, although > > not yet proven correct: > > It is in fact proven not correct when running the test $GOBO/test/tools. > > Can you be more explicit about what ET_AST_ITERATOR.process_features > fails to process? Is your AST well formed with synonyms correctly > chained? > > > By the way, did you get my previous e-mail about waiting for me to update > > SF svn ? > > Yes. -- Howard Thomson -- "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein |
From: Eric B. <er...@go...> - 2007-08-22 09:56:03
|
Howard Thomson wrote: > I don't yet fully understand the implications of the presence of synonyms in a > class, The trick is that the ET_AST_PRINTER prints: foo, bar (...) is do ... end and not: foo (...) is do ... end bar (...) is do ... end when it finds synonyms. This is needed when what we want it just change the formating of a class text without decoupling synonym features. This trick about synonyms is done if class ET_AST_ITERATOR in feature `process_features' and for example in feature `process_do_procedure'. If you don't want this behavior and want the synonym features to stand by themsleves, then you would need to redefine these features in a descendant of ET_AST_PRINTER. > and I am unsure as to what assumptions one can make about the ordering > of features in ET_CLASS.queries and ET_CLASS.procedures. Queries in ET_CLASS.queries between 1 and `queries.declared_count' are guaranteed to be sorted in the order they appear in the class text. Likewise for procedures. However we know nothing about the ordering between a query and a procedure. We have to compare their position in the class text in that case. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |