From 58f6608644d76112394217f1ab6d419a140a1a73 Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 8 May 2018 16:16:01 -0400 Subject: add ds9 minmax parser --- ds9/parsers/minmaxlex.fcl | 22 +++++++++++++++++++++ ds9/parsers/minmaxparser.tac | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 ds9/parsers/minmaxlex.fcl create mode 100644 ds9/parsers/minmaxparser.tac diff --git a/ds9/parsers/minmaxlex.fcl b/ds9/parsers/minmaxlex.fcl new file mode 100644 index 0000000..be171dd --- /dev/null +++ b/ds9/parsers/minmaxlex.fcl @@ -0,0 +1,22 @@ +#tab minmaxparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +close {return $CLOSE_} +auto {return $AUTO_} +datamin {return $DATAMIN_} +irafmin {return $IRAFMIN_} +interval {return $INTERVAL_} +mode {return $MODE_} +sample {return $SAMPLE_} +scan {return $SCAN_} + +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/minmaxparser.tac b/ds9/parsers/minmaxparser.tac new file mode 100644 index 0000000..7b926f2 --- /dev/null +++ b/ds9/parsers/minmaxparser.tac @@ -0,0 +1,47 @@ +%{ +%} + +#include numeric.tin +#include string.tin + +%start command + +%token AUTO_ +%token DATAMIN_ +%token IRAFMIN_ +%token INTERVAL_ +%token MODE_ +%token SAMPLE_ +%token SCAN_ + +%% + +#include numeric.trl + +command : minmax + | minmax {yyclearin; YYACCEPT} STRING_ + ; + +minmax : {ScaleCmdSet mode minmax ChangeScaleMode} + | mode {MinmaxCmdSet mode $1 ChangeMinMax} + | MODE_ mode {MinmaxCmdSet mode $2 ChangeMinMax} + | INTERVAL_ INT_ {MinmaxCmdSet sample $2 ChangeMinMax} + ; + +mode : SCAN_ {set _ scan} + | SAMPLE_ {set _ sample} + | DATAMIN_ {set _ datamin} + | IRAFMIN_ {set _ irafmin} +# backward compatibility + | AUTO_ {set _ scan} + ; + +%% + +proc minmax::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12