43 |
// to save us typing work in the rules action definitions |
// to save us typing work in the rules action definitions |
44 |
#define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer |
#define LSCPSERVER ((yyparse_param_t*) yyparse_param)->pServer |
45 |
#define SESSION_PARAM ((yyparse_param_t*) yyparse_param) |
#define SESSION_PARAM ((yyparse_param_t*) yyparse_param) |
46 |
#define INCREMENT_LINE { SESSION_PARAM->iLine++; SESSION_PARAM->iColumn = 0; sParsed.clear(); } |
#define INCREMENT_LINE { SESSION_PARAM->onNextLine(); sParsed.clear(); } |
47 |
|
|
48 |
// clears input buffer |
// clears input buffer |
49 |
void restart(yyparse_param_t* pparam, int& yychar); |
void restart(yyparse_param_t* pparam, int& yychar); |
2029 |
line.replace(0, nMin, l.substr(0, nMin)); |
line.replace(0, nMin, l.substr(0, nMin)); |
2030 |
} |
} |
2031 |
|
|
2032 |
|
size_t cursorPos = line.size() + param->iCursorOffset; |
2033 |
|
if (cursorPos < 0) cursorPos = 0; |
2034 |
|
|
2035 |
// generate an info string that will be sent to the LSCP shell for letting |
// generate an info string that will be sent to the LSCP shell for letting |
2036 |
// it know which part is correct, which one is wrong, where is the cursor, etc. |
// it know which part is correct, which one is wrong, where is the cursor, etc. |
2037 |
String result = line; |
String result = line; |
2038 |
result.insert(n <= result.length() ? n : result.length(), LSCP_SHK_GOOD_FRONT); |
result.insert(n <= result.length() ? n : result.length(), LSCP_SHK_GOOD_FRONT); |
2039 |
|
result.insert(cursorPos <= n ? cursorPos : cursorPos + String(LSCP_SHK_GOOD_FRONT).length(), LSCP_SHK_CURSOR); |
2040 |
int code = (n > line.length()) ? LSCP_SHU_COMPLETE : (n < line.length()) ? |
int code = (n > line.length()) ? LSCP_SHU_COMPLETE : (n < line.length()) ? |
2041 |
LSCP_SHU_SYNTAX_ERR : LSCP_SHU_INCOMPLETE; |
LSCP_SHU_SYNTAX_ERR : LSCP_SHU_INCOMPLETE; |
2042 |
result = "SHU:" + ToString(code) + ":" + result + LSCP_SHK_CURSOR; |
result = "SHU:" + ToString(code) + ":" + result; |
2043 |
//if (n > line.length()) result += " [OK]"; |
//if (n > line.length()) result += " [OK]"; |
2044 |
|
|
2045 |
// get a clean parser stack to the last valid parse position |
// get a clean parser stack to the last valid parse position |