lhs-id modifications ; tests pass

pull/2/head
Matthew Butterick 9 years ago
parent 2026c603de
commit 6d80193419

@ -22,9 +22,6 @@
(:+ id-char))) (:+ id-char)))
(define lex/1 (define lex/1
(lexer-src-pos (lexer-src-pos
[(:: "'" [(:: "'"
@ -64,6 +61,8 @@
(token-EOF lexeme)] (token-EOF lexeme)]
[(:: id (:* whitespace) ":") [(:: id (:* whitespace) ":")
(token-RULE_HEAD lexeme)] (token-RULE_HEAD lexeme)]
[(:: "<" id ">" (:* whitespace) ":")
(token-RULE_HEAD_HIDDEN lexeme)]
[id [id
(token-ID lexeme)] (token-ID lexeme)]

@ -17,6 +17,7 @@
token-PIPE token-PIPE
token-REPEAT token-REPEAT
token-RULE_HEAD token-RULE_HEAD
token-RULE_HEAD_HIDDEN
token-ID token-ID
token-LIT token-LIT
token-EOF token-EOF
@ -45,6 +46,7 @@
PIPE PIPE
REPEAT REPEAT
RULE_HEAD RULE_HEAD
RULE_HEAD_HIDDEN
ID ID
LIT LIT
EOF)) EOF))
@ -84,7 +86,23 @@
(position-col $1-start-pos)) (position-col $1-start-pos))
trimmed trimmed
#f) #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 [pattern
[(implicit-pattern-sequence PIPE pattern) [(implicit-pattern-sequence PIPE pattern)

Loading…
Cancel
Save