diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-06-19 17:47:50 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-06-19 17:47:50 (GMT) |
commit | 69a0db6f952dbb1c0359667cbec48407770083d2 (patch) | |
tree | bf6540c0174319d759c5320c3d4760a8bd801406 /ds9/parsers/fitssendparser.tac | |
parent | 39a20376dc46c9d2212b4e87d3e9711d7405dab7 (diff) | |
download | blt-69a0db6f952dbb1c0359667cbec48407770083d2.zip blt-69a0db6f952dbb1c0359667cbec48407770083d2.tar.gz blt-69a0db6f952dbb1c0359667cbec48407770083d2.tar.bz2 |
add ds9 fits send parser
Diffstat (limited to 'ds9/parsers/fitssendparser.tac')
-rw-r--r-- | ds9/parsers/fitssendparser.tac | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/ds9/parsers/fitssendparser.tac b/ds9/parsers/fitssendparser.tac new file mode 100644 index 0000000..9d334a9 --- /dev/null +++ b/ds9/parsers/fitssendparser.tac @@ -0,0 +1,83 @@ +%{ +%} + +#include wcssys.tin +#include skyframe.tin +#include rformat.tin +#include int.tin +#include string.tin + +%start fitssend + +%token BITPIX_ +%token DEPTH_ +%token GZ_ +%token HEADER_ +%token HEIGHT_ +%token IMAGE_ +%token KEYWORD_ +%token RESAMPLE_ +%token SIZE_ +%token SLICE_ +%token TABLE_ +%token TYPE_ +%token WIDTH_ + +%% + +#include wcssys.trl +#include skyframe.trl +#include rformat.trl + +fitssend: WIDTH_ {ProcessSendCmdCurrent "get fits width"} + | HEIGHT_ {ProcessSendCmdCurrent "get fits height"} + | DEPTH_ {ProcessSendCmdCurrent "get fits depth 2"} + | BITPIX_ {ProcessSendCmdCurrent "get fits bitpix"} +# backward compatibility + | TYPE_ {FitsSendCmdType} + | SIZE_ size + | HEADER_ header + | opt gz {FitsSendCmd $1} +; + +size : {ProcessSendCmdCurrent "get fits size"} + | wcssys {ProcessSendCmdCurrent "get fits size $1 fk5 degrees"} + | skyframe {ProcessSendCmdCurrent "get fits size wcs $1 degrees"} + | rformat {ProcessSendCmdCurrent "get fits size wcs fk5 $1"} + | wcssys skyframe {ProcessSendCmdCurrent "get fits size $1 $2 degrees"} + | wcssys rformat {ProcessSendCmdCurrent "get fits size $1 fk5 $2"} + | skyframe rformat {ProcessSendCmdCurrent "get fits size wcs $1 $2"} + | wcssys skyframe rformat {ProcessSendCmdCurrent "get fits size $1 $2 $3"} + ; + +header : {ProcessSendCmdSend {.txt} "get fits header 1"} + | INT_ {ProcessSendCmdSend {.txt} "get fits header $1"} + | KEYWORD_ STRING_ {ProcessSendCmdCurrent "get fits header keyword \{$2\}"} + +# has to be quoted because of common tokens + | INT_ KEYWORD_ STRING_ {ProcessSendCmdCurrent "get fits header $1 keyword \{$3\}"} + | KEYWORD_ BITPIX_ {ProcessSendCmdCurrent "get fits header keyword \{BITPIX\}"} + | INT_ KEYWORD_ BITPIX_ {ProcessSendCmdCurrent "get fits header $1 keyword \{BITPIX\}"} + ; + +opt : {set _ image} + | TABLE_ {set _ table} + | IMAGE_ {set _ image} + | SLICE_ {set _ slice} +# backward compatibility + | RESAMPLE_ {set _ resample} + ; + +gz : + | GZ_ + ; + +%% + +proc fitssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |