[DEV] some corrections
This commit is contained in:
parent
258a6766c8
commit
c63f6b3ce1
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
1383
test/testBlock.cpp
1383
test/testBlock.cpp
File diff suppressed because it is too large
Load Diff
1379
test/testClass.cpp
1379
test/testClass.cpp
File diff suppressed because it is too large
Load Diff
3838
test/testDoWhile.cpp
3838
test/testDoWhile.cpp
File diff suppressed because it is too large
Load Diff
1616
test/testElse.cpp
1616
test/testElse.cpp
File diff suppressed because it is too large
Load Diff
3882
test/testFor.cpp
3882
test/testFor.cpp
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
1499
test/testStruct.cpp
1499
test/testStruct.cpp
File diff suppressed because it is too large
Load Diff
3903
test/testWhile.cpp
3903
test/testWhile.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user