summaryrefslogtreecommitdiffstats
path: root/ds9/parsers
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-01 19:11:07 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-01 19:11:07 (GMT)
commit88233512265280fd373a68e890599090f8ebb524 (patch)
tree7dc427469e91997ced5bd77145c860f1d86240af /ds9/parsers
parentf0494107d510409a45df1dfb556144abb50716ab (diff)
downloadblt-88233512265280fd373a68e890599090f8ebb524.zip
blt-88233512265280fd373a68e890599090f8ebb524.tar.gz
blt-88233512265280fd373a68e890599090f8ebb524.tar.bz2
add ds9 pan parser
Diffstat (limited to 'ds9/parsers')
-rw-r--r--ds9/parsers/panlex.fcl6
-rw-r--r--ds9/parsers/panparser.tac48
-rw-r--r--ds9/parsers/zoomparser.tac6
3 files changed, 27 insertions, 33 deletions
diff --git a/ds9/parsers/panlex.fcl b/ds9/parsers/panlex.fcl
index 351de9e..18c5115 100644
--- a/ds9/parsers/panlex.fcl
+++ b/ds9/parsers/panlex.fcl
@@ -15,7 +15,8 @@ E [Ee][+-]?{D}+
%%
--zscale {return $pan::CMD_}
+-zscale {return $pan::CMD_}
+-zoom {return $pan::CMD_}
close {return $pan::CLOSE_}
open {return $pan::OPEN_}
@@ -89,6 +90,9 @@ ecliptic {return $pan::ECLIPTIC_}
# Quoted STRING
\{[^\}]*\} {set pan::yylval [string range $yytext 1 end-1]; return $pan::STRING_}
+# CMD
+#-\S+\S+ {set pan::yylval $yytext; return $pan::CMD_}
+
# STRING
\S+\S+ {set pan::yylval $yytext; return $pan::STRING_}
diff --git a/ds9/parsers/panparser.tac b/ds9/parsers/panparser.tac
index 85f40e1..42c2ad0 100644
--- a/ds9/parsers/panparser.tac
+++ b/ds9/parsers/panparser.tac
@@ -1,8 +1,4 @@
%{
-namespace eval pan {
- variable xx {}
- variable yy {}
-}
%}
%start command
@@ -62,7 +58,7 @@ namespace eval pan {
%%
command : pan
-| pan CMD_ {pan::yyclearin}
+| pan {pan::yyclearin; YYACCEPT} CMD_
;
numeric : INT_ {set _ $1}
@@ -128,35 +124,29 @@ skyframe : FK4_ {set _ fk4}
# YYABORT
# }
-coord : numeric numeric {set pan::xx $1; set pan::yy $2}
- ;
-
-skycoord : SEXSTR_ SEXSTR_ {set pan::xx $1; set pan::yy $2}
- ;
-
pan : OPEN_ {PanZoomDialog}
| CLOSE_ {PanZoomDestroyDialog}
| TO_ panto
- | coord {Pan $pan::xx $pan::yy physical}
- | coord coordsys {Pan $pan::xx $pan::yy $2}
- | coord wcssys {Pan $pan::xx $pan::yy $2 fk5}
- | coord wcssys skyframe {Pan $pan::xx $pan::yy $2 $3}
- | coord skyframe {Pan $pan::xx $pan::yy wcs $3}
- | skycoord {Pan $pan::xx $pan::yy wcs fk5}
- | skycoord wcssys {Pan $pan::xx $pan::yy $2 fk5}
- | skycoord wcssys skyframe {Pan $pan::xx $pan::yy $2 $3}
- | skycoord skyframe {Pan $pan::xx $pan::yy wcs $2}
+ | numeric numeric {Pan $1 $2 physical}
+ | numeric numeric coordsys {Pan $1 $2 $3}
+ | numeric numeric wcssys {Pan $1 $2 $3 fk5}
+ | numeric numeric skyframe {Pan $1 $2 wcs $3}
+ | numeric numeric wcssys skyframe {Pan $1 $2 $3 $4}
+ | SEXSTR_ SEXSTR_ {Pan $1 $2 wcs fk5}
+ | SEXSTR_ SEXSTR_ wcssys {Pan $1 $2 $3 fk5}
+ | SEXSTR_ SEXSTR_ skyframe {Pan $1 $2 wcs $3}
+ | SEXSTR_ SEXSTR_ wcssys skyframe {Pan $1 $2 $3 $4}
;
-panto : coord {PanTo $pan::xx $pan::yy physical}
- | coord coordsys {PanTo $pan::xx $pan::yy $2}
- | coord wcssys {PanTo $pan::xx $pan::yy $2 fk5}
- | coord wcssys skyframe {PanTo $pan::xx $pan::yy $2 $3}
- | coord skyframe {PanTo $pan::xx $pan::yy wcs $3}
- | skycoord {PanTo $pan::xx $pan::yy wcs fk5}
- | skycoord wcssys {PanTo $pan::xx $pan::yy $2 fk5}
- | skycoord wcssys skyframe {PanTo $pan::xx $pan::yy $2 $3}
- | skycoord skyframe {PanTo $pan::xx $pan::yy wcs $2}
+panto : numeric numeric {PanTo $1 $2 physical}
+ | numeric numeric coordsys {PanTo $1 $2 $3}
+ | numeric numeric wcssys {PanTo $1 $2 $3 fk5}
+ | numeric numeric skyframe {PanTo $1 $2 wcs $3}
+ | numeric numeric wcssys skyframe {PanTo $1 $2 $3 $4}
+ | SEXSTR_ SEXSTR_ {PanTo $1 $2 wcs fk5}
+ | SEXSTR_ SEXSTR_ wcssys {PanTo $1 $2 $3 fk5}
+ | SEXSTR_ SEXSTR_ skyframe {PanTo $1 $2 wcs $3}
+ | SEXSTR_ SEXSTR_ wcssys skyframe {PanTo $1 $2 $3 $4}
;
%%
diff --git a/ds9/parsers/zoomparser.tac b/ds9/parsers/zoomparser.tac
index 5a8211b..a49b838 100644
--- a/ds9/parsers/zoomparser.tac
+++ b/ds9/parsers/zoomparser.tac
@@ -17,7 +17,7 @@
%%
command : zoom
- | zoom STRING_ {zoom::yyclearin}
+ | zoom {zoom::yyclearin; YYACCEPT} STRING_
;
numeric : INT_ {set _ $1}
@@ -41,7 +41,7 @@ zoomTo: FIT_ {ZoomToFit}
%%
proc zoom::yyerror {msg} {
- puts stderr "$msg:"
puts stderr "$zoom::yy_current_buffer"
- puts stderr [format "zoom %*s" $zoom::index_ ^]
+ puts stderr [format "%*s" $zoom::index_ ^]
+ puts stderr "$msg:"
}