diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-05-14 17:30:43 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-05-14 17:30:43 (GMT) |
commit | 2fa692287fff7c95f049b4cb890c971c300d157e (patch) | |
tree | 6ded36bb5cb38d56b930a3c3959b13d279141eb2 /ds9 | |
parent | f2a247a51f0002dc38f0ee7049dfa5ca704fd503 (diff) | |
download | blt-2fa692287fff7c95f049b4cb890c971c300d157e.zip blt-2fa692287fff7c95f049b4cb890c971c300d157e.tar.gz blt-2fa692287fff7c95f049b4cb890c971c300d157e.tar.bz2 |
add ds9 restore parser
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/backup.tcl | 16 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/restorelex.fcl | 12 | ||||
-rw-r--r-- | ds9/parsers/restoreparser.tac | 25 |
4 files changed, 55 insertions, 0 deletions
diff --git a/ds9/library/backup.tcl b/ds9/library/backup.tcl index d2882dc..954fa3d 100644 --- a/ds9/library/backup.tcl +++ b/ds9/library/backup.tcl @@ -810,6 +810,14 @@ proc ProcessRestoreCmd {varname iname} { upvar $varname var upvar $iname i + global debug + if {$debug(tcl,parser)} { + restore::YY_FLUSH_BUFFER + restore::yy_scan_string [lrange $var $i end] + restore::yyparse + incr i [expr $restore::yycnt-1] + } else { + set fn [lindex $var $i] if {$fn != {}} { FileLast backupfbox $fn @@ -818,3 +826,11 @@ proc ProcessRestoreCmd {varname iname} { Error [msgcat::mc {Unable to open file}] } } +} + +proc RestoreCmd {fn} { + FileLast backupfbox $fn + Restore $fn +} + + diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 1b5c3a1..13f0c09 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -300,6 +300,8 @@ source $ds9(root)/library/psparser.tcl source $ds9(root)/library/pslex.tcl source $ds9(root)/library/regionparser.tcl source $ds9(root)/library/regionlex.tcl +source $ds9(root)/library/restoreparser.tcl +source $ds9(root)/library/restorelex.tcl source $ds9(root)/library/rgbparser.tcl source $ds9(root)/library/rgblex.tcl source $ds9(root)/library/rgbarrayparser.tcl diff --git a/ds9/parsers/restorelex.fcl b/ds9/parsers/restorelex.fcl new file mode 100644 index 0000000..8e28d79 --- /dev/null +++ b/ds9/parsers/restorelex.fcl @@ -0,0 +1,12 @@ +#tab restoreparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +#include string.fin + +%% diff --git a/ds9/parsers/restoreparser.tac b/ds9/parsers/restoreparser.tac new file mode 100644 index 0000000..6d9a6a6 --- /dev/null +++ b/ds9/parsers/restoreparser.tac @@ -0,0 +1,25 @@ +%{ +%} + +#include string.tin + +%start command + +%% + +command : restore + | restore {yyclearin; YYACCEPT} STRING_ + ; + +restore : STRING_ {RestoreCmd $1} + ; + +%% + +proc restore::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |