package provide DS9 1.0

######
# Begin autogenerated taccle (version 1.3) routines.
# Although taccle itself is protected by the GNU Public License (GPL)
# all user-supplied functions are protected by their respective
# author's license.  See http://mini.net/tcl/taccle for other details.
######

namespace eval mosaicwcs {
    variable yylval {}
    variable table
    variable rules
    variable token {}
    variable yycnt 0
    variable yyerr 0
    variable save_state 0

    namespace export yylex
}

proc mosaicwcs::YYABORT {} {
    return -code return 1
}

proc mosaicwcs::YYACCEPT {} {
    return -code return 0
}

proc mosaicwcs::YYERROR {} {
    variable yyerr
    set yyerr 1
}

proc mosaicwcs::yyclearin {} {
    variable token
    variable yycnt
    set token {}
    incr yycnt -1
}

proc mosaicwcs::yyerror {s} {
    puts stderr $s
}

proc mosaicwcs::setupvalues {stack pointer numsyms} {
    upvar 1 1 y
    set y {}
    for {set i 1} {$i <= $numsyms} {incr i} {
        upvar 1 $i y
        set y [lindex $stack $pointer]
        incr pointer
    }
}

proc mosaicwcs::unsetupvalues {numsyms} {
    for {set i 1} {$i <= $numsyms} {incr i} {
        upvar 1 $i y
        unset y
    }
}

array set mosaicwcs::table {
  9:284 reduce
  5:276,target 25
  30:284 reduce
  29:284 reduce
  27:0 reduce
  2:284,target 34
  1:279,target 35
  1:280,target 35
  34:284,target 35
  2:263,target 34
  6:0,target 1
  0:275,target 33
  2:0 reduce
  1:258,target 35
  5:274,target 23
  24:0 reduce
  23:284,target 18
  33:0,target 32
  2:282,target 34
  25:0,target 20
  17:0,target 12
  12:284,target 7
  10:0,target 5
  1:277,target 35
  17:284 reduce
  2:261,target 34
  0:273,target 33
  21:0 reduce
  5:272,target 21
  6:284 reduce
  26:284 reduce
  2:279,target 34
  2:280,target 34
  1:275,target 35
  2:258,target 34
  0:271,target 33
  24:284,target 19
  17:0 reduce
  5:270,target 19
  5:269,target 18
  13:284,target 8
  2:277,target 34
  0:289,target 4
  3:0,target 0
  1:273,target 35
  14:284 reduce
  0:268,target 33
  14:0 reduce
  30:0,target 25
  29:0,target 24
  22:0,target 17
  5:267,target 16
  35:0 reduce
  14:0,target 9
  23:284 reduce
  2:275,target 34
  0:257 reduce
  1:271,target 35
  0:258 reduce
  25:284,target 20
  0:260 reduce
  0:259 reduce
  9:0 reduce
  0:266,target 33
  0:261 reduce
  11:0 reduce
  0:262 reduce
  32:284 reduce
  0:263 reduce
  0:264 reduce
  32:0 reduce
  5:265,target 14
  0:265 reduce
  14:284,target 9
  0:266 reduce
  0:267 reduce
  0:268 reduce
  0:270 reduce
  0:269 reduce
  2:273,target 34
  0:271 reduce
  0:285,target 1
  0:272 reduce
  0:273 reduce
  1:268,target 35
  0:274 reduce
  6:0 reduce
  5:284,target 31
  0:275 reduce
  0:276 reduce
  0:264,target 33
  11:284 reduce
  0:277 reduce
  0:278 reduce
  28:0 reduce
  7:0,target 2
  0:279 reduce
  0:280 reduce
  5:263,target 12
  0:0,target 33
  0:281 reduce
  0:282 reduce
  0:283 reduce
  0:284 reduce
  0:285 shift
  2:271,target 34
  20:284 reduce
  19:284 reduce
  0:283,target 33
  0:286 shift
  26:284,target 21
  34:0,target 29
  0:288 goto
  1:266,target 35
  26:0,target 21
  0:289 goto
  3:0 accept
  18:0,target 13
  5:282,target 31
  0:291 goto
  11:0,target 6
  0:262,target 33
  8:284 reduce
  25:0 reduce
  15:284,target 10
  28:284 reduce
  5:261,target 10
  5:257 shift
  5:258 shift
  5:260 shift
  5:259 shift
  2:268,target 34
  5:261 shift
  0:281,target 33
  6:284,target 1
  5:262 shift
  5:263 shift
  0:0 reduce
  1:264,target 35
  5:264 shift
  5:280,target 29
  5:279,target 28
  5:265 shift
  5:266 shift
  0:260,target 33
  0:259,target 33
  22:0 reduce
  5:267 shift
  5:268 shift
  5:270 shift
  5:269 shift
  5:271 shift
  5:258,target 7
  5:272 shift
  5:273 shift
  1:283,target 35
  27:284,target 22
  5:274 shift
  5:275 shift
  2:266,target 34
  5:276 shift
  0:278,target 33
  16:284 reduce
  5:277 shift
  5:278 shift
  1:262,target 35
  5:280 shift
  5:279 shift
  4:0,target 28
  16:284,target 11
  5:281 shift
  5:277,target 26
  18:0 reduce
  5:282 shift
  0:257,target 33
  5:283 shift
  5:284 reduce
  25:284 reduce
  5:287 goto
  31:0,target 26
  1:281,target 35
  23:0,target 18
  7:284,target 2
  2:257 reduce
  5:290 goto
  15:0,target 10
  2:258 reduce
  2:264,target 34
  0:276,target 33
  2:259 reduce
  2:260 reduce
  2:261 reduce
  1:259,target 35
  1:260,target 35
  2:262 reduce
  34:284 shift
  2:263 reduce
  15:0 reduce
  5:275,target 24
  2:264 reduce
  2:265 reduce
  2:266 reduce
  2:267 reduce
  2:268 reduce
  2:283,target 34
  28:284,target 23
  2:269 reduce
  2:270 reduce
  2:271 reduce
  1:278,target 35
  2:272 reduce
  2:273 reduce
  2:262,target 34
  2:274 reduce
  0:274,target 33
  2:275 reduce
  17:284,target 12
  2:276 reduce
  13:284 reduce
  1:257,target 35
  2:277 reduce
  12:0 reduce
  2:278 reduce
  5:273,target 22
  2:279 reduce
  2:280 reduce
  2:281 reduce
  33:0 reduce
  2:282 reduce
  2:283 reduce
  2:281,target 34
  2:284 reduce
  8:284,target 3
  22:284 reduce
  8:0,target 3
  1:276,target 35
  1:0,target 35
  2:259,target 34
  2:260,target 34
  0:272,target 33
  7:0 reduce
  31:284 reduce
  5:271,target 20
  35:0,target 30
  30:0 reduce
  29:0 reduce
  30:284,target 25
  29:284,target 24
  27:0,target 22
  20:0,target 15
  19:0,target 14
  12:0,target 7
  2:278,target 34
  0:291,target 5
  1:274,target 35
  18:284,target 13
  2:257,target 34
  5:290,target 34
  0:270,target 33
  0:269,target 33
  4:0 reduce
  10:284 reduce
  26:0 reduce
  5:268,target 17
  9:284,target 4
  2:276,target 34
  0:288,target 3
  18:284 reduce
  1:272,target 35
  5:287,target 33
  1:0 reduce
  0:267,target 33
  31:284,target 26
  23:0 reduce
  7:284 reduce
  5:266,target 15
  27:284 reduce
  5:0,target 31
  2:274,target 34
  20:284,target 15
  19:284,target 14
  0:286,target 2
  1:269,target 35
  1:270,target 35
  32:0,target 27
  0:265,target 33
  24:0,target 19
  20:0 reduce
  19:0 reduce
  16:0,target 11
  5:264,target 13
  2:272,target 34
  0:284,target 33
  1:267,target 35
  15:284 reduce
  5:283,target 32
  32:284,target 27
  0:263,target 33
  16:0 reduce
  5:262,target 11
  24:284 reduce
  21:284,target 16
  2:269,target 34
  2:270,target 34
  0:282,target 33
  1:257 reduce
  1:258 reduce
  1:259 reduce
  1:260 reduce
  1:265,target 35
  10:284,target 5
  1:261 reduce
  5:281,target 30
  1:262 reduce
  33:284 reduce
  13:0 reduce
  9:0,target 4
  0:261,target 33
  1:263 reduce
  1:264 reduce
  2:0,target 34
  1:265 reduce
  34:0 reduce
  1:266 reduce
  5:260,target 9
  5:259,target 8
  1:267 reduce
  1:268 reduce
  1:269 reduce
  1:270 reduce
  1:284,target 35
  1:271 reduce
  1:272 reduce
  2:267,target 34
  28:0,target 23
  0:279,target 33
  0:280,target 33
  1:273 reduce
  21:0,target 16
  1:274 reduce
  33:284,target 32
  13:0,target 8
  1:263,target 35
  1:275 reduce
  8:0 reduce
  1:276 reduce
  12:284 reduce
  10:0 reduce
  5:278,target 27
  1:277 reduce
  0:258,target 33
  1:278 reduce
  1:279 reduce
  1:280 reduce
  31:0 reduce
  1:281 reduce
  22:284,target 17
  1:282 reduce
  5:257,target 6
  1:283 reduce
  1:284 reduce
  1:282,target 35
  21:284 reduce
  2:265,target 34
  11:284,target 6
  0:277,target 33
  1:261,target 35
  5:0 reduce
}

array set mosaicwcs::rules {
  9,l 287
  11,l 287
  32,l 290
  6,l 287
  28,l 288
  3,l 287
  25,l 287
  0,l 292
  22,l 287
  18,l 287
  15,l 287
  12,l 287
  33,l 291
  7,l 287
  29,l 289
  30,l 289
  4,l 287
  26,l 287
  1,l 287
  23,l 287
  19,l 287
  20,l 287
  16,l 287
  13,l 287
  34,l 291
  8,l 287
  10,l 287
  31,l 290
  5,l 287
  27,l 287
  2,l 287
  24,l 287
  21,l 287
  17,l 287
  14,l 287
  35,l 291
}

array set mosaicwcs::rules {
  12,dc 1
  26,dc 1
  3,dc 1
  18,dc 1
  33,dc 0
  9,dc 1
  11,dc 1
  25,dc 1
  2,dc 1
  17,dc 1
  32,dc 1
  8,dc 1
  10,dc 1
  24,dc 1
  1,dc 1
  16,dc 1
  31,dc 0
  7,dc 1
  23,dc 1
  0,dc 1
  15,dc 1
  29,dc 2
  30,dc 3
  6,dc 1
  22,dc 1
  14,dc 1
  28,dc 1
  5,dc 1
  21,dc 1
  35,dc 1
  13,dc 1
  27,dc 1
  4,dc 1
  19,dc 1
  20,dc 1
  34,dc 1
}

array set mosaicwcs::rules {
  7,line 79
  4,line 76
  34,line 115
  1,line 73
  31,line 110
  27,line 99
  24,line 96
  21,line 93
  17,line 89
  14,line 86
  11,line 83
  9,line 81
  6,line 78
  3,line 75
  33,line 114
  29,line 106
  30,line 107
  26,line 98
  23,line 95
  19,line 91
  20,line 92
  16,line 88
  13,line 85
  10,line 82
  8,line 80
  5,line 77
  35,line 116
  2,line 74
  32,line 111
  28,line 103
  25,line 97
  22,line 94
  18,line 90
  15,line 87
  12,line 84
}

array set mosaicwcs::lr1_table {
  35 {{30 0 3}}
  14,trans {}
  33,trans {}
  18,trans {}
  1,trans {}
  23,trans {}
  5,trans {{257 6} {258 7} {259 8} {260 9} {261 10} {262 11} {263 12} {264 13} {265 14} {266 15} {267 16} {268 17} {269 18} {270 19} {271 20} {272 21} {273 22} {274 23} {275 24} {276 25} {277 26} {278 27} {279 28} {280 29} {281 30} {282 31} {283 32} {287 33} {290 34}}
  27,trans {}
  9,trans {}
  13,trans {}
  32,trans {}
  17,trans {}
  0,trans {{285 1} {286 2} {288 3} {289 4} {291 5}}
  22,trans {}
  4,trans {}
  26,trans {}
  8,trans {}
  12,trans {}
  31,trans {}
  16,trans {}
  35,trans {}
  21,trans {}
  3,trans {}
  10 {{5 {0 284} 1}}
  11 {{6 {0 284} 1}}
  25,trans {}
  12 {{7 {0 284} 1}}
  7,trans {}
  13 {{8 {0 284} 1}}
  14 {{9 {0 284} 1}}
  15 {{10 {0 284} 1}}
  11,trans {}
  30,trans {}
  29,trans {}
  16 {{11 {0 284} 1}}
  0 {{0 0 0} {28 0 0} {29 0 0} {30 0 0} {33 {0 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284} 0} {34 {0 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284} 0} {35 {0 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284} 0}}
  17 {{12 {0 284} 1}}
  1 {{35 {0 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284} 1}}
  18 {{13 {0 284} 1}}
  15,trans {}
  2 {{34 {0 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284} 1}}
  19 {{14 {0 284} 1}}
  20 {{15 {0 284} 1}}
  34,trans {{284 35}}
  3 {{0 0 1}}
  21 {{16 {0 284} 1}}
  4 {{28 0 1}}
  22 {{17 {0 284} 1}}
  5 {{29 0 1} {30 0 1} {31 {0 284} 0} {32 {0 284} 0} {1 {0 284} 0} {2 {0 284} 0} {3 {0 284} 0} {4 {0 284} 0} {5 {0 284} 0} {6 {0 284} 0} {7 {0 284} 0} {8 {0 284} 0} {9 {0 284} 0} {10 {0 284} 0} {11 {0 284} 0} {12 {0 284} 0} {13 {0 284} 0} {14 {0 284} 0} {15 {0 284} 0} {16 {0 284} 0} {17 {0 284} 0} {18 {0 284} 0} {19 {0 284} 0} {20 {0 284} 0} {21 {0 284} 0} {22 {0 284} 0} {23 {0 284} 0} {24 {0 284} 0} {25 {0 284} 0} {26 {0 284} 0} {27 {0 284} 0}}
  23 {{18 {0 284} 1}}
  20,trans {}
  19,trans {}
  6 {{1 {0 284} 1}}
  2,trans {}
  24 {{19 {0 284} 1}}
  7 {{2 {0 284} 1}}
  25 {{20 {0 284} 1}}
  8 {{3 {0 284} 1}}
  26 {{21 {0 284} 1}}
  9 {{4 {0 284} 1}}
  27 {{22 {0 284} 1}}
  24,trans {}
  28 {{23 {0 284} 1}}
  6,trans {}
  29 {{24 {0 284} 1}}
  30 {{25 {0 284} 1}}
  31 {{26 {0 284} 1}}
  32 {{27 {0 284} 1}}
  10,trans {}
  28,trans {}
  33 {{32 {0 284} 1}}
  34 {{29 0 2} {30 0 2}}
}

array set mosaicwcs::token_id_table {
  286,t 0
  286 NEW_
  280,title WCSW
  279,title WCSV
  264,line 14
  292,line 117
  287 wcssys
  270,t 0
  269,t 0
  288 command
  290 sys
  289 mosaicwcs
  276,line 26
  265,title WCSH
  291,t 1
  291 opts
  284,title string
  292 start'
  274,t 0
  261,line 11
  288,line 102
  257,t 0
  270,title WCSM
  269,title WCSL
  288,title {}
  273,line 23
  278,t 0
  257,line 7
  262,t 0
  285,line 39
  274,title WCSQ
  283,t 0
  270,line 20
  269,line 19
  259,title WCSB
  260,title WCSC
  266,t 0
  278,title WCSU
  282,line 32
  287,t 1
  error error
  271,t 0
  264,title WCSG
  266,line 16
  283,title WCSZ
  292,t 1
  278,line 28
  error,line 71
  275,t 0
  268,title WCSK
  287,title {}
  258,t 0
  263,line 13
  291,line 113
  error,title {}
  280,t 0
  279,t 0
  275,line 25
  273,title WCSP
  292,title {}
  263,t 0
  259,line 9
  260,line 10
  287,line 72
  258,title WCSA
  284,t 0
  277,title WCST
  272,line 22
  267,t 0
  263,title WCSF
  288,t 1
  284,line 35
  282,title WCSY
  272,t 0
  268,line 18
  267,title WCSJ
  286,title NEW
  257 WCS_
  281,line 31
  276,t 0
  258 WCSA_
  259,t 0
  259 WCSB_
  260 WCSC_
  260,t 0
  272,title WCSO
  261 WCSD_
  265,line 15
  291,title {}
  262 WCSE_
  281,t 0
  263 WCSF_
  277,line 27
  257,title WCS
  264 WCSG_
  264,t 0
  276,title WCSS
  265 WCSH_
  262,line 12
  266 WCSI_
  290,line 109
  289,line 105
  285,t 0
  267 WCSJ_
  0,t 0
  0 {$}
  262,title WCSE
  268 WCSK_
  268,t 0
  281,title WCSX
  274,line 24
  270 WCSM_
  269 WCSL_
  error,t 0
  271 WCSN_
  290,t 1
  289,t 1
  272 WCSO_
  258,line 8
  286,line 40
  273,t 0
  273 WCSP_
  266,title WCSI
  285,title MASK
  274 WCSQ_
  275 WCSR_
  271,line 21
  276 WCSS_
  277,t 0
  277 WCST_
  271,title WCSN
  290,title {}
  289,title {}
  283,line 33
  278 WCSU_
  261,t 0
  280 WCSW_
  279 WCSV_
  281 WCSX_
  267,line 17
  282,t 0
  282 WCSY_
  275,title WCSR
  283 WCSZ_
  265,t 0
  284 STRING_
  280,line 30
  279,line 29
  285 MASK_
  261,title WCSD
}

proc mosaicwcs::yyparse {} {
    variable yylval
    variable table
    variable rules
    variable token
    variable yycnt
    variable lr1_table
    variable token_id_table
    variable yyerr
    variable save_state

    set yycnt 0
    set state_stack {0}
    set value_stack {{}}
    set token ""
    set accepted 0
    set yyerr 0
    set save_state 0

    while {$accepted == 0} {
        set state [lindex $state_stack end]
        if {$token == ""} {
            set yylval ""
            set token [yylex]
            set buflval $yylval
	    if {$token>0} {
	        incr yycnt
            }
        }
        if {![info exists table($state:$token)] || $yyerr} {
	    if {!$yyerr} {
	        set save_state $state
	    }
            # pop off states until error token accepted
            while {[llength $state_stack] > 0 && \
                       ![info exists table($state:error)]} {
                set state_stack [lrange $state_stack 0 end-1]
                set value_stack [lrange $value_stack 0 \
                                       [expr {[llength $state_stack] - 1}]]
                set state [lindex $state_stack end]
            }
            if {[llength $state_stack] == 0} {
 
	        set rr { }
                if {[info exists lr1_table($save_state,trans)] && [llength $lr1_table($save_state,trans)] >= 1} {
                    foreach trans $lr1_table($save_state,trans) {
                        foreach {tok_id nextstate} $trans {
			    set ss $token_id_table($tok_id,title)
			    if {$ss != {}} {
			        append rr "$ss, "
                            }
                        }
                    }
                }
		set rr [string trimleft $rr { }]
		set rr [string trimright $rr {, }]
                yyerror "parse error, expecting: $rr"


                return 1
            }
            lappend state_stack [set state $table($state:error,target)]
            lappend value_stack {}
            # consume tokens until it finds an acceptable one
            while {![info exists table($state:$token)]} {
                if {$token == 0} {
                    yyerror "end of file while recovering from error"
                    return 1
                }
                set yylval {}
                set token [yylex]
                set buflval $yylval
            }
            continue
        }
        switch -- $table($state:$token) {
            shift {
                lappend state_stack $table($state:$token,target)
                lappend value_stack $buflval
                set token ""
            }
            reduce {
                set rule $table($state:$token,target)
                set ll $rules($rule,l)
                if {[info exists rules($rule,e)]} {
                    set dc $rules($rule,e)
                } else {
                    set dc $rules($rule,dc)
                }
                set stackpointer [expr {[llength $state_stack]-$dc}]
                setupvalues $value_stack $stackpointer $dc
                set _ $1
                set yylval [lindex $value_stack end]
                switch -- $rule {
                    1 { set _ wcs }
                    2 { set _ wcsa }
                    3 { set _ wcsb }
                    4 { set _ wcsc }
                    5 { set _ wcsd }
                    6 { set _ wcse }
                    7 { set _ wcsf }
                    8 { set _ wcsg }
                    9 { set _ wcsh }
                    10 { set _ wcsi }
                    11 { set _ wcsj }
                    12 { set _ wcsk }
                    13 { set _ wcsl }
                    14 { set _ wcsm }
                    15 { set _ wcsn }
                    16 { set _ wcso }
                    17 { set _ wcsp }
                    18 { set _ wcsq }
                    19 { set _ wcsr }
                    20 { set _ wcss }
                    21 { set _ wcst }
                    22 { set _ wcsu }
                    23 { set _ wcsv }
                    24 { set _ wcsw }
                    25 { set _ wcsx }
                    26 { set _ wcsy }
                    27 { set _ wcsz }
                    29 { MosaicWCSCmdLoad {} $1 $2 }
                    30 { MosaicWCSCmdLoad $3 $1 $2 }
                    31 { set _ wcs }
                    32 { set _ $1 }
                    34 { CreateFrame; set _ {} }
                    35 { set _ mask }
                }
                unsetupvalues $dc
                # pop off tokens from the stack if normal rule
                if {![info exists rules($rule,e)]} {
                    incr stackpointer -1
                    set state_stack [lrange $state_stack 0 $stackpointer]
                    set value_stack [lrange $value_stack 0 $stackpointer]
                }
                # now do the goto transition
                lappend state_stack $table([lindex $state_stack end]:$ll,target)
                lappend value_stack $_
            }
            accept {
                set accepted 1
            }
            goto -
            default {
                puts stderr "Internal parser error: illegal command $table($state:$token)"
                return 2
            }
        }
    }
    return 0
}

######
# end autogenerated taccle functions
######

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}
