diff --git a/brag/brag/rules/lexer.rkt b/brag/brag/rules/lexer.rkt index 877f563..32a205f 100755 --- a/brag/brag/rules/lexer.rkt +++ b/brag/brag/rules/lexer.rkt @@ -22,9 +22,6 @@ (:+ id-char))) - - - (define lex/1 (lexer-src-pos [(:: "'" @@ -64,6 +61,8 @@ (token-EOF lexeme)] [(:: id (:* whitespace) ":") (token-RULE_HEAD lexeme)] + [(:: "<" id ">" (:* whitespace) ":") + (token-RULE_HEAD_HIDDEN lexeme)] [id (token-ID lexeme)] diff --git a/brag/brag/rules/parser.rkt b/brag/brag/rules/parser.rkt index a9dc02d..5a318dc 100755 --- a/brag/brag/rules/parser.rkt +++ b/brag/brag/rules/parser.rkt @@ -17,6 +17,7 @@ token-PIPE token-REPEAT token-RULE_HEAD + token-RULE_HEAD_HIDDEN token-ID token-LIT token-EOF @@ -45,6 +46,7 @@ PIPE REPEAT RULE_HEAD + RULE_HEAD_HIDDEN ID LIT EOF)) @@ -84,7 +86,23 @@ (position-col $1-start-pos)) trimmed #f) - $2))]] + $2))] + + ;; angles indicate hiding. set hide value to #t + [(RULE_HEAD_HIDDEN pattern) + (begin + (begin + (define trimmed (cadr (regexp-match #px"<(\\w+)>\\s*:$" $1))) + (rule (position->pos $1-start-pos) + (position->pos $2-end-pos) + (lhs-id (position->pos $1-start-pos) + (pos (+ (position-offset $1-start-pos) + (string-length trimmed)) + (position-line $1-start-pos) + (position-col $1-start-pos)) + trimmed + #t) + $2)))]] [pattern [(implicit-pattern-sequence PIPE pattern)