summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/scaleparser.tac
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-04-05 19:03:51 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-04-05 19:03:51 (GMT)
commit696e25ed993de4a631f5593cd66db659392dd98d (patch)
tree427ac077c045a3872a619489304b2b67d482b088 /ds9/parsers/scaleparser.tac
parent91183bb25977d84b6ed93e1a83335aef1e6fca54 (diff)
downloadblt-696e25ed993de4a631f5593cd66db659392dd98d.zip
blt-696e25ed993de4a631f5593cd66db659392dd98d.tar.gz
blt-696e25ed993de4a631f5593cd66db659392dd98d.tar.bz2
add ds9 scale parser
Diffstat (limited to 'ds9/parsers/scaleparser.tac')
-rw-r--r--ds9/parsers/scaleparser.tac100
1 files changed, 100 insertions, 0 deletions
diff --git a/ds9/parsers/scaleparser.tac b/ds9/parsers/scaleparser.tac
new file mode 100644
index 0000000..61ffc87
--- /dev/null
+++ b/ds9/parsers/scaleparser.tac
@@ -0,0 +1,100 @@
+%{
+%}
+
+#include yesno.tin
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%token ASINH_
+%token CLOSE_
+%token DATASEC_
+%token EXP_
+%token GLOBAL_
+%token HISTEQU_
+%token LIMITS_
+%token LINEAR_
+%token LOCAL_
+%token LOCK_
+%token LOG_
+%token MATCH_
+%token MINMAX_
+%token MODE_
+%token OPEN_
+%token POW_
+%token SCALELIMITS_
+%token SCOPE_
+%token SINH_
+%token SQRT_
+%token SQUARED_
+%token USER_
+%token ZMAX_
+%token ZSCALE_
+
+%%
+
+#include yesno.trl
+#include numeric.trl
+
+command : scale
+ | scale {yyclearin; YYACCEPT} STRING_
+ ;
+
+scale : OPEN_ {ScaleDialog}
+ | CLOSE_ {ScaleDestroyDialog}
+ | MATCH_ match
+ | LOCK_ lock
+ | scales {ScaleCmdSet type $1 ChangeScale}
+ | LOG_ log
+ | DATASEC_ yesno {ScaleCmdSet datasec $2 ChangeDATASEC}
+ | LIMITS_ numeric numeric {ScaleCmdSet min $2 {}; ScaleCmdSet max $3 ChangeScaleLimit}
+ | SCALELIMITS_ numeric numeric {ScaleCmdSet min $2 {}; ScaleCmdSet max $3 ChangeScaleLimit}
+ | mode {ScaleCmdSet mode $1 ChangeScaleMode}
+ | MODE_ mode {ScaleCmdSet mode $2 ChangeScaleMode}
+ | scope {ScaleCmdSet scope $1 ChangeScaleScope}
+ | SCOPE_ scope {ScaleCmdSet scope $2 ChangeScaleScope}
+ ;
+
+scales : LINEAR_ {set _ linear}
+ | POW_ {set _ pow}
+ | SQRT_ {set _ sqrt}
+ | SQUARED_ {set _ squared}
+ | ASINH_ {set _ asinh}
+ | HISTEQU_ {set _ histequ}
+ ;
+
+match : {MatchScaleCurrent}
+ | LIMITS_ {MatchScaleLimitsCurrent}
+ | SCALELIMITS_ {MatchScaleLimitsCurrent}
+ ;
+
+lock : yesno {ScaleCmdSet lock $1 LockScaleCurrent}
+ | LIMITS_ yesno {ScaleCmdSet lock,limits $2 LockScaleLimitsCurrent}
+ | SCALELIMITS_ yesno {ScaleCmdSet lock,limits $2 LockScaleLimitsCurrent}
+ ;
+
+log : {ScaleCmdSet type log ChangeScale}
+ | EXP_ numeric {ScaleCmdSet log $2 ChangeScale}
+ ;
+
+mode : numeric {set _ $1}
+ | MINMAX_ {set _ minmax}
+ | ZSCALE_ {set _ zscale}
+ | ZMAX_ {set _ zmax}
+ | USER_ {set _ user}
+ ;
+
+scope : LOCAL_ {set _ local}
+ | GLOBAL_ {set _ global}
+ ;
+
+%%
+
+proc scale::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}