summaryrefslogtreecommitdiffstats
path: root/sinksh/syntaxtree.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-15 10:44:25 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-15 10:44:25 +0100
commitd09517a4d4fcdf496c0298ef8b8f54f3c9120293 (patch)
tree7b35e8ebe88ae5ff47387deb428c3ff8da42d28e /sinksh/syntaxtree.cpp
parent4e9f8f2590f55b39b9ff70d2c375fc2d25d2500d (diff)
downloadsink-d09517a4d4fcdf496c0298ef8b8f54f3c9120293.tar.gz
sink-d09517a4d4fcdf496c0298ef8b8f54f3c9120293.zip
sinksh fixes
Diffstat (limited to 'sinksh/syntaxtree.cpp')
-rw-r--r--sinksh/syntaxtree.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/sinksh/syntaxtree.cpp b/sinksh/syntaxtree.cpp
index 3380b04..8a8684c 100644
--- a/sinksh/syntaxtree.cpp
+++ b/sinksh/syntaxtree.cpp
@@ -101,14 +101,22 @@ SyntaxTree::Command SyntaxTree::match(const QStringList &commandLine) const
101 QStringList tailCommands; 101 QStringList tailCommands;
102 while (commandLineIt.hasNext() && syntaxIt.hasNext()) { 102 while (commandLineIt.hasNext() && syntaxIt.hasNext()) {
103 const QString word = commandLineIt.next(); 103 const QString word = commandLineIt.next();
104 bool match = false;
104 while (syntaxIt.hasNext()) { 105 while (syntaxIt.hasNext()) {
105 const Syntax &syntax = syntaxIt.next(); 106 const Syntax &syntax = syntaxIt.next();
106 if (word == syntax.keyword) { 107 if (word == syntax.keyword) {
107 lastFullSyntax = &syntax; 108 lastFullSyntax = &syntax;
108 syntaxIt = syntax.children; 109 syntaxIt = syntax.children;
110 match = true;
109 break; 111 break;
110 } 112 }
111 } 113 }
114 if (!match) {
115 //Otherwise we would miss the just evaluated command from the tailCommands
116 if (commandLineIt.hasPrevious()) {
117 commandLineIt.previous();
118 }
119 }
112 } 120 }
113 121
114 if (lastFullSyntax) { 122 if (lastFullSyntax) {