diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-05-14 17:38:22 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-05-14 17:38:22 (GMT) |
commit | 5f2e59a9516c29a4c92eadbdbdf73398f73f5214 (patch) | |
tree | e0d9d4d61b96d1dd14ee3cfcc9379a33d4f2b546 /ds9 | |
parent | 2fa692287fff7c95f049b4cb890c971c300d157e (diff) | |
download | blt-5f2e59a9516c29a4c92eadbdbdf73398f73f5214.zip blt-5f2e59a9516c29a4c92eadbdbdf73398f73f5214.tar.gz blt-5f2e59a9516c29a4c92eadbdbdf73398f73f5214.tar.bz2 |
add ds9 preserve parser
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/load.tcl | 9 | ||||
-rw-r--r-- | ds9/library/source.tcl | 6 | ||||
-rw-r--r-- | ds9/parsers/preservelex.fcl | 17 | ||||
-rw-r--r-- | ds9/parsers/preserveparser.tac | 34 |
4 files changed, 64 insertions, 2 deletions
diff --git a/ds9/library/load.tcl b/ds9/library/load.tcl index 1a7cd37..221a1f6 100644 --- a/ds9/library/load.tcl +++ b/ds9/library/load.tcl @@ -434,6 +434,14 @@ proc ProcessPreserveCmd {varname iname} { upvar $varname var upvar $iname i + global debug + if {$debug(tcl,parser)} { + preserve::YY_FLUSH_BUFFER + preserve::yy_scan_string [lrange $var $i end] + preserve::yyparse + incr i [expr $preserve::yycnt-1] + } else { + global ds9 global scale global panzoom @@ -453,6 +461,7 @@ proc ProcessPreserveCmd {varname iname} { } } } +} proc ProcessSendPreserveCmd {proc id param} { global scale diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 13f0c09..e24dbad 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -292,10 +292,12 @@ source $ds9(root)/library/pixeltableparser.tcl source $ds9(root)/library/pixeltablelex.tcl source $ds9(root)/library/plotparser.tcl source $ds9(root)/library/plotlex.tcl -source $ds9(root)/library/prefsparser.tcl -source $ds9(root)/library/prefslex.tcl source $ds9(root)/library/precisionparser.tcl source $ds9(root)/library/precisionlex.tcl +source $ds9(root)/library/prefsparser.tcl +source $ds9(root)/library/prefslex.tcl +source $ds9(root)/library/preserveparser.tcl +source $ds9(root)/library/preservelex.tcl source $ds9(root)/library/psparser.tcl source $ds9(root)/library/pslex.tcl source $ds9(root)/library/regionparser.tcl diff --git a/ds9/parsers/preservelex.fcl b/ds9/parsers/preservelex.fcl new file mode 100644 index 0000000..ef0834b --- /dev/null +++ b/ds9/parsers/preservelex.fcl @@ -0,0 +1,17 @@ +#tab preserveparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +pan {return $PAN_} +regions {return $REGIONS_} + +#include yesno.fin +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/preserveparser.tac b/ds9/parsers/preserveparser.tac new file mode 100644 index 0000000..0c33299 --- /dev/null +++ b/ds9/parsers/preserveparser.tac @@ -0,0 +1,34 @@ +%{ +%} + +#include yesno.tin +#include numeric.tin +#include string.tin + +%start command + +%token PAN_ +%token REGIONS_ + +%% + +#include yesno.trl +#include numeric.trl + +command : preserve + | preserve {yyclearin; YYACCEPT} STRING_ + ; + +preserve : PAN_ yesno {PanZoomCmdSet preserve $2 PreservePan} + | REGIONS_ yesno {MarkerCmdSet preserve $2 MarkerPreserve} + ; + +%% + +proc preserve::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |