3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2014 Christian Schoenebeck * |
* Copyright (C) 2005 - 2016 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
1620 |
// the token is valid, "stackCopy" has been reduced accordingly |
// the token is valid, "stackCopy" has been reduced accordingly |
1621 |
// and now do recurse ... |
// and now do recurse ... |
1622 |
nextExpectedChars += _tokenName(token); |
nextExpectedChars += _tokenName(token); |
1623 |
nextExpectedCharsLen = nextExpectedChars.size(); |
nextExpectedCharsLen = (int)nextExpectedChars.size(); |
1624 |
walkAndFillExpectedSymbols( //FIXME: could cause stack overflow (should be a loop instead), is probably fine with our current grammar though |
walkAndFillExpectedSymbols( //FIXME: could cause stack overflow (should be a loop instead), is probably fine with our current grammar though |
1625 |
stackCopy, expectedSymbols, nextExpectedChars, history, depth + 1 |
stackCopy, expectedSymbols, nextExpectedChars, history, depth + 1 |
1626 |
); |
); |
1663 |
|
|
1664 |
// "shift" / push the new state on the symbol stack and call this |
// "shift" / push the new state on the symbol stack and call this |
1665 |
// function recursively, and restore the stack after the recurse return |
// function recursively, and restore the stack after the recurse return |
1666 |
stackSize = stack.size(); |
stackSize = (int)stack.size(); |
1667 |
nextExpectedCharsLen = nextExpectedChars.size(); |
nextExpectedCharsLen = (int)nextExpectedChars.size(); |
1668 |
stack.push_back(action); |
stack.push_back(action); |
1669 |
nextExpectedChars += _tokenName(token); |
nextExpectedChars += _tokenName(token); |
1670 |
walkAndFillExpectedSymbols( //FIXME: could cause stack overflow (should be a loop instead), is probably fine with our current grammar though |
walkAndFillExpectedSymbols( //FIXME: could cause stack overflow (should be a loop instead), is probably fine with our current grammar though |
1865 |
yyparse_param_t* param = GetCurrentYaccSession(); |
yyparse_param_t* param = GetCurrentYaccSession(); |
1866 |
YYTYPE_INT16* ss = (*param->ppStackBottom); |
YYTYPE_INT16* ss = (*param->ppStackBottom); |
1867 |
YYTYPE_INT16* sp = (*param->ppStackTop); |
YYTYPE_INT16* sp = (*param->ppStackTop); |
1868 |
int iStackSize = sp - ss + 1; |
int iStackSize = int(sp - ss + 1); |
1869 |
// copy and wrap parser's symbol stack into a convenient STL container |
// copy and wrap parser's symbol stack into a convenient STL container |
1870 |
std::vector<YYTYPE_INT16> stack; |
std::vector<YYTYPE_INT16> stack; |
1871 |
for (int i = 0; i < iStackSize; ++i) { |
for (int i = 0; i < iStackSize; ++i) { |
1981 |
// (from the left) |
// (from the left) |
1982 |
String sCommon; |
String sCommon; |
1983 |
for (int i = 0; true; ++i) { |
for (int i = 0; true; ++i) { |
1984 |
char c; |
char c = '\0'; |
1985 |
for (std::map<String,BisonSymbolInfo>::const_iterator it = expectedSymbols.begin(); |
for (std::map<String,BisonSymbolInfo>::const_iterator it = expectedSymbols.begin(); |
1986 |
it != expectedSymbols.end(); ++it) |
it != expectedSymbols.end(); ++it) |
1987 |
{ |
{ |
2062 |
// if auto correction is enabled, apply the auto corrected string to |
// if auto correction is enabled, apply the auto corrected string to |
2063 |
// intput/output string 'line' |
// intput/output string 'line' |
2064 |
if (param->bShellAutoCorrect) { |
if (param->bShellAutoCorrect) { |
2065 |
int nMin = (n < line.length()) ? n : line.length(); |
int nMin = int( (n < line.length()) ? n : line.length() ); |
2066 |
line.replace(0, nMin, l.substr(0, nMin)); |
line.replace(0, nMin, l.substr(0, nMin)); |
2067 |
} |
} |
2068 |
|
|
2069 |
size_t cursorPos = line.size() + param->iCursorOffset; |
ssize_t cursorPos = line.size() + param->iCursorOffset; |
2070 |
if (cursorPos < 0) cursorPos = 0; |
if (cursorPos < 0) cursorPos = 0; |
2071 |
|
|
2072 |
// 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 |