From 44a961c1f3f71474c45744f1dd3f590d6aa3eadd Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 11 May 2018 15:40:07 -0400 Subject: add ds9 smosaiciraf parser --- ds9/library/smosaiciraf.tcl | 22 ++++++++++------------ ds9/library/source.tcl | 2 ++ ds9/parsers/smosaiciraflex.fcl | 15 +++++++++++++++ ds9/parsers/smosaicirafparser.tac | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 ds9/parsers/smosaiciraflex.fcl create mode 100644 ds9/parsers/smosaicirafparser.tac diff --git a/ds9/library/smosaiciraf.tcl b/ds9/library/smosaiciraf.tcl index 18d92c5..bf5cde2 100644 --- a/ds9/library/smosaiciraf.tcl +++ b/ds9/library/smosaiciraf.tcl @@ -21,11 +21,15 @@ proc ProcessSMosaicIRAFCmd {varname iname sock fn layer} { upvar $varname var upvar $iname i - global loadParam - global current + global debug + if {$debug(tcl,parser)} { + smosaiciraf::YY_FLUSH_BUFFER + smosaiciraf::yy_scan_string [lrange $var $i end] + smosaiciraf::yyparse + incr i [expr $smosaiciraf::yycnt-1] + } else { set layer {} - switch -- [string tolower [lindex $var $i]] { new { incr i @@ -41,20 +45,13 @@ proc ProcessSMosaicIRAFCmd {varname iname sock fn layer} { } } - set opt [lindex $var $i] - if {$opt != {}} { - incr i - } else { - set opt wcs - } - if {$sock != {}} { # xpa if {0} { # not supported } else { LoadSMosaicIRAFFile [lindex $var $i] [lindex $var [expr $i+1]] \ - $layer $opt + $layer } } else { # comm @@ -62,8 +59,9 @@ proc ProcessSMosaicIRAFCmd {varname iname sock fn layer} { # not supported } else { LoadSMosaicIRAFFile [lindex $var $i] [lindex $var [expr $i+1]] \ - $layer $opt + $layer } } FinishLoad } +} diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 2030400..b22de0b 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -324,6 +324,8 @@ source $ds9(root)/library/sleepparser.tcl source $ds9(root)/library/sleeplex.tcl source $ds9(root)/library/smoothparser.tcl source $ds9(root)/library/smoothlex.tcl +source $ds9(root)/library/smosaicirafparser.tcl +source $ds9(root)/library/smosaiciraflex.tcl source $ds9(root)/library/smosaicwcsparser.tcl source $ds9(root)/library/smosaicwcslex.tcl source $ds9(root)/library/sourceparser.tcl diff --git a/ds9/parsers/smosaiciraflex.fcl b/ds9/parsers/smosaiciraflex.fcl new file mode 100644 index 0000000..9af2cd3 --- /dev/null +++ b/ds9/parsers/smosaiciraflex.fcl @@ -0,0 +1,15 @@ +#tab smosaicirafparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +mask {return $MASK_} +new {return $NEW_} + +#include string.fin + +%% diff --git a/ds9/parsers/smosaicirafparser.tac b/ds9/parsers/smosaicirafparser.tac new file mode 100644 index 0000000..daa6a3b --- /dev/null +++ b/ds9/parsers/smosaicirafparser.tac @@ -0,0 +1,33 @@ +%{ +%} + +#include string.tin + +%start command + +%token MASK_ +%token NEW_ + +%% + +command : smosaiciraf + | smosaiciraf {yyclearin; YYACCEPT} STRING_ + ; + +smosaiciraf : opts STRING_ STRING_ {LoadSMosaicIRAFFile $2 $3 $1} + ; + +opts : + | NEW_ {CreateFrame; set _ {}} + | MASK_ {set _ mask} + ; + +%% + +proc smosaiciraf::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12