[Mulgara-svn] r803 - trunk/src/jar/itql/java/org/mulgara/itql
pag at mulgara.org
pag at mulgara.org
Mon Apr 21 22:30:10 UTC 2008
Author: pag
Date: 2008-04-21 15:30:10 -0700 (Mon, 21 Apr 2008)
New Revision: 803
Modified:
trunk/src/jar/itql/java/org/mulgara/itql/TqlSession.java
trunk/src/jar/itql/java/org/mulgara/itql/TqlSessionUI.java
Log:
Now handles partial commands that share a line with a previous command
Modified: trunk/src/jar/itql/java/org/mulgara/itql/TqlSession.java
===================================================================
--- trunk/src/jar/itql/java/org/mulgara/itql/TqlSession.java 2008-04-21 22:12:40 UTC (rev 802)
+++ trunk/src/jar/itql/java/org/mulgara/itql/TqlSession.java 2008-04-21 22:30:10 UTC (rev 803)
@@ -108,6 +108,9 @@
/** A flag to indicate that an executed command was complete */
private boolean incomplete = false;
+ /** The last command that was run. */
+ private String lastCommand = "";
+
/**
* Start an interactive TQL session from the command prompt.
* @param args command line parameters
@@ -218,14 +221,23 @@
answers.clear();
messages.clear();
- // presume complete commands
+ boolean previouslyIncomplete = incomplete;
+
+ // presume ensuing commands are complete
incomplete = false;
for (String query: commandSplitter.split(command)) {
// clear out empty commands
if (incomplete) incomplete = false;
- if (log.isDebugEnabled()) log.debug("Starting execution of command \"" + command + "\"");
+ // check if we need to follow on
+ if (previouslyIncomplete) {
+ query = lastCommand + query;
+ previouslyIncomplete = false;
+ }
+ lastCommand = query + " ";
+ if (log.isDebugEnabled()) log.debug("Starting execution of command \"" + query + "\"");
+
// execute the command
if (!autoTql.executeCommand(query)) {
close();
Modified: trunk/src/jar/itql/java/org/mulgara/itql/TqlSessionUI.java
===================================================================
--- trunk/src/jar/itql/java/org/mulgara/itql/TqlSessionUI.java 2008-04-21 22:12:40 UTC (rev 802)
+++ trunk/src/jar/itql/java/org/mulgara/itql/TqlSessionUI.java 2008-04-21 22:30:10 UTC (rev 803)
@@ -100,9 +100,6 @@
/** Whether we are running a command still. */
private volatile boolean runningCommand = false;
- /** The last command that was run. */
- private String lastCommand = "";
-
/**
* Create a new UI representation.
* @param newItqlSession the itql session to call when we receive commands and
@@ -410,10 +407,6 @@
// Put the command at the end of the array.
history.add(command);
- // check if we need to follow on
- if (tqlSession.isCommandIncomplete()) command = lastCommand + command;
- lastCommand = command + " ";
-
command = command + NEWLINE;
// If the array gets too large remove the last entry.
More information about the Mulgara-svn
mailing list