From 08ce1967aeb83710caaffad9562abddd822dd12a Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Sun, 20 Aug 2017 13:35:40 +0100 Subject: [PATCH] [functional-tests/regex] add comment for regex grammar. --- functional-tests/regex.scm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/functional-tests/regex.scm b/functional-tests/regex.scm index 1b27ca3..fe49655 100644 --- a/functional-tests/regex.scm +++ b/functional-tests/regex.scm @@ -149,7 +149,6 @@ ;; current threads. Note there cannot be more threads than instructions, so ;; a yarn is represented as a vector the same length as the instructions. ;; Threads are run in lock step, all taking the same input. - (define-record-type yarn (fields (mutable size) (mutable stack) @@ -219,7 +218,7 @@ (add-thread! threads l1) (add-thread! threads l2))))) - ;; compile to thunks to avoid calling match in the loop. + ;; compile to closures to avoid calling match in the loop. (let ((code (vector-copy code))) (define (step in-c) @@ -248,4 +247,28 @@ (c-loop (+ 1 c-index))))) (any-matches? threads code)))))))))) + ;;;-------------------------------------------------------- + ;;; Parser + + ;; ::= | + ;; ::= "|" + ;; ::= | + ;; ::= + ;; ::= | | + ;; ::= "*" + ;; ::= "+" + ;; ::= | | | | + ;; ::= "(" ")" + ;; ::= "." + ;; ::= "$" + ;; ::= any non metacharacter | "\" metacharacter + ;; ::= | + ;; ::= "[" "]" + ;; ::= "[^" "]" + ;; ::= | + ;; ::= | + ;; ::= "-" + + ;; I don't care about parse performance so we'll use a simple recursive + ;; decent parser. )