From 7cfa08b0968e0af4bc64ea0eab90d2b3f315fcbc Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 8 May 2018 15:41:03 -0400 Subject: add ds9 mask parser --- ds9/parsers/iislex.fcl | 15 +++++++++++++++ ds9/parsers/iisparser.tac | 31 +++++++++++++++++++++++++++++++ ds9/parsers/masklex.fcl | 20 ++++++++++++++++++++ ds9/parsers/maskparser.tac | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 ds9/parsers/iislex.fcl create mode 100644 ds9/parsers/iisparser.tac create mode 100644 ds9/parsers/masklex.fcl create mode 100644 ds9/parsers/maskparser.tac diff --git a/ds9/parsers/iislex.fcl b/ds9/parsers/iislex.fcl new file mode 100644 index 0000000..7795f16 --- /dev/null +++ b/ds9/parsers/iislex.fcl @@ -0,0 +1,15 @@ +#tab iisparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +filename {return $FILENAME_} + +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/iisparser.tac b/ds9/parsers/iisparser.tac new file mode 100644 index 0000000..e486cbb --- /dev/null +++ b/ds9/parsers/iisparser.tac @@ -0,0 +1,31 @@ +%{ +%} + +#include numeric.tin +#include string.tin + +%start command + +%token FILENAME_ + +%% + +#include numeric.trl + +command : iis + | iis {yyclearin; YYACCEPT} STRING_ + ; + +iis : FILENAME_ STRING_ {IISCmd $2} + | FILENAME_ STRING_ INT_ {IISCmd $2 $3} + ; + +%% + +proc iis::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/masklex.fcl b/ds9/parsers/masklex.fcl new file mode 100644 index 0000000..a64b52f --- /dev/null +++ b/ds9/parsers/masklex.fcl @@ -0,0 +1,20 @@ +#tab maskparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +close {return $CLOSE_} +clear {return $CLEAR_} +color {return $COLOR_} +mark {return $MARK_} +open {return $OPEN_} +transparency {return $TRANSPARENCY_} + +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/maskparser.tac b/ds9/parsers/maskparser.tac new file mode 100644 index 0000000..4d37592 --- /dev/null +++ b/ds9/parsers/maskparser.tac @@ -0,0 +1,41 @@ +%{ +%} + +#include numeric.tin +#include string.tin + +%start command + +%token CLEAR_ +%token CLOSE_ +%token COLOR_ +%token MARK_ +%token OPEN_ +%token TRANSPARENCY_ + +%% + +#include numeric.trl + +command : mask + | mask {yyclearin; YYACCEPT} STRING_ + ; + +mask : {MaskCmdSet rr mask} + | OPEN_ {MaskDialog} + | CLOSE_ {MaskDestroyDialog} + | CLEAR_ {MaskClear} + | COLOR_ STRING_ {MaskCmdSet color $2 MaskColor} + | MARK_ INT_ {MaskCmdSet mark $2 MaskMark} + | TRANSPARENCY_ INT_ {MaskCmdSet transparency $2 MaskTransparency} + ; + +%% + +proc mask::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12