summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/zoomparser.tac
diff options
context:
space:
mode:
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_ ^]
+}