diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-04-05 21:28:13 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-04-05 21:28:13 (GMT) |
commit | 11376f9238353b2c2fc2df9d1c42a622ed93278b (patch) | |
tree | 08e5373032c38639527d9a56c9bc3ff33e6525f3 /ds9/parsers/cubeparser.tac | |
parent | 5b568c0640d28680274b432fb1d068990506186c (diff) | |
download | blt-11376f9238353b2c2fc2df9d1c42a622ed93278b.zip blt-11376f9238353b2c2fc2df9d1c42a622ed93278b.tar.gz blt-11376f9238353b2c2fc2df9d1c42a622ed93278b.tar.bz2 |
add ds9 cube parser
Diffstat (limited to 'ds9/parsers/cubeparser.tac')
-rw-r--r-- | ds9/parsers/cubeparser.tac | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/ds9/parsers/cubeparser.tac b/ds9/parsers/cubeparser.tac new file mode 100644 index 0000000..0aacdd2 --- /dev/null +++ b/ds9/parsers/cubeparser.tac @@ -0,0 +1,90 @@ +%{ +%} + +#include coords.tin +#include yesno.tin +#include numeric.tin +#include string.tin + +%start command + +%token AXIS_ +%token AXES_ +%token CLOSE_ +%token FIRST_ +%token INTERVAL_ +%token LAST_ +%token LOCK_ +%token MATCH_ +%token NEXT_ +%token NONE_ +%token OPEN_ +%token ORDER_ +%token PLAY_ +%token PREV_ +%token STOP_ + +%token 123_ +%token 132_ +%token 213_ +%token 231_ +%token 312_ +%token 321_ + +%% + +#include coords.trl +#include yesno.trl +#include numeric.trl + +command : cube + | cube {yyclearin; YYACCEPT} STRING_ + ; + +cube : OPEN_ + | CLOSE_ {CubeDestroyDialog} + | MATCH_ match {MatchCubeCurrent $2} + | LOCK_ lock {CubeCmdSet lock $2 LockCubeCurrent} + | PLAY_ {CubePlay} + | STOP_ {CubeStop} + | NEXT_ {CubeNext} + | PREV_ {CubePrev} + | INTERVAL_ numeric {CubeCmdSet interval [expr int($2*1000)]} + | AXIS_ INT_ {CubeCmdSet axis [expr $2-1]} + | AXES_ order + | ORDER_ order + | INT_ {CubeCmdCoord $1 image 2} + | numeric wcssys {CubeCmdCoord $1 $2 2} + | numeric wcssys INT_ {CubeCmdCoord $1 $2 [expr $3-1]} + ; + +match : IMAGE_ {set _ image} + | wcssys {set _ $1} + ; + +lock : IMAGE_ {set _ image} + | wcssys {set _ $1} + | NONE_ {set _ none} + ; + +order : LOCK_ yesno {CubeCmdSet lock,axes $2 LockAxesCurrent} + | orderAxes {CubeCmdSet axes $1} + ; + +orderAxes : 123_ {set _ 123} + | 132_ {set _ 132} + | 213_ {set _ 213} + | 231_ {set _ 231} + | 312_ {set _ 312} + | 321_ {set _ 321} + ; + +%% + +proc cube::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |