@ -78,15 +78,15 @@
( member ( syntax-e #' start-rule ) ' RULE-IDS ) )
( member ( syntax-e #' start-rule ) ' RULE-IDS ) )
;; The cfg-parser depends on the start-rule provided in (start ...) to have the same
;; The cfg-parser depends on the start-rule provided in (start ...) to have the same
;; context as the rest of this body. Hence RECOLORED-START-RULE
;; context as the rest of this body. Hence RECOLORED-START-RULE
( with-syntax ( [ RECOLORED-START-RULE ( datum->syntax #' RULES-STX ( syntax-e #' start-rule ) ) ] )
( with-syntax ( [ RECOLORED-START-RULE ( datum->syntax #' RULES-STX ( syntax-e #' start-rule ) ) ]
#' ( let ( [ THE-GRAMMAR ( cfg-parser ( tokens enumerated-tokens )
[ PARSE-NAME ( datum->syntax #' RULES-STX ( string->symbol ( format " ~a-rule-parser " ' start-rule ) ) ) ] )
#' ( let* ( [ THE-GRAMMAR ( cfg-parser ( tokens enumerated-tokens )
( src-pos )
( src-pos )
( start RECOLORED-START-RULE )
( start RECOLORED-START-RULE )
( end EOF )
( end EOF )
( error THE-ERROR-HANDLER )
( error THE-ERROR-HANDLER )
( grammar . GENERATED-RULE-CODES ) ) ] )
( grammar . GENERATED-RULE-CODES ) ) ]
( procedure-rename
[ THE-BODY ( lambda ( tokenizer )
( case-lambda [ ( tokenizer )
( define next-token
( define next-token
( make-permissive-tokenizer tokenizer all-tokens-hash/mutable ) )
( make-permissive-tokenizer tokenizer all-tokens-hash/mutable ) )
;; little post-processor to support cuts on top rule name
;; little post-processor to support cuts on top rule name
@ -97,10 +97,13 @@
( if ( eq? ( syntax-property top-rule-name-stx ' hide-or-splice? ) ' hide )
( if ( eq? ( syntax-property top-rule-name-stx ' hide-or-splice? ) ' hide )
;; use `remove-rule-name` so we get the same housekeeping
;; use `remove-rule-name` so we get the same housekeeping
( remove-rule-name parse-tree-stx )
( remove-rule-name parse-tree-stx )
parse-tree-stx ) ]
parse-tree-stx ) ) ] )
( procedure-rename
( case-lambda [ ( tokenizer )
( THE-BODY tokenizer ) ]
[ ( source tokenizer )
[ ( source tokenizer )
( parameterize ( [ current-source source ] )
( parameterize ( [ current-source source ] )
( PARSE tokenizer ) ) ] )
( THE-BODY tokenizer ) ) ] )
( string->symbol ( format " ~a-rule-parser " ' start-rule ) ) ) ) ) ]
( string->symbol ( format " ~a-rule-parser " ' start-rule ) ) ) ) ) ]
[ ( _ not-a-rule-id )
[ ( _ not-a-rule-id )
( raise-syntax-error #f
( raise-syntax-error #f