@ -78,15 +78,15 @@
( member ( syntax-e #' start-rule ) ' RULE-IDS ) )
;; 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
( with-syntax ( [ RECOLORED-START-RULE ( datum->syntax #' RULES-STX ( syntax-e #' start-rule ) ) ] )
#' ( let ( [ THE-GRAMMAR ( cfg-parser ( tokens enumerated-tokens )
( with-syntax ( [ RECOLORED-START-RULE ( datum->syntax #' RULES-STX ( syntax-e #' start-rule ) ) ]
[ PARSE-NAME ( datum->syntax #' RULES-STX ( string->symbol ( format " ~a-rule-parser " ' start-rule ) ) ) ] )
#' ( let* ( [ THE-GRAMMAR ( cfg-parser ( tokens enumerated-tokens )
( src-pos )
( start RECOLORED-START-RULE )
( end EOF )
( error THE-ERROR-HANDLER )
( grammar . GENERATED-RULE-CODES ) ) ] )
( procedure-rename
( case-lambda [ ( tokenizer )
( grammar . GENERATED-RULE-CODES ) ) ]
[ THE-BODY ( lambda ( tokenizer )
( define next-token
( make-permissive-tokenizer tokenizer all-tokens-hash/mutable ) )
;; 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 )
;; use `remove-rule-name` so we get the same housekeeping
( remove-rule-name parse-tree-stx )
parse-tree-stx ) ]
parse-tree-stx ) ) ] )
( procedure-rename
( case-lambda [ ( tokenizer )
( THE-BODY tokenizer ) ]
[ ( source tokenizer )
( parameterize ( [ current-source source ] )
( PARSE tokenizer ) ) ] )
( THE-BODY tokenizer ) ) ] )
( string->symbol ( format " ~a-rule-parser " ' start-rule ) ) ) ) ) ]
[ ( _ not-a-rule-id )
( raise-syntax-error #f