#lang scheme/base
(require "../base.ss")
(require (only-in (javascript-in ast)
prefix-operators
postfix-operators
infix-operators
assignment-operators
prefix-operator?
postfix-operator?
infix-operator?
assignment-operator?))
(define scheme-prefix-operators
(map (lambda (op)
(case op
[(++) 'pre++]
[(--) 'pre--]
[(+) 'pre+]
[(-) 'pre-]
[else op]))
prefix-operators))
(define scheme-postfix-operators
(map (lambda (op)
(case op
[(++) 'post++]
[(--) 'post--]
[else op]))
postfix-operators))
(define all-scheme-operators
`(,@scheme-prefix-operators
,@scheme-postfix-operators
,@infix-operators
,@assignment-operators))
(define (scheme-prefix-operator? op)
(if (memq op scheme-prefix-operators) #t #f))
(define (scheme-postfix-operator? op)
(if (memq op scheme-postfix-operators) #t #f))
(define (scheme-operator? op)
(if (memq op all-scheme-operators) #t #f))
(provide prefix-operators
postfix-operators
infix-operators
assignment-operators
prefix-operator?
postfix-operator?
infix-operator?
assignment-operator?)
(provide/contract
[scheme-prefix-operators (listof symbol?)]
[scheme-postfix-operators (listof symbol?)]
[scheme-prefix-operator? (-> any/c boolean?)]
[scheme-postfix-operator? (-> any/c boolean?)]
[scheme-operator? (-> any/c boolean?)])