You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
Racket
43 lines
1.0 KiB
Racket
8 years ago
|
#lang racket/base
|
||
|
(provide (all-defined-out))
|
||
|
|
||
|
|
||
3 years ago
|
;; We keep our own position structure because yaragg/parser-tools/lex's position
|
||
8 years ago
|
;; structure is non-transparent, hence highly resistant to unit testing.
|
||
|
(struct pos (offset line col)
|
||
|
#:transparent)
|
||
|
|
||
|
(struct rule (start end lhs pattern)
|
||
|
#:transparent)
|
||
|
|
||
|
(struct lhs-id (start end val splice)
|
||
|
#:transparent)
|
||
|
|
||
|
;; A pattern can be one of the following:
|
||
|
(struct pattern (start end)
|
||
|
#:transparent)
|
||
|
|
||
|
(struct pattern-id pattern (val hide)
|
||
|
#:transparent)
|
||
|
|
||
|
;; Token structure to be defined by the user
|
||
|
(struct pattern-token pattern (val hide)
|
||
|
#:transparent)
|
||
|
|
||
|
;; Token structure defined as the literal string to be matched.
|
||
|
(struct pattern-lit pattern (val hide)
|
||
|
#:transparent)
|
||
|
|
||
7 years ago
|
(struct pattern-choice pattern (vals hide)
|
||
8 years ago
|
#:transparent)
|
||
|
|
||
7 years ago
|
(struct pattern-repeat pattern (min
|
||
|
max
|
||
7 years ago
|
val
|
||
|
hide)
|
||
8 years ago
|
#:transparent)
|
||
|
|
||
7 years ago
|
(struct pattern-seq pattern (vals hide)
|
||
8 years ago
|
#:transparent)
|
||
|
|