summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/zoomparser.tac
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-02-26 16:56:59 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-02-26 16:56:59 (GMT)
commit008b58aed410034000a2398ef97e93ea8d5eb549 (patch)
tree88ea88a44ca358dd6082ff92f39894a480b14a2e /ds9/parsers/zoomparser.tac
parentd3a9b9f899af36b50a1f344e34692de035782912 (diff)
downloadblt-008b58aed410034000a2398ef97e93ea8d5eb549.zip
blt-008b58aed410034000a2398ef97e93ea8d5eb549.tar.gz
blt-008b58aed410034000a2398ef97e93ea8d5eb549.tar.bz2
cmd 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_ ^]
+}