package backEnd;

import java.util.Collection;

import commands.Command;

class Parser {

	Parser() {
	}

	/**
	 * Called by the model via the controller every time a user runs a new
	 * script. The Parser will begin by checking the syntax to make sure there
	 * are no errors, and will return an integer for different error messages to
	 * be handled by the view.
	 * 
	 * @param script
	 *            Raw input from the user
	 * @return
	 * 
	 */
	int checkScript(String script) {
		return 0;
	}

	/**
	 * Called by the model if the input script is valid. At this point, the
	 * parser will split the script up into different lines and individual
	 * commands. The Parser will then call the CommandFactory to build all of
	 * the commands and add them to the returned list
	 * 
	 * @param script
	 *            Raw input from the user (always error free)
	 * @return A list of commands to be sent to the ScriptManager
	 */
	Collection<Command> parseScript(String script) {
		System.out.println(script);
		return null;
	}

}

@@ -40,16 +40,40 @@
 ection;%0A
+import commands.Command;
 %0Aimport 
@@ -88,17 +88,25 @@
 .Command
-;
+Factory;%0A
 %0A%0Aclass 
@@ -119,30 +119,74 @@
  %7B%0A%0A
-%09
+    private String myString;%0A%0A    
 Parser
+ 
 () %7B%0A
-%09%7D%0A%0A%09/**%0A%09
+%0A    %7D%0A%0A    /**%0A    
  * C
@@ -252,17 +252,20 @@
 s a new%0A
-%09
+    
  * scrip
@@ -331,17 +331,20 @@
 e there%0A
-%09
+    
  * are n
@@ -412,17 +412,20 @@
 ages to%0A
-%09
+    
  * be ha
@@ -443,22 +443,28 @@
 e view.%0A
-%09 * %0A%09
+     * %0A    
  * @para
@@ -464,39 +464,38 @@
 * @param script%0A
-%09 *
+ 
     
+*
         Raw inpu
@@ -510,17 +510,20 @@
 he user%0A
-%09
+    
  * @retu
@@ -529,19 +529,28 @@
 urn%0A
-%09 * %0A%09 */%0A%09
+     * %0A     */%0A    
 int 
@@ -556,24 +556,25 @@
  checkScript
+ 
 (String scri
@@ -579,18 +579,24 @@
 ript) %7B%0A
-%09%09
+        
 return 0
@@ -601,18 +601,27 @@
  0;%0A
-%09%7D%0A%0A%09/**%0A%09
+    %7D%0A%0A    /**%0A    
  * C
@@ -688,17 +688,20 @@
 nt, the%0A
-%09
+    
  * parse
@@ -763,17 +763,20 @@
 ividual%0A
-%09
+    
  * comma
@@ -841,17 +841,20 @@
  all of%0A
-%09
+    
  * the c
@@ -899,14 +899,20 @@
 ist%0A
-%09 * %0A%09
+     * %0A    
  * @
@@ -928,15 +928,14 @@
 ipt%0A
-%09 *
     
+ *
     
@@ -982,17 +982,20 @@
 r free)%0A
-%09
+    
  * @retu
@@ -1052,14 +1052,20 @@
 ger%0A
-%09 */%0A%09
+     */%0A    
 Coll
@@ -1091,16 +1091,17 @@
 seScript
+ 
 (String 
@@ -1110,18 +1110,24 @@
 ript) %7B%0A
-%09%09
+        
 System.o
@@ -1150,10 +1150,328 @@
 t);%0A
-%09%09
+        String%5B%5D inputArray = script.split(%22%5C%5Cs+%22);%0A        for (int i = 0; i %3C inputArray.length; i++) %7B%0A            System.out.println(inputArray%5Bi%5D);%0A        %7D%0A        %0A        CommandFactory myFactory = new CommandFactory();%0A        %0A        for (String input : inputArray)%0A        %7B%0A            %0A        %7D%0A%0A        
 retu
@@ -1483,10 +1483,12 @@
 ll;%0A
-%09%7D%0A
+    %7D
 %0A%7D%0A

split input text