diff options
Diffstat (limited to 'sinksh/syntaxtree.cpp')
-rw-r--r-- | sinksh/syntaxtree.cpp | 8 |
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) { |