%{
%}

#include yesno.tin
#include font.tin
#include base.tin

%start command

%token DISTANCE_
%token HORIZONTAL_
%token LOCK_
%token MATCH_
%token NUMERICS_
%token ORIENTATION_
%token SIZE_
%token SPACE_
%token TICKS_
%token VALUE_
%token VERTICAL_

%%

#include yesno.trl
#include font.trl
#include base.trl

command : colorbar
 | colorbar {yyclearin; YYACCEPT} CMD_
 ;

colorbar : yesno {global view; set view(colorbar) $1; UpdateView}
# backward compatibility
 | MATCH_ {MatchColorCurrent}
# backward compatibility
 | LOCK_ yesno {global colorbar; set colorbar(lock) $2; LockColorCurrent}
 | NUMERICS_ yesno {global colorbar; set colorbar(numerics) $2; UpdateView}
 | SPACE_ space {global colorbar; set colorbar(space) $2; UpdateView}
 | FONT_ font {global colorbar; set colorbar(font) $2; UpdateView}
 | FONTSIZE_ INT_ {global colorbar; set colorbar(font,size) $2; UpdateView}
 | FONTWEIGHT_ fontweight {global colorbar; set colorbar(font,weight) $2; UpdateView}
 | FONTSLANT_ fontslant {global colorbar; set colorbar(font,slant) $2; UpdateView}
 | FONTSTYLE_ fontstyle
 | ORIENTATION_ orientation {global colorbar; set colorbar(orientation) $2; UpdateView}
 | orientation {global colorbar; set colorbar(orientation) $1; UpdateView}
 | SIZE_ INT_ {global colorbar; set colorbar(size) $2; UpdateView}
 | TICKS_ INT_ {global colorbar; set colorbar(ticks) $2; UpdateView}
 ;
 
fontstyle : NORMAL_  {global colorbar; set colorbar(font,weight) normal; set colorbar(font,slant) roman; UpdateView}
 | BOLD_ {global colorbar; set colorbar(font,weight) bold; set colorbar(font,slant) roman; UpdateView}
 | ITALIC_ {global colorbar; set colorbar(font,weight) normal; set colorbar(font,slant) italic; UpdateView}
 ;

space : VALUE_ {set _ 1}
 | DISTANCE_ {set _ 0}
 ;

orientation : VERTICAL_ {set _ vertical}
 | HORIZONTAL_ {set _ horizontal}
 ;

%%

proc colorbar::yyerror {msg} {
     variable yycnt
     variable yy_current_buffer
     variable index_

     ParserError $msg $yycnt $yy_current_buffer $index_
}

@@ -1037,32 +1037,57 @@
 $2; UpdateView%7D%0A
+# backward compatibility%0A
  %7C FONTSTYLE_ fo
@@ -1096,29 +1096,16 @@
 style%0A %7C
- ORIENTATION_
  orienta
@@ -1154,17 +1154,17 @@
 ation) $
-2
+1
 ; Update
@@ -1169,18 +1169,56 @@
 teView%7D%0A
- %7C
+# backward compatibility%0A %7C ORIENTATION_
  orienta
@@ -1259,33 +1259,33 @@
 r(orientation) $
-1
+2
 ; UpdateView%7D%0A %7C

update ds9 parsers