   var sources: [String] = []
 
   func parseFromString(string: String) {
+    // Map names to processors
+    let map = [
+      "name":    self.parseName,
+      "sources": self.parseSources,
+      "module":  self.parseModule
+    ]
+
     let stringAsNSString = string as NSString
 
     var lineNumber = 0
+    
+    var scanner = NSScanner(string: string)
+    scanner.charactersToBeSkipped = WhitespaceCharacterSet
 
+    commandLoop: while !scanner.atEnd {
+      consumeCommentsAndNewlines(scanner)
+
+      let maybeWord = scanWord(scanner)
+
+      if maybeWord == nil {
+        if scanner.atEnd { return }
+
+        println("Ran out of input")
+        exit(1)
+      }
+
+      let word = maybeWord!
+
+      for (command, action) in map {
+        if word == command {
+          // println("Action found for \(word)")
+          action(scanner, 0)
+          continue commandLoop
+        }
+      }
+
+      println("Unrecognied token `\(word)`")
+      exit(1)
+    }
+
+
+    /*
     stringAsNSString.enumerateLinesUsingBlock { (line, stop) in
-      // Map names to processors
-      let map = [
-        "name": self.parseName,
-        "sources": self.parseSources
-      ]
-
       let scanner = NSScanner(string: line)
       lineNumber += 1
 

      println("Unrecognized token '\(token!)' on line \(lineNumber)")
      exit(1)
    }
  }

  func parseName(scanner: NSScanner, _ lineNumber: Int) {

    }
  }

  func parseModule(scanner: NSScanner, _ lineNumber: Int) {
    mustScanWord(scanner, "{")

    scanner.scanUpToString("}", intoString: nil)
    scanner.scanString("}", intoString: nil)
  }

  func validate() {
    // TODO: Implement some validations
    return
