[DEV] some corrections

This commit is contained in:
Edouard DUPIN 2018-01-22 21:06:47 +01:00
parent 258a6766c8
commit c63f6b3ce1
11 changed files with 20069 additions and 803 deletions

View File

@ -139,6 +139,42 @@ estyle::Generator::Generator():
propertyParenthese.set("switch", etk::move(estyle::GroupProperty(this, "parenthese", "switch")));
propertyParenthese.set("block", etk::move(estyle::GroupProperty(this, "parenthese", "block")));
etk::String type = "if";
propertyCondition.set(type, etk::move(eproperty::List<int8_t>(this, "condition-" + type + "-mode", 0, "Contion generic property")));
propertyCondition[type].add(0, "none");
propertyCondition[type].add(1, "magic");
//propertyCondition[type].add(2, "right");
//propertyCondition[type].add(3, "left");
type = "for";
propertyCondition.set(type, etk::move(eproperty::List<int8_t>(this, "condition-" + type + "-mode", 0, "Contion generic property")));
propertyCondition[type].add(0, "none");
propertyCondition[type].add(1, "magic");
//propertyCondition[type].add(2, "right");
//propertyCondition[type].add(3, "left");
type = "while";
propertyCondition.set(type, etk::move(eproperty::List<int8_t>(this, "condition-" + type + "-mode", 0, "Contion generic property")));
propertyCondition[type].add(0, "none");
propertyCondition[type].add(1, "magic");
//propertyCondition[type].add(2, "right");
//propertyCondition[type].add(3, "left");
type = "do-while";
propertyCondition.set(type, etk::move(eproperty::List<int8_t>(this, "condition-" + type + "-mode", 0, "Contion generic property")));
propertyCondition[type].add(0, "none");
propertyCondition[type].add(1, "magic");
//propertyCondition[type].add(2, "right");
//propertyCondition[type].add(3, "left");
/*
type = "function";
propertyCondition.set(type, etk::move(eproperty::List<int8_t>(this, "condition-" + type + "-mode", 0, "Contion generic property"));
propertyCondition[type].add(0, "none");
propertyCondition[type].add(1, "magic");
//propertyCondition[type].add(2, "right");
//propertyCondition[type].add(3, "left");
*/
}
estyle::Generator::~Generator() {
@ -1104,27 +1140,33 @@ int64_t estyle::Generator::generateCondition(int64_t _pos) {
}
}
if ( nbCondition == 0
|| removeNewLine == true) {
|| removeNewLine == true
|| propertyCondition[m_type].get() == 0) {
ESTYLE_WARNING("==> only one element");
process(_pos+1, sectionEnd);
} else {
m_output += " ";
offsetPushAuto();
for (int64_t iii=_pos+1; iii<=sectionEnd; ++iii) {
enum estyle::lexer::tocken elem = m_lexer.getTocken(iii);
if (elem == estyle::lexer::PARENTHESE_IN) {
iii = generateCondition(iii);
} else if ( elem == estyle::lexer::AND_AND
|| elem == estyle::lexer::OR_OR) {
addNewLine();
offsetPop();
addSpace();
offsetPush(5);
m_output += " " + m_lexer.getData(iii) + " ";
} else {
iii = process(iii, sectionEnd, estyle::lexer::AND_AND, estyle::lexer::OR_OR, estyle::lexer::PARENTHESE_IN, estyle::lexer::PARENTHESE_OUT);
iii--;
if (propertyCondition[m_type].get() == 1) {
m_output += " ";
offsetPushAuto();
for (int64_t iii=_pos+1; iii<=sectionEnd; ++iii) {
enum estyle::lexer::tocken elem = m_lexer.getTocken(iii);
if (elem == estyle::lexer::PARENTHESE_IN) {
iii = generateCondition(iii);
} else if ( elem == estyle::lexer::AND_AND
|| elem == estyle::lexer::OR_OR) {
addNewLine();
offsetPop();
addSpace();
offsetPush(5);
m_output += " " + m_lexer.getData(iii) + " ";
} else {
iii = process(iii, sectionEnd, estyle::lexer::AND_AND, estyle::lexer::OR_OR, estyle::lexer::PARENTHESE_IN, estyle::lexer::PARENTHESE_OUT);
iii--;
}
}
} else {
ESTYLE_ERROR("UN-impllemented methode of condition ... ==> TODO");
process(_pos+1, sectionEnd);
}
offsetPop();
}

View File

@ -31,6 +31,7 @@ namespace estyle {
// brace for "if"
etk::Map<etk::String, estyle::GroupProperty> propertyBrace;
etk::Map<etk::String, estyle::GroupProperty> propertyParenthese;
etk::Map<etk::String, eproperty::List<int8_t>> propertyCondition;
private:
void clear();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff