예제 #1
0
void AllowedGroupConnectorsMessageArg::append(MessageBuilder &builder) const
{
  static GroupConnector::Type types[] = {
    GroupConnector::andGC, GroupConnector::orGC, GroupConnector::seqGC,
    GroupConnector::grpcGC, GroupConnector::dtgcGC
    };
  static Syntax::DelimGeneral delims[] = {
    Syntax::dAND, Syntax::dOR, Syntax::dSEQ,
    Syntax::dGRPC, Syntax::dDTGC
    };
  Boolean first = 1;
  for (size_t i = 0; i < SIZEOF(types); i++)
    if (allow_.groupConnector(types[i])) {
      if (!first)
	builder.appendFragment(ParserMessages::listSep);
      else
	first = 0;
      const StringC &delim = syntax_->delimGeneral(delims[i]);
      builder.appendFragment(ParserMessages::delimStart);
      builder.appendChars(delim.data(), delim.size());
#if 0
      builder.appendFragment(ParserMessages::delimEnd);
#endif
    }
}
예제 #2
0
파일: Group.C 프로젝트: juddy/edcde
void AllowedGroupTokensMessageArg::append(MessageBuilder &builder) const
{
  const MessageFragment *fragment[4];
  int nFragments = 0;
  if (allow_.groupToken(GroupToken::dataTagLiteral))
    fragment[nFragments++] = &ParserMessages::parameterLiteral;
  if (allow_.groupToken(GroupToken::dataTagGroup))
    fragment[nFragments++] = &ParserMessages::dataTagGroup;
  switch (allow_.group()) {
  case GroupToken::modelGroup:
    fragment[nFragments++] = &ParserMessages::modelGroup;
    break;
  case GroupToken::dataTagTemplateGroup:
    fragment[nFragments++] = &ParserMessages::dataTagTemplateGroup;
    break;
  default:
    break;
  }
  switch (allow_.nameStart()) {
  case GroupToken::name:
    fragment[nFragments++] = &ParserMessages::name;
    break;
  case GroupToken::nameToken:
    fragment[nFragments++] = &ParserMessages::nameToken;
    break;
  case GroupToken::elementToken:
    fragment[nFragments++] = &ParserMessages::elementToken;
    break;
  default:
    break;
  }
  Boolean first = 1;
  for (int i = 0; i < nFragments; i++) {
    if (!first)
      builder.appendFragment(ParserMessages::listSep);
    else
      first = 0;
    builder.appendFragment(*fragment[i]);
  }
  if (allow_.groupToken(GroupToken::pcdata)) {
    if (!first)
      builder.appendFragment(ParserMessages::listSep);
    StringC pcdata(syntax_->delimGeneral(Syntax::dRNI));
    pcdata += syntax_->reservedName(Syntax::rPCDATA);
    builder.appendChars(pcdata.data(), pcdata.size());
  }
}
예제 #3
0
파일: MessageArg.C 프로젝트: juddy/edcde
void StringMessageArg::append(MessageBuilder &builder) const
{
  builder.appendChars(s_.data(), s_.size());
}
예제 #4
0
void AllowedParamsMessageArg::append(MessageBuilder &builder) const
{
  Syntax::DelimGeneral delims[3];
  int nDelims = 0;
  if (allow_.mdc())
    delims[nDelims++] = Syntax::dMDC;
  if (allow_.dso())
    delims[nDelims++] = Syntax::dDSO;
  switch (allow_.mainMode()) {
  case mdMinusMode:
    delims[nDelims++] = Syntax::dMINUS;
    break;
  case mdPeroMode:
    delims[nDelims++] = Syntax::dPERO;
    break;
  default:
    break;
  }
  Boolean first = 1;
  int i;
  for (i = 0; i < nDelims; i++) {
    if (!first)
      builder.appendFragment(ParserMessages::listSep);
    else
      first = 0;
    const StringC &delim = syntax_->delimGeneral(delims[i]);
    builder.appendFragment(ParserMessages::delimStart);
    builder.appendChars(delim.data(), delim.size());
#if 0
    builder.appendFragment(ParserMessages::delimEnd);
#endif
  }
  const MessageFragment *fragment[5];
  int nFragments = 0;
  if (allow_.inclusions())
    fragment[nFragments++] = &ParserMessages::inclusions;
  if (allow_.exclusions())
    fragment[nFragments++] = &ParserMessages::exclusions;
  switch (allow_.literal()) {
  case Param::minimumLiteral:
    fragment[nFragments++] = &ParserMessages::minimumLiteral;
    break;
  case Param::attributeValueLiteral:
  case Param::tokenizedAttributeValueLiteral:
    fragment[nFragments++] = &ParserMessages::attributeValueLiteral;
    break;
  case Param::systemIdentifier:
    fragment[nFragments++] = &ParserMessages::systemIdentifier;
    break;
  case Param::paramLiteral:
    fragment[nFragments++] = &ParserMessages::parameterLiteral;
    break;
  }
  switch (allow_.nameStart()) {
  case Param::name:
  case Param::entityName:
  case Param::paramEntityName:
    fragment[nFragments++] = &ParserMessages::name;
    break;
  case Param::attributeValue:
    fragment[nFragments++] = &ParserMessages::attributeValue;
    break;
  }
  if (allow_.digit() == Param::number)
    fragment[nFragments++] = &ParserMessages::number;
  
  for (i = 0; i < nFragments; i++) {
    if (!first)
      builder.appendFragment(ParserMessages::listSep);
    else
      first = 0;
    builder.appendFragment(*fragment[i]);
  }
  if (allow_.rni() || allow_.nameStart() == Param::reservedName) {
    for (int i = 0; i < Syntax::nNames; i++) {
      if (allow_.reservedName(Syntax::ReservedName(i))) {
	if (!first)
	  builder.appendFragment(ParserMessages::listSep);
	else
	  first = 0;
	StringC str;
	if (allow_.rni())
	  str = syntax_->delimGeneral(Syntax::dRNI);
	str += syntax_->reservedName(Syntax::ReservedName(i));
	builder.appendChars(str.data(), str.size());
      }
    }
  }
}