summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/zoomparser.tac
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-02-27 21:38:03 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-02-27 21:38:03 (GMT)
commitce6caae3395949230e685564a975433fb2b3cd32 (patch)
tree1940ae3da0df4c93451d89f4210feef4923743bb /ds9/parsers/zoomparser.tac
parent79990d84c0f50dd1c64a56dc6670e3478088cf66 (diff)
downloadblt-ce6caae3395949230e685564a975433fb2b3cd32.zip
blt-ce6caae3395949230e685564a975433fb2b3cd32.tar.gz
blt-ce6caae3395949230e685564a975433fb2b3cd32.tar.bz2
add ds9 parsers
Diffstat (limited to 'ds9/parsers/zoomparser.tac')
-rw-r--r--ds9/parsers/zoomparser.tac46
1 files changed, 46 insertions, 0 deletions
diff --git a/ds9/parsers/zoomparser.tac b/ds9/parsers/zoomparser.tac
new file mode 100644
index 0000000..16d7ade
--- /dev/null
+++ b/ds9/parsers/zoomparser.tac
@@ -0,0 +1,46 @@
+%{
+%}
+
+%token INT_
+%token REAL_
+%token STRING_
+
+%start command
+
+%token CLOSE_
+%token IN_
+%token FIT_
+%token OPEN_
+%token OUT_
+%token TO_
+
+%%
+
+command : {ProcessRealizeDS9} zoom
+ ;
+
+zoom : numeric {Zoom $1 $1}
+ | numeric numeric {Zoom $1 $2}
+ | OPEN_ {PanZoomDialog}
+ | CLOSE_ {PanZoomDestroyDialog}
+ | IN_ {Zoom 2 2}
+ | OUT_ {Zoom .5 .5}
+ | TO_ zoomTo
+ ;
+
+zoomTo: FIT_ {ZoomToFit}
+ | numeric {global zoom; set current(zoom) " $1 $1 "; ChangeZoom}
+ | numeric numeric {global zoom; set current(zoom) " $1 $2 "; ChangeZoom}
+ ;
+
+numeric : INT_ {set _ $1}
+ | REAL_ {set _ $1}
+ ;
+
+%%
+
+proc zoom::yyerror {msg} {
+ puts stderr "$msg:"
+ puts stderr "$zoom::yy_current_buffer"
+ puts stderr [format "%*s" $zoom::index_ ^]
+}