summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-06-19 18:19:46 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-06-19 18:19:46 (GMT)
commit3fb5597b67427c147608087f99f3d24c2d2dd6ad (patch)
tree46a44fe634fead32ee2b664a7b56489e00a625a4
parent69a0db6f952dbb1c0359667cbec48407770083d2 (diff)
downloadblt-3fb5597b67427c147608087f99f3d24c2d2dd6ad.zip
blt-3fb5597b67427c147608087f99f3d24c2d2dd6ad.tar.gz
blt-3fb5597b67427c147608087f99f3d24c2d2dd6ad.tar.bz2
add ds9 mask send parser
-rw-r--r--ds9/library/mask.tcl12
-rw-r--r--ds9/library/source.tcl2
-rw-r--r--ds9/parsers/masksendlex.fcl16
-rw-r--r--ds9/parsers/masksendparser.tac25
4 files changed, 49 insertions, 6 deletions
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_
+}