 import Foundation
 import Kineo
 
-func parseAlgebra(_ qfile : String, verbose : Bool = false) throws {
+func parseAlgebra(_ qfile : String, silent : Bool = false) throws {
     let url = URL(fileURLWithPath: qfile)
     let sparql = try Data(contentsOf: url)
     guard var p = SPARQLParser(data: sparql) else { fatalError("Failed to construct SPARQL parser") }
     let algebra = try p.parse()
     let s = algebra.serialize()
-    if verbose {
+    if !silent {
         print(s)
     }
 }
 
-func parseTokens(_ qfile : String, verbose : Bool = false) throws {
+func parseTokens(_ qfile : String, silent : Bool = false) throws {
     let url = URL(fileURLWithPath: qfile)
     let sparql = try Data(contentsOf: url)
     let stream = InputStream(data: sparql)
     stream.open()
     var lexer = SPARQLLexer(source: stream)
     while let t = lexer.next() {
-        print("\(t)")
+        if !silent {
+            print("\(t)")
+        }
     }
 }
 
 var verbose = false
+var silent = false
 var printTokens = false
 let _args = CommandLine.arguments
 let argscount = _args.count


if let next = args.peek(), next.hasPrefix("-") {
    _ = args.next()
    if next == "-v" {
        verbose = true
    } else if next == "-t" {
        printTokens = true

do {
    warn("\(qfile)")
    if printTokens {
        try parseTokens(qfile, silent: silent)
    } else {
        try parseAlgebra(qfile, silent: silent)
    }
    //print("ok")
} catch SPARQLParsingError.parsingError(let message) {
