Exemple #1
0
void 
SymTab::typePrintST(ostream& os, int indent, char leftdelim, char rightdelim, 
				bool linebreak, int first, int last) const {
  int i; SymTab::const_iterator it = begin(); int n_printed=0;

  //os << "printST(" << indent << ")";
  if ((first == 0) && (last == 0))
	last = 1000000;

  for (i=0; (it != end()) && (i < last); i++, ++it)  {
	SymTabEntry *ste = (SymTabEntry *)(*it);
	if (i >= first) {
	  if ((ste->kind() != SymTabEntry::RULE_BLOCK_KIND) && 
		  (ste->kind() != SymTabEntry::EVENT_BLOCK_KIND) && 
		  (ste->name() != "state") && (ste->name() != "other") &&
		  (ste->name() != "any")) {
		n_printed++;
	  }
	}
  }

  if (leftdelim != '\0') {
	os << leftdelim;
	if ((n_printed > 0) && (linebreak))
	  prtln(os, indent+STEP_INDENT);
  }

  for (i=0, it=begin();
	   (it != end()) && (i < last); i++, ++it)  {
	SymTabEntry *ste = (SymTabEntry *)(*it);
	if (i >= first) {
	  if ((ste->kind() != SymTabEntry::RULE_BLOCK_KIND) && 
		  (ste->kind() != SymTabEntry::EVENT_BLOCK_KIND) && 
		  (ste->name() != "state") && (ste->name() != "other") &&
		  (ste->name() != "any")) {
		ste->typePrint(os,indent+STEP_INDENT);
		if ((leftdelim == '\0') && (rightdelim != '\0'))
		  os << rightdelim;
		if (--n_printed > 0) {
		  if (linebreak)
			prtln(os,indent+STEP_INDENT);
		  else os << ", ";
		}
		else if (linebreak)
		  prtln(os,indent);
	  }
	}
  }

  if (leftdelim != '\0') // This is not a typo -- we shd check leftdelim
	os << rightdelim; 
  //if (linebreak)
  //prtln(os, indent);
}