summaryrefslogtreecommitdiff
path: root/gcc/testsuite/melt/tandmatch-1.melt
blob: 80db58a082e58e4a82f76c72aa7b5f6587cb4fcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;; -*- lisp -*-
;; file tandmatch-1.melt

#| run in buildir/gcc
 ./cc1 -fmelt=runfile -fmelt-dynlibdir=. \
    -fmelt-compile-script=./built-melt-cc-script \
    -fmelt-gensrcdir=. -fmelt-tempdir=/tmp -fmelt-init=@warmelt2 \
    -fmelt-arg=.../tandmatch-1.melt -fmelt-debug
|#

(put_fields 'foobar 
	    :symb_data 'foodata)

(defun testmatchand (x)
  (debug_msg x "testmatchand x")
  (match x
	 ;; the example is stupid, we could use a single instance test
	 ;; but this is to test and patterns!
	 ( ?(and 
	     ?(instance class_named :named_name ?nam)
	     ;; a simple variable gets no tester but should be bound
	     ?xx
	     ?(instance class_symbol :symb_data ?dat))
	    (debug_msg xx "testmatchand xx")
	    (debug_msg nam "testmatchand nam")
	    (debug_msg dat "testmatchand dat")))) 

(testmatchand 'foobar)

;; eof testmatchand