Ver Fonte

Simplification constructeur

Arthur Brandao há 6 anos atrás
pai
commit
afe5dacfd3
1 ficheiros alterados com 9 adições e 18 exclusões
  1. 9 18
      src/migl/lisp/LispImpl.java

+ 9 - 18
src/migl/lisp/LispImpl.java

@@ -10,27 +10,18 @@ public class LispImpl implements Lisp {
 
 	@Override
 	public Object parse(String expr) throws LispError {
-		/*
-		 * Implementer Grammaire
-		 * X = E | F
-		 * E = bool | entier | decimal | string
-		 * F = '('X*')'
-		 */
 		Stack<String> explode = this.explode(expr);
-		while(explode.size() > 0) {
-			String val = explode.remove(0);
-			//Analyse le type d'expression
-			if(val.equals("(")){
-				return this.parseList(explode);
-			} else {
-				//Element seul
-				if(explode.size() > 1) {
-					throw new LispError("Invalid format");
-				}
-				return this.parseElement(val);
+		//Analyse le type d'expression
+		String val = explode.remove(0);
+		if(val.equals("(")){
+			return this.parseList(explode);
+		} else {
+			//Element seul
+			if(explode.size() > 1) {
+				throw new LispError("Invalid format");
 			}
+			return this.parseElement(val);
 		}
-		return null;
 	}
 
 	@Override