mirror of
https://gitlab.com/niansa/pilang2.git
synced 2025-03-06 20:49:22 +01:00
Fixed bug with # in string
This commit is contained in:
parent
56393f28f0
commit
8a4572991c
1 changed files with 5 additions and 2 deletions
7
main.cpp
7
main.cpp
|
@ -478,7 +478,9 @@ void init_interpreter(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
std::string execline(std::string commandstr) {
|
||||
commandstr = ltrim(commandstr.substr(0, commandstr.find("#", 0)));
|
||||
commandstr = ltrim(commandstr);
|
||||
if (commandstr[0] == '#')
|
||||
return success;
|
||||
//std::cout << "$ " << commandstr << std::endl;
|
||||
if (rtrim(commandstr) == "") { // Command is empty
|
||||
return commandstr;
|
||||
|
@ -508,13 +510,14 @@ std::string execline(std::string commandstr) {
|
|||
bool charig = false;
|
||||
bool skipall = false;
|
||||
for (std::string::iterator currchar = argsstr.begin(); currchar < argsstr.end(); currchar++) {
|
||||
if (skipall) {
|
||||
if (skipall and *currchar != ',') {
|
||||
continue;
|
||||
} else if (*currchar == '"' and !skipall) {
|
||||
instring = !instring;
|
||||
if (currarg == "")
|
||||
arginstring = true;
|
||||
} else if (*currchar == '#' and !charig and !instring) {
|
||||
*(currchar + 1) = ',';
|
||||
skipall = true;
|
||||
} else if (*currchar == ',' and !charig and !instring) {
|
||||
if (currarg.length() != 0 and *currarg.begin() == '$' and !arginstring) {
|
||||
|
|
Loading…
Add table
Reference in a new issue