From 3fb5597b67427c147608087f99f3d24c2d2dd6ad Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 19 Jun 2018 14:19:46 -0400 Subject: add ds9 mask send parser --- ds9/library/mask.tcl | 12 ++++++------ ds9/library/source.tcl | 2 ++ ds9/parsers/masksendlex.fcl | 16 ++++++++++++++++ ds9/parsers/masksendparser.tac | 25 +++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 ds9/parsers/masksendlex.fcl create mode 100644 ds9/parsers/masksendparser.tac diff --git a/ds9/library/mask.tcl b/ds9/library/mask.tcl index 8775abe..58036b4 100644 --- a/ds9/library/mask.tcl +++ b/ds9/library/mask.tcl @@ -273,12 +273,12 @@ proc ProcessMaskCmd {varname iname} { } proc ProcessSendMaskCmd {proc id param {sock {}} {fn {}}} { - global mask + global parse + set parse(proc) $proc + set parse(id) $id - switch -- [string tolower $param] { - color {$proc $id "$mask(color)\n"} - mark {$proc $id "$mask(mark)\n"} - transparency {$proc $id "$mask(transparency)\n"} - } + masksend::YY_FLUSH_BUFFER + masksend::yy_scan_string $param + masksend::yyparse } diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 26ca935..2fdd76d 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -288,6 +288,8 @@ source $ds9(root)/library/magnifiersendparser.tcl source $ds9(root)/library/magnifiersendlex.tcl source $ds9(root)/library/maskparser.tcl source $ds9(root)/library/masklex.tcl +source $ds9(root)/library/masksendparser.tcl +source $ds9(root)/library/masksendlex.tcl source $ds9(root)/library/matchparser.tcl source $ds9(root)/library/matchlex.tcl source $ds9(root)/library/mecubeparser.tcl diff --git a/ds9/parsers/masksendlex.fcl b/ds9/parsers/masksendlex.fcl new file mode 100644 index 0000000..993e163 --- /dev/null +++ b/ds9/parsers/masksendlex.fcl @@ -0,0 +1,16 @@ +#tab masksendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +color {return $COLOR_} +mark {return $MARK_} +transparency {return $TRANSPARENCY_} + +#include ws.fin + +%% diff --git a/ds9/parsers/masksendparser.tac b/ds9/parsers/masksendparser.tac new file mode 100644 index 0000000..3feb109 --- /dev/null +++ b/ds9/parsers/masksendparser.tac @@ -0,0 +1,25 @@ +%{ +%} + +%start masksend + +%token COLOR_ +%token MARK_ +%token TRANSPARENCY_ + +%% + +masksend : COLOR_ {ProcessSendCmdGet mask color} + | MARK_ {ProcessSendCmdGet mask mark} + | TRANSPARENCY_ {ProcessSendCmdGet mask transparency} + ; + +%% + +proc masksend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12