Context: WebDSL

issue: type of argument of addToPublications is missing

problem: entire function is marked red


entity PublicationList {
publications -> Set
facets -> Set

usedFacets -> Set<PublicationListFacet> := [f | f : PublicationListFacet in facets where f.inUse]

function add(pubs : Set<Publication>) { 
  //log("  add Set<Publication>");
  for(pub : Publication in pubs){ add(pub); } 
}
function add(pubs : List<Publication>) {  
  //log("  add List<Publication>");
  for(pub : Publication in pubs){ add(pub); } 
}
function add(pubs : List<PublishedVolume>) {  
  //log("  add List<PublishedVolume>");
  for(pub : PublishedVolume in pubs){ add(pub); } 
}
function add(pub : Publication) { 
  //log("Adding publication: " + pub.title);
  publications.add(pub.aliasRoot()); 
}
function remove(pub : Publication) { 
  publications.remove(pub); 
}
extend function addToPublications(pub ) {
  //log("  adding publication " + pub.title);
  if(!(pub in publications)) {
    for(facet : PublicationListFacet in usedFacets) { facet.add(pub); }
  }
}
extend function removeFromPublications(pub : Publication) {
  //log("  removing publication " + pub.title);
  if(pub in publications) {
    for(facet : PublicationListFacet in usedFacets) { facet.remove(pub); }
  }
}
function publicationsBy(facetType : String) : PublicationListFacet {
  //log("publicationsBy(" + facetType + ")");
  for(facet : PublicationListFacet in facets where facet.type == facetType) { 
    //log("publicationsBy(" + facetType + ") - facet found");
    return facet.init();
  }
  var facet := newPublicationListFacet(facetType);
  this.facets.add(facet);
  facet.init();
  facet.save();
  //log("publicationsBy(" + facetType + ") - new facet created");
  return facet;
}

}

Submitted by Eelco Visser on 2 September 2010 at 10:58

On 2 September 2010 at 17:55 Maartje commented:

Additional information:

Function argument “pub” instead of “pub : Publication” causes the whole function Region to be skipped (FG fails)
Function argument " pub" (with the extra whitespace) is correctly recovered by FG.

extend function addToPublications(pub ) {
//log(" adding publication " + pub.title);
}

extend function addToPublications( pub ) {
//log(" adding publication " + pub.title);
}

Problem cause:
~[A-Za-z0-9_] -> WATERTOKENSTART {recover}
WATERTOKENSTART [A-Za-z0-9_]* -> WATERTOKEN

We choose for this two-step approach for reason of performance.

Solution attempt:
Use a one-line recovery rule instead:
[A-Za-z0-9_]+ -> WATERTOKEN {recover}

Results:
A. The one line recovery rule fixed the issue
B. The testsuite showed no decrease in performance (even better performance FG-average 70ms instead of 92ms),
quality gave more or less the same score (small decrease on 4 out of 100 files but that were quite complicated uncommon scenarios with multiple errors)


On 2 September 2010 at 17:55 Maartje closed this issue.

On 2 September 2010 at 17:56 Maartje reopened this issue.

On 6 September 2010 at 15:25 Maartje commented:

Probably a good idea to use [A-Za-z0-9_]+ -> WATER {recover} instead of ~[A-Za-z0-9_] -> WATERTOKENSTART {recover}, WATERTOKENSTART [A-Za-z0-9_]* -> WATERTOKEN


On 6 September 2010 at 15:53 Lennart Kats closed this issue.

On 6 September 2010 at 15:53 Lennart Kats commented:

I adjusted the make-permissive tool for this per Maartje’s recommendation. To be included in 0.5.3.3.

Log in to post comments