diff options
-rw-r--r-- | ds9/library/nameres.tcl | 31 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/coords.trl | 2 | ||||
-rw-r--r-- | ds9/parsers/nreslex.fcl | 29 | ||||
-rw-r--r-- | ds9/parsers/nresparser.tac | 60 |
5 files changed, 121 insertions, 3 deletions
diff --git a/ds9/library/nameres.tcl b/ds9/library/nameres.tcl index 075dfa0..8af9383 100644 --- a/ds9/library/nameres.tcl +++ b/ds9/library/nameres.tcl @@ -184,6 +184,19 @@ proc ProcessNRESCmd {varname iname} { upvar $varname var upvar $iname i + NRESDialog + + global debug + if {$debug(tcl,parser)} { + global cvarname + set cvarname dnres + + nres::YY_FLUSH_BUFFER + nres::yy_scan_string [lrange $var $i end] + nres::yyparse + incr i [expr $nres::yycnt-1] + } else { + set vvarname dnres upvar #0 $vvarname vvar global $vvarname @@ -191,8 +204,6 @@ proc ProcessNRESCmd {varname iname} { global nres global pnres - NRESDialog - switch -- [string tolower [lindex $var $i]] { {} - open {} @@ -230,6 +241,22 @@ proc ProcessNRESCmd {varname iname} { } } } +} + +proc NRESCmdSet {which value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar($which) $value +} + +proc NRESCmdName {value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(name) $value + NRESApply $cvarname 1 +} proc ProcessSendNRESCmd {proc id param} { global nres diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index b22de0b..1b5c3a1 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -272,6 +272,8 @@ source $ds9(root)/library/multiframeparser.tcl source $ds9(root)/library/multiframelex.tcl source $ds9(root)/library/nanparser.tcl source $ds9(root)/library/nanlex.tcl +source $ds9(root)/library/nresparser.tcl +source $ds9(root)/library/nreslex.tcl source $ds9(root)/library/nrrdparser.tcl source $ds9(root)/library/nrrdlex.tcl source $ds9(root)/library/nvssparser.tcl diff --git a/ds9/parsers/coords.trl b/ds9/parsers/coords.trl index e0dd7af..4aee420 100644 --- a/ds9/parsers/coords.trl +++ b/ds9/parsers/coords.trl @@ -57,7 +57,7 @@ skyframe : FK4_ {set _ fk4} # YYABORT # } -skyformat: DEGREES_ {set _ degrees} +skyformat : DEGREES_ {set _ degrees} | SEXAGESIMAL_ {set _ sexagesimal} ; diff --git a/ds9/parsers/nreslex.fcl b/ds9/parsers/nreslex.fcl new file mode 100644 index 0000000..bd8aad9 --- /dev/null +++ b/ds9/parsers/nreslex.fcl @@ -0,0 +1,29 @@ +#tab nresparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +close {return $CLOSE_} +crosshair {return $CROSSHAIR_} +name {return $NAME_} +open {return $OPEN_} +pan {return $PAN_} +server {return $SERVER_} +skyformat {return $SKYFORMAT_} + +ned-sao {return $NEDSAO_} +ned-cds {return $NEDCDS_} +simbad-sao {return $SIMBADSAO_} +simbad-cds {return $SIMBADCDS_} +vizier-sao {return $VIZIERSAO_} +vizier-cds {return $VIZIERCDS_} + +#include coords.fin +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/nresparser.tac b/ds9/parsers/nresparser.tac new file mode 100644 index 0000000..390ab52 --- /dev/null +++ b/ds9/parsers/nresparser.tac @@ -0,0 +1,60 @@ +%{ +%} + +#include coords.tin +#include numeric.tin +#include string.tin + +%start command + +%token CLOSE_ +%token CROSSHAIR_ +%token NAME_ +%token OPEN_ +%token PAN_ +%token SERVER_ +%token SKYFORMAT_ + +%token NEDSAO_ +%token NEDCDS_ +%token SIMBADSAO_ +%token SIMBADCDS_ +%token VIZIERSAO_ +%token VIZIERCDS_ + +%% + +#include coords.trl +#include numeric.trl + +command : nres + | nres {yyclearin; YYACCEPT} STRING_ + ; + +nres : OPEN_ + | CLOSE_ {global cvarname; ARDestroy $cvarname} + | SERVER_ server {global pnres; set pnres(server) $2} + | PAN_ {global cvarname; NRESPan $cvarname} + | CROSSHAIR_ {global cvarname; NRESCrosshair $cvarname} + | SKYFORMAT_ skyformat {NRESCmdSet skyformat $2; NRESCmdSet skyformat,msg $2} + | NAME_ STRING_ {NRESCmdName $2} + | STRING_ {NRESCmdName $1} + ; + +server : NEDSAO_ {set _ ned-sao} + | NEDCDS_ {set _ ned-cds} + | SIMBADSAO_ {set _ simbad-sao} + | SIMBADCDS_ {set _ simbad-cds} + | VIZIERSAO_ {set _ vizier-sao} + | VIZIERCDS_ {set _ vizier-cds} + ; + +%% + +proc nres::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |