summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-06 23:08:48 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-06 23:08:48 (GMT)
commit021d6756d52f544b8db23ec1f0995afdfe550d80 (patch)
tree40f37874406c9c89709edde0fca3eda99030cc02
parentcca94f4a7bd7d29d942ff6e4ac522f10bf07d50f (diff)
downloadblt-021d6756d52f544b8db23ec1f0995afdfe550d80.zip
blt-021d6756d52f544b8db23ec1f0995afdfe550d80.tar.gz
blt-021d6756d52f544b8db23ec1f0995afdfe550d80.tar.bz2
add ds9 parsers
-rw-r--r--ds9/library/2mass.tcl12
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/make.include2
-rw-r--r--ds9/parsers/coords.fin5
-rw-r--r--ds9/parsers/coords.tin5
-rw-r--r--ds9/parsers/coords.trl9
-rw-r--r--ds9/parsers/twomasslex.fcl27
-rw-r--r--ds9/parsers/twomassparser.tac63
-rw-r--r--ds9/parsers/yesno.fin6
-rw-r--r--ds9/parsers/yesno.tin6
-rw-r--r--ds9/parsers/yesno.trl12
11 files changed, 148 insertions, 1 deletions
diff --git a/ds9/library/2mass.tcl b/ds9/library/2mass.tcl
index df4004c..24b9644 100644
--- a/ds9/library/2mass.tcl
+++ b/ds9/library/2mass.tcl
@@ -129,6 +129,18 @@ Foundation.
proc Process2MASSCmd {varname iname} {
upvar $varname var
+ upvar $iname ii
+
+ 2MASSDialog
+
+ twomass::YY_FLUSH_BUFFER
+ twomass::yy_scan_string [lrange $var $ii end]
+ twomass::yyparse
+ incr ii [expr $twomass::yycnt-1]
+}
+
+proc oProcess2MASSCmd {varname iname} {
+ upvar $varname var
upvar $iname i
2MASSDialog
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index b1be59f..6633edb 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -188,6 +188,8 @@ source $ds9(root)/library/xmfbox.tcl
source $ds9(root)/library/xmlrpc.tcl
source $ds9(root)/library/xpa.tcl
+source $ds9(root)/library/twomassparser.tcl
+source $ds9(root)/library/twomasslex.tcl
source $ds9(root)/library/panparser.tcl
source $ds9(root)/library/panlex.tcl
source $ds9(root)/library/zoomparser.tcl
diff --git a/ds9/make.include b/ds9/make.include
index 6453dda..54743da 100644
--- a/ds9/make.include
+++ b/ds9/make.include
@@ -7,7 +7,7 @@ $(prefix)/ds9/parsers/%parser.tcl : %parser.tac
tclsh $(prefix)/taccle/taccle.tcl -p $* -d -v -w $<
$(prefix)/ds9/parsers/%lex.tcl : %lex.fcl
- tclsh $(prefix)/fickle/fickle.tcl -P $* $<
+ tclsh $(prefix)/fickle/fickle.tcl -P $* -d $<
#--------------------------library
diff --git a/ds9/parsers/coords.fin b/ds9/parsers/coords.fin
index 394be49..e7766bd 100644
--- a/ds9/parsers/coords.fin
+++ b/ds9/parsers/coords.fin
@@ -38,6 +38,11 @@ j2000 {return $FK5_}
galactic {return $GALACTIC_}
ecliptic {return $ECLIPTIC_}
+degrees {return $DEGREES_}
+sexagesimal {return $SEXAGESIMAL_}
+arcmin {return $ARCMIN_}
+arcsec {return $ARCSEC_}
+
# SEXAGESIMAL
[+-]?{D}+:{D}+:{D}+"."? |
[+-]?{D}+:{D}+:{D}*"."{D}+ {set yylval $yytext; return $SEXSTR_}
diff --git a/ds9/parsers/coords.tin b/ds9/parsers/coords.tin
index ea9b92e..4b8aa7b 100644
--- a/ds9/parsers/coords.tin
+++ b/ds9/parsers/coords.tin
@@ -40,3 +40,8 @@
%token ECLIPTIC_
%token J2000_
%token B1950_
+
+%token DEGREES_
+%token SEXAGESIMAL_
+%token ARCMIN_
+%token ARCSEC_
diff --git a/ds9/parsers/coords.trl b/ds9/parsers/coords.trl
index c055be1..412a523 100644
--- a/ds9/parsers/coords.trl
+++ b/ds9/parsers/coords.trl
@@ -53,3 +53,12 @@ skyframe : FK4_ {set _ fk4}
YYABORT
}
;
+
+ skyformat : DEGREES_ {set _ degrees}
+ | ARCMIN_ {set _ arcmin}
+ | ARCSEC_ {set _ arcsec}
+ | error {
+ yyerror "must be: degrees|arcmin|arcsec"
+ YYABORT
+ }
+ ;
diff --git a/ds9/parsers/twomasslex.fcl b/ds9/parsers/twomasslex.fcl
new file mode 100644
index 0000000..86b21f8
--- /dev/null
+++ b/ds9/parsers/twomasslex.fcl
@@ -0,0 +1,27 @@
+#tab twomassparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+close {return $CLOSE_}
+coord {return $COORD_}
+crosshair {return $CROSSHAIR_}
+current {return $CURRENT_}
+frame {return $FRAME_}
+name {return $NAME_}
+new {return $NEW_}
+open {return $OPEN_}
+save {return $SAVE_}
+size {return $SIZE_}
+survey {return $SURVEY_}
+update {return $UPDATE_}
+
+#include base.fin
+#include coords.fin
+#include yesno.fin
+
+%%
diff --git a/ds9/parsers/twomassparser.tac b/ds9/parsers/twomassparser.tac
new file mode 100644
index 0000000..4fab16e
--- /dev/null
+++ b/ds9/parsers/twomassparser.tac
@@ -0,0 +1,63 @@
+%{
+%}
+
+#include base.tin
+#include coords.tin
+#include yesno.tin
+
+%start command
+
+%token CLOSE_
+%token COORD_
+%token CROSSHAIR_
+%token CURRENT_
+%token FRAME_
+%token NAME_
+%token NEW_
+%token OPEN_
+%token UPDATE_
+%token SAVE_
+%token SIZE_
+%token SURVEY_
+
+%%
+
+#include base.trl
+#include coords.trl
+#include yesno.trl
+
+command : 2mass
+ | 2mass {yyclearin; YYACCEPT} STRING_
+ ;
+
+deg : {set _ degrees}
+ | DEGREES_ {set _ degrees}
+ ;
+
+sex : {set _ sexagesimal}
+ | SEXAGESIMAL_ {set _ sexagesimal}
+ ;
+
+2mass : {IMGSVRApply dtwomass 1}
+ | OPEN_ {}
+ | CLOSE_ {ARDestroy dtwomass}
+ | STRING_ {global dtwomass; set dtwomass(name) $1; IMGSVRApply dtwomass 1}
+ | NAME_ STRING_ {global dtwomass; set dtwomass(name) $2; IMGSVRApply dtwomass 1}
+ | COORD_ numeric numeric deg {global dtwomass; set dtwomass(x) $2; set dtwomass(y) $3; set dtwomass(skyformat) $4; set dtwomass(skyformat,msg) $4; IMGSVRApply dtwomass 1}
+ | COORD_ SEXSTR_ SEXSTR_ sex {global dtwomass; set dtwomass(x) $2; set dtwomass(y) $3; set dtwomass(skyformat) $4; set dtwomass(skyformat,msg) $4; IMGSVRApply dtwomass 1}
+ | SIZE_ numeric numeric skyformat {global dtwomass; set dtwomass(width) $2; set dtwomass(height) $3; set dtwomass(rformat) $4; set dtwomass(rformat,msg) $4}
+ | SAVE_ yesno {global dtwomass; set dtwomass(save) $2}
+ | FRAME_ frame {global dtwomass; set dtwomass(mode) $2}
+ | UPDATE_ FRAME_ {IMGSVRUpdate dtwomass; IMGSVRApply dtwomass 1}
+ | UPDATE_ CROSSHAIR_ {IMGSVRCrosshair dtwomass; IMGSVRApply dtwomass 1}
+ | SURVEY_ survey {global dtwomass; set dtwomass(survey) $2}
+ ;
+
+frame : NEW_ {set _ new}
+ | CURRENT_ {set _ current}
+ ;
+
+survey : 'j' {set _ $1}
+ | 'h' {set _ $1}
+ | 'k' {set _ $1}
+ ;
diff --git a/ds9/parsers/yesno.fin b/ds9/parsers/yesno.fin
new file mode 100644
index 0000000..7307411
--- /dev/null
+++ b/ds9/parsers/yesno.fin
@@ -0,0 +1,6 @@
+yes {return $YES_}
+no {return $NO_}
+on {return $ON_}
+off {return $OFF_}
+true {return $TRUE_}
+false {return $FALSE_}
diff --git a/ds9/parsers/yesno.tin b/ds9/parsers/yesno.tin
new file mode 100644
index 0000000..ba84ffd
--- /dev/null
+++ b/ds9/parsers/yesno.tin
@@ -0,0 +1,6 @@
+%token YES_
+%token NO_
+%token ON_
+%token OFF_
+%token TRUE_
+%token FALSE_
diff --git a/ds9/parsers/yesno.trl b/ds9/parsers/yesno.trl
new file mode 100644
index 0000000..0871b27
--- /dev/null
+++ b/ds9/parsers/yesno.trl
@@ -0,0 +1,12 @@
+yesno : YES_ {set _ 1}
+ | ON_ {set _ 1}
+ | TRUE_ {set _ 1}
+ | NO_ {set _ 0}
+ | OFF_ {set _ 0}
+ | FALSE_ {set _ 0}
+ | error {
+ yyerror "must be: yes|on|true|no|off|false"
+ YYABORT
+ }
+;
+ \ No newline at end of file