summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-05-08 20:16:01 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-05-08 20:16:01 (GMT)
commit58f6608644d76112394217f1ab6d419a140a1a73 (patch)
treeffeab1f05a64889a72944cb3e031b9ad20a6d773
parenta9da761371c99957c0e89ee51b4862b71d64461a (diff)
downloadblt-58f6608644d76112394217f1ab6d419a140a1a73.zip
blt-58f6608644d76112394217f1ab6d419a140a1a73.tar.gz
blt-58f6608644d76112394217f1ab6d419a140a1a73.tar.bz2
add ds9 minmax parser
-rw-r--r--ds9/parsers/minmaxlex.fcl22
-rw-r--r--ds9/parsers/minmaxparser.tac47
2 files changed, 69 insertions, 0 deletions
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_
+}