Commit da690d13 authored by Victor Yacovlev's avatar Victor Yacovlev

Improved error underline for loop declaration

parent 572b154e
......@@ -1099,36 +1099,38 @@ void SyntaxAnalizerPrivate::parseLoopBegin(int str)
int toIndex = st.data.indexOf(toLexem);
int stepIndex = st.data.indexOf(stepLexem);
QString err = "";
if (fromIndex!=-1 && forIndex!=-1 && fromIndex-forIndex==1) {
forLexem->error = _("No loop variable");
return;
err = _("No loop variable");
}
if (toIndex!=-1 && fromIndex>toIndex) {
toLexem->error = _("'to' earler then 'from'");
return;
err = _("'to' earler then 'from'");
}
if (fromIndex==-1 && toIndex!=-1) {
toLexem->error = _("No 'from' before 'to'");
return;
err = _("No 'from' before 'to'");
}
if (fromIndex==-1 && toIndex==-1) {
forLexem->error = _("No 'from'..'to'.. after variable");
return;
err = _("No 'from'..'to'.. after variable");
}
if (!fromLexem) {
forLexem->error = _("No loop variable");
return;
err = _("No loop variable");
}
if (!fromLexem) {
forLexem->error = _("No loop 'from' value");
return;
err = _("No loop 'from' value");
}
if (!toLexem) {
forLexem->error = _("No loop 'to' value");
err = _("No loop 'to' value");
}
if (err.length()) {
for (int i=1; i<st.data.size(); i++) {
st.data[i]->error = err;
}
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment