summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-03 22:52:28 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-03 22:52:28 (GMT)
commite7b4d65a7d83358bf1647547112e4b48b830ea76 (patch)
treebe1e99a034db5bd35c8b815d86ba1ce1bd8dcd79
parent1d6ba2b117bdf94a16402ae8e380c6dd9e10ef51 (diff)
downloadblt-e7b4d65a7d83358bf1647547112e4b48b830ea76.zip
blt-e7b4d65a7d83358bf1647547112e4b48b830ea76.tar.gz
blt-e7b4d65a7d83358bf1647547112e4b48b830ea76.tar.bz2
simplify ds9 parsers
-rw-r--r--ds9/parsers/base.fin12
-rw-r--r--ds9/parsers/coords.fin12
-rw-r--r--ds9/parsers/panparser.tac113
-rw-r--r--ds9/parsers/zoomparser.tac10
4 files changed, 20 insertions, 127 deletions
diff --git a/ds9/parsers/base.fin b/ds9/parsers/base.fin
index a1c6932..6a63cac 100644
--- a/ds9/parsers/base.fin
+++ b/ds9/parsers/base.fin
@@ -5,18 +5,6 @@
[+-]?{D}+"."?({E})? |
[+-]?{D}*"."{D}+({E})? {set yylval $yytext; return $REAL_}
-# SEXAGESIMAL
-[+-]?{D}+:{D}+:{D}+"."? |
-[+-]?{D}+:{D}+:{D}*"."{D}+ {set yylval $yytext; return $SEXSTR_}
-
-# HMS
-[+-]?{D}+h{D}+m{D}+"."?s |
-[+-]?{D}+h{D}+m{D}*"."{D}+s {set yylval $yytext; return $HMSSTR_}
-
-# DMS
-[+-]?{D}+d{D}+m{D}+"."?s |
-[+-]?{D}+d{D}+m{D}*"."{D}+s {set yylval $yytext; return $SMSSTR_}
-
# Quoted STRING
\"[^\"]*\" {set yylval [string range $yytext 1 end-1]; return $STRING_}
diff --git a/ds9/parsers/coords.fin b/ds9/parsers/coords.fin
index 3c72e46..394be49 100644
--- a/ds9/parsers/coords.fin
+++ b/ds9/parsers/coords.fin
@@ -38,3 +38,15 @@ j2000 {return $FK5_}
galactic {return $GALACTIC_}
ecliptic {return $ECLIPTIC_}
+# SEXAGESIMAL
+[+-]?{D}+:{D}+:{D}+"."? |
+[+-]?{D}+:{D}+:{D}*"."{D}+ {set yylval $yytext; return $SEXSTR_}
+
+# HMS
+[+-]?{D}+h{D}+m{D}+"."?s |
+[+-]?{D}+h{D}+m{D}*"."{D}+s {set yylval $yytext; return $HMSSTR_}
+
+# DMS
+[+-]?{D}+d{D}+m{D}+"."?s |
+[+-]?{D}+d{D}+m{D}*"."{D}+s {set yylval $yytext; return $SMSSTR_}
+
diff --git a/ds9/parsers/panparser.tac b/ds9/parsers/panparser.tac
index 2e208a5..7ebab1c 100644
--- a/ds9/parsers/panparser.tac
+++ b/ds9/parsers/panparser.tac
@@ -3,125 +3,22 @@
%start command
-%token INT_
-%token REAL_
-%token STRING_
-%token SEXSTR_
+#include coords.tin
+#include base.tin
%token CLOSE_
%token OPEN_
%token TO_
-%token IMAGE_
-%token PHYSICAL_
-%token AMPLIFIER_
-%token DETECTOR_
-
-%token WCS_
-%token WCSA_
-%token WCSB_
-%token WCSC_
-%token WCSD_
-%token WCSE_
-%token WCSF_
-%token WCSG_
-%token WCSH_
-%token WCSI_
-%token WCSJ_
-%token WCSK_
-%token WCSL_
-%token WCSM_
-%token WCSN_
-%token WCSO_
-%token WCSP_
-%token WCSQ_
-%token WCSR_
-%token WCSS_
-%token WCST_
-%token WCSU_
-%token WCSV_
-%token WCSW_
-%token WCSX_
-%token WCSY_
-%token WCSZ_
-
-%token FK4_
-%token FK5_
-%token ICRS_
-%token GALACTIC_
-%token ECLIPTIC_
-%token J2000_
-%token B1950_
-
%%
+#include coords.trl
+#include base.trl
+
command : pan
| pan {yyclearin; YYACCEPT} STRING_
;
-numeric : INT_ {set _ $1}
- | REAL_ {set _ $1}
- ;
-
-coordsys : IMAGE_ {set _ image}
- | PHYSICAL_ {set _ physical}
- | AMPLIFIER_ {set _ amplifier}
- | DETECTOR_ {set _ detector}
- ;
-
-#| error {
-# yyerror "must be: image|physical|amplifier|detector"
-# YYABORT
-# }
-
-wcssys : WCS_ {set _ wcs}
- | WCSA_ {set _ wcsa}
- | WCSB_ {set _ wcsb}
- | WCSC_ {set _ wcsc}
- | WCSD_ {set _ wcsd}
- | WCSE_ {set _ wcse}
- | WCSF_ {set _ wcsf}
- | WCSG_ {set _ wcsg}
- | WCSH_ {set _ wcsh}
- | WCSI_ {set _ wcsi}
- | WCSJ_ {set _ wcsj}
- | WCSK_ {set _ wcsk}
- | WCSL_ {set _ wcsl}
- | WCSM_ {set _ wcsm}
- | WCSN_ {set _ wcsn}
- | WCSO_ {set _ wcso}
- | WCSP_ {set _ wcsp}
- | WCSQ_ {set _ wcsq}
- | WCSR_ {set _ wcsr}
- | WCSS_ {set _ wcss}
- | WCST_ {set _ wcst}
- | WCSU_ {set _ wcsu}
- | WCSV_ {set _ wcsv}
- | WCSW_ {set _ wcsw}
- | WCSX_ {set _ wcsx}
- | WCSY_ {set _ wcsy}
- | WCSZ_ {set _ wcsz}
- ;
-
-# | error {
-# yyerror "must be: wcs|wcsa...wcsz"
-# YYABORT
-# }
-
-skyframe : FK4_ {set _ fk4}
- | B1950_ {set _ fk4}
- | FK5_ {set _ fk5}
- | J2000_ {set _ fk5}
- | ICRS_ {set _ icrs}
- | GALACTIC_ {set _ galactic}
- | ECLIPTIC_ {set _ ecliptic}
- ;
-
-# | error {
-# yyerror "must be: fk4|fk5|icrs|galactic|ecliptic"
-# YYABORT
-# }
-
pan : OPEN_ {PanZoomDialog}
| CLOSE_ {PanZoomDestroyDialog}
| TO_ panto
diff --git a/ds9/parsers/zoomparser.tac b/ds9/parsers/zoomparser.tac
index 1e2969e..71c738d 100644
--- a/ds9/parsers/zoomparser.tac
+++ b/ds9/parsers/zoomparser.tac
@@ -1,9 +1,7 @@
%{
%}
-%token INT_
-%token REAL_
-%token STRING_
+#include base.tin
%start command
@@ -16,14 +14,12 @@
%%
+#include base.trl
+
command : zoom
| zoom {yyclearin; YYACCEPT} STRING_
;
-numeric : INT_ {set _ $1}
- | REAL_ {set _ $1}
- ;
-
zoom : OPEN_ {PanZoomDialog}
| CLOSE_ {PanZoomDestroyDialog}
| IN_ {Zoom 2 2}