diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-03-13 18:42:51 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-03-13 18:42:51 (GMT) |
commit | e5ce79e94828eba8e30e4375a0b2604acad2ec94 (patch) | |
tree | 5dde219f6b0f3c0bd835912ba43dc2fb009ad9e9 /ds9/parsers | |
parent | b200b4fc6ca872f7de8a5b19adce2f24f3db8ac3 (diff) | |
download | blt-e5ce79e94828eba8e30e4375a0b2604acad2ec94.zip blt-e5ce79e94828eba8e30e4375a0b2604acad2ec94.tar.gz blt-e5ce79e94828eba8e30e4375a0b2604acad2ec94.tar.bz2 |
add ds9 tile parser
Diffstat (limited to 'ds9/parsers')
-rw-r--r-- | ds9/parsers/binparser.tac | 6 | ||||
-rw-r--r-- | ds9/parsers/tilelex.fcl | 23 | ||||
-rw-r--r-- | ds9/parsers/tileparser.tac | 78 | ||||
-rw-r--r-- | ds9/parsers/yesno.trl | 3 |
4 files changed, 104 insertions, 6 deletions
diff --git a/ds9/parsers/binparser.tac b/ds9/parsers/binparser.tac index 3a7b554..dc04007 100644 --- a/ds9/parsers/binparser.tac +++ b/ds9/parsers/binparser.tac @@ -45,7 +45,7 @@ bin : CLOSE_ {BinDestroyDialog} | COLSZ_ cols cols cols {BinCols \"$2\" \"$3\" \"$4\"} | FACTOR_ binFactor | DEPTH_ INT_ {global bin; set bin(depth) $2; ChangeBinDepth} - | FILTER_ binFilter + | FILTER_ STRING_ {BinFilter $2} | FUNCTION_ binFunction {global bin; set bin(function) $2; ChangeBinFunction} | IN_ {Bin .5 .5} | OUT_ {Bin 2 2} @@ -72,10 +72,6 @@ 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} ; diff --git a/ds9/parsers/tilelex.fcl b/ds9/parsers/tilelex.fcl new file mode 100644 index 0000000..afcddca --- /dev/null +++ b/ds9/parsers/tilelex.fcl @@ -0,0 +1,23 @@ +#tab tileparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +automatic {return $AUTOMATIC_} +column {return $COLUMN_} +direction {return $DIRECTION_} +gap {return $GAP_} +grid {return $GRID_} +layout {return $LAYOUT_} +manual {return $MANUAL_} +mode {return $MODE_} +row {return $ROW_} + +#include yesno.fin +#include base.fin + +%% diff --git a/ds9/parsers/tileparser.tac b/ds9/parsers/tileparser.tac new file mode 100644 index 0000000..9276a05 --- /dev/null +++ b/ds9/parsers/tileparser.tac @@ -0,0 +1,78 @@ +%{ +%} + +#include yesno.tin +#include base.tin + +%start command + +%token AUTOMATIC_ +%token COLUMN_ +%token DIRECTION_ +%token GAP_ +%token GRID_ +%token LAYOUT_ +%token MANUAL_ +%token MODE_ +%token ROW_ + +%% + +#include yesno.trl +#include base.trl + + +yes : YES_ {set _ 1} + | ON_ {set _ 1} + | TRUE_ {set _ 1} + ; + +no : NO_ {set _ 0} + | OFF_ {set _ 0} + | FALSE_ {set _ 0} + ; + +command : tile + | tile {yyclearin; YYACCEPT} STRING_ + ; + +tile: {global current; set current(display) tile; DisplayMode} + | yes {global current; set current(display) tile; DisplayMode} + | no {global current; set current(display) single; DisplayMode} + | MODE_ tileMode {global tile; set tile(mode) $2; DisplayMode} + | GRID_ tileGrid + | COLUMN_ {global tile; set tile(mode) column; DisplayMode} + | ROW_ {global tile; set tile(mode) row; DisplayMode} + ; + +tileMode : GRID_ {set _ grid} + | COLUMN_ {set _ column} + | ROW_ {set _ row} + ; + +tileGrid : {global tile; set tile(mode) grid; DisplayMode} + | MODE_ tileGridMode {global tile; set tile(grid,mode) $2; DisplayMode} + | DIRECTION_ tileGridDir {global tile; set tile(grid,dir) $2; DisplayMode} + | LAYOUT_ INT_ INT_ {global tile; set tile(grid,col) $2; set tile(grid,row) $3; set tile(grid,mode) manual; DisplayMode} + | GAP_ INT_ {global tile; set tile(grid,gap) $2; DisplayMode} + ; + +tileGridMode : AUTOMATIC_ {set _ automatic} + | MANUAL_ {set _ manual} + ; + +tileGridDir : 'x' {set _ x} + | 'X' {set _ x} + | 'y' {set _ y} + | 'Y' {set _ y} + ; + +%% + +proc tile::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/yesno.trl b/ds9/parsers/yesno.trl index e4fdcd0..a34d258 100644 --- a/ds9/parsers/yesno.trl +++ b/ds9/parsers/yesno.trl @@ -5,9 +5,10 @@ yesno : {set _ 1} | NO_ {set _ 0} | OFF_ {set _ 0} | FALSE_ {set _ 0} -; + ; # | error { # yyerror "must be: yes|on|true|no|off|false" # YYABORT # } + |