Esempio n. 1
0
void Parser::pattern_spec(string id) {
    match(PATTERN);
    groups_pattern.clear();
    pattern_expr();
    name_spec();
    
}
Esempio n. 2
0
void Parser::regex_spec(string id) {
    match(REGEX);
    string regex = tokens[look].value;
    match(REGEX_);
    match(ON);
    column();
    name_spec();
    views[id].extract_regex(regex, groups, col_names, text);
}
Esempio n. 3
0
void UmlRelation::generate_def(QTextStream & f, WrapperStr indent, bool h,
                               WrapperStr templates, WrapperStr cl_names,
                               WrapperStr, WrapperStr)
{
    if (isClassMember() && !cppDecl().isEmpty()) {
        UmlClass * cl = (UmlClass *) parent();

        if ((!templates.isEmpty() || (cl->name().find('<') != -1))
            ? h : !h) {
            const char * p = cppDecl();
            const char * pp = 0;

            while ((*p == ' ') || (*p == '\t'))
                p += 1;

            bool re_template = !templates.isEmpty() &&
                               insert_template(p, f, indent, templates);

            if (*p != '#')
                f << indent;

            const char * pname = name_spec(p);

            for (;;) {
                if (*p == 0) {
                    if (pp == 0)
                        break;

                    // comment management done
                    p = pp;
                    pp = 0;

                    if (re_template)
                        f << templates;

                    if (*p == 0)
                        break;

                    if (*p != '#')
                        f << indent;
                }

                if (*p == '\n') {
                    f << toLocale(p);

                    if (*p && (*p != '#'))
                        f << indent;
                }
                else if (*p == '@')
                    manage_alias(p, f);
                else if (*p != '$') {
                    if (p == pname)
                        f << cl_names << "::";

                    f << toLocale(p);
                }
                else if (!strncmp(p, "${comment}", 10)) {
                    if (!manage_comment(p, pp, CppSettings::isGenerateJavadocStyleComment())
                        && re_template)
                        f << templates;
                }
                else if (!strncmp(p, "${description}", 14)) {
                    if (!manage_description(p, pp) && re_template)
                        f << templates;
                }
                else if (!strncmp(p, "${static}", 9)) {
                    p += 9;
                }
                else if (!strncmp(p, "${const}", 8)) {
                    p += 8;

                    if (isReadOnly())
                        f << "const ";
                }
                else if (!strncmp(p, "${volatile}", 11)) {
                    p += 11;

                    if (isVolatile())
                        f << "volatile ";
                }
                else if (!strncmp(p, "${mutable}", 10)) {
                    p += 10;
                }
                else if (!strncmp(p, "${type}", 7)) {
                    p += 7;
                    roleType()->write(f);
                }
                else if (!strncmp(p, "${name}", 7)) {
                    p += 7;

                    if (*pname == '$')
                        f << cl_names << "::";

                    f << roleName();
                }
                else if (!strncmp(p, "${inverse_name}", 15)) {
                    p += 15;

                    switch (relationKind()) {
                    case anAssociation:
                    case anAggregation:
                    case anAggregationByValue:
                        f << side(side(TRUE) != this)->roleName();

                    default:
                        break;
                    }
                }
                else if (!strncmp(p, "${multiplicity}", 15)) {
                    p += 15;

                    const WrapperStr & m = multiplicity();

                    if (!m.isEmpty() && (*((const char *) m) == '['))
                        f << m;
                    else
                        f << '[' << m << ']';
                }
                else if (!strncmp(p, "${stereotype}", 13)) {
                    p += 13;
                    f << CppSettings::relationAttributeStereotype(stereotype());
                }
                else if (!strncmp(p, "${value}", 8)) {
                    if (!defaultValue().isEmpty()) {
                        if (need_equal(p, defaultValue()))
                            f << " = ";

                        f << defaultValue();
                    }

                    p += 8;
                }
                else if (!strncmp(p, "${h_value}", 10))
                    p += 10;
                else if (!strncmp(p, "${association}", 14)) {
                    p += 14;
                    UmlClass::write(f, association());
                }
                else
                    // strange
                    f << toLocale(p);
            }

            f << '\n';
        }
    }
}
Esempio n. 4
0
void UmlAttribute::generate_def(QTextOStream & f, Q3CString indent, bool h,
				Q3CString templates, Q3CString cl_names,
				Q3CString, Q3CString) {
  if (isClassMember() && !cppDecl().isEmpty()) {
    UmlClass * cl = (UmlClass *) parent();

    if ((!templates.isEmpty() || ((cl->name().find('<') != -1))) ? h : !h) {
      const char * p = cppDecl();
      const char * pp = 0;
      
      while ((*p == ' ') || (*p == '\t'))
	p += 1;
      
      bool re_template = !templates.isEmpty() && 
	insert_template(p, f, indent, templates);
      
      if (*p != '#')
	f << indent;
      
      const char * pname = name_spec(p);
      
      for (;;) {
	if (*p == 0) {
	  if (pp == 0)
	    break;
	  
	  // comment management done
	  p = pp;
	  pp = 0;

	  if (re_template)
	    f << templates;

	  if (*p == 0)
	    break;

	  f << indent;
	}

	if (*p == '\n') {
	  f << *p++;
	  if (*p && (*p != '#'))
	    f << indent;
	}
	else if (*p == '@')
	  manage_alias(p, f);
	else if (*p != '$') {
	  if (p == pname)
	    f << cl_names << "::";
	  f << *p++;
	}
	else if (!strncmp(p, "${comment}", 10)) {
	  if (!manage_comment(p, pp, CppSettings::isGenerateJavadocStyleComment())
	      && re_template)
	    f << templates;
	}
	else if (!strncmp(p, "${description}", 14)) {
	  if (!manage_description(p, pp) && re_template)
	    f << templates;
	}
	else if (!strncmp(p, "${name}", 7)) {
	  if (*pname == '$')
	    f << cl_names << "::";
	  p += 7;
	  f << name();
	}
	else if (!strncmp(p, "${multiplicity}", 15)) {
	  p += 15;
      
	  const Q3CString & m = multiplicity();
	  
	  if (!m.isEmpty() && (*((const char *) m) == '['))
	    f << m;
	  else
	    f << '[' << m << ']';
	}
	else if (!strncmp(p, "${stereotype}", 13)) {
	  p += 13;
	  f << CppSettings::relationAttributeStereotype(stereotype());
	}
	else if (!strncmp(p, "${value}", 8)) {
	  if (!defaultValue().isEmpty()) {
	    if (need_equal(p, defaultValue()))
	      f << " = ";
	    f << defaultValue();
	  }
	  p += 8;
	}
	else if (!strncmp(p, "${h_value}", 10))
	  p += 10;
	else if (!strncmp(p, "${static}", 9)) {
	  p += 9;
	}
	else if (!strncmp(p, "${const}", 8)) {
	  p += 8;
	  if (isReadOnly())
	    f << "const ";
	}
	else if (!strncmp(p, "${volatile}", 11)) {
	  p += 11;
	  if (isVolatile())
	    f << "volatile ";
	}
	else if (!strncmp(p, "${mutable}", 10)) {
	  p += 10;
	}
	else if (!strncmp(p, "${type}", 7)) {
	  p += 7;
	  UmlClass::write(f, type());
	  //f << CppSettings::Type(Type().Type());
	}
	else
	  // strange
	  f << *p++;
      }
      
      f << '\n';
    }
  }
}