Move semantic actions into their own module

remotes/jackfirth/master
Jack Firth 2 years ago
parent de06a5ed82
commit b2611aee1b

@ -17,17 +17,7 @@
(-> semantic-action? parser-derivation? #:rest (listof parser-derivation?)
nonterminal-derivation?))]
[parser-derivation->syntax (-> parser-derivation? syntax?)]
[parser-derivation->datum (-> parser-derivation? any/c)]
[semantic-action? predicate/c]
[cut-action cut-action?]
[cut-action? predicate/c]
[splice-action splice-action?]
[splice-action? predicate/c]
[label-action? predicate/c]
[label-action (->* (any/c) (#:properties hash? #:expression-properties hash?) label-action?)]
[label-action-value (-> label-action? any/c)]
[label-action-properties (-> label-action? hash?)]
[label-action-expression-properties (-> label-action? hash?)]))
[parser-derivation->datum (-> parser-derivation? any/c)]))
(require racket/match
@ -35,6 +25,7 @@
racket/struct
rebellion/collection/vector
rebellion/private/static-name
yaragg/base/semantic-action
yaragg/base/token)
@ -47,35 +38,6 @@
;@----------------------------------------------------------------------------------------------------
(define (semantic-action? v)
(or (cut-action? v) (splice-action? v) (label-action? v)))
(struct cut-action () #:transparent #:constructor-name constructor:cut-action #:omit-define-syntaxes)
(define cut-action (constructor:cut-action))
(struct splice-action ()
#:transparent #:constructor-name constructor:splice-action #:omit-define-syntaxes)
(define splice-action (constructor:splice-action))
(struct label-action (value expression-properties properties)
#:transparent
#:constructor-name constructor:label-action
#:omit-define-syntaxes
#:guard
(struct-guard/c any/c
(hash/c any/c any/c #:immutable #true #:flat? #true)
(hash/c any/c any/c #:immutable #true #:flat? #true)))
(define (label-action value
#:properties [properties (hash)]
#:expression-properties [expression-properties (hash)])
(constructor:label-action value properties expression-properties))
(define (parser-derivation? v)
(or (terminal-derivation? v) (nonterminal-derivation? v)))

@ -21,7 +21,8 @@
(require racket/sequence
racket/set
rebellion/collection/vector
yaragg/base/derivation)
yaragg/base/derivation
yaragg/base/semantic-action)
;@----------------------------------------------------------------------------------------------------

@ -0,0 +1,58 @@
#lang racket/base
(require racket/contract/base)
(provide
(contract-out
[semantic-action? predicate/c]
[cut-action cut-action?]
[cut-action? predicate/c]
[splice-action splice-action?]
[splice-action? predicate/c]
[label-action? predicate/c]
[label-action (->* (any/c) (#:properties hash? #:expression-properties hash?) label-action?)]
[label-action-value (-> label-action? any/c)]
[label-action-properties (-> label-action? hash?)]
[label-action-expression-properties (-> label-action? hash?)]))
(require racket/match
racket/sequence
racket/struct
rebellion/collection/vector
rebellion/private/static-name
yaragg/base/token)
;@----------------------------------------------------------------------------------------------------
(define (semantic-action? v)
(or (cut-action? v) (splice-action? v) (label-action? v)))
(struct cut-action () #:transparent #:constructor-name constructor:cut-action #:omit-define-syntaxes)
(define cut-action (constructor:cut-action))
(struct splice-action ()
#:transparent #:constructor-name constructor:splice-action #:omit-define-syntaxes)
(define splice-action (constructor:splice-action))
(struct label-action (value expression-properties properties)
#:transparent
#:constructor-name constructor:label-action
#:omit-define-syntaxes
#:guard
(struct-guard/c any/c
(hash/c any/c any/c #:immutable #true #:flat? #true)
(hash/c any/c any/c #:immutable #true #:flat? #true)))
(define (label-action value
#:properties [properties (hash)]
#:expression-properties [expression-properties (hash)])
(constructor:label-action value properties expression-properties))
Loading…
Cancel
Save