summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/binparser.tac
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-09 18:36:19 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-09 18:36:19 (GMT)
commitc56fc146b06bab65ab04ebc337f19bb347f15f11 (patch)
tree0becfe977f846177646fb0d7f7a711ef8eb0e1a2 /ds9/parsers/binparser.tac
parentdc1c107ac6d51fab16940a4c197438c46ca68f2e (diff)
downloadblt-c56fc146b06bab65ab04ebc337f19bb347f15f11.zip
blt-c56fc146b06bab65ab04ebc337f19bb347f15f11.tar.gz
blt-c56fc146b06bab65ab04ebc337f19bb347f15f11.tar.bz2
add bin ds9 parser
Diffstat (limited to 'ds9/parsers/binparser.tac')
-rw-r--r--ds9/parsers/binparser.tac93
1 files changed, 93 insertions, 0 deletions
diff --git a/ds9/parsers/binparser.tac b/ds9/parsers/binparser.tac
new file mode 100644
index 0000000..329fab4
--- /dev/null
+++ b/ds9/parsers/binparser.tac
@@ -0,0 +1,93 @@
+%{
+%}
+
+#include yesno.tin
+#include base.tin
+
+%start command
+
+%token ABOUT_
+%token AVERAGE_
+%token BUFFERSIZE_
+%token CENTER_
+%token CLOSE_
+%token COLS_
+%token COLSZ_
+%token DEPTH_
+%token FACTOR_
+%token FILTER_
+%token FIT_
+%token FUNCTION_
+%token IN_
+%token LOCK_
+%token MATCH_
+%token OPEN_
+%token OUT_
+%token SUM_
+%token TO_
+
+%%
+
+#include yesno.trl
+#include base.trl
+
+command : bin
+ | bin {yyclearin; YYACCEPT} CMD_
+ ;
+
+bin : CLOSE_ {BinDestroyDialog}
+ | OPEN_ {BinDialog}
+ | MATCH_ {MatchBinCurrent}
+ | LOCK_ yesno {global bin; set bin(lock) $2; LockBinCurrent}
+ | ABOUT_ binAbout
+ | BUFFERSIZE_ INT_ {global bin; set bin(buffersize) $2; ChangeBinBufferSize}
+ | COLS_ cols cols {BinCols \"$2\" \"$3\" \"\"}
+ | COLSZ_ cols cols cols {BinCols \"$2\" \"$3\" \"$4\"}
+ | FACTOR_ binFactor
+ | DEPTH_ INT_ {global bin; set bin(depth) $2; ChangeBinDepth}
+ | FILTER_ binFilter
+ | FUNCTION_ binFunction {global bin; set bin(function) $2; ChangeBinFunction}
+ | IN_ {Bin .5 .5}
+ | OUT_ {Bin 2 2}
+ | TO_ binTo
+ ;
+
+cols : STRING_ {set _ $1}
+ | colsxyz {set _ $1}
+ ;
+
+colsxyz : 'x' {set _ $1}
+ | 'X' {set _ $1}
+ | 'y' {set _ $1}
+ | 'Y' {set _ $1}
+ ;
+
+binAbout : numeric numeric {BinAbout $1 $2}
+ | CENTER_ {BinAboutCenter}
+ ;
+
+binFactor : numeric {global bin; set bin(factor) "$1 $1"; ChangeBinFactor}
+ | numeric numeric {global bin; set bin(factor) "$1 $2"; ChangeBinFactor}
+ ;
+
+binFilter : {BinFilter {}}
+ | STRING_ {BinFilter $1}
+ ;
+
+binFunction: AVERAGE_ {set _ average}
+ | SUM_ {set _ sum}
+ ;
+
+binTo: binFactor
+ | FIT_ {BinToFit}
+ ;
+
+%%
+
+proc bin::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}