summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/sampparser.tac
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-05-08 21:11:59 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-05-08 21:11:59 (GMT)
commit6736e9427bcbabf9a02b7549337df06226b805ae (patch)
treead929d5507cd53c027f2ec2b3d075fe1dce7d8a2 /ds9/parsers/sampparser.tac
parent3df839da664ea2addc7ccc6d7868dc55b0ee279b (diff)
downloadblt-6736e9427bcbabf9a02b7549337df06226b805ae.zip
blt-6736e9427bcbabf9a02b7549337df06226b805ae.tar.gz
blt-6736e9427bcbabf9a02b7549337df06226b805ae.tar.bz2
add ds9 samp parser
Diffstat (limited to 'ds9/parsers/sampparser.tac')
-rw-r--r--ds9/parsers/sampparser.tac50
1 files changed, 50 insertions, 0 deletions
diff --git a/ds9/parsers/sampparser.tac b/ds9/parsers/sampparser.tac
new file mode 100644
index 0000000..2c3d4ba
--- /dev/null
+++ b/ds9/parsers/sampparser.tac
@@ -0,0 +1,50 @@
+%{
+%}
+
+#include yesno.tin
+#include string.tin
+
+%start command
+
+%token BROADCAST_
+%token CONNECT_
+%token DISCONNECT_
+%token IMAGE_
+%token SEND_
+%token TABLE_
+
+%%
+
+#include yesno.trl
+
+command : samp
+ | samp {yyclearin; YYACCEPT} STRING_
+ ;
+
+samp : yes {SAMPConnect}
+ | no {SAMPDisconnect}
+ | CONNECT_ {SAMPConnect}
+ | DISCONNECT_ {SAMPDisconnect}
+ | BROADCAST_ broadcast
+ | SEND_ send
+ ;
+
+broadcast : {SAMPSendImageLoadFits {}}
+ | IMAGE_ {SAMPSendImageLoadFits {}}
+ | TABLE_ {SAMPSendTableLoadFits {}}
+ ;
+
+send : STRING_ {SAMPCmdSendImage $1}
+ | IMAGE_ STRING_ {SAMPCmdSendImage $2}
+ | TABLE_ STRING_ {SAMPCmdSendTable $2}
+ ;
+
+%%
+
+proc samp::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}