summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/cmapparser.tac
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-03-09 19:15:14 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-03-09 19:15:14 (GMT)
commit10338a49af87a69984de4754ef468f9a37763367 (patch)
treecb9977b8e3b3c39255e0e1ed169fd93effea67fe /ds9/parsers/cmapparser.tac
parent64dfc2783db0f55d1f1fda2eed079fc7707955c0 (diff)
downloadblt-10338a49af87a69984de4754ef468f9a37763367.zip
blt-10338a49af87a69984de4754ef468f9a37763367.tar.gz
blt-10338a49af87a69984de4754ef468f9a37763367.tar.bz2
add cmap ds9 parser
Diffstat (limited to 'ds9/parsers/cmapparser.tac')
-rw-r--r--ds9/parsers/cmapparser.tac61
1 files changed, 61 insertions, 0 deletions
diff --git a/ds9/parsers/cmapparser.tac b/ds9/parsers/cmapparser.tac
new file mode 100644
index 0000000..b699991
--- /dev/null
+++ b/ds9/parsers/cmapparser.tac
@@ -0,0 +1,61 @@
+%{
+%}
+
+#include yesno.tin
+#include base.tin
+
+%start command
+
+%token CLOSE_
+%token DELETE_
+%token FILE_
+%token INVERT_
+%token LOAD_
+%token LOCK_
+%token MATCH_
+%token OPEN_
+%token SAVE_
+%token TAG_
+%token VALUE_
+
+%%
+
+#include yesno.trl
+#include base.trl
+
+command : cmap
+ | cmap {yyclearin; YYACCEPT} CMD_
+ ;
+
+cmap : STRING_ {CmapCmd $1}
+ | CLOSE_ {ColormapDestroyDialog}
+ | OPEN_ {ColormapDialog}
+# backward compatibility
+ | MATCH_ {MatchColorCurrent}
+# backward compatibility
+ | LOCK_ yesno {global colorbar; set colorbar(lock) $2; LockColorCurrent}
+ | LOAD_ cmapLoad
+ | FILE_ cmapLoad
+ | SAVE_ STRING_ {SaveColormapFile $2; FileLast colormapfbox $2}
+ | INVERT_ yesno {global colorbar; set colorbar(invert) $2; InvertColorbar}
+ | TAG_ cmapTag
+ | VALUE_ numeric numeric {CmapValueCmd $2 $3}
+ ;
+
+cmapLoad : STRING_ {LoadColormapFile $1; FileLast colormapfbox $1}
+ ;
+
+cmapTag : LOAD_ STRING_ {LoadColorTag $2}
+ | SAVE_ STRING_ {global current; $current(colorbar) tag save $2}
+ | DELETE_ {DeleteColorTag}
+ ;
+
+%%
+
+proc cmap::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}