From 237eb51e0bdbab7b65e2f36b4bcc455785b167b7 Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 11 Jun 2018 13:11:55 -0400 Subject: add ds9 xpa send parser --- ds9/library/source.tcl | 2 ++ ds9/library/xpa.tcl | 10 +++++++--- ds9/parsers/xpasendlex.fcl | 14 ++++++++++++++ ds9/parsers/xpasendparser.tac | 22 ++++++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 ds9/parsers/xpasendlex.fcl create mode 100644 ds9/parsers/xpasendparser.tac diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index 0623c54..e6e75e4 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -432,6 +432,8 @@ source $ds9(root)/library/widthparser.tcl source $ds9(root)/library/widthlex.tcl source $ds9(root)/library/xpaparser.tcl source $ds9(root)/library/xpalex.tcl +source $ds9(root)/library/xpasendparser.tcl +source $ds9(root)/library/xpasendlex.tcl source $ds9(root)/library/xpafirstparser.tcl source $ds9(root)/library/xpafirstlex.tcl source $ds9(root)/library/zscaleparser.tcl diff --git a/ds9/library/xpa.tcl b/ds9/library/xpa.tcl index 16aa16b..5dde6b5 100644 --- a/ds9/library/xpa.tcl +++ b/ds9/library/xpa.tcl @@ -2222,7 +2222,11 @@ proc ProcessXPACmd {varname iname} { } proc ProcessSendXPACmd {proc id param {sock {}} {fn {}}} { - switch -- [string tolower [lindex $param 0]] { - info {$proc $id [XPAInfoResult]} - } + global parse + set parse(proc) $proc + set parse(id) $id + + xpasend::YY_FLUSH_BUFFER + xpasend::yy_scan_string $param + xpasend::yyparse } diff --git a/ds9/parsers/xpasendlex.fcl b/ds9/parsers/xpasendlex.fcl new file mode 100644 index 0000000..024d7b8 --- /dev/null +++ b/ds9/parsers/xpasendlex.fcl @@ -0,0 +1,14 @@ +#tab xpasendparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +info {return $INFO_} + +#include ws.fin + +%% diff --git a/ds9/parsers/xpasendparser.tac b/ds9/parsers/xpasendparser.tac new file mode 100644 index 0000000..c27b80f --- /dev/null +++ b/ds9/parsers/xpasendparser.tac @@ -0,0 +1,22 @@ +%{ +%} + +%start xpasend + +%token INFO_ + +%% + +xpasend : {global parse; $parse(proc) $parse(id) [XPAInfoResult]} + | INFO_ {global parse; $parse(proc) $parse(id) [XPAInfoResult]} + ; + +%% + +proc xpasend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12