awk.ss: Awk-like Syntax

To load: (require (lib "awk.ss"))

This library defines the awk macro from Scsh:

(awk next-record-expr
     (record field-variable ···)
     counter-variable/optional
     ((state-variable init-expr) ···)
     continue-variable/optional
  clause ···)

counter-variable/optional is either empty or
  variable

continue-variable/optional is either empty or
  variable

clause is one of
  (test body-expr ···1)
  (test => procedure-expr)
  (/ regexp-str / (variable-or-false ···1) body-expr ···1)
  (range exclusive-start-test exclusive-stop-test body-expr ···1)
  (:range inclusive-start-test exclusive-stop-test body-expr ···1)
  (range: exclusive-start-test inclusive-stop-test body-expr ···1)
  (:range: inclusive-start-test inclusive-inclusive-stop-test body-expr ···1)
  (else body-expr ···1)
  (after body-expr ···1)

test is one of
  integer
  regexp-str 
  expr

variable-or-false is one of
  variable
  #f

For detailed information about awk, see Olin Shivers's Scsh Reference Manual. In addition to awk, the Scsh-compatible procedures match:start, match:end, match:substring, and regexp-exec are defined. These match: procedures must be used to extract match information in a regular expression clause when using the => form.