diff --git a/lang/ninja/src/ninja.sld b/lang/ninja/src/ninja.sld index f9c5bab..bd6ebdb 100644 --- a/lang/ninja/src/ninja.sld +++ b/lang/ninja/src/ninja.sld @@ -376,6 +376,21 @@ (parse-variable) rule) + (define (read-pool) + (define name (read-token)) + (unless (string? name) (error "reading pool: expected valid ident, found" name)) + (unless (expect-token 'newline) (error "reading pool: expected name to be followed by newline")) + (define (parse-variable) + (define name #f) + (define contents #f) + (when (expect-token 'indent) + (set! name (read-token)) + (unless (string? name) (error "reading pool: expected name, found" name)) + (unless (expect-token 'equals) (error "reading poolo: expected equals, found" (read-token))) + (set! contents (read-eval-string-text #f)) + (parse-variable))) + (parse-variable)) + (define (read-build-edge file) (define (read-list tail) (define eval-string (try-read-eval-string-text #t)) @@ -409,6 +424,8 @@ (define contents #f) (when (expect-token 'indent) (set! name (read-token)) + (when (eq? name 'pool) (set! name "pool")) ; uh. how is this supposed to work + (unless (string? name) (error "reading build edge var: expected name, found" name)) (unless (expect-token 'equals) (error "reading build edge var: expected equals, found" (read-token))) (set! contents (resolve-evalstring (read-eval-string-text #f) file #f #f #f)) @@ -430,7 +447,7 @@ ((default) (do () ((expect-token 'newline)) (set-build-file-default-targets! file (cons (resolve-evalstring (read-eval-string-text #t) file #f #f #f) (build-file-default-targets file))))) ((subninja include) (error "todo: includes")) - ((pool) (error "todo: pool declaration")) + ((pool) (read-pool) (read-toplevel file)) ((newline) (read-toplevel file)) (else (unless (string? token) (error "unexpected" (list token i)))