Skip to content

Commit

Permalink
rename is_mother to is_single
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Jan 5, 2025
1 parent 3e22f67 commit ef48e95
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 145 deletions.
110 changes: 55 additions & 55 deletions config/json/layout/type.json

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions config/layout/type.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/module/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ def command_layout_type(item: Dict[str, Any], prefix: str, value: str) -> str:
idtext = itemid.replace(prefix, "")
idtextlower = idtext.lower()
generate_name = item.get("generate_name", idtext.lower())
is_mother = str(item.get("is_mother", "false")).lower()
is_single = str(item.get("is_single", "false")).lower()

return (
f"({itemid}, "
+ f'"{idtext}", '
+ f'"{idtextlower}", '
+ f'"{generate_name}", '
+ f'"{value}", '
+ f"{is_mother}"
+ f"{is_single}"
+ ")\n"
)

Expand Down
4 changes: 2 additions & 2 deletions config/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,15 +744,15 @@ def get_a_attr(attributes: List[Dict], attr_id: str) -> Optional[Dict]:
first_value = values[0] if values else ""

generate_name = item.get("generate_name", "")
is_mother = item.get("is_mother", False)
is_single = item.get("is_single", False)

docs += f'<h2 id="{id}">دستور <code>{first_value}</code></h2>\n'
docs += descriptions.get(SELECTED_LANGUAGE, "") + "\n"
docs += (
"این دستور "
+ (
"مادر است و می تواند حامی دستوراتی به عنوان فرزند باشد."
if is_mother
if is_single
else "فرزند است."
)
+ "\n\n"
Expand Down
38 changes: 19 additions & 19 deletions src/ast_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,19 @@ ast_layout_node_type_t name_to_ast_layout_node_type(char *name) {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
else if (strcmp(name, NAME) == 0) { \
type = TYPE; \
return type; \
}
#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
else if (strcmp(name, NAME) == 0) { \
type = TYPE; \
return type; \
}
#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
else if (strcmp(name, NAME) == 0) { \
type = TYPE; \
return type; \
Expand Down Expand Up @@ -445,15 +445,15 @@ ast_layout_node_type_t enduser_name_to_ast_layout_node_type(char *name) {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
else if (strcmp(name, ENDUSER_NAME) == 0) { \
type = TYPE; \
return type; \
}
#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)
#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
else if (strcmp(name, ENDUSER_NAME) == 0) { \
type = TYPE; \
return type; \
Expand Down Expand Up @@ -512,15 +512,15 @@ char *ast_layout_node_type_to_name(ast_layout_node_type_t type) {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
case TYPE: \
return NAME;
#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
case TYPE: \
return NAME;
#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)

#include "generated-config/ast_layout_type.h"
}
Expand All @@ -544,15 +544,15 @@ char *ast_layout_node_type_to_enduser_name(ast_layout_node_type_t type) {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
case TYPE: \
return ENDUSER_NAME;
#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
case TYPE: \
return ENDUSER_NAME;
#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)

#include "generated-config/ast_layout_type.h"
}
Expand Down Expand Up @@ -616,24 +616,24 @@ ast_layout_attribute_type_t name_to_ast_layout_attribute_type(char *name) {
}

// TODO
bool ast_layout_node_type_is_mother(ast_layout_node_type_t type) {
bool ast_layout_node_type_is_single(ast_layout_node_type_t type) {
switch (type) {
#undef ADD_LAYOUT_TYPE
#undef ADD_LAYOUT_TYPE_HIDE
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
case TYPE: \
return IS_MOTHER;
return IS_SINGLE;

#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
case TYPE: \
return IS_MOTHER;
return IS_SINGLE;

#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)

#include "generated-config/ast_layout_type.h"
}
Expand All @@ -656,7 +656,7 @@ ast_layout_attribute_type_t ast_layout_attribute_enduser_name_in_node_to_type(ch
}
}

if (ast_layout_node_type_is_mother(parent_node_type)) {
if (ast_layout_node_type_is_single(parent_node_type)) {
char *enduser_content = ast_layout_attribute_type_to_enduser_name(AST_LAYOUT_ATTRIBUTE_TYPE_CONTENT);
if (strcmp(name, enduser_content) == 0) {
return AST_LAYOUT_ATTRIBUTE_TYPE_CONTENT;
Expand Down
8 changes: 4 additions & 4 deletions src/ast_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ typedef enum {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
TYPE,
#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
TYPE,
#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)

#include "generated-config/ast_layout_type.h"
} ast_layout_node_type_t;
Expand Down Expand Up @@ -432,6 +432,6 @@ char *ast_layout_attribute_type_to_enduser_name(
ast_layout_attribute_type_t type);

// TODO
bool ast_layout_node_type_is_mother(ast_layout_node_type_t type);
bool ast_layout_node_type_is_single(ast_layout_node_type_t type);

#endif
6 changes: 3 additions & 3 deletions src/generator_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,15 +1157,15 @@ char *generator_code_layout_node_type(ast_layout_node_type_t type) {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
case TYPE: \
return GENERATED_NAME;
#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
case TYPE: \
return GENERATED_NAME;
#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)

#include "generated-config/ast_layout_type.h"
}
Expand Down
10 changes: 5 additions & 5 deletions src/validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ bool is_layout_node_a_single_tag(ast_layout_node_type_t type) {
#undef ADD_LAYOUT_TYPE_REPEAT

#define ADD_LAYOUT_TYPE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, ENDUSER_NAME, \
IS_MOTHER) \
IS_SINGLE) \
case TYPE: \
return IS_MOTHER;
return IS_SINGLE;

#define ADD_LAYOUT_TYPE_HIDE(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER) \
ENDUSER_NAME, IS_SINGLE) \
case TYPE: \
return IS_MOTHER;
return IS_SINGLE;

#define ADD_LAYOUT_TYPE_REPEAT(TYPE, NAME, NAME_LOWER, GENERATED_NAME, \
ENDUSER_NAME, IS_MOTHER)
ENDUSER_NAME, IS_SINGLE)

#include "generated-config/ast_layout_type.h"
}
Expand Down

0 comments on commit ef48e95

Please sign in to comment.