From 4530b547880bded9b583ed9b73cbfdb34fb5209a Mon Sep 17 00:00:00 2001 From: William Joye Date: Sat, 19 Jan 2019 14:38:05 -0500 Subject: parser scripts now in repo --- ds9/parsers/alignlex.tcl | 352 ++ ds9/parsers/alignparser.tab.tcl | 7 + ds9/parsers/alignparser.tcl | 395 ++ ds9/parsers/analysislex.tcl | 473 +++ ds9/parsers/analysisparser.tab.tcl | 18 + ds9/parsers/analysisparser.tcl | 747 ++++ ds9/parsers/analysissendlex.tcl | 374 ++ ds9/parsers/analysissendparser.tab.tcl | 9 + ds9/parsers/analysissendparser.tcl | 378 ++ ds9/parsers/arraylex.tcl | 319 ++ ds9/parsers/arrayparser.tab.tcl | 4 + ds9/parsers/arrayparser.tcl | 346 ++ ds9/parsers/backuplex.tcl | 286 ++ ds9/parsers/backupparser.tab.tcl | 1 + ds9/parsers/backupparser.tcl | 287 ++ ds9/parsers/bglex.tcl | 286 ++ ds9/parsers/bgparser.tab.tcl | 1 + ds9/parsers/bgparser.tcl | 287 ++ ds9/parsers/binlex.tcl | 602 ++++ ds9/parsers/binparser.tab.tcl | 29 + ds9/parsers/binparser.tcl | 1209 +++++++ ds9/parsers/binsendlex.tcl | 333 ++ ds9/parsers/binsendparser.tab.tcl | 8 + ds9/parsers/binsendparser.tcl | 346 ++ ds9/parsers/blinklex.tcl | 393 ++ ds9/parsers/blinkparser.tab.tcl | 10 + ds9/parsers/blinkparser.tcl | 467 +++ ds9/parsers/blinksendlex.tcl | 236 ++ ds9/parsers/blinksendparser.tab.tcl | 1 + ds9/parsers/blinksendparser.tcl | 254 ++ ds9/parsers/blocklex.tcl | 470 +++ ds9/parsers/blockparser.tab.tcl | 17 + ds9/parsers/blockparser.tcl | 630 ++++ ds9/parsers/blocksendlex.tcl | 256 ++ ds9/parsers/blocksendparser.tab.tcl | 1 + ds9/parsers/blocksendparser.tcl | 254 ++ ds9/parsers/catlex.tcl | 1897 ++++++++++ ds9/parsers/catparser.tab.tcl | 146 + ds9/parsers/catparser.tcl | 4543 +++++++++++++++++++++++ ds9/parsers/catsendlex.tcl | 297 ++ ds9/parsers/catsendparser.tab.tcl | 2 + ds9/parsers/catsendparser.tcl | 322 ++ ds9/parsers/cmaplex.tcl | 503 +++ ds9/parsers/cmapparser.tab.tcl | 20 + ds9/parsers/cmapparser.tcl | 793 +++++ ds9/parsers/cmapsendlex.tcl | 289 ++ ds9/parsers/cmapsendparser.tab.tcl | 4 + ds9/parsers/cmapsendparser.tcl | 296 ++ ds9/parsers/colorbarlex.tcl | 616 ++++ ds9/parsers/colorbarparser.tab.tcl | 31 + ds9/parsers/colorbarparser.tcl | 919 +++++ ds9/parsers/colorbarsendlex.tcl | 377 ++ ds9/parsers/colorbarsendparser.tab.tcl | 12 + ds9/parsers/colorbarsendparser.tcl | 398 +++ ds9/parsers/contourlex.tcl | 1207 +++++++ ds9/parsers/contourparser.tab.tcl | 84 + ds9/parsers/contourparser.tcl | 3008 ++++++++++++++++ ds9/parsers/contoursendlex.tcl | 806 +++++ ds9/parsers/contoursendparser.tab.tcl | 51 + ds9/parsers/contoursendparser.tcl | 1398 ++++++++ ds9/parsers/croplex.tcl | 864 +++++ ds9/parsers/cropparser.tab.tcl | 52 + ds9/parsers/cropparser.tcl | 2562 +++++++++++++ ds9/parsers/cropsendlex.tcl | 730 ++++ ds9/parsers/cropsendparser.tab.tcl | 44 + ds9/parsers/cropsendparser.tcl | 1701 +++++++++ ds9/parsers/crosshairlex.tcl | 786 ++++ ds9/parsers/crosshairparser.tab.tcl | 45 + ds9/parsers/crosshairparser.tcl | 1983 +++++++++++ ds9/parsers/crosshairsendlex.tcl | 697 ++++ ds9/parsers/crosshairsendparser.tab.tcl | 41 + ds9/parsers/crosshairsendparser.tcl | 1436 ++++++++ ds9/parsers/cubelex.tcl | 998 ++++++ ds9/parsers/cubeparser.tab.tcl | 65 + ds9/parsers/cubeparser.tcl | 2151 +++++++++++ ds9/parsers/cubesendlex.tcl | 300 ++ ds9/parsers/cubesendparser.tab.tcl | 5 + ds9/parsers/cubesendparser.tcl | 340 ++ ds9/parsers/cursorlex.tcl | 297 ++ ds9/parsers/cursorparser.tab.tcl | 2 + ds9/parsers/cursorparser.tcl | 295 ++ ds9/parsers/datasendlex.tcl | 778 ++++ ds9/parsers/datasendparser.tab.tcl | 47 + ds9/parsers/datasendparser.tcl | 1842 ++++++++++ ds9/parsers/dssesolex.tcl | 632 ++++ ds9/parsers/dssesoparser.tab.tcl | 31 + ds9/parsers/dssesoparser.tcl | 1023 ++++++ ds9/parsers/dssesosendlex.tcl | 311 ++ ds9/parsers/dssesosendparser.tab.tcl | 6 + ds9/parsers/dssesosendparser.tcl | 324 ++ ds9/parsers/dsssaolex.tcl | 588 +++ ds9/parsers/dsssaoparser.tab.tcl | 27 + ds9/parsers/dsssaoparser.tcl | 939 +++++ ds9/parsers/dsssaosendlex.tcl | 311 ++ ds9/parsers/dsssaosendparser.tab.tcl | 6 + ds9/parsers/dsssaosendparser.tcl | 314 ++ ds9/parsers/dssstscilex.tcl | 687 ++++ ds9/parsers/dssstsciparser.tab.tcl | 36 + ds9/parsers/dssstsciparser.tcl | 1103 ++++++ ds9/parsers/dssstscisendlex.tcl | 311 ++ ds9/parsers/dssstscisendparser.tab.tcl | 6 + ds9/parsers/dssstscisendparser.tcl | 324 ++ ds9/parsers/envilex.tcl | 297 ++ ds9/parsers/enviparser.tab.tcl | 2 + ds9/parsers/enviparser.tcl | 324 ++ ds9/parsers/exportlex.tcl | 470 +++ ds9/parsers/exportparser.tab.tcl | 17 + ds9/parsers/exportparser.tcl | 703 ++++ ds9/parsers/fitslex.tcl | 319 ++ ds9/parsers/fitsparser.tab.tcl | 4 + ds9/parsers/fitsparser.tcl | 382 ++ ds9/parsers/fitssendlex.tcl | 847 +++++ ds9/parsers/fitssendparser.tab.tcl | 52 + ds9/parsers/fitssendparser.tcl | 1754 +++++++++ ds9/parsers/framelex.tcl | 890 +++++ ds9/parsers/frameparser.tab.tcl | 55 + ds9/parsers/frameparser.tcl | 1583 +++++++++ ds9/parsers/framesendlex.tcl | 872 +++++ ds9/parsers/framesendparser.tab.tcl | 57 + ds9/parsers/framesendparser.tcl | 1533 ++++++++ ds9/parsers/gridlex.tcl | 1552 ++++++++ ds9/parsers/gridparser.tab.tcl | 109 + ds9/parsers/gridparser.tcl | 3546 ++++++++++++++++++ ds9/parsers/gridsendlex.tcl | 711 ++++ ds9/parsers/gridsendparser.tab.tcl | 36 + ds9/parsers/gridsendparser.tcl | 1278 +++++++ ds9/parsers/headerlex.tcl | 319 ++ ds9/parsers/headerparser.tab.tcl | 4 + ds9/parsers/headerparser.tcl | 409 +++ ds9/parsers/heightlex.tcl | 297 ++ ds9/parsers/heightparser.tab.tcl | 2 + ds9/parsers/heightparser.tcl | 291 ++ ds9/parsers/iconifylex.tcl | 352 ++ ds9/parsers/iconifyparser.tab.tcl | 7 + ds9/parsers/iconifyparser.tcl | 395 ++ ds9/parsers/iexamsendlex.tcl | 793 +++++ ds9/parsers/iexamsendparser.tab.tcl | 48 + ds9/parsers/iexamsendparser.tcl | 1621 +++++++++ ds9/parsers/iislex.tcl | 308 ++ ds9/parsers/iisparser.tab.tcl | 3 + ds9/parsers/iisparser.tcl | 311 ++ ds9/parsers/iissendlex.tcl | 267 ++ ds9/parsers/iissendparser.tab.tcl | 2 + ds9/parsers/iissendparser.tcl | 278 ++ ds9/parsers/locklex.tcl | 806 +++++ ds9/parsers/lockparser.tab.tcl | 51 + ds9/parsers/lockparser.tcl | 1657 +++++++++ ds9/parsers/locksendlex.tcl | 377 ++ ds9/parsers/locksendparser.tab.tcl | 12 + ds9/parsers/locksendparser.tcl | 402 +++ ds9/parsers/magnifierlex.tcl | 426 +++ ds9/parsers/magnifierparser.tab.tcl | 13 + ds9/parsers/magnifierparser.tcl | 543 +++ ds9/parsers/magnifiersendlex.tcl | 289 ++ ds9/parsers/magnifiersendparser.tab.tcl | 4 + ds9/parsers/magnifiersendparser.tcl | 296 ++ ds9/parsers/masklex.tcl | 789 ++++ ds9/parsers/maskparser.tab.tcl | 46 + ds9/parsers/maskparser.tcl | 1113 ++++++ ds9/parsers/masksendlex.tcl | 300 ++ ds9/parsers/masksendparser.tab.tcl | 5 + ds9/parsers/masksendparser.tcl | 304 ++ ds9/parsers/matchlex.tcl | 759 ++++ ds9/parsers/matchparser.tab.tcl | 44 + ds9/parsers/matchparser.tcl | 1363 +++++++ ds9/parsers/mecubelex.tcl | 297 ++ ds9/parsers/mecubeparser.tab.tcl | 2 + ds9/parsers/mecubeparser.tcl | 298 ++ ds9/parsers/minmaxlex.tcl | 384 ++ ds9/parsers/minmaxparser.tab.tcl | 9 + ds9/parsers/minmaxparser.tcl | 433 +++ ds9/parsers/minmaxsendlex.tcl | 267 ++ ds9/parsers/minmaxsendparser.tab.tcl | 2 + ds9/parsers/minmaxsendparser.tcl | 268 ++ ds9/parsers/modelex.tcl | 407 +++ ds9/parsers/modeparser.tab.tcl | 12 + ds9/parsers/modeparser.tcl | 467 +++ ds9/parsers/mosaicimageiraflex.tcl | 308 ++ ds9/parsers/mosaicimageirafparser.tab.tcl | 3 + ds9/parsers/mosaicimageirafparser.tcl | 314 ++ ds9/parsers/mosaicimagewcslex.tcl | 605 ++++ ds9/parsers/mosaicimagewcsparser.tab.tcl | 30 + ds9/parsers/mosaicimagewcsparser.tcl | 940 +++++ ds9/parsers/mosaicimagewfpc2lex.tcl | 308 ++ ds9/parsers/mosaicimagewfpc2parser.tab.tcl | 3 + ds9/parsers/mosaicimagewfpc2parser.tcl | 314 ++ ds9/parsers/mosaiciraflex.tcl | 308 ++ ds9/parsers/mosaicirafparser.tab.tcl | 3 + ds9/parsers/mosaicirafparser.tcl | 314 ++ ds9/parsers/mosaicwcslex.tcl | 605 ++++ ds9/parsers/mosaicwcsparser.tab.tcl | 30 + ds9/parsers/mosaicwcsparser.tcl | 940 +++++ ds9/parsers/movielex.tcl | 448 +++ ds9/parsers/movieparser.tab.tcl | 15 + ds9/parsers/movieparser.tcl | 869 +++++ ds9/parsers/multiframelex.tcl | 286 ++ ds9/parsers/multiframeparser.tab.tcl | 1 + ds9/parsers/multiframeparser.tcl | 267 ++ ds9/parsers/nanlex.tcl | 286 ++ ds9/parsers/nanparser.tab.tcl | 1 + ds9/parsers/nanparser.tcl | 287 ++ ds9/parsers/nreslex.tcl | 451 +++ ds9/parsers/nresparser.tab.tcl | 16 + ds9/parsers/nresparser.tcl | 546 +++ ds9/parsers/nressendlex.tcl | 319 ++ ds9/parsers/nressendparser.tab.tcl | 4 + ds9/parsers/nressendparser.tcl | 296 ++ ds9/parsers/nrrdlex.tcl | 308 ++ ds9/parsers/nrrdparser.tab.tcl | 3 + ds9/parsers/nrrdparser.tcl | 340 ++ ds9/parsers/nvsslex.tcl | 588 +++ ds9/parsers/nvssparser.tab.tcl | 27 + ds9/parsers/nvssparser.tcl | 939 +++++ ds9/parsers/nvsssendlex.tcl | 311 ++ ds9/parsers/nvsssendparser.tab.tcl | 6 + ds9/parsers/nvsssendparser.tcl | 314 ++ ds9/parsers/orientlex.tcl | 330 ++ ds9/parsers/orientparser.tab.tcl | 5 + ds9/parsers/orientparser.tcl | 419 +++ ds9/parsers/pagesetuplex.tcl | 426 +++ ds9/parsers/pagesetupparser.tab.tcl | 13 + ds9/parsers/pagesetupparser.tcl | 491 +++ ds9/parsers/pagesetupsendlex.tcl | 278 ++ ds9/parsers/pagesetupsendparser.tab.tcl | 3 + ds9/parsers/pagesetupsendparser.tcl | 276 ++ ds9/parsers/panlex.tcl | 809 +++++ ds9/parsers/panparser.tab.tcl | 47 + ds9/parsers/panparser.tcl | 2424 +++++++++++++ ds9/parsers/pansendlex.tcl | 686 ++++ ds9/parsers/pansendparser.tab.tcl | 40 + ds9/parsers/pansendparser.tcl | 1422 ++++++++ ds9/parsers/photolex.tcl | 308 ++ ds9/parsers/photoparser.tab.tcl | 3 + ds9/parsers/photoparser.tcl | 314 ++ ds9/parsers/pixeltablelex.tcl | 374 ++ ds9/parsers/pixeltableparser.tab.tcl | 9 + ds9/parsers/pixeltableparser.tcl | 431 +++ ds9/parsers/plotlex.tcl | 1854 ++++++++++ ds9/parsers/plotparser.tab.tcl | 141 + ds9/parsers/plotparser.tcl | 5335 ++++++++++++++++++++++++++++ ds9/parsers/plotsendlex.tcl | 814 +++++ ds9/parsers/plotsendparser.tab.tcl | 49 + ds9/parsers/plotsendparser.tcl | 1557 ++++++++ ds9/parsers/precisionlex.tcl | 297 ++ ds9/parsers/precisionparser.tab.tcl | 2 + ds9/parsers/precisionparser.tcl | 311 ++ ds9/parsers/prefslex.tcl | 429 +++ ds9/parsers/prefsparser.tab.tcl | 14 + ds9/parsers/prefsparser.tcl | 523 +++ ds9/parsers/prefssendlex.tcl | 300 ++ ds9/parsers/prefssendparser.tab.tcl | 5 + ds9/parsers/prefssendparser.tcl | 304 ++ ds9/parsers/preservelex.tcl | 374 ++ ds9/parsers/preserveparser.tab.tcl | 9 + ds9/parsers/preserveparser.tcl | 439 +++ ds9/parsers/preservesendlex.tcl | 278 ++ ds9/parsers/preservesendparser.tab.tcl | 3 + ds9/parsers/preservesendparser.tcl | 276 ++ ds9/parsers/pslex.tcl | 550 +++ ds9/parsers/psparser.tab.tcl | 25 + ds9/parsers/psparser.tcl | 764 ++++ ds9/parsers/pssendlex.tcl | 322 ++ ds9/parsers/pssendparser.tab.tcl | 7 + ds9/parsers/pssendparser.tcl | 332 ++ ds9/parsers/regionlex.tcl | 1844 ++++++++++ ds9/parsers/regionparser.tab.tcl | 141 + ds9/parsers/regionparser.tcl | 4909 +++++++++++++++++++++++++ ds9/parsers/regionsendlex.tcl | 1243 +++++++ ds9/parsers/regionsendparser.tab.tcl | 88 + ds9/parsers/regionsendparser.tcl | 3568 +++++++++++++++++++ ds9/parsers/restorelex.tcl | 286 ++ ds9/parsers/restoreparser.tab.tcl | 1 + ds9/parsers/restoreparser.tcl | 287 ++ ds9/parsers/rgbarraylex.tcl | 307 ++ ds9/parsers/rgbarrayparser.tab.tcl | 2 + ds9/parsers/rgbarrayparser.tcl | 298 ++ ds9/parsers/rgbcubelex.tcl | 297 ++ ds9/parsers/rgbcubeparser.tab.tcl | 2 + ds9/parsers/rgbcubeparser.tcl | 298 ++ ds9/parsers/rgbimagelex.tcl | 297 ++ ds9/parsers/rgbimageparser.tab.tcl | 2 + ds9/parsers/rgbimageparser.tcl | 298 ++ ds9/parsers/rgblex.tcl | 847 +++++ ds9/parsers/rgbparser.tab.tcl | 52 + ds9/parsers/rgbparser.tcl | 1340 +++++++ ds9/parsers/rgbsendlex.tcl | 432 +++ ds9/parsers/rgbsendparser.tab.tcl | 17 + ds9/parsers/rgbsendparser.tcl | 488 +++ ds9/parsers/rotatelex.tcl | 349 ++ ds9/parsers/rotateparser.tab.tcl | 6 + ds9/parsers/rotateparser.tcl | 379 ++ ds9/parsers/samplex.tcl | 418 +++ ds9/parsers/sampparser.tab.tcl | 13 + ds9/parsers/sampparser.tcl | 565 +++ ds9/parsers/saveimagelex.tcl | 426 +++ ds9/parsers/saveimageparser.tab.tcl | 13 + ds9/parsers/saveimageparser.tcl | 711 ++++ ds9/parsers/savelex.tcl | 429 +++ ds9/parsers/saveparser.tab.tcl | 14 + ds9/parsers/saveparser.tcl | 567 +++ ds9/parsers/scalelex.tcl | 646 ++++ ds9/parsers/scaleparser.tab.tcl | 33 + ds9/parsers/scaleparser.tcl | 1083 ++++++ ds9/parsers/scalesendlex.tcl | 333 ++ ds9/parsers/scalesendparser.tab.tcl | 8 + ds9/parsers/scalesendparser.tcl | 362 ++ ds9/parsers/sfitslex.tcl | 319 ++ ds9/parsers/sfitsparser.tab.tcl | 4 + ds9/parsers/sfitsparser.tcl | 362 ++ ds9/parsers/shmlex.tcl | 835 +++++ ds9/parsers/shmparser.tab.tcl | 50 + ds9/parsers/shmparser.tcl | 3234 +++++++++++++++++ ds9/parsers/sialex.tcl | 1094 ++++++ ds9/parsers/siaparser.tab.tcl | 73 + ds9/parsers/siaparser.tcl | 2108 +++++++++++ ds9/parsers/skyviewlex.tcl | 599 ++++ ds9/parsers/skyviewparser.tab.tcl | 28 + ds9/parsers/skyviewparser.tcl | 995 ++++++ ds9/parsers/skyviewsendlex.tcl | 322 ++ ds9/parsers/skyviewsendparser.tab.tcl | 7 + ds9/parsers/skyviewsendparser.tcl | 338 ++ ds9/parsers/sleeplex.tcl | 316 ++ ds9/parsers/sleepparser.tab.tcl | 3 + ds9/parsers/sleepparser.tcl | 331 ++ ds9/parsers/smoothlex.tcl | 536 +++ ds9/parsers/smoothparser.tab.tcl | 23 + ds9/parsers/smoothparser.tcl | 711 ++++ ds9/parsers/smoothsendlex.tcl | 322 ++ ds9/parsers/smoothsendparser.tab.tcl | 7 + ds9/parsers/smoothsendparser.tcl | 338 ++ ds9/parsers/smosaiciraflex.tcl | 308 ++ ds9/parsers/smosaicirafparser.tab.tcl | 3 + ds9/parsers/smosaicirafparser.tcl | 306 ++ ds9/parsers/smosaicwcslex.tcl | 605 ++++ ds9/parsers/smosaicwcsparser.tab.tcl | 30 + ds9/parsers/smosaicwcsparser.tcl | 874 +++++ ds9/parsers/sourcelex.tcl | 286 ++ ds9/parsers/sourceparser.tab.tcl | 1 + ds9/parsers/sourceparser.tcl | 287 ++ ds9/parsers/srgbcubelex.tcl | 297 ++ ds9/parsers/srgbcubeparser.tab.tcl | 2 + ds9/parsers/srgbcubeparser.tcl | 292 ++ ds9/parsers/threadslex.tcl | 297 ++ ds9/parsers/threadsparser.tab.tcl | 2 + ds9/parsers/threadsparser.tcl | 291 ++ ds9/parsers/threedlex.tcl | 609 ++++ ds9/parsers/threedparser.tab.tcl | 26 + ds9/parsers/threedparser.tcl | 931 +++++ ds9/parsers/threedsendlex.tcl | 406 +++ ds9/parsers/threedsendparser.tab.tcl | 11 + ds9/parsers/threedsendparser.tcl | 447 +++ ds9/parsers/tilelex.tcl | 462 +++ ds9/parsers/tileparser.tab.tcl | 17 + ds9/parsers/tileparser.tcl | 722 ++++ ds9/parsers/tilesendlex.tcl | 300 ++ ds9/parsers/tilesendparser.tab.tcl | 5 + ds9/parsers/tilesendparser.tcl | 327 ++ ds9/parsers/twomasslex.tcl | 588 +++ ds9/parsers/twomassparser.tab.tcl | 27 + ds9/parsers/twomassparser.tcl | 1007 ++++++ ds9/parsers/twomasssendlex.tcl | 311 ++ ds9/parsers/twomasssendparser.tab.tcl | 6 + ds9/parsers/twomasssendparser.tcl | 324 ++ ds9/parsers/updatelex.tcl | 374 ++ ds9/parsers/updateparser.tab.tcl | 9 + ds9/parsers/updateparser.tcl | 474 +++ ds9/parsers/urlfitslex.tcl | 319 ++ ds9/parsers/urlfitsparser.tab.tcl | 4 + ds9/parsers/urlfitsparser.tcl | 346 ++ ds9/parsers/viewlex.tcl | 966 +++++ ds9/parsers/viewparser.tab.tcl | 61 + ds9/parsers/viewparser.tcl | 2071 +++++++++++ ds9/parsers/viewsendlex.tcl | 856 +++++ ds9/parsers/viewsendparser.tab.tcl | 51 + ds9/parsers/viewsendparser.tcl | 993 ++++++ ds9/parsers/vlalex.tcl | 610 ++++ ds9/parsers/vlaparser.tab.tcl | 29 + ds9/parsers/vlaparser.tcl | 991 ++++++ ds9/parsers/vlasendlex.tcl | 311 ++ ds9/parsers/vlasendparser.tab.tcl | 6 + ds9/parsers/vlasendparser.tcl | 324 ++ ds9/parsers/vlsslex.tcl | 588 +++ ds9/parsers/vlssparser.tab.tcl | 27 + ds9/parsers/vlssparser.tcl | 939 +++++ ds9/parsers/vlsssendlex.tcl | 311 ++ ds9/parsers/vlsssendparser.tab.tcl | 6 + ds9/parsers/vlsssendparser.tcl | 314 ++ ds9/parsers/volex.tcl | 473 +++ ds9/parsers/voparser.tab.tcl | 18 + ds9/parsers/voparser.tcl | 587 +++ ds9/parsers/vosendlex.tcl | 300 ++ ds9/parsers/vosendparser.tab.tcl | 5 + ds9/parsers/vosendparser.tcl | 310 ++ ds9/parsers/wcslex.tcl | 858 +++++ ds9/parsers/wcsparser.tab.tcl | 53 + ds9/parsers/wcsparser.tcl | 1349 +++++++ ds9/parsers/wcssendlex.tcl | 289 ++ ds9/parsers/wcssendparser.tab.tcl | 4 + ds9/parsers/wcssendparser.tcl | 296 ++ ds9/parsers/weblex.tcl | 385 ++ ds9/parsers/webparser.tab.tcl | 10 + ds9/parsers/webparser.tcl | 522 +++ ds9/parsers/widthlex.tcl | 297 ++ ds9/parsers/widthparser.tab.tcl | 2 + ds9/parsers/widthparser.tcl | 291 ++ ds9/parsers/xpafirstlex.tcl | 461 +++ ds9/parsers/xpafirstparser.tab.tcl | 16 + ds9/parsers/xpafirstparser.tcl | 551 +++ ds9/parsers/xpalex.tcl | 461 +++ ds9/parsers/xpaparser.tab.tcl | 16 + ds9/parsers/xpaparser.tcl | 551 +++ ds9/parsers/xpasendlex.tcl | 256 ++ ds9/parsers/xpasendparser.tab.tcl | 1 + ds9/parsers/xpasendparser.tcl | 254 ++ ds9/parsers/zoomlex.tcl | 382 ++ ds9/parsers/zoomparser.tab.tcl | 9 + ds9/parsers/zoomparser.tcl | 486 +++ ds9/parsers/zscalelex.tcl | 415 +++ ds9/parsers/zscaleparser.tab.tcl | 12 + ds9/parsers/zscaleparser.tcl | 435 +++ ds9/parsers/zscalesendlex.tcl | 278 ++ ds9/parsers/zscalesendparser.tab.tcl | 3 + ds9/parsers/zscalesendparser.tcl | 276 ++ 423 files changed, 194018 insertions(+) create mode 100644 ds9/parsers/alignlex.tcl create mode 100644 ds9/parsers/alignparser.tab.tcl create mode 100644 ds9/parsers/alignparser.tcl create mode 100644 ds9/parsers/analysislex.tcl create mode 100644 ds9/parsers/analysisparser.tab.tcl create mode 100644 ds9/parsers/analysisparser.tcl create mode 100644 ds9/parsers/analysissendlex.tcl create mode 100644 ds9/parsers/analysissendparser.tab.tcl create mode 100644 ds9/parsers/analysissendparser.tcl create mode 100644 ds9/parsers/arraylex.tcl create mode 100644 ds9/parsers/arrayparser.tab.tcl create mode 100644 ds9/parsers/arrayparser.tcl create mode 100644 ds9/parsers/backuplex.tcl create mode 100644 ds9/parsers/backupparser.tab.tcl create mode 100644 ds9/parsers/backupparser.tcl create mode 100644 ds9/parsers/bglex.tcl create mode 100644 ds9/parsers/bgparser.tab.tcl create mode 100644 ds9/parsers/bgparser.tcl create mode 100644 ds9/parsers/binlex.tcl create mode 100644 ds9/parsers/binparser.tab.tcl create mode 100644 ds9/parsers/binparser.tcl create mode 100644 ds9/parsers/binsendlex.tcl create mode 100644 ds9/parsers/binsendparser.tab.tcl create mode 100644 ds9/parsers/binsendparser.tcl create mode 100644 ds9/parsers/blinklex.tcl create mode 100644 ds9/parsers/blinkparser.tab.tcl create mode 100644 ds9/parsers/blinkparser.tcl create mode 100644 ds9/parsers/blinksendlex.tcl create mode 100644 ds9/parsers/blinksendparser.tab.tcl create mode 100644 ds9/parsers/blinksendparser.tcl create mode 100644 ds9/parsers/blocklex.tcl create mode 100644 ds9/parsers/blockparser.tab.tcl create mode 100644 ds9/parsers/blockparser.tcl create mode 100644 ds9/parsers/blocksendlex.tcl create mode 100644 ds9/parsers/blocksendparser.tab.tcl create mode 100644 ds9/parsers/blocksendparser.tcl create mode 100644 ds9/parsers/catlex.tcl create mode 100644 ds9/parsers/catparser.tab.tcl create mode 100644 ds9/parsers/catparser.tcl create mode 100644 ds9/parsers/catsendlex.tcl create mode 100644 ds9/parsers/catsendparser.tab.tcl create mode 100644 ds9/parsers/catsendparser.tcl create mode 100644 ds9/parsers/cmaplex.tcl create mode 100644 ds9/parsers/cmapparser.tab.tcl create mode 100644 ds9/parsers/cmapparser.tcl create mode 100644 ds9/parsers/cmapsendlex.tcl create mode 100644 ds9/parsers/cmapsendparser.tab.tcl create mode 100644 ds9/parsers/cmapsendparser.tcl create mode 100644 ds9/parsers/colorbarlex.tcl create mode 100644 ds9/parsers/colorbarparser.tab.tcl create mode 100644 ds9/parsers/colorbarparser.tcl create mode 100644 ds9/parsers/colorbarsendlex.tcl create mode 100644 ds9/parsers/colorbarsendparser.tab.tcl create mode 100644 ds9/parsers/colorbarsendparser.tcl create mode 100644 ds9/parsers/contourlex.tcl create mode 100644 ds9/parsers/contourparser.tab.tcl create mode 100644 ds9/parsers/contourparser.tcl create mode 100644 ds9/parsers/contoursendlex.tcl create mode 100644 ds9/parsers/contoursendparser.tab.tcl create mode 100644 ds9/parsers/contoursendparser.tcl create mode 100644 ds9/parsers/croplex.tcl create mode 100644 ds9/parsers/cropparser.tab.tcl create mode 100644 ds9/parsers/cropparser.tcl create mode 100644 ds9/parsers/cropsendlex.tcl create mode 100644 ds9/parsers/cropsendparser.tab.tcl create mode 100644 ds9/parsers/cropsendparser.tcl create mode 100644 ds9/parsers/crosshairlex.tcl create mode 100644 ds9/parsers/crosshairparser.tab.tcl create mode 100644 ds9/parsers/crosshairparser.tcl create mode 100644 ds9/parsers/crosshairsendlex.tcl create mode 100644 ds9/parsers/crosshairsendparser.tab.tcl create mode 100644 ds9/parsers/crosshairsendparser.tcl create mode 100644 ds9/parsers/cubelex.tcl create mode 100644 ds9/parsers/cubeparser.tab.tcl create mode 100644 ds9/parsers/cubeparser.tcl create mode 100644 ds9/parsers/cubesendlex.tcl create mode 100644 ds9/parsers/cubesendparser.tab.tcl create mode 100644 ds9/parsers/cubesendparser.tcl create mode 100644 ds9/parsers/cursorlex.tcl create mode 100644 ds9/parsers/cursorparser.tab.tcl create mode 100644 ds9/parsers/cursorparser.tcl create mode 100644 ds9/parsers/datasendlex.tcl create mode 100644 ds9/parsers/datasendparser.tab.tcl create mode 100644 ds9/parsers/datasendparser.tcl create mode 100644 ds9/parsers/dssesolex.tcl create mode 100644 ds9/parsers/dssesoparser.tab.tcl create mode 100644 ds9/parsers/dssesoparser.tcl create mode 100644 ds9/parsers/dssesosendlex.tcl create mode 100644 ds9/parsers/dssesosendparser.tab.tcl create mode 100644 ds9/parsers/dssesosendparser.tcl create mode 100644 ds9/parsers/dsssaolex.tcl create mode 100644 ds9/parsers/dsssaoparser.tab.tcl create mode 100644 ds9/parsers/dsssaoparser.tcl create mode 100644 ds9/parsers/dsssaosendlex.tcl create mode 100644 ds9/parsers/dsssaosendparser.tab.tcl create mode 100644 ds9/parsers/dsssaosendparser.tcl create mode 100644 ds9/parsers/dssstscilex.tcl create mode 100644 ds9/parsers/dssstsciparser.tab.tcl create mode 100644 ds9/parsers/dssstsciparser.tcl create mode 100644 ds9/parsers/dssstscisendlex.tcl create mode 100644 ds9/parsers/dssstscisendparser.tab.tcl create mode 100644 ds9/parsers/dssstscisendparser.tcl create mode 100644 ds9/parsers/envilex.tcl create mode 100644 ds9/parsers/enviparser.tab.tcl create mode 100644 ds9/parsers/enviparser.tcl create mode 100644 ds9/parsers/exportlex.tcl create mode 100644 ds9/parsers/exportparser.tab.tcl create mode 100644 ds9/parsers/exportparser.tcl create mode 100644 ds9/parsers/fitslex.tcl create mode 100644 ds9/parsers/fitsparser.tab.tcl create mode 100644 ds9/parsers/fitsparser.tcl create mode 100644 ds9/parsers/fitssendlex.tcl create mode 100644 ds9/parsers/fitssendparser.tab.tcl create mode 100644 ds9/parsers/fitssendparser.tcl create mode 100644 ds9/parsers/framelex.tcl create mode 100644 ds9/parsers/frameparser.tab.tcl create mode 100644 ds9/parsers/frameparser.tcl create mode 100644 ds9/parsers/framesendlex.tcl create mode 100644 ds9/parsers/framesendparser.tab.tcl create mode 100644 ds9/parsers/framesendparser.tcl create mode 100644 ds9/parsers/gridlex.tcl create mode 100644 ds9/parsers/gridparser.tab.tcl create mode 100644 ds9/parsers/gridparser.tcl create mode 100644 ds9/parsers/gridsendlex.tcl create mode 100644 ds9/parsers/gridsendparser.tab.tcl create mode 100644 ds9/parsers/gridsendparser.tcl create mode 100644 ds9/parsers/headerlex.tcl create mode 100644 ds9/parsers/headerparser.tab.tcl create mode 100644 ds9/parsers/headerparser.tcl create mode 100644 ds9/parsers/heightlex.tcl create mode 100644 ds9/parsers/heightparser.tab.tcl create mode 100644 ds9/parsers/heightparser.tcl create mode 100644 ds9/parsers/iconifylex.tcl create mode 100644 ds9/parsers/iconifyparser.tab.tcl create mode 100644 ds9/parsers/iconifyparser.tcl create mode 100644 ds9/parsers/iexamsendlex.tcl create mode 100644 ds9/parsers/iexamsendparser.tab.tcl create mode 100644 ds9/parsers/iexamsendparser.tcl create mode 100644 ds9/parsers/iislex.tcl create mode 100644 ds9/parsers/iisparser.tab.tcl create mode 100644 ds9/parsers/iisparser.tcl create mode 100644 ds9/parsers/iissendlex.tcl create mode 100644 ds9/parsers/iissendparser.tab.tcl create mode 100644 ds9/parsers/iissendparser.tcl create mode 100644 ds9/parsers/locklex.tcl create mode 100644 ds9/parsers/lockparser.tab.tcl create mode 100644 ds9/parsers/lockparser.tcl create mode 100644 ds9/parsers/locksendlex.tcl create mode 100644 ds9/parsers/locksendparser.tab.tcl create mode 100644 ds9/parsers/locksendparser.tcl create mode 100644 ds9/parsers/magnifierlex.tcl create mode 100644 ds9/parsers/magnifierparser.tab.tcl create mode 100644 ds9/parsers/magnifierparser.tcl create mode 100644 ds9/parsers/magnifiersendlex.tcl create mode 100644 ds9/parsers/magnifiersendparser.tab.tcl create mode 100644 ds9/parsers/magnifiersendparser.tcl create mode 100644 ds9/parsers/masklex.tcl create mode 100644 ds9/parsers/maskparser.tab.tcl create mode 100644 ds9/parsers/maskparser.tcl create mode 100644 ds9/parsers/masksendlex.tcl create mode 100644 ds9/parsers/masksendparser.tab.tcl create mode 100644 ds9/parsers/masksendparser.tcl create mode 100644 ds9/parsers/matchlex.tcl create mode 100644 ds9/parsers/matchparser.tab.tcl create mode 100644 ds9/parsers/matchparser.tcl create mode 100644 ds9/parsers/mecubelex.tcl create mode 100644 ds9/parsers/mecubeparser.tab.tcl create mode 100644 ds9/parsers/mecubeparser.tcl create mode 100644 ds9/parsers/minmaxlex.tcl create mode 100644 ds9/parsers/minmaxparser.tab.tcl create mode 100644 ds9/parsers/minmaxparser.tcl create mode 100644 ds9/parsers/minmaxsendlex.tcl create mode 100644 ds9/parsers/minmaxsendparser.tab.tcl create mode 100644 ds9/parsers/minmaxsendparser.tcl create mode 100644 ds9/parsers/modelex.tcl create mode 100644 ds9/parsers/modeparser.tab.tcl create mode 100644 ds9/parsers/modeparser.tcl create mode 100644 ds9/parsers/mosaicimageiraflex.tcl create mode 100644 ds9/parsers/mosaicimageirafparser.tab.tcl create mode 100644 ds9/parsers/mosaicimageirafparser.tcl create mode 100644 ds9/parsers/mosaicimagewcslex.tcl create mode 100644 ds9/parsers/mosaicimagewcsparser.tab.tcl create mode 100644 ds9/parsers/mosaicimagewcsparser.tcl create mode 100644 ds9/parsers/mosaicimagewfpc2lex.tcl create mode 100644 ds9/parsers/mosaicimagewfpc2parser.tab.tcl create mode 100644 ds9/parsers/mosaicimagewfpc2parser.tcl create mode 100644 ds9/parsers/mosaiciraflex.tcl create mode 100644 ds9/parsers/mosaicirafparser.tab.tcl create mode 100644 ds9/parsers/mosaicirafparser.tcl create mode 100644 ds9/parsers/mosaicwcslex.tcl create mode 100644 ds9/parsers/mosaicwcsparser.tab.tcl create mode 100644 ds9/parsers/mosaicwcsparser.tcl create mode 100644 ds9/parsers/movielex.tcl create mode 100644 ds9/parsers/movieparser.tab.tcl create mode 100644 ds9/parsers/movieparser.tcl create mode 100644 ds9/parsers/multiframelex.tcl create mode 100644 ds9/parsers/multiframeparser.tab.tcl create mode 100644 ds9/parsers/multiframeparser.tcl create mode 100644 ds9/parsers/nanlex.tcl create mode 100644 ds9/parsers/nanparser.tab.tcl create mode 100644 ds9/parsers/nanparser.tcl create mode 100644 ds9/parsers/nreslex.tcl create mode 100644 ds9/parsers/nresparser.tab.tcl create mode 100644 ds9/parsers/nresparser.tcl create mode 100644 ds9/parsers/nressendlex.tcl create mode 100644 ds9/parsers/nressendparser.tab.tcl create mode 100644 ds9/parsers/nressendparser.tcl create mode 100644 ds9/parsers/nrrdlex.tcl create mode 100644 ds9/parsers/nrrdparser.tab.tcl create mode 100644 ds9/parsers/nrrdparser.tcl create mode 100644 ds9/parsers/nvsslex.tcl create mode 100644 ds9/parsers/nvssparser.tab.tcl create mode 100644 ds9/parsers/nvssparser.tcl create mode 100644 ds9/parsers/nvsssendlex.tcl create mode 100644 ds9/parsers/nvsssendparser.tab.tcl create mode 100644 ds9/parsers/nvsssendparser.tcl create mode 100644 ds9/parsers/orientlex.tcl create mode 100644 ds9/parsers/orientparser.tab.tcl create mode 100644 ds9/parsers/orientparser.tcl create mode 100644 ds9/parsers/pagesetuplex.tcl create mode 100644 ds9/parsers/pagesetupparser.tab.tcl create mode 100644 ds9/parsers/pagesetupparser.tcl create mode 100644 ds9/parsers/pagesetupsendlex.tcl create mode 100644 ds9/parsers/pagesetupsendparser.tab.tcl create mode 100644 ds9/parsers/pagesetupsendparser.tcl create mode 100644 ds9/parsers/panlex.tcl create mode 100644 ds9/parsers/panparser.tab.tcl create mode 100644 ds9/parsers/panparser.tcl create mode 100644 ds9/parsers/pansendlex.tcl create mode 100644 ds9/parsers/pansendparser.tab.tcl create mode 100644 ds9/parsers/pansendparser.tcl create mode 100644 ds9/parsers/photolex.tcl create mode 100644 ds9/parsers/photoparser.tab.tcl create mode 100644 ds9/parsers/photoparser.tcl create mode 100644 ds9/parsers/pixeltablelex.tcl create mode 100644 ds9/parsers/pixeltableparser.tab.tcl create mode 100644 ds9/parsers/pixeltableparser.tcl create mode 100644 ds9/parsers/plotlex.tcl create mode 100644 ds9/parsers/plotparser.tab.tcl create mode 100644 ds9/parsers/plotparser.tcl create mode 100644 ds9/parsers/plotsendlex.tcl create mode 100644 ds9/parsers/plotsendparser.tab.tcl create mode 100644 ds9/parsers/plotsendparser.tcl create mode 100644 ds9/parsers/precisionlex.tcl create mode 100644 ds9/parsers/precisionparser.tab.tcl create mode 100644 ds9/parsers/precisionparser.tcl create mode 100644 ds9/parsers/prefslex.tcl create mode 100644 ds9/parsers/prefsparser.tab.tcl create mode 100644 ds9/parsers/prefsparser.tcl create mode 100644 ds9/parsers/prefssendlex.tcl create mode 100644 ds9/parsers/prefssendparser.tab.tcl create mode 100644 ds9/parsers/prefssendparser.tcl create mode 100644 ds9/parsers/preservelex.tcl create mode 100644 ds9/parsers/preserveparser.tab.tcl create mode 100644 ds9/parsers/preserveparser.tcl create mode 100644 ds9/parsers/preservesendlex.tcl create mode 100644 ds9/parsers/preservesendparser.tab.tcl create mode 100644 ds9/parsers/preservesendparser.tcl create mode 100644 ds9/parsers/pslex.tcl create mode 100644 ds9/parsers/psparser.tab.tcl create mode 100644 ds9/parsers/psparser.tcl create mode 100644 ds9/parsers/pssendlex.tcl create mode 100644 ds9/parsers/pssendparser.tab.tcl create mode 100644 ds9/parsers/pssendparser.tcl create mode 100644 ds9/parsers/regionlex.tcl create mode 100644 ds9/parsers/regionparser.tab.tcl create mode 100644 ds9/parsers/regionparser.tcl create mode 100644 ds9/parsers/regionsendlex.tcl create mode 100644 ds9/parsers/regionsendparser.tab.tcl create mode 100644 ds9/parsers/regionsendparser.tcl create mode 100644 ds9/parsers/restorelex.tcl create mode 100644 ds9/parsers/restoreparser.tab.tcl create mode 100644 ds9/parsers/restoreparser.tcl create mode 100644 ds9/parsers/rgbarraylex.tcl create mode 100644 ds9/parsers/rgbarrayparser.tab.tcl create mode 100644 ds9/parsers/rgbarrayparser.tcl create mode 100644 ds9/parsers/rgbcubelex.tcl create mode 100644 ds9/parsers/rgbcubeparser.tab.tcl create mode 100644 ds9/parsers/rgbcubeparser.tcl create mode 100644 ds9/parsers/rgbimagelex.tcl create mode 100644 ds9/parsers/rgbimageparser.tab.tcl create mode 100644 ds9/parsers/rgbimageparser.tcl create mode 100644 ds9/parsers/rgblex.tcl create mode 100644 ds9/parsers/rgbparser.tab.tcl create mode 100644 ds9/parsers/rgbparser.tcl create mode 100644 ds9/parsers/rgbsendlex.tcl create mode 100644 ds9/parsers/rgbsendparser.tab.tcl create mode 100644 ds9/parsers/rgbsendparser.tcl create mode 100644 ds9/parsers/rotatelex.tcl create mode 100644 ds9/parsers/rotateparser.tab.tcl create mode 100644 ds9/parsers/rotateparser.tcl create mode 100644 ds9/parsers/samplex.tcl create mode 100644 ds9/parsers/sampparser.tab.tcl create mode 100644 ds9/parsers/sampparser.tcl create mode 100644 ds9/parsers/saveimagelex.tcl create mode 100644 ds9/parsers/saveimageparser.tab.tcl create mode 100644 ds9/parsers/saveimageparser.tcl create mode 100644 ds9/parsers/savelex.tcl create mode 100644 ds9/parsers/saveparser.tab.tcl create mode 100644 ds9/parsers/saveparser.tcl create mode 100644 ds9/parsers/scalelex.tcl create mode 100644 ds9/parsers/scaleparser.tab.tcl create mode 100644 ds9/parsers/scaleparser.tcl create mode 100644 ds9/parsers/scalesendlex.tcl create mode 100644 ds9/parsers/scalesendparser.tab.tcl create mode 100644 ds9/parsers/scalesendparser.tcl create mode 100644 ds9/parsers/sfitslex.tcl create mode 100644 ds9/parsers/sfitsparser.tab.tcl create mode 100644 ds9/parsers/sfitsparser.tcl create mode 100644 ds9/parsers/shmlex.tcl create mode 100644 ds9/parsers/shmparser.tab.tcl create mode 100644 ds9/parsers/shmparser.tcl create mode 100644 ds9/parsers/sialex.tcl create mode 100644 ds9/parsers/siaparser.tab.tcl create mode 100644 ds9/parsers/siaparser.tcl create mode 100644 ds9/parsers/skyviewlex.tcl create mode 100644 ds9/parsers/skyviewparser.tab.tcl create mode 100644 ds9/parsers/skyviewparser.tcl create mode 100644 ds9/parsers/skyviewsendlex.tcl create mode 100644 ds9/parsers/skyviewsendparser.tab.tcl create mode 100644 ds9/parsers/skyviewsendparser.tcl create mode 100644 ds9/parsers/sleeplex.tcl create mode 100644 ds9/parsers/sleepparser.tab.tcl create mode 100644 ds9/parsers/sleepparser.tcl create mode 100644 ds9/parsers/smoothlex.tcl create mode 100644 ds9/parsers/smoothparser.tab.tcl create mode 100644 ds9/parsers/smoothparser.tcl create mode 100644 ds9/parsers/smoothsendlex.tcl create mode 100644 ds9/parsers/smoothsendparser.tab.tcl create mode 100644 ds9/parsers/smoothsendparser.tcl create mode 100644 ds9/parsers/smosaiciraflex.tcl create mode 100644 ds9/parsers/smosaicirafparser.tab.tcl create mode 100644 ds9/parsers/smosaicirafparser.tcl create mode 100644 ds9/parsers/smosaicwcslex.tcl create mode 100644 ds9/parsers/smosaicwcsparser.tab.tcl create mode 100644 ds9/parsers/smosaicwcsparser.tcl create mode 100644 ds9/parsers/sourcelex.tcl create mode 100644 ds9/parsers/sourceparser.tab.tcl create mode 100644 ds9/parsers/sourceparser.tcl create mode 100644 ds9/parsers/srgbcubelex.tcl create mode 100644 ds9/parsers/srgbcubeparser.tab.tcl create mode 100644 ds9/parsers/srgbcubeparser.tcl create mode 100644 ds9/parsers/threadslex.tcl create mode 100644 ds9/parsers/threadsparser.tab.tcl create mode 100644 ds9/parsers/threadsparser.tcl create mode 100644 ds9/parsers/threedlex.tcl create mode 100644 ds9/parsers/threedparser.tab.tcl create mode 100644 ds9/parsers/threedparser.tcl create mode 100644 ds9/parsers/threedsendlex.tcl create mode 100644 ds9/parsers/threedsendparser.tab.tcl create mode 100644 ds9/parsers/threedsendparser.tcl create mode 100644 ds9/parsers/tilelex.tcl create mode 100644 ds9/parsers/tileparser.tab.tcl create mode 100644 ds9/parsers/tileparser.tcl create mode 100644 ds9/parsers/tilesendlex.tcl create mode 100644 ds9/parsers/tilesendparser.tab.tcl create mode 100644 ds9/parsers/tilesendparser.tcl create mode 100644 ds9/parsers/twomasslex.tcl create mode 100644 ds9/parsers/twomassparser.tab.tcl create mode 100644 ds9/parsers/twomassparser.tcl create mode 100644 ds9/parsers/twomasssendlex.tcl create mode 100644 ds9/parsers/twomasssendparser.tab.tcl create mode 100644 ds9/parsers/twomasssendparser.tcl create mode 100644 ds9/parsers/updatelex.tcl create mode 100644 ds9/parsers/updateparser.tab.tcl create mode 100644 ds9/parsers/updateparser.tcl create mode 100644 ds9/parsers/urlfitslex.tcl create mode 100644 ds9/parsers/urlfitsparser.tab.tcl create mode 100644 ds9/parsers/urlfitsparser.tcl create mode 100644 ds9/parsers/viewlex.tcl create mode 100644 ds9/parsers/viewparser.tab.tcl create mode 100644 ds9/parsers/viewparser.tcl create mode 100644 ds9/parsers/viewsendlex.tcl create mode 100644 ds9/parsers/viewsendparser.tab.tcl create mode 100644 ds9/parsers/viewsendparser.tcl create mode 100644 ds9/parsers/vlalex.tcl create mode 100644 ds9/parsers/vlaparser.tab.tcl create mode 100644 ds9/parsers/vlaparser.tcl create mode 100644 ds9/parsers/vlasendlex.tcl create mode 100644 ds9/parsers/vlasendparser.tab.tcl create mode 100644 ds9/parsers/vlasendparser.tcl create mode 100644 ds9/parsers/vlsslex.tcl create mode 100644 ds9/parsers/vlssparser.tab.tcl create mode 100644 ds9/parsers/vlssparser.tcl create mode 100644 ds9/parsers/vlsssendlex.tcl create mode 100644 ds9/parsers/vlsssendparser.tab.tcl create mode 100644 ds9/parsers/vlsssendparser.tcl create mode 100644 ds9/parsers/volex.tcl create mode 100644 ds9/parsers/voparser.tab.tcl create mode 100644 ds9/parsers/voparser.tcl create mode 100644 ds9/parsers/vosendlex.tcl create mode 100644 ds9/parsers/vosendparser.tab.tcl create mode 100644 ds9/parsers/vosendparser.tcl create mode 100644 ds9/parsers/wcslex.tcl create mode 100644 ds9/parsers/wcsparser.tab.tcl create mode 100644 ds9/parsers/wcsparser.tcl create mode 100644 ds9/parsers/wcssendlex.tcl create mode 100644 ds9/parsers/wcssendparser.tab.tcl create mode 100644 ds9/parsers/wcssendparser.tcl create mode 100644 ds9/parsers/weblex.tcl create mode 100644 ds9/parsers/webparser.tab.tcl create mode 100644 ds9/parsers/webparser.tcl create mode 100644 ds9/parsers/widthlex.tcl create mode 100644 ds9/parsers/widthparser.tab.tcl create mode 100644 ds9/parsers/widthparser.tcl create mode 100644 ds9/parsers/xpafirstlex.tcl create mode 100644 ds9/parsers/xpafirstparser.tab.tcl create mode 100644 ds9/parsers/xpafirstparser.tcl create mode 100644 ds9/parsers/xpalex.tcl create mode 100644 ds9/parsers/xpaparser.tab.tcl create mode 100644 ds9/parsers/xpaparser.tcl create mode 100644 ds9/parsers/xpasendlex.tcl create mode 100644 ds9/parsers/xpasendparser.tab.tcl create mode 100644 ds9/parsers/xpasendparser.tcl create mode 100644 ds9/parsers/zoomlex.tcl create mode 100644 ds9/parsers/zoomparser.tab.tcl create mode 100644 ds9/parsers/zoomparser.tcl create mode 100644 ds9/parsers/zscalelex.tcl create mode 100644 ds9/parsers/zscaleparser.tab.tcl create mode 100644 ds9/parsers/zscaleparser.tcl create mode 100644 ds9/parsers/zscalesendlex.tcl create mode 100644 ds9/parsers/zscalesendparser.tab.tcl create mode 100644 ds9/parsers/zscalesendparser.tcl diff --git a/ds9/parsers/alignlex.tcl b/ds9/parsers/alignlex.tcl new file mode 100644 index 0000000..9f123cd --- /dev/null +++ b/ds9/parsers/alignlex.tcl @@ -0,0 +1,352 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval align { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc align::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc align::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc align::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc align::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc align::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc align::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc align::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc align::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc align::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $YES_ + } + 1 { +return $NO_ + } + 2 { +return $ON_ + } + 3 { +return $OFF_ + } + 4 { +return $TRUE_ + } + 5 { +return $FALSE_ + } + 6 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 7 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval $yytext; return $STRING_ + } + 10 { +# ignore whitespace + } + 11 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/alignparser.tab.tcl b/ds9/parsers/alignparser.tab.tcl new file mode 100644 index 0000000..3cd65f3 --- /dev/null +++ b/ds9/parsers/alignparser.tab.tcl @@ -0,0 +1,7 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 diff --git a/ds9/parsers/alignparser.tcl b/ds9/parsers/alignparser.tcl new file mode 100644 index 0000000..c085664 --- /dev/null +++ b/ds9/parsers/alignparser.tcl @@ -0,0 +1,395 @@ +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 align { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc align::YYABORT {} { + return -code return 1 +} + +proc align::YYACCEPT {} { + return -code return 0 +} + +proc align::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc align::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc align::yyerror {s} { + puts stderr $s +} + +proc align::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 align::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set align::table { + 0:257 shift + 0:258 shift + 0:259 shift + 0:260 shift + 5:0,target 4 + 9:0 reduce + 0:261 shift + 11:0 reduce + 0:262 shift + 0:263 reduce + 0:264 goto + 7:263,target 11 + 0:265 goto + 2:263 reduce + 0:267 goto + 4:263 reduce + 0:265,target 8 + 2:263,target 5 + 6:0,target 7 + 6:263 reduce + 2:0 reduce + 6:0 reduce + 0:264,target 7 + 7:0,target 11 + 0:0,target 1 + 5:263,target 4 + 0:263,target 1 + 8:0,target 0 + 3:0 reduce + 10:263 shift + 1:0,target 2 + 11:0,target 10 + 0:262,target 6 + 7:0 reduce + 3:263,target 3 + 9:266,target 10 + 9:0,target 8 + 0:261,target 5 + 1:263 reduce + 2:0,target 5 + 3:263 reduce + 10:263,target 11 + 0:0 reduce + 5:263 reduce + 7:263 reduce + 0:259,target 3 + 0:260,target 4 + 9:263 reduce + 4:0 reduce + 6:263,target 7 + 3:0,target 3 + 9:266 goto + 1:263,target 2 + 8:0 accept + 0:258,target 2 + 9:263,target 9 + 4:0,target 6 + 0:257,target 1 + 1:0 reduce + 0:267,target 9 + 4:263,target 6 + 5:0 reduce +} + +array set align::rules { + 9,l 266 + 11,l 267 + 2,l 264 + 6,l 264 + 3,l 264 + 7,l 264 + 0,l 268 + 4,l 264 + 8,l 265 + 10,l 265 + 1,l 264 + 5,l 264 +} + +array set align::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 10,dc 3 + 6,dc 1 + 1,dc 0 + 9,dc 0 + 4,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set align::rules { + 7,line 35 + 10,line 39 + 4,line 32 + 1,line 29 + 9,line 38 + 6,line 34 + 3,line 31 + 8,line 38 + 11,line 43 + 5,line 33 + 2,line 30 + 9,e 1 +} + +array set align::lr1_table { + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 263} 0} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0}} + 1 {{2 {0 263} 1}} + 2 {{5 {0 263} 1}} + 3 {{3 {0 263} 1}} + 4 {{6 {0 263} 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {267 9}} + 5 {{4 {0 263} 1}} + 1,trans {} + 2,trans {} + 6 {{7 {0 263} 1}} + 3,trans {} + 7 {{11 {0 263} 1}} + 4,trans {} + 8 {{0 0 1}} + 10 {{10 0 2}} + 5,trans {} + 9 {{8 0 1} {10 0 1} {9 263 0}} + 11 {{10 0 3}} + 6,trans {} + 7,trans {} + 8,trans {} + 10,trans {{263 11}} + 9,trans {{266 10}} + 11,trans {} +} + +array set align::token_id_table { + 264,line 28 + 265,title {} + 261,line 11 + 257,t 0 + 257,line 7 + 262,t 0 + 259,title ON + 260,title OFF + 266,t 1 + error error + 264,title {} + 266,line 38 + 268,title {} + error,line 27 + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 267,t 1 + 263,title string + 268,line 44 + 267,title {} + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 261 TRUE_ + 265,line 37 + 262 FALSE_ + 263 STRING_ + 257,title YES + 264 yesno + 264,t 1 + 265 command + 262,line 12 + 266 @PSEUDO1 + 267 align + 268,t 1 + 268 start' + 262,title FALSE + 0 {$} + 0,t 0 + error,t 0 + 258,line 8 + 266,title {} + 261,t 0 + 267,line 42 + 265,t 1 + 261,title TRUE +} + +proc align::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { ProcessCmdSet current align $1 AlignWCSFrame } + } + 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 align::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/analysislex.tcl b/ds9/parsers/analysislex.tcl new file mode 100644 index 0000000..d3fc14d --- /dev/null +++ b/ds9/parsers/analysislex.tcl @@ -0,0 +1,473 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval analysis { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc analysis::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc analysis::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc analysis::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc analysis::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc analysis::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc analysis::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc analysis::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc analysis::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc analysis::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 +set CLEAR_ 259 +set LOAD_ 260 +set MESSAGE_ 261 +set PLOT_ 262 +set STDIN_ 263 +set TASK_ 264 +set TEXT_ 265 +set OK_ 266 +set OKCANCEL_ 267 +set RETRYCANCEL_ 268 +set YESNO_ 269 +set YESNOCANCEL_ 270 +set XY_ 271 +set XYEX_ 272 +set XYEY_ 273 +set XYEXEY_ 274 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: message + if {[regexp -start $index_ -indices -line -nocase -- {\A(message)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: plot + if {[regexp -start $index_ -indices -line -nocase -- {\A(plot)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: stdin + if {[regexp -start $index_ -indices -line -nocase -- {\A(stdin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: task + if {[regexp -start $index_ -indices -line -nocase -- {\A(task)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: text + if {[regexp -start $index_ -indices -line -nocase -- {\A(text)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: ok + if {[regexp -start $index_ -indices -line -nocase -- {\A(ok)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: okcancel + if {[regexp -start $index_ -indices -line -nocase -- {\A(okcancel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: retrycancel + if {[regexp -start $index_ -indices -line -nocase -- {\A(retrycancel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: yesno + if {[regexp -start $index_ -indices -line -nocase -- {\A(yesno)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: yesnocancel + if {[regexp -start $index_ -indices -line -nocase -- {\A(yesnocancel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: xy + if {[regexp -start $index_ -indices -line -nocase -- {\A(xy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: xyex + if {[regexp -start $index_ -indices -line -nocase -- {\A(xyex)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: xyey + if {[regexp -start $index_ -indices -line -nocase -- {\A(xyey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: xyexey + if {[regexp -start $index_ -indices -line -nocase -- {\A(xyexey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLEAR_ + } + 1 { +return $LOAD_ + } + 2 { +return $MESSAGE_ + } + 3 { +return $PLOT_ + } + 4 { +return $STDIN_ + } + 5 { +return $TASK_ + } + 6 { +return $TEXT_ + } + 7 { +return $OK_ + } + 8 { +return $OKCANCEL_ + } + 9 { +return $RETRYCANCEL_ + } + 10 { +return $YESNO_ + } + 11 { +return $YESNOCANCEL_ + } + 12 { +return $XY + } + 13 { +return $XYEX + } + 14 { +return $XYEY + } + 15 { +return $XYEXEY + } + 16 { +set yylval $yytext; return $INT_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 20 { +set yylval $yytext; return $STRING_ + } + 21 { +# ignore whitespace + } + 22 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/analysisparser.tab.tcl b/ds9/parsers/analysisparser.tab.tcl new file mode 100644 index 0000000..2b62789 --- /dev/null +++ b/ds9/parsers/analysisparser.tab.tcl @@ -0,0 +1,18 @@ +set INT_ 257 +set STRING_ 258 +set CLEAR_ 259 +set LOAD_ 260 +set MESSAGE_ 261 +set PLOT_ 262 +set STDIN_ 263 +set TASK_ 264 +set TEXT_ 265 +set OK_ 266 +set OKCANCEL_ 267 +set RETRYCANCEL_ 268 +set YESNO_ 269 +set YESNOCANCEL_ 270 +set XY_ 271 +set XYEX_ 272 +set XYEY_ 273 +set XYEXEY_ 274 diff --git a/ds9/parsers/analysisparser.tcl b/ds9/parsers/analysisparser.tcl new file mode 100644 index 0000000..05cb9a1 --- /dev/null +++ b/ds9/parsers/analysisparser.tcl @@ -0,0 +1,747 @@ +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 analysis { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc analysis::YYABORT {} { + return -code return 1 +} + +proc analysis::YYACCEPT {} { + return -code return 0 +} + +proc analysis::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc analysis::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc analysis::yyerror {s} { + puts stderr $s +} + +proc analysis::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 analysis::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set analysis::table { + 17:258 reduce + 27:0 reduce + 10:258,target 2 + 6:258 shift + 26:258 reduce + 0:275,target 9 + 6:263 shift + 2:0 reduce + 1:258,target 4 + 24:0 reduce + 35:257 shift + 41:0,target 29 + 33:258,target 35 + 25:0,target 15 + 10:0,target 1 + 22:258,target 28 + 35:271 shift + 35:272 shift + 6:284 goto + 11:258,target 30 + 14:258 reduce + 35:273 shift + 35:274 shift + 8:283,target 28 + 3:258 reduce + 3:260 shift + 2:258,target 10 + 23:258 reduce + 35:285 goto + 7:257,target 24 + 5:269,target 18 + 5:270,target 19 + 38:0 reduce + 32:258 reduce + 3:0,target 16 + 23:258,target 9 + 41:258 reduce + 3:280 goto + 12:258,target 7 + 14:0 reduce + 37:0,target 30 + 30:0,target 19 + 5:267,target 16 + 22:0,target 28 + 3:280,target 12 + 14:0,target 6 + 11:258 shift + 3:258,target 16 + 0:257 shift + 0:258 shift + 0:260 shift + 0:259 shift + 0:261 shift + 9:0 accept + 19:258 reduce + 20:258 shift + 0:262 shift + 11:0 reduce + 0:264 shift + 0:265 shift + 32:0 reduce + 8:258 shift + 24:258,target 14 + 28:258 reduce + 11:281 goto + 0:275 goto + 13:258,target 13 + 0:264,target 7 + 0:277 goto + 37:258 reduce + 28:0 reduce + 4:258,target 13 + 34:0,target 3 + 3:0 reduce + 26:0,target 5 + 36:258,target 34 + 5:282,target 20 + 0:262,target 6 + 8:283 goto + 11:0,target 18 + 16:258 reduce + 25:0 reduce + 25:258,target 15 + 5:258 reduce + 25:258 reduce + 6:284,target 23 + 14:258,target 6 + 35:273,target 39 + 5:266 shift + 0:259,target 3 + 0:260,target 4 + 5:267 shift + 6:263,target 22 + 22:0 reduce + 5:268 shift + 5:269 shift + 5:270 shift + 5:258,target 20 + 37:258,target 30 + 35:271,target 37 + 4:0,target 12 + 5:282 goto + 0:257,target 1 + 26:258,target 5 + 13:258 reduce + 39:0 reduce + 40:0 reduce + 38:0,target 31 + 31:0,target 17 + 15:258,target 21 + 23:0,target 9 + 2:258 reduce + 22:258 reduce + 6:258,target 21 + 36:0 reduce + 31:258 reduce + 38:258,target 31 + 11:281,target 31 + 10:276,target 29 + 12:0 reduce + 27:258,target 27 + 39:258 reduce + 40:258 reduce + 10:258 reduce + 16:258,target 22 + 35:285,target 41 + 8:0,target 26 + 1:0,target 4 + 7:279,target 26 + 18:258 reduce + 7:258,target 25 + 30:0 reduce + 27:0,target 27 + 7:257 shift + 40:258,target 33 + 7:258 shift + 12:0,target 7 + 39:258,target 32 + 10:276 goto + 27:258 reduce + 4:0 reduce + 28:258,target 8 + 5:268,target 17 + 26:0 reduce + 36:258 reduce + 17:258,target 23 + 3:260,target 11 + 1:0 reduce + 7:279 goto + 8:258,target 27 + 15:258 reduce + 23:0 reduce + 5:266,target 15 + 41:258,target 29 + 4:258 shift + 24:258 reduce + 29:258,target 34 + 30:258,target 19 + 39:0,target 32 + 40:0,target 33 + 0:265,target 8 + 32:0,target 11 + 24:0,target 14 + 35:257,target 36 + 18:258,target 24 + 41:0 reduce + 33:258 shift + 4:278 goto + 4:278,target 14 + 12:258 reduce + 37:0 reduce + 31:258,target 17 + 1:258 reduce + 35:274,target 40 + 21:258 shift + 0:261,target 5 + 9:0,target 0 + 13:0 reduce + 19:258,target 25 + 20:258,target 32 + 2:0,target 10 + 34:0 reduce + 29:258 shift + 30:258 reduce + 36:0,target 34 + 28:0,target 8 + 35:272,target 38 + 13:0,target 13 + 8:0 reduce + 10:0 reduce + 0:258,target 2 + 38:258 reduce + 31:0 reduce + 32:258,target 11 + 0:277,target 10 + 21:258,target 33 +} + +array set analysis::rules { + 9,l 277 + 11,l 277 + 32,l 285 + 6,l 277 + 28,l 284 + 3,l 275 + 25,l 282 + 0,l 286 + 22,l 282 + 18,l 281 + 15,l 279 + 12,l 278 + 33,l 285 + 7,l 277 + 29,l 284 + 30,l 285 + 4,l 277 + 26,l 283 + 1,l 275 + 23,l 282 + 19,l 281 + 20,l 282 + 16,l 280 + 13,l 278 + 34,l 285 + 8,l 277 + 10,l 277 + 31,l 285 + 5,l 277 + 27,l 283 + 2,l 276 + 24,l 282 + 21,l 282 + 17,l 280 + 14,l 279 +} + +array set analysis::rules { + 12,dc 0 + 26,dc 0 + 3,dc 3 + 18,dc 0 + 33,dc 1 + 9,dc 2 + 11,dc 3 + 25,dc 1 + 2,dc 0 + 17,dc 2 + 32,dc 1 + 8,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 16,dc 0 + 31,dc 1 + 7,dc 2 + 23,dc 1 + 0,dc 1 + 15,dc 1 + 29,dc 4 + 30,dc 1 + 6,dc 2 + 22,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 2 + 21,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 19,dc 1 + 20,dc 0 + 34,dc 1 +} + +array set analysis::rules { + 7,line 42 + 4,line 39 + 34,line 85 + 1,line 35 + 31,line 82 + 27,line 74 + 24,line 69 + 21,line 66 + 17,line 58 + 14,line 53 + 11,line 46 + 9,line 44 + 6,line 41 + 3,line 36 + 33,line 84 + 29,line 78 + 30,line 81 + 26,line 73 + 23,line 68 + 19,line 62 + 20,line 65 + 16,line 57 + 13,line 50 + 10,line 45 + 8,line 43 + 5,line 40 + 2,line 35 + 32,line 83 + 28,line 77 + 2,e 1 + 25,line 70 + 22,line 67 + 18,line 61 + 15,line 54 + 12,line 49 +} + +array set analysis::lr1_table { + 35 {{29 {0 258} 3} {30 {0 258} 0} {31 {0 258} 0} {32 {0 258} 0} {33 {0 258} 0} {34 {0 258} 0}} + 36 {{34 {0 258} 1}} + 14,trans {} + 37 {{30 {0 258} 1}} + 33,trans {{258 35}} + 38 {{31 {0 258} 1}} + 40 {{33 {0 258} 1}} + 39 {{32 {0 258} 1}} + 41 {{29 {0 258} 4}} + 18,trans {} + 1,trans {} + 37,trans {} + 23,trans {} + 5,trans {{266 15} {267 16} {268 17} {269 18} {270 19} {282 20}} + 27,trans {} + 9,trans {} + 13,trans {} + 32,trans {} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {275 9} {277 10}} + 36,trans {} + 22,trans {} + 4,trans {{258 13} {278 14}} + 41,trans {} + 26,trans {} + 8,trans {{258 27} {283 28}} + 12,trans {} + 31,trans {} + 16,trans {} + 35,trans {{257 36} {271 37} {272 38} {273 39} {274 40} {285 41}} + 21,trans {{258 33}} + 3,trans {{260 11} {280 12}} + 40,trans {} + 39,trans {} + 10 {{1 0 1} {3 0 1} {2 258 0}} + 11 {{17 {0 258} 1} {18 {0 258} 0} {19 {0 258} 0}} + 25,trans {} + 12 {{7 {0 258} 2}} + 7,trans {{257 24} {258 25} {279 26}} + 13 {{13 {0 258} 1}} + 14 {{6 {0 258} 2}} + 15 {{21 258 1}} + 11,trans {{258 30} {281 31}} + 30,trans {} + 29,trans {{258 34}} + 16 {{22 258 1}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0} {5 {0 258} 0} {6 {0 258} 0} {7 {0 258} 0} {8 {0 258} 0} {9 {0 258} 0} {10 {0 258} 0} {11 {0 258} 0}} + 17 {{23 258 1}} + 1 {{4 {0 258} 1}} + 18 {{24 258 1}} + 2 {{10 {0 258} 1}} + 19 {{25 258 1}} + 20 {{11 {0 258} 2}} + 15,trans {} + 34,trans {} + 3 {{7 {0 258} 1} {16 {0 258} 0} {17 {0 258} 0}} + 21 {{29 {0 258} 1}} + 4 {{6 {0 258} 1} {12 {0 258} 0} {13 {0 258} 0}} + 22 {{28 {0 258} 1}} + 5 {{11 {0 258} 1} {20 258 0} {21 258 0} {22 258 0} {23 258 0} {24 258 0} {25 258 0}} + 23 {{9 {0 258} 2}} + 20,trans {{258 32}} + 19,trans {} + 6 {{9 {0 258} 1} {28 {0 258} 0} {29 {0 258} 0}} + 2,trans {} + 24 {{14 {0 258} 1}} + 38,trans {} + 7 {{5 {0 258} 1} {14 {0 258} 0} {15 {0 258} 0}} + 25 {{15 {0 258} 1}} + 8 {{8 {0 258} 1} {26 {0 258} 0} {27 {0 258} 0}} + 26 {{5 {0 258} 2}} + 9 {{0 0 1}} + 27 {{27 {0 258} 1}} + 24,trans {} + 6,trans {{258 21} {263 22} {284 23}} + 28 {{8 {0 258} 2}} + 29 {{3 0 2}} + 30 {{19 {0 258} 1}} + 31 {{17 {0 258} 2}} + 32 {{11 {0 258} 3}} + 10,trans {{276 29}} + 28,trans {} + 33 {{29 {0 258} 2}} + 34 {{3 0 3}} +} + +array set analysis::token_id_table { + 286,t 1 + 286 start' + 280,title {} + 279,title {} + 264,line 18 + 270,t 0 + 269,t 0 + 276,line 35 + 265,title TEXT + 284,title {} + 274,t 0 + 261,line 15 + 257,t 0 + 270,title YESNOCANCEL + 269,title YESNO + 273,line 29 + 278,t 1 + 257,line 7 + 262,t 0 + 285,line 80 + 274,title XYEXEY + 283,t 1 + 270,line 25 + 269,line 24 + 259,title CLEAR + 260,title LOAD + 266,t 0 + 278,title {} + 282,line 64 + error error + 271,t 0 + 264,title TASK + 266,line 21 + 283,title {} + 278,line 48 + 275,t 1 + error,line 33 + 268,title RETRYCANCEL + 258,t 0 + 263,line 17 + error,title {} + 280,t 1 + 279,t 1 + 275,line 34 + 273,title XYEY + 263,t 0 + 259,line 13 + 260,line 14 + 258,title string + 284,t 1 + 277,title {} + 272,line 28 + 267,t 0 + 263,title STDIN + 284,line 76 + 282,title {} + 272,t 0 + 268,line 23 + 267,title OKCANCEL + 286,title {} + 257 INT_ + 281,line 60 + 276,t 1 + 258 STRING_ + 259,t 0 + 259 CLEAR_ + 260 LOAD_ + 260,t 0 + 272,title XYEX + 261 MESSAGE_ + 265,line 19 + 262 PLOT_ + 281,t 1 + 263 STDIN_ + 277,line 38 + 257,title integer + 264 TASK_ + 264,t 0 + 276,title {} + 265 TEXT_ + 262,line 16 + 266 OK_ + 285,t 1 + 267 OKCANCEL_ + 0,t 0 + 0 {$} + 262,title PLOT + 268 RETRYCANCEL_ + 268,t 0 + 281,title {} + 274,line 30 + 270 YESNOCANCEL_ + 269 YESNO_ + error,t 0 + 271 XY_ + 272 XYEX_ + 258,line 9 + 286,line 86 + 273,t 0 + 273 XYEY_ + 266,title OK + 285,title {} + 274 XYEXEY_ + 275 command + 271,line 27 + 276 @PSEUDO1 + 277,t 1 + 277 analysis + 271,title XY + 283,line 72 + 278 load + 261,t 0 + 280 clear + 279 task + 281 clearLoad + 267,line 22 + 282,t 1 + 282 message + 275,title {} + 283 text + 265,t 0 + 284 plot + 280,line 56 + 279,line 52 + 285 dim + 261,title MESSAGE +} + +proc analysis::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { AnalysisTask $1 menu } + 10 { ProcessAnalysisFile $1 } + 11 { AnalysisMessage $2 $3 } + 12 { AnalysisCmdLoad } + 13 { ProcessAnalysisFile $1 } + 14 { AnalysisTask $1 menu } + 15 { AnalysisCmdTask $1 } + 16 { ClearAnalysis } + 18 { ClearAnalysis; AnalysisCmdLoad } + 19 { ClearAnalysis; ProcessAnalysisFile $1 } + 20 { set _ ok } + 21 { set _ ok } + 22 { set _ okcancel } + 23 { set _ retrycancel } + 24 { set _ yesno } + 25 { set _ yesnocancel } + 26 { AnalysisCmdText } + 27 { AnalysisText apXPA Analysis $1 append } + 28 { AnalysisCmdPlotStdin } + 29 { AnalysisCmdPlotLine $1 $2 $3 $4 } + 30 { set _ xy } + 31 { set _ xyex } + 32 { set _ xyey } + 33 { set _ xyexey } + 34 { set _ $1 } + } + 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 analysis::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/analysissendlex.tcl b/ds9/parsers/analysissendlex.tcl new file mode 100644 index 0000000..706df68 --- /dev/null +++ b/ds9/parsers/analysissendlex.tcl @@ -0,0 +1,374 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval analysissend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc analysissend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc analysissend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc analysissend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc analysissend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc analysissend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc analysissend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc analysissend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc analysissend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc analysissend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set ENTRY_ 258 +set MESSAGE_ 259 +set MODE_ 260 +set TASK_ 261 +set LOCK_ 262 +set OK_ 263 +set OKCANCEL_ 264 +set YESNO_ 265 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: entry + if {[regexp -start $index_ -indices -line -nocase -- {\A(entry)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: message + if {[regexp -start $index_ -indices -line -nocase -- {\A(message)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: task + if {[regexp -start $index_ -indices -line -nocase -- {\A(task)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: ok + if {[regexp -start $index_ -indices -line -nocase -- {\A(ok)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: okcancel + if {[regexp -start $index_ -indices -line -nocase -- {\A(okcancel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: yesno + if {[regexp -start $index_ -indices -line -nocase -- {\A(yesno)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ENTRY_ + } + 1 { +return $MESSAGE_ + } + 2 { +return $MODE_ + } + 3 { +return $TASK_ + } + 4 { +return $LOCK_ + } + 5 { +return $OK_ + } + 6 { +return $OKCANCEL_ + } + 7 { +return $YESNO_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval $yytext; return $STRING_ + } + 12 { +# ignore whitespace + } + 13 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/analysissendparser.tab.tcl b/ds9/parsers/analysissendparser.tab.tcl new file mode 100644 index 0000000..2c2e389 --- /dev/null +++ b/ds9/parsers/analysissendparser.tab.tcl @@ -0,0 +1,9 @@ +set STRING_ 257 +set ENTRY_ 258 +set MESSAGE_ 259 +set MODE_ 260 +set TASK_ 261 +set LOCK_ 262 +set OK_ 263 +set OKCANCEL_ 264 +set YESNO_ 265 diff --git a/ds9/parsers/analysissendparser.tcl b/ds9/parsers/analysissendparser.tcl new file mode 100644 index 0000000..be22bbe --- /dev/null +++ b/ds9/parsers/analysissendparser.tcl @@ -0,0 +1,378 @@ +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 analysissend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc analysissend::YYABORT {} { + return -code return 1 +} + +proc analysissend::YYACCEPT {} { + return -code return 0 +} + +proc analysissend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc analysissend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc analysissend::yyerror {s} { + puts stderr $s +} + +proc analysissend::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 analysissend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set analysissend::table { + 6:0 accept + 3:0,target 4 + 7:0 reduce + 1:257 shift + 0:258 shift + 5:0,target 6 + 2:257 reduce + 0:259 shift + 0:260 shift + 8:257,target 8 + 2:264,target 9 + 0:266,target 6 + 0:261 shift + 7:0,target 2 + 1:257,target 7 + 0:262 shift + 0:258,target 1 + 12:0 reduce + 11:257,target 12 + 0:0,target 1 + 0:261,target 4 + 2:263 shift + 12:0,target 3 + 8:257 reduce + 2:264 shift + 0:266 goto + 10:257 reduce + 9:257 reduce + 4:0,target 5 + 2:265 shift + 11:257 shift + 2:263,target 8 + 0:0 reduce + 6:0,target 0 + 2:267 goto + 10:257,target 10 + 9:257,target 9 + 2:265,target 10 + 3:0 reduce + 2:257,target 7 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 2:267,target 11 + 5:0 reduce + 0:262,target 5 +} + +array set analysissend::rules { + 9,l 267 + 2,l 266 + 6,l 266 + 3,l 266 + 7,l 267 + 0,l 268 + 4,l 266 + 8,l 267 + 10,l 267 + 1,l 266 + 5,l 266 +} + +array set analysissend::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 3 + 10,dc 1 + 6,dc 1 + 1,dc 0 + 9,dc 1 + 4,dc 1 + 7,dc 0 + 2,dc 2 +} + +array set analysissend::rules { + 7,line 32 + 10,line 35 + 4,line 27 + 1,line 24 + 9,line 34 + 6,line 29 + 3,line 26 + 8,line 33 + 5,line 28 + 2,line 25 +} + +array set analysissend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0}} + 1 {{2 0 1}} + 2 {{3 0 1} {7 257 0} {8 257 0} {9 257 0} {10 257 0}} + 3 {{4 0 1}} + 4 {{5 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5} {266 6}} + 5 {{6 0 1}} + 1,trans {{257 7}} + 2,trans {{263 8} {264 9} {265 10} {267 11}} + 6 {{0 0 1}} + 3,trans {} + 7 {{2 0 2}} + 4,trans {} + 8 {{8 257 1}} + 5,trans {} + 10 {{10 257 1}} + 9 {{9 257 1}} + 6,trans {} + 11 {{3 0 2}} + 12 {{3 0 3}} + 7,trans {} + 8,trans {} + 10,trans {} + 9,trans {} + 11,trans {{257 12}} + 12,trans {} +} + +array set analysissend::token_id_table { + 264,line 18 + 265,title YESNO + 261,line 14 + 257,t 0 + 257,line 7 + 262,t 0 + 259,title MESSAGE + 260,title MODE + 266,t 1 + 264,title OKCANCEL + error error + 266,line 23 + 268,title {} + error,line 22 + 258,t 0 + 263,line 17 + error,title {} + 263,t 0 + 259,line 12 + 260,line 13 + 258,title ENTRY + 267,t 1 + 263,title OK + 268,line 36 + 267,title {} + 257 STRING_ + 258 ENTRY_ + 259,t 0 + 259 MESSAGE_ + 260 MODE_ + 260,t 0 + 261 TASK_ + 265,line 19 + 262 LOCK_ + 263 OK_ + 257,title string + 264 OKCANCEL_ + 264,t 0 + 265 YESNO_ + 262,line 15 + 266 analysissend + 267 type + 268,t 1 + 268 start' + 262,title LOCK + 0 {$} + 0,t 0 + error,t 0 + 258,line 11 + 266,title {} + 261,t 0 + 267,line 31 + 265,t 0 + 261,title TASK +} + +proc analysissend::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 { AnalysisSendCmd } + 2 { AnalysisSendCmdEntry $2 } + 3 { AnalysisSendCmdMessage $2 $3 } + 4 { ProcessSendCmdGet ime task } + 5 { AnalysisSendCmdTask } + 6 { ProcessSendCmdGet ime lock } + 7 { set _ ok } + 8 { set _ ok } + 9 { set _ okcancel } + 10 { set _ yesno } + } + 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 analysissend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/arraylex.tcl b/ds9/parsers/arraylex.tcl new file mode 100644 index 0000000..2534c80 --- /dev/null +++ b/ds9/parsers/arraylex.tcl @@ -0,0 +1,319 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval array { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc array::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc array::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc array::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc array::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc array::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc array::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc array::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc array::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc array::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set RGB_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: rgb + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $RGB_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/arrayparser.tab.tcl b/ds9/parsers/arrayparser.tab.tcl new file mode 100644 index 0000000..def5af3 --- /dev/null +++ b/ds9/parsers/arrayparser.tab.tcl @@ -0,0 +1,4 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set RGB_ 260 diff --git a/ds9/parsers/arrayparser.tcl b/ds9/parsers/arrayparser.tcl new file mode 100644 index 0000000..a36909c --- /dev/null +++ b/ds9/parsers/arrayparser.tcl @@ -0,0 +1,346 @@ +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 array { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc array::YYABORT {} { + return -code return 1 +} + +proc array::YYACCEPT {} { + return -code return 0 +} + +proc array::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc array::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc array::yyerror {s} { + puts stderr $s +} + +proc array::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 array::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set array::table { + 6:0 reduce + 0:257 reduce + 6:257,target 9 + 1:257 reduce + 0:258 shift + 8:0 reduce + 5:0,target 1 + 2:257 reduce + 0:260 shift + 0:259 shift + 10:0 reduce + 9:0 reduce + 3:257 shift + 0:261 goto + 2:260 shift + 1:257,target 8 + 0:258,target 1 + 0:262 goto + 0:0,target 6 + 0:263 goto + 10:0,target 5 + 9:0,target 3 + 6:257 shift + 3:257,target 8 + 0:261,target 4 + 7:257 shift + 2:0,target 7 + 0:263,target 6 + 4:0,target 0 + 7:257,target 10 + 0:0 reduce + 6:0,target 2 + 1:0 reduce + 0:257,target 6 + 2:0 reduce + 8:0,target 4 + 2:257,target 7 + 0:260,target 3 + 0:259,target 2 + 4:0 accept + 1:0,target 8 + 5:0 reduce + 2:260,target 7 + 0:262,target 5 +} + +array set array::rules { + 2,l 262 + 6,l 263 + 3,l 262 + 7,l 263 + 0,l 264 + 4,l 262 + 8,l 263 + 1,l 261 + 5,l 262 +} + +array set array::rules { + 5,dc 3 + 0,dc 1 + 8,dc 1 + 3,dc 2 + 6,dc 0 + 1,dc 1 + 4,dc 2 + 7,dc 1 + 2,dc 1 +} + +array set array::rules { + 7,line 30 + 4,line 25 + 1,line 19 + 6,line 29 + 3,line 24 + 8,line 31 + 5,line 26 + 2,line 22 +} + +array set array::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 {0 257} 0} {7 {0 257} 0} {8 {0 257} 0}} + 1 {{8 {0 257} 1}} + 2 {{5 0 1} {7 {0 257} 1}} + 3 {{4 0 1}} + 4 {{0 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5} {263 6}} + 5 {{1 0 1}} + 1,trans {} + 6 {{2 0 1} {3 0 1}} + 2,trans {{260 7}} + 3,trans {{257 8}} + 7 {{5 0 2}} + 4,trans {} + 8 {{4 0 2}} + 10 {{5 0 3}} + 9 {{3 0 2}} + 5,trans {} + 6,trans {{257 9}} + 7,trans {{257 10}} + 8,trans {} + 10,trans {} + 9,trans {} +} + +array set array::token_id_table { + 264,line 32 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 11 + 261,line 18 + error,line 16 + 257 STRING_ + 257,t 0 + 263,line 28 + 258 MASK_ + 258,t 0 + error,title {} + 260,t 0 + 260 RGB_ + 259 NEW_ + 259,t 0 + 261,t 1 + 261 command + 262,t 1 + 262 array + 257,line 7 + 263,t 1 + 263 opts + 264,t 1 + 264 start' + 260,line 13 + 257,title string + 259,line 12 + 258,title MASK + 262,line 21 + 260,title RGB + 259,title NEW + 261,title {} +} + +proc array::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 { + 2 { ArrayCmdLoad {} $1 } + 3 { ArrayCmdLoad $2 $1 } + 4 { RGBArrayCmdLoad $2 } + 5 { CreateRGBFrame; RGBArrayCmdLoad $3 } + 7 { CreateFrame; set _ {} } + 8 { 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 array::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/backuplex.tcl b/ds9/parsers/backuplex.tcl new file mode 100644 index 0000000..acc40a6 --- /dev/null +++ b/ds9/parsers/backuplex.tcl @@ -0,0 +1,286 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval backup { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc backup::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc backup::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc backup::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc backup::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc backup::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc backup::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc backup::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc backup::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc backup::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval $yytext; return $STRING_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/backupparser.tab.tcl b/ds9/parsers/backupparser.tab.tcl new file mode 100644 index 0000000..b7d9526 --- /dev/null +++ b/ds9/parsers/backupparser.tab.tcl @@ -0,0 +1 @@ +set STRING_ 257 diff --git a/ds9/parsers/backupparser.tcl b/ds9/parsers/backupparser.tcl new file mode 100644 index 0000000..9b8aa7b --- /dev/null +++ b/ds9/parsers/backupparser.tcl @@ -0,0 +1,287 @@ +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 backup { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc backup::YYABORT {} { + return -code return 1 +} + +proc backup::YYACCEPT {} { + return -code return 0 +} + +proc backup::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc backup::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc backup::yyerror {s} { + puts stderr $s +} + +proc backup::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 backup::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set backup::table { + 3:0,target 1 + 0:257 shift + 0:258 goto + 1:257 reduce + 5:0,target 3 + 0:260 goto + 3:257 reduce + 4:257 shift + 0:258,target 2 + 1:257,target 4 + 3:259 goto + 3:257,target 2 + 2:0,target 0 + 3:259,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:260,target 3 + 1:0,target 4 + 5:0 reduce + 4:257,target 5 +} + +array set backup::rules { + 0,l 261 + 1,l 258 + 2,l 259 + 3,l 258 + 4,l 260 +} + +array set backup::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set backup::rules { + 2,e 1 + 2,line 14 + 4,line 18 + 1,line 14 + 3,line 15 +} + +array set backup::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0}} + 1 {{4 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 257 0}} + 0,trans {{257 1} {258 2} {260 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{259 4}} + 4,trans {{257 5}} + 5,trans {} +} + +array set backup::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 13 + 261,line 19 + 257 STRING_ + 257,t 0 + error,line 12 + 258,t 1 + 258 command + 260,t 1 + 260 backup + 259,t 1 + 259 @PSEUDO1 + error,title {} + 261,t 1 + 261 start' + 257,line 7 + 260,line 17 + 259,line 14 + 257,title string + 258,title {} + 260,title {} + 259,title {} + 261,title {} +} + +proc backup::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { FileLast backupfbox $1; Backup $1 } + } + 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 backup::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/bglex.tcl b/ds9/parsers/bglex.tcl new file mode 100644 index 0000000..657f29e --- /dev/null +++ b/ds9/parsers/bglex.tcl @@ -0,0 +1,286 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval bg { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc bg::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc bg::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc bg::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc bg::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc bg::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc bg::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc bg::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc bg::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc bg::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval $yytext; return $STRING_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/bgparser.tab.tcl b/ds9/parsers/bgparser.tab.tcl new file mode 100644 index 0000000..b7d9526 --- /dev/null +++ b/ds9/parsers/bgparser.tab.tcl @@ -0,0 +1 @@ +set STRING_ 257 diff --git a/ds9/parsers/bgparser.tcl b/ds9/parsers/bgparser.tcl new file mode 100644 index 0000000..28cdaf8 --- /dev/null +++ b/ds9/parsers/bgparser.tcl @@ -0,0 +1,287 @@ +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 bg { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc bg::YYABORT {} { + return -code return 1 +} + +proc bg::YYACCEPT {} { + return -code return 0 +} + +proc bg::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc bg::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc bg::yyerror {s} { + puts stderr $s +} + +proc bg::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 bg::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set bg::table { + 3:0,target 1 + 0:257 shift + 0:258 goto + 1:257 reduce + 5:0,target 3 + 0:260 goto + 3:257 reduce + 4:257 shift + 0:258,target 2 + 1:257,target 4 + 3:259 goto + 3:257,target 2 + 2:0,target 0 + 3:259,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:260,target 3 + 1:0,target 4 + 5:0 reduce + 4:257,target 5 +} + +array set bg::rules { + 0,l 261 + 1,l 258 + 2,l 259 + 3,l 258 + 4,l 260 +} + +array set bg::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set bg::rules { + 2,e 1 + 2,line 14 + 4,line 18 + 1,line 14 + 3,line 15 +} + +array set bg::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0}} + 1 {{4 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 257 0}} + 0,trans {{257 1} {258 2} {260 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{259 4}} + 4,trans {{257 5}} + 5,trans {} +} + +array set bg::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 13 + 261,line 19 + 257 STRING_ + 257,t 0 + error,line 12 + 258,t 1 + 258 command + 260,t 1 + 260 bg + 259,t 1 + 259 @PSEUDO1 + error,title {} + 261,t 1 + 261 start' + 257,line 7 + 260,line 17 + 259,line 14 + 257,title string + 258,title {} + 260,title {} + 259,title {} + 261,title {} +} + +proc bg::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet pds9 bg $1 PrefsBgColor } + } + 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 bg::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/binlex.tcl b/ds9/parsers/binlex.tcl new file mode 100644 index 0000000..d9baab6 --- /dev/null +++ b/ds9/parsers/binlex.tcl @@ -0,0 +1,602 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval bin { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc bin::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc bin::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc bin::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc bin::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc bin::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc bin::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc bin::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc bin::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc bin::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set ABOUT_ 266 +set AVERAGE_ 267 +set BUFFERSIZE_ 268 +set CENTER_ 269 +set CLEAR_ 270 +set CLOSE_ 271 +set COLS_ 272 +set COLSZ_ 273 +set DEPTH_ 274 +set FACTOR_ 275 +set FILTER_ 276 +set FIT_ 277 +set FUNCTION_ 278 +set IN_ 279 +set LOCK_ 280 +set MATCH_ 281 +set OPEN_ 282 +set OUT_ 283 +set SUM_ 284 +set TO_ 285 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: about + if {[regexp -start $index_ -indices -line -nocase -- {\A(about)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: average + if {[regexp -start $index_ -indices -line -nocase -- {\A(average)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: buffersize + if {[regexp -start $index_ -indices -line -nocase -- {\A(buffersize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: center + if {[regexp -start $index_ -indices -line -nocase -- {\A(center)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: cols + if {[regexp -start $index_ -indices -line -nocase -- {\A(cols)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: colsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(colsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: depth + if {[regexp -start $index_ -indices -line -nocase -- {\A(depth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: factor + if {[regexp -start $index_ -indices -line -nocase -- {\A(factor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: filter + if {[regexp -start $index_ -indices -line -nocase -- {\A(filter)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: fit + if {[regexp -start $index_ -indices -line -nocase -- {\A(fit)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: function + if {[regexp -start $index_ -indices -line -nocase -- {\A(function)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: in + if {[regexp -start $index_ -indices -line -nocase -- {\A(in)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: out + if {[regexp -start $index_ -indices -line -nocase -- {\A(out)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: sum + if {[regexp -start $index_ -indices -line -nocase -- {\A(sum)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: to + if {[regexp -start $index_ -indices -line -nocase -- {\A(to)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ABOUT_ + } + 1 { +return $AVERAGE_ + } + 2 { +return $BUFFERSIZE_ + } + 3 { +return $CENTER_ + } + 4 { +return $CLEAR_ + } + 5 { +return $CLOSE_ + } + 6 { +return $COLS_ + } + 7 { +return $COLSZ_ + } + 8 { +return $DEPTH_ + } + 9 { +return $FACTOR_ + } + 10 { +return $FILTER_ + } + 11 { +return $FIT_ + } + 12 { +return $FUNCTION_ + } + 13 { +return $IN_ + } + 14 { +return $LOCK_ + } + 15 { +return $MATCH_ + } + 16 { +return $OPEN_ + } + 17 { +return $OUT_ + } + 18 { +return $SUM_ + } + 19 { +return $TO_ + } + 20 { +return $YES_ + } + 21 { +return $NO_ + } + 22 { +return $ON_ + } + 23 { +return $OFF_ + } + 24 { +return $TRUE_ + } + 25 { +return $FALSE_ + } + 26 { +set yylval $yytext; return $INT_ + } + 27 - + 28 { +set yylval $yytext; return $REAL_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval $yytext; return $STRING_ + } + 33 { +# ignore whitespace + } + 34 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/binparser.tab.tcl b/ds9/parsers/binparser.tab.tcl new file mode 100644 index 0000000..deb895e --- /dev/null +++ b/ds9/parsers/binparser.tab.tcl @@ -0,0 +1,29 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set ABOUT_ 266 +set AVERAGE_ 267 +set BUFFERSIZE_ 268 +set CENTER_ 269 +set CLEAR_ 270 +set CLOSE_ 271 +set COLS_ 272 +set COLSZ_ 273 +set DEPTH_ 274 +set FACTOR_ 275 +set FILTER_ 276 +set FIT_ 277 +set FUNCTION_ 278 +set IN_ 279 +set LOCK_ 280 +set MATCH_ 281 +set OPEN_ 282 +set OUT_ 283 +set SUM_ 284 +set TO_ 285 diff --git a/ds9/parsers/binparser.tcl b/ds9/parsers/binparser.tcl new file mode 100644 index 0000000..3fa7168 --- /dev/null +++ b/ds9/parsers/binparser.tcl @@ -0,0 +1,1209 @@ +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 bin { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc bin::YYABORT {} { + return -code return 1 +} + +proc bin::YYACCEPT {} { + return -code return 0 +} + +proc bin::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc bin::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc bin::yyerror {s} { + puts stderr $s +} + +proc bin::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 bin::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set bin::table { + 7:264,target 19 + 34:265,target 22 + 1:293 goto + 9:284 shift + 47:265 reduce + 31:y,target 28 + 27:0 reduce + 48:0 reduce + 27:Y,target 30 + 23:265,target 18 + 17:265 reduce + 56:z,target 29 + 56:265 shift + 2:263,target 23 + 0:275,target 7 + 6:263 shift + 9:296 goto + 33:z,target 29 + 4:291,target 31 + 12:265,target 15 + 15:297,target 52 + 57:265,target 39 + 31:292,target 32 + 25:z,target 33 + 26:265 reduce + 24:0 reduce + 11:261,target 47 + 48:0,target 7 + 41:0,target 43 + 30:Z,target 28 + 29:Z,target 34 + 45:0 reduce + 46:265,target 6 + 25:0,target 33 + 35:263 shift + 3:265,target 14 + 17:0,target 10 + 35:264 shift + 10:0,target 25 + 35:265 reduce + 56:x,target 27 + 0:273,target 5 + 35:265,target 38 + 33:x,target 27 + 25:x,target 33 + 17:289 goto + 31:X shift + 11:258,target 44 + 44:265 reduce + 31:Y shift + 42:0 reduce + 31:Z shift + 30:X,target 28 + 29:X,target 34 + 24:265,target 31 + 56:291 goto + 56:292 goto + 5:Y,target 25 + 14:265 reduce + 5:291,target 33 + 13:265,target 13 + 53:265 shift + 27:y,target 30 + 0:271,target 3 + 5:X shift + 35:263,target 18 + 5:Y shift + 5:Z shift + 3:265 reduce + 17:0 reduce + 18:264,target 8 + 35:287 goto + 32:Y,target 29 + 27:X reduce + 27:Y reduce + 24:Y,target 31 + 23:265 reduce + 47:265,target 4 + 38:0 reduce + 27:Z reduce + 4:265,target 30 + 59:0 reduce + 0:290,target 17 + 3:0,target 14 + 30:z,target 28 + 29:z,target 34 + 36:265,target 21 + 32:265 reduce + 0:268,target 2 + 45:0,target 3 + 37:0,target 41 + 26:Z,target 35 + 14:0 reduce + 30:0,target 28 + 29:0,target 34 + 24:X reduce + 25:265,target 33 + 24:Y reduce + 22:0,target 17 + 35:0 reduce + 24:Z reduce + 11:257 shift + 14:0,target 26 + 11:258 shift + 41:265 reduce + 11:259 shift + 11:260 shift + 11:261 shift + 31:x shift + 11:262 shift + 31:y shift + 14:265,target 26 + 59:265,target 20 + 33:292,target 32 + 31:z shift + 30:x,target 28 + 29:x,target 34 + 11:265 reduce + 0:266,target 1 + 5:y,target 28 + 19:264,target 9 + 50:265 reduce + 49:265 reduce + 11:0 reduce + 26:X,target 35 + 48:265,target 7 + 32:0 reduce + 5:265,target 30 + 5:x shift + 19:263 reduce + 0:266 shift + 5:y shift + 19:264 reduce + 5:z shift + 19:265 reduce + 20:265 reduce + 21:287,target 54 + 0:268 shift + 32:y,target 29 + 27:x reduce + 37:265,target 41 + 27:y reduce + 24:y,target 31 + 0:285,target 15 + 0:271 shift + 56:292,target 32 + 27:z reduce + 0:272 shift + 0:273 shift + 0:274 shift + 8:265 shift + 28:Y,target 32 + 0:275 shift + 28:265 reduce + 0:276 shift + 26:265,target 35 + 0:278 shift + 4:Z,target 26 + 8:270 shift + 28:0 reduce + 0:279 shift + 0:280 shift + 11:286 goto + 0:281 shift + 8:295,target 39 + 0:282 shift + 50:0 reduce + 49:0 reduce + 26:z,target 35 + 1:287,target 21 + 0:283 shift + 24:x reduce + 57:0,target 39 + 37:265 reduce + 24:y reduce + 0:285 shift + 50:0,target 45 + 49:0,target 16 + 24:z reduce + 0:283,target 14 + 42:0,target 24 + 31:Z,target 26 + 34:0,target 22 + 0:288 goto + 21:264,target 19 + 26:0,target 35 + 3:0 reduce + 0:290 goto + 18:0,target 8 + 50:265,target 45 + 49:265,target 16 + 11:0,target 1 + 46:265 reduce + 25:0 reduce + 4:X,target 24 + 46:0 reduce + 56:X shift + 38:265,target 40 + 26:x,target 35 + 56:Y shift + 15:263,target 18 + 56:Z shift + 0:281,target 12 + 55:265 reduce + 31:X,target 24 + 1:264,target 19 + 8:295 goto + 27:265,target 30 + 5:265 shift + 25:265 reduce + 6:263,target 34 + 22:0 reduce + 32:X reduce + 32:Y reduce + 28:y,target 32 + 56:Y,target 25 + 43:0 reduce + 32:Z reduce + 4:z,target 29 + 33:Y,target 25 + 25:Y,target 33 + 34:265 reduce + 0:278,target 9 + 8:270,target 38 + 51:265,target 44 + 31:z,target 29 + 18:0 reduce + 28:X reduce + 28:Y reduce + 54:0,target 36 + 43:265 reduce + 40:265,target 42 + 40:0 reduce + 39:265,target 23 + 39:0 reduce + 28:Z reduce + 46:0,target 6 + 38:0,target 40 + 27:Z,target 30 + 4:x,target 27 + 23:0,target 18 + 5:291 goto + 13:265 reduce + 28:265,target 32 + 0:276,target 8 + 5:292 goto + 56:x shift + 56:y shift + 52:265 reduce + 4:292,target 32 + 56:z shift + 2:263 shift + 7:263,target 18 + 31:x,target 27 + 25:X reduce + 11:262,target 48 + 25:Y reduce + 17:265,target 11 + 36:0 reduce + 25:Z reduce + 15:277,target 50 + 22:265 reduce + 57:0 reduce + 35:287,target 57 + 27:X,target 30 + 32:x reduce + 32:y reduce + 56:y,target 28 + 52:265,target 27 + 32:z reduce + 0:274,target 6 + 8:265,target 37 + 31:265 shift + 33:y,target 28 + 31:291,target 55 + 25:y,target 33 + 12:0 reduce + 41:265,target 43 + 11:259,target 45 + 11:260,target 46 + 30:Y,target 28 + 29:Y,target 34 + 54:0 reduce + 40:265 reduce + 39:265 reduce + 28:x reduce + 5:Z,target 26 + 30:265,target 28 + 29:265,target 34 + 28:y reduce + 9:267,target 40 + 28:z reduce + 5:292,target 32 + 27:z,target 30 + 0:272,target 4 + 10:265 reduce + 35:264,target 19 + 58:0,target 12 + 15:294,target 51 + 51:0,target 44 + 48:265 reduce + 18:265,target 8 + 43:0,target 2 + 32:Z,target 29 + 35:0,target 38 + 30:0 reduce + 29:0 reduce + 24:Z,target 31 + 11:257,target 43 + 27:0,target 30 + 18:263 reduce + 18:264 reduce + 19:0,target 9 + 20:0,target 37 + 51:0 reduce + 12:0,target 15 + 18:265 reduce + 25:x reduce + 53:265,target 58 + 31:291 goto + 25:y reduce + 5:X,target 24 + 57:265 reduce + 31:292 goto + 25:z reduce + 7:263 shift + 7:264 shift + 27:x,target 30 + 42:265,target 24 + 27:265 reduce + 18:263,target 8 + 32:X,target 29 + 26:0 reduce + 24:X,target 31 + 1:293,target 22 + 9:284,target 41 + 47:0 reduce + 31:265,target 30 + 0:288,target 16 + 36:265 reduce + 30:y,target 28 + 29:y,target 34 + 5:z,target 29 + 19:265,target 9 + 20:265,target 37 + 26:Y,target 35 + 23:0 reduce + 45:265 reduce + 33:X shift + 33:Y shift + 44:0 reduce + 33:Z shift + 7:287 goto + 54:265,target 36 + 7:294,target 36 + 15:263 shift + 32:z,target 29 + 15:264 shift + 24:z,target 31 + 55:0,target 19 + 33:291,target 56 + 1:269,target 20 + 54:265 reduce + 47:0,target 4 + 7:294 goto + 43:265,target 2 + 40:0,target 42 + 39:0,target 23 + 28:Z,target 32 + 32:0,target 29 + 5:x,target 27 + 19:263,target 9 + 24:0,target 31 + 4:265 shift + 15:287,target 35 + 16:0,target 0 + 19:0 reduce + 20:0 reduce + 30:X reduce + 29:X reduce + 24:265 reduce + 30:Y reduce + 29:Y reduce + 41:0 reduce + 32:265,target 29 + 30:Z reduce + 29:Z reduce + 15:277 shift + 32:x,target 29 + 24:x,target 31 + 56:291,target 59 + 33:265 shift + 4:X shift + 28:X,target 32 + 4:Y shift + 4:Z shift + 15:287 goto + 16:0 accept + 26:X reduce + 4:Y,target 25 + 26:Y reduce + 10:265,target 25 + 55:265,target 19 + 37:0 reduce + 26:Z reduce + 42:265 reduce + 26:y,target 35 + 58:0 reduce + 15:294 goto + 15:264,target 19 + 33:x shift + 33:y shift + 0:282,target 13 + 44:265,target 5 + 33:z shift + 31:Y,target 25 + 4:291 goto + 12:265 reduce + 15:297 goto + 4:292 goto + 21:263,target 18 + 51:265 reduce + 1:263 shift + 13:0 reduce + 1:264 shift + 9:296,target 42 + 33:265,target 30 + 21:263 shift + 34:0 reduce + 28:z,target 32 + 21:264 shift + 56:Z,target 26 + 59:0,target 20 + 55:0 reduce + 52:0,target 27 + 33:291 goto + 1:269 shift + 59:265 reduce + 44:0,target 5 + 33:Z,target 26 + 33:292 goto + 30:x reduce + 29:x reduce + 7:287,target 35 + 36:0,target 21 + 30:y reduce + 29:y reduce + 25:Z,target 33 + 22:265,target 17 + 30:z reduce + 29:z reduce + 28:0,target 32 + 0:279,target 10 + 0:280,target 11 + 11:286,target 49 + 17:289,target 53 + 1:263,target 18 + 13:0,target 13 + 30:265 reduce + 29:265 reduce + 9:267 shift + 10:0 reduce + 11:265,target 1 + 56:265,target 30 + 4:x shift + 28:x,target 32 + 4:y shift + 56:X,target 24 + 4:z shift + 52:0 reduce + 38:265 reduce + 26:x reduce + 4:y,target 28 + 45:265,target 3 + 33:X,target 24 + 26:y reduce + 26:z reduce + 25:X,target 33 + 1:287 goto + 21:287 goto +} + +array set bin::rules { + 9,l 287 + 11,l 289 + 32,l 292 + 6,l 286 + 28,l 291 + 3,l 286 + 25,l 290 + 0,l 298 + 22,l 290 + 43,l 296 + 18,l 290 + 40,l 295 + 39,l 294 + 15,l 290 + 36,l 293 + 12,l 288 + 33,l 292 + 7,l 286 + 29,l 291 + 30,l 292 + 4,l 286 + 26,l 290 + 1,l 286 + 23,l 290 + 44,l 297 + 19,l 290 + 20,l 290 + 41,l 295 + 16,l 290 + 37,l 293 + 13,l 290 + 34,l 292 + 8,l 287 + 10,l 288 + 31,l 292 + 5,l 286 + 27,l 290 + 2,l 286 + 24,l 290 + 45,l 297 + 21,l 290 + 42,l 296 + 17,l 290 + 38,l 294 + 14,l 290 + 35,l 292 +} + +array set bin::rules { + 12,dc 3 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 2 + 33,dc 1 + 9,dc 1 + 11,dc 0 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 2 + 17,dc 2 + 32,dc 1 + 8,dc 1 + 10,dc 1 + 24,dc 2 + 1,dc 0 + 38,dc 1 + 16,dc 2 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 2 + 0,dc 1 + 37,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 2 + 36,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 2 + 35,dc 1 + 13,dc 1 + 27,dc 2 + 4,dc 1 + 42,dc 1 + 19,dc 3 + 20,dc 4 + 34,dc 1 +} + +array set bin::rules { + 41,line 110 + 7,line 62 + 37,line 102 + 4,line 59 + 34,line 97 + 1,line 56 + 31,line 94 + 27,line 86 + 24,line 83 + 21,line 80 + 17,line 76 + 14,line 73 + 11,line 68 + 43,line 114 + 9,line 65 + 40,line 109 + 39,line 106 + 6,line 61 + 36,line 101 + 3,line 58 + 33,line 96 + 29,line 90 + 30,line 93 + 26,line 85 + 23,line 82 + 19,line 78 + 20,line 79 + 16,line 75 + 13,line 72 + 10,line 68 + 45,line 118 + 42,line 113 + 8,line 64 + 38,line 105 + 5,line 60 + 35,line 98 + 2,line 57 + 32,line 95 + 28,line 89 + 25,line 84 + 22,line 81 + 18,line 77 + 15,line 74 + 12,line 69 + 11,e 1 + 44,line 117 +} + +array set bin::lr1_table { + 66,trans {} + 35 {{8 {0 263 264 265} 1}} + 14,trans {} + 36 {{9 {0 263 264 265} 1}} + 33,trans {{X 24} {Y 25} {Z 26} {x 27} {y 28} {z 29} {265 30} {291 68} {292 32}} + 37 {{38 {0 265} 1} {39 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 52,trans {} + 38 {{21 {0 265} 2}} + 71,trans {} + 40 {{40 {0 265} 1}} + 39 {{41 {0 265} 1}} + 18,trans {} + 41 {{23 {0 265} 2}} + 1,trans {{263 18} {264 19} {269 20} {287 21} {293 22}} + 37,trans {{263 56} {264 57} {287 69}} + 42 {{42 {0 265} 1}} + 56,trans {} + 43 {{43 {0 265} 1}} + 44 {{24 {0 265} 2}} + 23,trans {} + 45 {{2 {0 265} 1}} + 5,trans {{X 24} {Y 25} {Z 26} {x 27} {y 28} {z 29} {265 30} {291 33} {292 32}} + 42,trans {} + 46 {{5 {0 265} 1}} + 61,trans {} + 47 {{3 {0 265} 1}} + 48 {{6 {0 265} 1}} + 27,trans {} + 50 {{7 {0 265} 1}} + 49 {{4 {0 265} 1}} + 9,trans {{267 42} {284 43} {296 44}} + 46,trans {} + 51 {{16 {0 265} 2}} + 65,trans {} + 52 {{45 {0 265} 1}} + 53 {{44 {0 265} 1}} + 13,trans {} + 32,trans {} + 54 {{27 {0 265} 2}} + 51,trans {} + 55 {{12 0 2}} + 70,trans {} + 69,trans {} + 56 {{8 {0 265} 1}} + 57 {{9 {0 265} 1}} + 17,trans {{289 55}} + 0,trans {{266 1} {268 2} {271 3} {272 4} {273 5} {274 6} {275 7} {276 8} {278 9} {279 10} {280 11} {281 12} {282 13} {283 14} {285 15} {288 16} {290 17}} + 36,trans {} + 58 {{36 {0 265} 2}} + 55,trans {{265 70}} + 60 {{33 {0 265} 1}} + 59 {{31 {0 265} 1}} + 61 {{35 {0 265} 1}} + 62 {{30 {0 265} 1}} + 22,trans {} + 4,trans {{X 24} {Y 25} {Z 26} {x 27} {y 28} {z 29} {265 30} {291 31} {292 32}} + 41,trans {} + 63 {{32 {0 265} 1}} + 60,trans {} + 59,trans {} + 64 {{34 {0 265} 1}} + 65 {{28 {0 265} 1}} + 66 {{19 {0 265} 3}} + 26,trans {} + 8,trans {{265 39} {270 40} {295 41}} + 45,trans {} + 67 {{29 {0 265} 1}} + 64,trans {} + 68 {{20 {0 265} 3} {28 {0 265} 0} {29 {0 265} 0} {30 {0 265} 0} {31 {0 265} 0} {32 {0 265} 0} {33 {0 265} 0} {34 {0 265} 0} {35 {0 265} 0}} + 70 {{12 0 3}} + 69 {{39 {0 265} 2}} + 12,trans {} + 71 {{20 {0 265} 4}} + 31,trans {{X 59} {Y 60} {Z 61} {x 62} {y 63} {z 64} {265 65} {291 66} {292 67}} + 50,trans {} + 49,trans {} + 68,trans {{X 59} {Y 60} {Z 61} {x 62} {y 63} {z 64} {265 65} {291 71} {292 67}} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {{263 56} {264 57} {287 58}} + 3,trans {} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{25 {0 265} 1}} + 11 {{16 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 25,trans {} + 12 {{15 {0 265} 1}} + 7,trans {{263 35} {264 36} {287 37} {294 38}} + 44,trans {} + 13 {{13 {0 265} 1}} + 63,trans {} + 14 {{26 {0 265} 1}} + 11,trans {{257 45} {258 46} {259 47} {260 48} {261 49} {262 50} {286 51}} + 15 {{27 {0 265} 1} {44 {0 265} 0} {45 {0 265} 0} {38 {0 265} 0} {39 {0 265} 0} {8 {0 263 264 265} 0} {9 {0 263 264 265} 0}} + 30,trans {} + 29,trans {} + 16 {{0 0 1}} + 48,trans {} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {18 {0 265} 0} {19 {0 265} 0} {20 {0 265} 0} {21 {0 265} 0} {22 {0 265} 0} {23 {0 265} 0} {24 {0 265} 0} {25 {0 265} 0} {26 {0 265} 0} {27 {0 265} 0}} + 17 {{10 0 1} {12 0 1} {11 265 0}} + 67,trans {} + 1 {{17 {0 265} 1} {36 {0 265} 0} {37 {0 265} 0} {8 {263 264} 0} {9 {263 264} 0}} + 18 {{8 {263 264} 1}} + 15,trans {{263 35} {264 36} {277 52} {287 37} {294 53} {297 54}} + 2 {{18 {0 265} 1}} + 19 {{9 {263 264} 1}} + 20 {{37 {0 265} 1}} + 34,trans {} + 3 {{14 {0 265} 1}} + 21 {{36 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 53,trans {} + 4 {{19 {0 265} 1} {28 {265 X Y Z x y z} 0} {29 {265 X Y Z x y z} 0} {30 {265 X Y Z x y z} 0} {31 {265 X Y Z x y z} 0} {32 {265 X Y Z x y z} 0} {33 {265 X Y Z x y z} 0} {34 {265 X Y Z x y z} 0} {35 {265 X Y Z x y z} 0}} + 22 {{17 {0 265} 2}} + 5 {{20 {0 265} 1} {28 {265 X Y Z x y z} 0} {29 {265 X Y Z x y z} 0} {30 {265 X Y Z x y z} 0} {31 {265 X Y Z x y z} 0} {32 {265 X Y Z x y z} 0} {33 {265 X Y Z x y z} 0} {34 {265 X Y Z x y z} 0} {35 {265 X Y Z x y z} 0}} + 23 {{18 {0 265} 2}} + 20,trans {} + 19,trans {} + 6 {{22 {0 265} 1}} + 2,trans {{263 23}} + 24 {{31 {265 X Y Z x y z} 1}} + 38,trans {} + 7 {{21 {0 265} 1} {38 {0 265} 0} {39 {0 265} 0} {8 {0 263 264 265} 0} {9 {0 263 264 265} 0}} + 25 {{33 {265 X Y Z x y z} 1}} + 57,trans {} + 8 {{23 {0 265} 1} {40 {0 265} 0} {41 {0 265} 0}} + 26 {{35 {265 X Y Z x y z} 1}} + 9 {{24 {0 265} 1} {42 {0 265} 0} {43 {0 265} 0}} + 27 {{30 {265 X Y Z x y z} 1}} + 24,trans {} + 28 {{32 {265 X Y Z x y z} 1}} + 6,trans {{263 34}} + 43,trans {} + 29 {{34 {265 X Y Z x y z} 1}} + 30 {{28 {265 X Y Z x y z} 1}} + 62,trans {} + 31 {{19 {0 265} 2} {28 {0 265} 0} {29 {0 265} 0} {30 {0 265} 0} {31 {0 265} 0} {32 {0 265} 0} {33 {0 265} 0} {34 {0 265} 0} {35 {0 265} 0}} + 10,trans {} + 32 {{29 {265 X Y Z x y z} 1}} + 28,trans {} + 33 {{20 {0 265} 2} {28 {265 X Y Z x y z} 0} {29 {265 X Y Z x y z} 0} {30 {265 X Y Z x y z} 0} {31 {265 X Y Z x y z} 0} {32 {265 X Y Z x y z} 0} {33 {265 X Y Z x y z} 0} {34 {265 X Y Z x y z} 0} {35 {265 X Y Z x y z} 0}} + 47,trans {} + 34 {{22 {0 265} 2}} +} + +array set bin::token_id_table { + 286 yesno + 286,t 1 + 287 numeric + 292,line 92 + 288 command + 265,title string + 289 @PSEUDO1 + 290 bin + 284,title SUM + 291 cols + 292 colsxyz + 288,line 67 + 293 about + 294 factor + 295 filter + 296 function + 262,t 0 + 297 to + 298 start' + 285,line 40 + 283,t 0 + 282,line 37 + 264,title float + 283,title OUT + 278,line 33 + error,line 54 + 258,t 0 + 275,line 30 + 279,t 0 + 280,t 0 + Z,line 97 + 272,line 27 + 263,title integer + 282,title OPEN + 268,line 23 + 276,t 0 + 265,line 17 + Y,t 0 + 297,t 1 + 262,line 12 + 262,title FALSE + 0 {$} + 0,t 0 + 281,title MATCH + error,t 0 + 258,line 8 + 273,t 0 + 294,t 1 + z,line 96 + 261,title TRUE + 279,title IN + 280,title LOCK + 298,title {} + 269,t 0 + 270,t 0 + 291,t 1 + y,t 0 + 297,line 116 + 266,t 0 + 260,title OFF + 259,title ON + 278,title FUNCTION + 297,title {} + 287,t 1 + 294,line 104 + error,title {} + 291,line 88 + X X + Y Y + Z Z + 263,t 0 + 258,title NO + 287,line 63 + 277,title FIT + 284,t 0 + 296,title {} + 284,line 39 + 281,line 36 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title YES + 277,line 32 + 276,title FILTER + 295,title {} + 274,line 29 + Y,line 95 + 271,line 26 + 277,t 0 + x x + y y + z z + Z,t 0 + 298,t 1 + 267,line 22 + 275,title FACTOR + 294,title {} + 264,line 15 + 261,line 11 + 274,t 0 + 295,t 1 + 257,line 7 + 274,title DEPTH + 293,title {} + 271,t 0 + error error + 292,t 1 + y,line 94 + 273,title COLSZ + z,t 0 + 292,title {} + 267,t 0 + Z,title {} + 288,t 1 + 296,line 112 + 272,title COLS + 291,title {} + 293,line 100 + 264,t 0 + 285,t 0 + 289,line 68 + 290,line 71 + Y,title {} + 286,line 55 + 271,title CLOSE + 261,t 0 + 283,line 38 + 289,title {} + 290,title {} + 282,t 0 + 279,line 34 + 280,line 35 + X,title {} + z,title {} + 276,line 31 + 257,t 0 + 269,title CENTER + 270,title CLEAR + 273,line 28 + 288,title {} + 278,t 0 + X,line 93 + 269,line 24 + 270,line 25 + y,title {} + 266,line 21 + 268,title BUFFERSIZE + 275,t 0 + 263,line 14 + 287,title {} + X,t 0 + 296,t 1 + 260,line 10 + 259,line 9 + x,title {} + 272,t 0 + 267,title AVERAGE + 257 YES_ + 286,title {} + 293,t 1 + 258 NO_ + 260 OFF_ + 259 ON_ + 261 TRUE_ + 262 FALSE_ + 263 INT_ + 264 REAL_ + x,line 92 + 265 STRING_ + 266 ABOUT_ + 267 AVERAGE_ + 268,t 0 + 268 BUFFERSIZE_ + 269 CENTER_ + 270 CLEAR_ + 271 CLOSE_ + 272 COLS_ + 289,t 1 + 290,t 1 + 266,title ABOUT + 273 COLSZ_ + 274 DEPTH_ + 285,title TO + 275 FACTOR_ + 298,line 119 + 276 FILTER_ + 277 FIT_ + x,t 0 + 278 FUNCTION_ + 279 IN_ + 280 LOCK_ + 281 MATCH_ + 282 OPEN_ + 295,line 108 + 265,t 0 + 283 OUT_ + 284 SUM_ + 285 TO_ +} + +proc bin::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { BinDialog } + 14 { BinDestroyDialog } + 15 { MatchBinCurrent } + 16 { ProcessCmdSet bin lock $2 LockBinCurrent } + 18 { ProcessCmdSet bin buffersize $2 ChangeBinBufferSize } + 19 { BinCols \"$2\" \"$3\" \"\" } + 20 { BinCols \"$2\" \"$3\" \"$4\" } + 22 { ProcessCmdSet bin depth $2 ChangeBinDepth } + 23 { BinFilter $2 } + 24 { ProcessCmdSet bin function $2 ChangeBinFunction } + 25 { Bin .5 .5 } + 26 { Bin 2 2 } + 28 { set _ $1 } + 29 { set _ $1 } + 30 { set _ $1 } + 31 { set _ $1 } + 32 { set _ $1 } + 33 { set _ $1 } + 34 { set _ $1 } + 35 { set _ $1 } + 36 { BinAbout $1 $2 } + 37 { BinAboutCenter } + 38 { ProcessCmdSet bin factor "$1 $1" ChangeBinFactor } + 39 { ProcessCmdSet bin factor "$1 $2" ChangeBinFactor } + 40 { set _ {} } + 41 { set _ $1 } + 42 { set _ average } + 43 { set _ sum } + 45 { BinToFit } + } + 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 bin::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/binsendlex.tcl b/ds9/parsers/binsendlex.tcl new file mode 100644 index 0000000..44dbee8 --- /dev/null +++ b/ds9/parsers/binsendlex.tcl @@ -0,0 +1,333 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval binsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc binsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc binsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc binsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc binsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc binsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc binsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc binsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc binsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc binsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set ABOUT_ 257 +set BUFFERSIZE_ 258 +set COLS_ 259 +set DEPTH_ 260 +set FACTOR_ 261 +set FILTER_ 262 +set FUNCTION_ 263 +set LOCK_ 264 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: about + if {[regexp -start $index_ -indices -line -nocase -- {\A(about)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: buffersize + if {[regexp -start $index_ -indices -line -nocase -- {\A(buffersize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: cols + if {[regexp -start $index_ -indices -line -nocase -- {\A(cols)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: depth + if {[regexp -start $index_ -indices -line -nocase -- {\A(depth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: factor + if {[regexp -start $index_ -indices -line -nocase -- {\A(factor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: filter + if {[regexp -start $index_ -indices -line -nocase -- {\A(filter)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: function + if {[regexp -start $index_ -indices -line -nocase -- {\A(function)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ABOUT_ + } + 1 { +return $BUFFERSIZE_ + } + 2 { +return $COLS_ + } + 3 { +return $DEPTH_ + } + 4 { +return $FACTOR_ + } + 5 { +return $FILTER_ + } + 6 { +return $FUNCTION_ + } + 7 { +return $LOCK_ + } + 8 { +# ignore whitespace + } + 9 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/binsendparser.tab.tcl b/ds9/parsers/binsendparser.tab.tcl new file mode 100644 index 0000000..5cddf61 --- /dev/null +++ b/ds9/parsers/binsendparser.tab.tcl @@ -0,0 +1,8 @@ +set ABOUT_ 257 +set BUFFERSIZE_ 258 +set COLS_ 259 +set DEPTH_ 260 +set FACTOR_ 261 +set FILTER_ 262 +set FUNCTION_ 263 +set LOCK_ 264 diff --git a/ds9/parsers/binsendparser.tcl b/ds9/parsers/binsendparser.tcl new file mode 100644 index 0000000..26bd866 --- /dev/null +++ b/ds9/parsers/binsendparser.tcl @@ -0,0 +1,346 @@ +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 binsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc binsend::YYABORT {} { + return -code return 1 +} + +proc binsend::YYACCEPT {} { + return -code return 0 +} + +proc binsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc binsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc binsend::yyerror {s} { + puts stderr $s +} + +proc binsend::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 binsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set binsend::table { + 6:0 reduce + 3:0,target 4 + 0:257 shift + 7:0 reduce + 0:264,target 8 + 0:258 shift + 8:0 reduce + 5:0,target 5 + 0:260 shift + 0:259 shift + 9:0 accept + 0:261 shift + 7:0,target 8 + 0:262 shift + 0:258,target 2 + 0:263 shift + 9:0,target 0 + 0:261,target 5 + 0:264 shift + 2:0,target 3 + 0:265 goto + 0:263,target 7 + 4:0,target 6 + 0:265,target 9 + 6:0,target 7 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 8:0,target 1 + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 reduce + 1:0,target 2 + 5:0 reduce + 0:262,target 6 +} + +array set binsend::rules { + 2,l 265 + 6,l 265 + 3,l 265 + 7,l 265 + 0,l 266 + 4,l 265 + 8,l 265 + 1,l 265 + 5,l 265 +} + +array set binsend::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 6,dc 1 + 1,dc 1 + 4,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set binsend::rules { + 7,line 26 + 4,line 23 + 1,line 20 + 6,line 25 + 3,line 22 + 8,line 27 + 5,line 24 + 2,line 21 +} + +array set binsend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0}} + 1 {{2 0 1}} + 2 {{3 0 1}} + 3 {{4 0 1}} + 4 {{6 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9}} + 5 {{5 0 1}} + 1,trans {} + 2,trans {} + 6 {{7 0 1}} + 3,trans {} + 7 {{8 0 1}} + 4,trans {} + 8 {{1 0 1}} + 5,trans {} + 9 {{0 0 1}} + 6,trans {} + 7,trans {} + 8,trans {} + 9,trans {} +} + +array set binsend::token_id_table { + 0,t 0 + 0 {$} + 264,line 15 + 262,title FILTER + 263,title FUNCTION + 266,line 28 + error,t 0 + error error + 264,title LOCK + 265,title {} + 258,line 9 + 266,title {} + 261,line 12 + error,line 18 + 257 ABOUT_ + 257,t 0 + 263,line 14 + 258 BUFFERSIZE_ + 258,t 0 + error,title {} + 260,t 0 + 260 DEPTH_ + 259 COLS_ + 259,t 0 + 265,line 19 + 261,t 0 + 261 FACTOR_ + 262,t 0 + 262 FILTER_ + 257,line 8 + 263,t 0 + 263 FUNCTION_ + 264,t 0 + 264 LOCK_ + 260,line 11 + 257,title ABOUT + 259,line 10 + 265,t 1 + 265 binsend + 258,title BUFFERSIZE + 266,t 1 + 266 start' + 262,line 13 + 260,title DEPTH + 259,title COLS + 261,title FACTOR +} + +proc binsend::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 { ProcessSendCmdYesNo bin lock } + 2 { ProcessSendCmdCurrent "get bin cursor" } + 3 { ProcessSendCmdGet bin buffersize } + 4 { ProcessSendCmdCurrent "get bin cols" } + 5 { ProcessSendCmdGet bin factor } + 6 { ProcessSendCmdGet bin depth } + 7 { ProcessSendCmdCurrent "get bin filter" } + 8 { ProcessSendCmdGet bin function } + } + 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 binsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/blinklex.tcl b/ds9/parsers/blinklex.tcl new file mode 100644 index 0000000..40f53bb --- /dev/null +++ b/ds9/parsers/blinklex.tcl @@ -0,0 +1,393 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval blink { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc blink::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc blink::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc blink::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc blink::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc blink::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc blink::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc blink::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc blink::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc blink::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set INTERVAL_ 266 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: interval + if {[regexp -start $index_ -indices -line -nocase -- {\A(interval)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $INTERVAL_ + } + 1 { +return $YES_ + } + 2 { +return $NO_ + } + 3 { +return $ON_ + } + 4 { +return $OFF_ + } + 5 { +return $TRUE_ + } + 6 { +return $FALSE_ + } + 7 { +set yylval $yytext; return $INT_ + } + 8 - + 9 { +set yylval $yytext; return $REAL_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 12 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 13 { +set yylval $yytext; return $STRING_ + } + 14 { +# ignore whitespace + } + 15 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/blinkparser.tab.tcl b/ds9/parsers/blinkparser.tab.tcl new file mode 100644 index 0000000..5a42616 --- /dev/null +++ b/ds9/parsers/blinkparser.tab.tcl @@ -0,0 +1,10 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set INTERVAL_ 266 diff --git a/ds9/parsers/blinkparser.tcl b/ds9/parsers/blinkparser.tcl new file mode 100644 index 0000000..5bbba41 --- /dev/null +++ b/ds9/parsers/blinkparser.tcl @@ -0,0 +1,467 @@ +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 blink { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc blink::YYABORT {} { + return -code return 1 +} + +proc blink::YYACCEPT {} { + return -code return 0 +} + +proc blink::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc blink::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc blink::yyerror {s} { + puts stderr $s +} + +proc blink::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 blink::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set blink::table { + 7:264,target 13 + 0:257 shift + 11:265 reduce + 0:258 shift + 0:259 shift + 0:260 shift + 5:0,target 3 + 13:265 reduce + 9:0 reduce + 0:266,target 7 + 0:261 shift + 11:0 reduce + 0:262 shift + 15:265 shift + 11:271 goto + 7:263,target 12 + 0:265 reduce + 5:265,target 3 + 0:266 shift + 0:267 goto + 2:265 reduce + 0:268 goto + 0:265,target 12 + 6:0,target 6 + 0:270 goto + 4:265 reduce + 16:0,target 11 + 2:0 reduce + 12:265,target 7 + 6:265 reduce + 0:272 goto + 8:265 reduce + 6:0 reduce + 11:271,target 15 + 8:265,target 13 + 12:0 reduce + 0:0,target 12 + 3:265,target 2 + 10:0,target 0 + 15:265,target 16 + 16:0 reduce + 8:0,target 13 + 7:269,target 14 + 3:0 reduce + 1:0,target 1 + 11:0,target 9 + 0:262,target 6 + 6:265,target 6 + 0:272,target 11 + 12:265 reduce + 1:265,target 1 + 14:265 reduce + 13:265,target 8 + 13:0 reduce + 9:0,target 14 + 0:261,target 5 + 2:0,target 4 + 12:0,target 7 + 1:265 reduce + 0:0 reduce + 3:265 reduce + 9:265,target 14 + 7:263 shift + 5:265 reduce + 7:264 shift + 0:259,target 3 + 0:260,target 4 + 0:270,target 10 + 4:0 reduce + 4:265,target 5 + 9:265 reduce + 3:0,target 2 + 13:0,target 8 + 8:0 reduce + 7:269 goto + 10:0 accept + 11:265,target 10 + 0:258,target 2 + 0:268,target 9 + 14:0 reduce + 4:0,target 5 + 14:0,target 15 + 0:257,target 1 + 1:0 reduce + 0:267,target 8 + 2:265,target 4 + 14:265,target 15 + 5:0 reduce +} + +array set blink::rules { + 9,l 270 + 11,l 270 + 15,l 272 + 2,l 267 + 6,l 268 + 12,l 272 + 3,l 267 + 7,l 269 + 13,l 272 + 0,l 273 + 4,l 268 + 8,l 269 + 10,l 271 + 14,l 272 + 1,l 267 + 5,l 268 +} + +array set blink::rules { + 5,dc 1 + 0,dc 1 + 12,dc 0 + 8,dc 1 + 3,dc 1 + 15,dc 2 + 10,dc 0 + 6,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 1 + 4,dc 1 + 11,dc 3 + 7,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set blink::rules { + 13,line 56 + 7,line 47 + 10,line 51 + 4,line 43 + 1,line 38 + 15,line 58 + 9,line 51 + 12,line 55 + 6,line 45 + 3,line 40 + 14,line 57 + 10,e 1 + 8,line 48 + 11,line 52 + 5,line 44 + 2,line 39 +} + +array set blink::lr1_table { + 13,trans {} + 0 {{0 0 0} {9 0 0} {11 0 0} {12 {0 265} 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0}} + 14,trans {} + 1 {{1 {0 265} 1}} + 15,trans {{265 16}} + 2 {{4 {0 265} 1}} + 16,trans {} + 3 {{2 {0 265} 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {266 7} {267 8} {268 9} {270 10} {272 11}} + 4 {{5 {0 265} 1}} + 1,trans {} + 5 {{3 {0 265} 1}} + 2,trans {} + 6 {{6 {0 265} 1}} + 3,trans {} + 7 {{15 {0 265} 1} {7 {0 265} 0} {8 {0 265} 0}} + 4,trans {} + 8 {{13 {0 265} 1}} + 5,trans {} + 9 {{14 {0 265} 1}} + 10 {{0 0 1}} + 6,trans {} + 11 {{9 0 1} {11 0 1} {10 265 0}} + 7,trans {{263 12} {264 13} {269 14}} + 12 {{7 {0 265} 1}} + 8,trans {} + 13 {{8 {0 265} 1}} + 10,trans {} + 9,trans {} + 14 {{15 {0 265} 2}} + 11,trans {{271 15}} + 15 {{11 0 2}} + 16 {{11 0 3}} + 12,trans {} +} + +array set blink::token_id_table { + 264,line 15 + 270,t 1 + 269,t 1 + 265,title string + 261,line 11 + 257,t 0 + 270,title {} + 269,title {} + 273,line 59 + 257,line 7 + 262,t 0 + 270,line 50 + 269,line 46 + 259,title ON + 260,title OFF + 266,t 0 + 271,t 1 + 264,title float + 266,line 21 + error error + 268,title {} + error,line 36 + 258,t 0 + 263,line 14 + error,title {} + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 272,line 54 + 267,t 1 + 263,title integer + 272,t 1 + 268,line 42 + 267,title {} + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title {} + 261 TRUE_ + 265,line 17 + 262 FALSE_ + 263 INT_ + 257,title YES + 264 REAL_ + 264,t 0 + 265 STRING_ + 262,line 12 + 266 INTERVAL_ + 267 yes + 268,t 1 + 268 no + 262,title FALSE + 0 {$} + 0,t 0 + 270 command + 269 numeric + 271 @PSEUDO1 + error,t 0 + 272 blink + 258,line 8 + 273,t 1 + 273 start' + 266,title INTERVAL + 271,line 51 + 271,title {} + 261,t 0 + 267,line 37 + 265,t 0 + 261,title TRUE +} + +proc blink::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 0 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ $1 } + 8 { set _ $1 } + 10 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 12 { ProcessCmdSet current display blink DisplayMode } + 13 { ProcessCmdSet current display blink DisplayMode } + 14 { ProcessCmdSet current display single DisplayMode } + 15 { ProcessCmdSet blink interval [expr int($2*1000)] DisplayMode } + } + 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 blink::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/blinksendlex.tcl b/ds9/parsers/blinksendlex.tcl new file mode 100644 index 0000000..068a476 --- /dev/null +++ b/ds9/parsers/blinksendlex.tcl @@ -0,0 +1,236 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval blinksend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc blinksend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc blinksend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc blinksend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc blinksend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc blinksend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc blinksend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc blinksend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc blinksend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc blinksend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INTERVAL_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: interval + if {[regexp -start $index_ -indices -line -nocase -- {\A(interval)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $INTERVAL_ + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/blinksendparser.tab.tcl b/ds9/parsers/blinksendparser.tab.tcl new file mode 100644 index 0000000..1293b70 --- /dev/null +++ b/ds9/parsers/blinksendparser.tab.tcl @@ -0,0 +1 @@ +set INTERVAL_ 257 diff --git a/ds9/parsers/blinksendparser.tcl b/ds9/parsers/blinksendparser.tcl new file mode 100644 index 0000000..2646f92 --- /dev/null +++ b/ds9/parsers/blinksendparser.tcl @@ -0,0 +1,254 @@ +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 blinksend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc blinksend::YYABORT {} { + return -code return 1 +} + +proc blinksend::YYACCEPT {} { + return -code return 0 +} + +proc blinksend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc blinksend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc blinksend::yyerror {s} { + puts stderr $s +} + +proc blinksend::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 blinksend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set blinksend::table { + 2:0 accept + 0:257 shift + 0:258,target 2 + 0:0,target 1 + 0:258 goto + 1:0,target 2 + 0:0 reduce + 2:0,target 0 + 1:0 reduce + 0:257,target 1 +} + +array set blinksend::rules { + 0,l 259 + 1,l 258 + 2,l 258 +} + +array set blinksend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 0 +} + +array set blinksend::rules { + 2,line 14 + 1,line 13 +} + +array set blinksend::lr1_table { + 0,trans {{257 1} {258 2}} + 0 {{0 0 0} {1 0 0} {2 0 0}} + 1,trans {} + 1 {{2 0 1}} + 2,trans {} + 2 {{0 0 1}} +} + +array set blinksend::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 12 + 257 INTERVAL_ + 257,t 0 + error,line 11 + 258,t 1 + 258 blinksend + 259,t 1 + 259 start' + error,title {} + 257,line 8 + 259,line 15 + 257,title INTERVAL + 258,title {} + 259,title {} +} + +proc blinksend::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 { BlinkSendCmd } + 2 { BlinkSendCmdInterval } + } + 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 blinksend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/blocklex.tcl b/ds9/parsers/blocklex.tcl new file mode 100644 index 0000000..37003c1 --- /dev/null +++ b/ds9/parsers/blocklex.tcl @@ -0,0 +1,470 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval block { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc block::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc block::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc block::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc block::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc block::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc block::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc block::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc block::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc block::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set CLOSE_ 266 +set FIT_ 267 +set IN_ 268 +set LOCK_ 269 +set MATCH_ 270 +set OPEN_ 271 +set OUT_ 272 +set TO_ 273 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: fit + if {[regexp -start $index_ -indices -line -nocase -- {\A(fit)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: in + if {[regexp -start $index_ -indices -line -nocase -- {\A(in)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: out + if {[regexp -start $index_ -indices -line -nocase -- {\A(out)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: to + if {[regexp -start $index_ -indices -line -nocase -- {\A(to)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $FIT_ + } + 2 { +return $IN_ + } + 3 { +return $LOCK_ + } + 4 { +return $MATCH_ + } + 5 { +return $OPEN_ + } + 6 { +return $OUT_ + } + 7 { +return $TO_ + } + 8 { +return $YES_ + } + 9 { +return $NO_ + } + 10 { +return $ON_ + } + 11 { +return $OFF_ + } + 12 { +return $TRUE_ + } + 13 { +return $FALSE_ + } + 14 { +set yylval $yytext; return $INT_ + } + 15 - + 16 { +set yylval $yytext; return $REAL_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 20 { +set yylval $yytext; return $STRING_ + } + 21 { +# ignore whitespace + } + 22 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/blockparser.tab.tcl b/ds9/parsers/blockparser.tab.tcl new file mode 100644 index 0000000..b989f13 --- /dev/null +++ b/ds9/parsers/blockparser.tab.tcl @@ -0,0 +1,17 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set CLOSE_ 266 +set FIT_ 267 +set IN_ 268 +set LOCK_ 269 +set MATCH_ 270 +set OPEN_ 271 +set OUT_ 272 +set TO_ 273 diff --git a/ds9/parsers/blockparser.tcl b/ds9/parsers/blockparser.tcl new file mode 100644 index 0000000..34ab6a6 --- /dev/null +++ b/ds9/parsers/blockparser.tcl @@ -0,0 +1,630 @@ +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 block { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc block::YYABORT {} { + return -code return 1 +} + +proc block::YYACCEPT {} { + return -code return 0 +} + +proc block::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc block::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc block::yyerror {s} { + puts stderr $s +} + +proc block::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 block::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set block::table { + 12:277,target 24 + 23:0,target 21 + 5:0,target 1 + 15:0,target 3 + 13:265 reduce + 0:266,target 3 + 2:264,target 9 + 11:0 accept + 0:276,target 11 + 15:265 reduce + 0:263 shift + 0:264 shift + 23:265,target 21 + 17:265 reduce + 5:265,target 1 + 2:263 reduce + 15:0 reduce + 0:266 shift + 2:264 reduce + 20:265 reduce + 19:265 reduce + 2:265 reduce + 17:265,target 4 + 0:268 shift + 2:263,target 9 + 22:265 reduce + 6:0,target 15 + 0:269 shift + 0:270 shift + 0:275,target 10 + 4:265 reduce + 20:0 reduce + 19:0 reduce + 16:0,target 6 + 0:271 shift + 2:0 reduce + 24:265 shift + 12:265,target 11 + 6:265 reduce + 0:272 shift + 0:273 shift + 8:265 reduce + 5:274,target 19 + 9:279,target 22 + 6:0 reduce + 0:275 goto + 0:276 goto + 0:264,target 2 + 8:265,target 18 + 0:278 goto + 25:0,target 23 + 7:0,target 13 + 21:265,target 22 + 17:0,target 4 + 12:0 reduce + 3:265,target 14 + 21:275,target 25 + 10:0,target 20 + 15:265,target 3 + 0:263,target 1 + 16:0 reduce + 0:273,target 9 + 10:265,target 20 + 21:264,target 2 + 10:275,target 23 + 5:262,target 18 + 26:0,target 12 + 21:0 reduce + 9:267,target 20 + 8:0,target 18 + 3:0 reduce + 18:0,target 7 + 10:263 shift + 1:0,target 8 + 11:0,target 0 + 10:264 shift + 24:265,target 26 + 10:265 reduce + 6:265,target 15 + 0:272,target 8 + 25:0 reduce + 7:0 reduce + 12:265 reduce + 10:264,target 2 + 21:263,target 1 + 18:265,target 7 + 5:261,target 17 + 1:265,target 8 + 14:265 reduce + 5:257 shift + 16:265 reduce + 13:265,target 2 + 13:0 reduce + 5:258 shift + 1:263 reduce + 20:0,target 24 + 19:0,target 16 + 5:260 shift + 5:259 shift + 0:271,target 7 + 1:264 reduce + 2:0,target 9 + 21:263 shift + 18:265 reduce + 12:0,target 10 + 5:261 shift + 1:265 reduce + 21:264 shift + 10:263,target 1 + 10:275 goto + 5:262 shift + 21:265 reduce + 17:0 reduce + 5:260,target 16 + 5:259,target 15 + 1:264,target 8 + 3:265 reduce + 23:265 reduce + 9:275,target 21 + 5:265 reduce + 12:277 goto + 25:265 reduce + 22:265,target 19 + 22:0 reduce + 9:263 shift + 7:265 reduce + 4:265,target 17 + 0:270,target 6 + 0:269,target 5 + 4:0 reduce + 9:264 shift + 21:0,target 22 + 3:0,target 14 + 16:265,target 6 + 13:0,target 2 + 5:258,target 14 + 1:263,target 8 + 26:0 reduce + 9:264,target 2 + 9:267 shift + 8:0 reduce + 21:275 goto + 10:0 reduce + 5:274 goto + 0:268,target 4 + 0:278,target 12 + 14:0 reduce + 5:257,target 13 + 25:265,target 23 + 22:0,target 19 + 9:263,target 1 + 9:275 goto + 7:265,target 13 + 4:0,target 17 + 14:0,target 5 + 18:0 reduce + 1:0 reduce + 20:265,target 24 + 19:265,target 16 + 2:265,target 9 + 9:279 goto + 23:0 reduce + 14:265,target 5 + 5:0 reduce +} + +array set block::rules { + 9,l 275 + 11,l 277 + 15,l 278 + 20,l 278 + 19,l 278 + 2,l 274 + 24,l 279 + 6,l 274 + 12,l 276 + 16,l 278 + 21,l 278 + 3,l 274 + 7,l 274 + 13,l 278 + 0,l 280 + 17,l 278 + 22,l 279 + 4,l 274 + 8,l 275 + 10,l 276 + 14,l 278 + 18,l 278 + 1,l 274 + 23,l 279 + 5,l 274 +} + +array set block::rules { + 23,dc 2 + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 3 + 8,dc 1 + 21,dc 2 + 3,dc 1 + 15,dc 1 + 10,dc 1 + 24,dc 1 + 6,dc 1 + 18,dc 1 + 1,dc 0 + 13,dc 1 + 9,dc 1 + 22,dc 1 + 4,dc 1 + 16,dc 2 + 11,dc 0 + 7,dc 1 + 20,dc 1 + 19,dc 2 + 2,dc 1 + 14,dc 1 +} + +array set block::rules { + 13,line 60 + 7,line 50 + 10,line 56 + 22,line 71 + 4,line 47 + 18,line 65 + 1,line 44 + 15,line 62 + 9,line 53 + 12,line 57 + 24,line 73 + 6,line 49 + 21,line 68 + 3,line 46 + 17,line 64 + 14,line 61 + 8,line 52 + 11,line 56 + 23,line 72 + 5,line 48 + 20,line 67 + 19,line 66 + 2,line 45 + 16,line 63 + 11,e 1 +} + +array set block::lr1_table { + 14,trans {} + 1,trans {} + 18,trans {} + 23,trans {} + 5,trans {{257 13} {258 14} {259 15} {260 16} {261 17} {262 18} {274 19}} + 27,trans {} + 9,trans {{263 1} {264 2} {267 20} {275 21} {279 22}} + 13,trans {} + 0,trans {{263 1} {264 2} {266 3} {268 4} {269 5} {270 6} {271 7} {272 8} {273 9} {275 10} {276 11} {278 12}} + 17,trans {} + 22,trans {} + 4,trans {} + 26,trans {{265 28}} + 8,trans {} + 12,trans {{277 26}} + 16,trans {} + 21,trans {{263 23} {264 24} {275 27}} + 3,trans {} + 10 {{20 {0 265} 1} {21 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 11 {{0 0 1}} + 25,trans {} + 12 {{10 0 1} {12 0 1} {11 265 0}} + 7,trans {} + 13 {{2 {0 265} 1}} + 14 {{5 {0 265} 1}} + 15 {{3 {0 265} 1}} + 11,trans {} + 16 {{6 {0 265} 1}} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {18 {0 265} 0} {19 {0 265} 0} {20 {0 265} 0} {21 {0 265} 0} {8 {0 263 264 265} 0} {9 {0 263 264 265} 0}} + 17 {{4 {0 265} 1}} + 1 {{8 {0 263 264 265} 1}} + 18 {{7 {0 265} 1}} + 2 {{9 {0 263 264 265} 1}} + 19 {{16 {0 265} 2}} + 20 {{24 {0 265} 1}} + 15,trans {} + 3 {{14 {0 265} 1}} + 21 {{22 {0 265} 1} {23 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 4 {{17 {0 265} 1}} + 22 {{19 {0 265} 2}} + 5 {{16 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 23 {{8 {0 265} 1}} + 6 {{15 {0 265} 1}} + 2,trans {} + 24 {{9 {0 265} 1}} + 19,trans {} + 20,trans {} + 7 {{13 {0 265} 1}} + 25 {{21 {0 265} 2}} + 8 {{18 {0 265} 1}} + 26 {{12 0 2}} + 27 {{23 {0 265} 2}} + 9 {{19 {0 265} 1} {22 {0 265} 0} {23 {0 265} 0} {24 {0 265} 0} {8 {0 263 264 265} 0} {9 {0 263 264 265} 0}} + 28 {{12 0 3}} + 24,trans {} + 6,trans {} + 10,trans {{263 23} {264 24} {275 25}} + 28,trans {} +} + +array set block::token_id_table { + 280,title {} + 279,title {} + 264,line 15 + 270,t 0 + 269,t 0 + 276,line 55 + 265,title string + 274,t 1 + 261,line 11 + 257,t 0 + 270,title MATCH + 269,title LOCK + 273,line 28 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 278,title {} + error error + 271,t 0 + 264,title float + 266,line 21 + 278,line 59 + 275,t 1 + error,line 42 + 268,title IN + 258,t 0 + 263,line 14 + error,title {} + 280,t 1 + 279,t 1 + 275,line 51 + 273,title TO + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 277,title {} + 272,line 27 + 267,t 0 + 263,title integer + 272,t 0 + 268,line 23 + 267,title FIT + 257 YES_ + 276,t 1 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title OUT + 261 TRUE_ + 265,line 17 + 262 FALSE_ + 263 INT_ + 277,line 56 + 257,title YES + 264 REAL_ + 264,t 0 + 276,title {} + 265 STRING_ + 262,line 12 + 266 CLOSE_ + 267 FIT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 IN_ + 268,t 0 + 274,line 43 + 270 MATCH_ + 269 LOCK_ + error,t 0 + 271 OPEN_ + 272 OUT_ + 258,line 8 + 273,t 0 + 273 TO_ + 266,title CLOSE + 274 yesno + 275 numeric + 271,line 26 + 276 command + 277,t 1 + 277 @PSEUDO1 + 271,title OPEN + 278 block + 261,t 0 + 280 start' + 279 blockTo + 267,line 22 + 275,title {} + 265,t 0 + 280,line 74 + 279,line 70 + 261,title TRUE +} + +proc block::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { BlockDialog } + 14 { BlockDestroyDialog } + 15 { MatchBlockCurrent } + 16 { ProcessCmdSet block lock $2 LockBlockCurrent } + 17 { Block .5 .5 } + 18 { Block 2 2 } + 20 { Block $1 $1 } + 21 { Block $1 $2 } + 22 { ProcessCmdSet block factor "$1 $1" ChangeBlock } + 23 { ProcessCmdSet block factor "$1 $2" ChangeBlock } + 24 { BlockToFit } + } + 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 block::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/blocksendlex.tcl b/ds9/parsers/blocksendlex.tcl new file mode 100644 index 0000000..f5fa205 --- /dev/null +++ b/ds9/parsers/blocksendlex.tcl @@ -0,0 +1,256 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval blocksend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc blocksend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc blocksend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc blocksend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc blocksend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc blocksend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc blocksend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc blocksend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc blocksend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc blocksend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set LOCK_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $LOCK_ + } + 1 { +# ignore whitespace + } + 2 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/blocksendparser.tab.tcl b/ds9/parsers/blocksendparser.tab.tcl new file mode 100644 index 0000000..a363650 --- /dev/null +++ b/ds9/parsers/blocksendparser.tab.tcl @@ -0,0 +1 @@ +set LOCK_ 257 diff --git a/ds9/parsers/blocksendparser.tcl b/ds9/parsers/blocksendparser.tcl new file mode 100644 index 0000000..54c37c2 --- /dev/null +++ b/ds9/parsers/blocksendparser.tcl @@ -0,0 +1,254 @@ +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 blocksend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc blocksend::YYABORT {} { + return -code return 1 +} + +proc blocksend::YYACCEPT {} { + return -code return 0 +} + +proc blocksend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc blocksend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc blocksend::yyerror {s} { + puts stderr $s +} + +proc blocksend::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 blocksend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set blocksend::table { + 2:0 accept + 0:257 shift + 0:258,target 2 + 0:0,target 1 + 0:258 goto + 1:0,target 2 + 0:0 reduce + 2:0,target 0 + 1:0 reduce + 0:257,target 1 +} + +array set blocksend::rules { + 0,l 259 + 1,l 258 + 2,l 258 +} + +array set blocksend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 0 +} + +array set blocksend::rules { + 2,line 14 + 1,line 13 +} + +array set blocksend::lr1_table { + 0,trans {{257 1} {258 2}} + 0 {{0 0 0} {1 0 0} {2 0 0}} + 1,trans {} + 1 {{2 0 1}} + 2,trans {} + 2 {{0 0 1}} +} + +array set blocksend::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 12 + 257 LOCK_ + 257,t 0 + error,line 11 + 258,t 1 + 258 blocksend + 259,t 1 + 259 start' + error,title {} + 257,line 8 + 259,line 15 + 257,title LOCK + 258,title {} + 259,title {} +} + +proc blocksend::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 { BlockSendCmd } + 2 { ProcessSendCmdYesNo block lock } + } + 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 blocksend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/catlex.tcl b/ds9/parsers/catlex.tcl new file mode 100644 index 0000000..5c4bd0f --- /dev/null +++ b/ds9/parsers/catlex.tcl @@ -0,0 +1,1897 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cat { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cat::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cat::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cat::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cat::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cat::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cat::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cat::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cat::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cat::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set WCS_ 275 +set WCSA_ 276 +set WCSB_ 277 +set WCSC_ 278 +set WCSD_ 279 +set WCSE_ 280 +set WCSF_ 281 +set WCSG_ 282 +set WCSH_ 283 +set WCSI_ 284 +set WCSJ_ 285 +set WCSK_ 286 +set WCSL_ 287 +set WCSM_ 288 +set WCSN_ 289 +set WCSO_ 290 +set WCSP_ 291 +set WCSQ_ 292 +set WCSR_ 293 +set WCSS_ 294 +set WCST_ 295 +set WCSU_ 296 +set WCSV_ 297 +set WCSW_ 298 +set WCSX_ 299 +set WCSY_ 300 +set WCSZ_ 301 +set FK4_ 302 +set B1950_ 303 +set FK5_ 304 +set J2000_ 305 +set ICRS_ 306 +set GALACTIC_ 307 +set ECLIPTIC_ 308 +set DEGREES_ 309 +set ARCMIN_ 310 +set ARCSEC_ 311 +set SEXAGESIMAL_ 312 +set INT_ 313 +set REAL_ 314 +set SEXSTR_ 315 +set STRING_ 316 +set 1AND2_ 317 +set 1NOT2_ 318 +set 1ONLY_ 319 +set 2NOT1_ 320 +set 2ONLY_ 321 +set ADD_ 322 +set ALLCOLS_ 323 +set ALLROWS_ 324 +set ANGLE_ 325 +set ARROW_ 326 +set BOX_ 327 +set BOXCIRCLE_ 328 +set BROADCAST_ 329 +set CANCEL_ 330 +set CDS_ 331 +set CIRCLE_ 332 +set CLEAR_ 333 +set CLOSE_ 334 +set COLOR_ 335 +set CONDITION_ 336 +set COORDINATE_ 337 +set CROSS_ 338 +set CROSSHAIR_ 339 +set CSV_ 340 +set DEC_ 341 +set DECR_ 342 +set DIAMOND_ 343 +set EDIT_ 344 +set ELLIPSE_ 345 +set EXPORT_ 346 +set ERROR_ 347 +set FILE_ 348 +set FILTER_ 349 +set FUNCTION_ 350 +set HEADER_ 351 +set HIDE_ 352 +set IMPORT_ 353 +set INCR_ 354 +set LOAD_ 355 +set LOCATION_ 356 +set MATCH_ 357 +set MAXROWS_ 358 +set NAME_ 359 +set NEW_ 360 +set PANTO_ 361 +set PLOT_ 362 +set POINT_ 363 +set PRINT_ 364 +set PSKY_ 365 +set PSYSTEM_ 366 +set RA_ 367 +set RADIUS_ 368 +set REGIONS_ 369 +set REMOVE_ 370 +set RETRIEVE_ 371 +set RETURN_ 372 +set SAMP_ 373 +set SAVE_ 374 +set SB_ 375 +set SEND_ 376 +set SERVER_ 377 +set SHAPE_ 378 +set SHOW_ 379 +set SIZE_ 380 +set SIZE2_ 381 +set SKY_ 382 +set SKYFORMAT_ 383 +set SORT_ 384 +set STARBASE_ 385 +set SYMBOL_ 386 +set SYSTEM_ 387 +set TEXT_ 388 +set TSV_ 389 +set UNIQUE_ 390 +set UNITS_ 391 +set UPDATE_ 392 +set VOT_ 393 +set XML_ 394 +set ADAC_ 395 +set CADC_ 396 +set CAMBRIDGE_ 397 +set SAO_ 398 +set UKIRT_ 399 +set IUCAA_ 400 +set BEJING_ 401 +set SAAO_ 402 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 1and2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(1and2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: 1not2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(1not2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: 1only + if {[regexp -start $index_ -indices -line -nocase -- {\A(1only)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: 2not1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(2not1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: 2only + if {[regexp -start $index_ -indices -line -nocase -- {\A(2only)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: add + if {[regexp -start $index_ -indices -line -nocase -- {\A(add)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: allcols + if {[regexp -start $index_ -indices -line -nocase -- {\A(allcols)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: allrows + if {[regexp -start $index_ -indices -line -nocase -- {\A(allrows)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: angle + if {[regexp -start $index_ -indices -line -nocase -- {\A(angle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: arrow + if {[regexp -start $index_ -indices -line -nocase -- {\A(arrow)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: broadcast + if {[regexp -start $index_ -indices -line -nocase -- {\A(broadcast)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: box + if {[regexp -start $index_ -indices -line -nocase -- {\A(box)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: boxcircle + if {[regexp -start $index_ -indices -line -nocase -- {\A(boxcircle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: cancel + if {[regexp -start $index_ -indices -line -nocase -- {\A(cancel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: cds + if {[regexp -start $index_ -indices -line -nocase -- {\A(cds)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: circle + if {[regexp -start $index_ -indices -line -nocase -- {\A(circle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: condition + if {[regexp -start $index_ -indices -line -nocase -- {\A(condition)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: coordinate + if {[regexp -start $index_ -indices -line -nocase -- {\A(coordinate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: cross + if {[regexp -start $index_ -indices -line -nocase -- {\A(cross)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: csv + if {[regexp -start $index_ -indices -line -nocase -- {\A(csv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: dec + if {[regexp -start $index_ -indices -line -nocase -- {\A(dec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: decr + if {[regexp -start $index_ -indices -line -nocase -- {\A(decr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: diamond + if {[regexp -start $index_ -indices -line -nocase -- {\A(diamond)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: edit + if {[regexp -start $index_ -indices -line -nocase -- {\A(edit)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: ellipse + if {[regexp -start $index_ -indices -line -nocase -- {\A(ellipse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: error + if {[regexp -start $index_ -indices -line -nocase -- {\A(error)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: export + if {[regexp -start $index_ -indices -line -nocase -- {\A(export)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: file + if {[regexp -start $index_ -indices -line -nocase -- {\A(file)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: filter + if {[regexp -start $index_ -indices -line -nocase -- {\A(filter)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: function + if {[regexp -start $index_ -indices -line -nocase -- {\A(function)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: header + if {[regexp -start $index_ -indices -line -nocase -- {\A(header)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: hide + if {[regexp -start $index_ -indices -line -nocase -- {\A(hide)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: import + if {[regexp -start $index_ -indices -line -nocase -- {\A(import)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: incr + if {[regexp -start $index_ -indices -line -nocase -- {\A(incr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: location + if {[regexp -start $index_ -indices -line -nocase -- {\A(location)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: maxrows + if {[regexp -start $index_ -indices -line -nocase -- {\A(maxrows)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: panto + if {[regexp -start $index_ -indices -line -nocase -- {\A(panto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: plot + if {[regexp -start $index_ -indices -line -nocase -- {\A(plot)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: point + if {[regexp -start $index_ -indices -line -nocase -- {\A(point)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: print + if {[regexp -start $index_ -indices -line -nocase -- {\A(print)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: psky + if {[regexp -start $index_ -indices -line -nocase -- {\A(psky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: psystem + if {[regexp -start $index_ -indices -line -nocase -- {\A(psystem)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: ra + if {[regexp -start $index_ -indices -line -nocase -- {\A(ra)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: radius + if {[regexp -start $index_ -indices -line -nocase -- {\A(radius)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: regions + if {[regexp -start $index_ -indices -line -nocase -- {\A(regions)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: remove + if {[regexp -start $index_ -indices -line -nocase -- {\A(remove)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: retrieve + if {[regexp -start $index_ -indices -line -nocase -- {\A(retrieve)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: return + if {[regexp -start $index_ -indices -line -nocase -- {\A(return)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: samp + if {[regexp -start $index_ -indices -line -nocase -- {\A(samp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: sb + if {[regexp -start $index_ -indices -line -nocase -- {\A(sb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: server + if {[regexp -start $index_ -indices -line -nocase -- {\A(server)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: shape + if {[regexp -start $index_ -indices -line -nocase -- {\A(shape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: show + if {[regexp -start $index_ -indices -line -nocase -- {\A(show)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: size2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(size2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: sort + if {[regexp -start $index_ -indices -line -nocase -- {\A(sort)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: starbase + if {[regexp -start $index_ -indices -line -nocase -- {\A(starbase)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: symbol + if {[regexp -start $index_ -indices -line -nocase -- {\A(symbol)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: text + if {[regexp -start $index_ -indices -line -nocase -- {\A(text)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: tsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(tsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: unique + if {[regexp -start $index_ -indices -line -nocase -- {\A(unique)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: units + if {[regexp -start $index_ -indices -line -nocase -- {\A(units)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: vot + if {[regexp -start $index_ -indices -line -nocase -- {\A(vot)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: xml + if {[regexp -start $index_ -indices -line -nocase -- {\A(xml)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: cds + if {[regexp -start $index_ -indices -line -nocase -- {\A(cds)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: adac + if {[regexp -start $index_ -indices -line -nocase -- {\A(adac)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: cadc + if {[regexp -start $index_ -indices -line -nocase -- {\A(cadc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + # rule 80: cambridge + if {[regexp -start $index_ -indices -line -nocase -- {\A(cambridge)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 80 + } + # rule 81: sao + if {[regexp -start $index_ -indices -line -nocase -- {\A(sao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 81 + } + # rule 82: ukirt + if {[regexp -start $index_ -indices -line -nocase -- {\A(ukirt)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 82 + } + # rule 83: iucaa + if {[regexp -start $index_ -indices -line -nocase -- {\A(iucaa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 83 + } + # rule 84: bejing + if {[regexp -start $index_ -indices -line -nocase -- {\A(bejing)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 84 + } + # rule 85: saao + if {[regexp -start $index_ -indices -line -nocase -- {\A(saao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 85 + } + # rule 86: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 86 + } + # rule 87: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 87 + } + # rule 88: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 88 + } + # rule 89: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 89 + } + # rule 90: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 90 + } + # rule 91: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 91 + } + # rule 92: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 92 + } + # rule 93: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 93 + } + # rule 94: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 94 + } + # rule 95: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 95 + } + # rule 96: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 96 + } + # rule 97: times + if {[regexp -start $index_ -indices -line -nocase -- {\A(times)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 97 + } + # rule 98: helvetica + if {[regexp -start $index_ -indices -line -nocase -- {\A(helvetica)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 98 + } + # rule 99: courier + if {[regexp -start $index_ -indices -line -nocase -- {\A(courier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 99 + } + # rule 100: normal + if {[regexp -start $index_ -indices -line -nocase -- {\A(normal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 100 + } + # rule 101: bold + if {[regexp -start $index_ -indices -line -nocase -- {\A(bold)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 101 + } + # rule 102: roman + if {[regexp -start $index_ -indices -line -nocase -- {\A(roman)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 102 + } + # rule 103: italic + if {[regexp -start $index_ -indices -line -nocase -- {\A(italic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 103 + } + # rule 104: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 104 + } + # rule 105: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 105 + } + # rule 106: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 106 + } + # rule 107: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 107 + } + # rule 108: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 108 + } + # rule 109: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 109 + } + # rule 110: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 110 + } + # rule 111: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 111 + } + # rule 112: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 112 + } + # rule 113: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 113 + } + # rule 114: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 114 + } + # rule 115: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 115 + } + # rule 116: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 116 + } + # rule 117: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 117 + } + # rule 118: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 118 + } + # rule 119: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 119 + } + # rule 120: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 120 + } + # rule 121: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 121 + } + # rule 122: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 122 + } + # rule 123: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 123 + } + # rule 124: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 124 + } + # rule 125: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 125 + } + # rule 126: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 126 + } + # rule 127: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 127 + } + # rule 128: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 128 + } + # rule 129: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 129 + } + # rule 130: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 130 + } + # rule 131: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 131 + } + # rule 132: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 132 + } + # rule 133: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 133 + } + # rule 134: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 134 + } + # rule 135: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 135 + } + # rule 136: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 136 + } + # rule 137: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 137 + } + # rule 138: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 138 + } + # rule 139: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 139 + } + # rule 140: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 140 + } + # rule 141: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 141 + } + # rule 142: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 142 + } + # rule 143: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 143 + } + # rule 144: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 144 + } + # rule 145: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 145 + } + # rule 146: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 146 + } + # rule 147: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 147 + } + # rule 148: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 148 + } + # rule 149: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 149 + } + # rule 150: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 150 + } + # rule 151: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 151 + } + # rule 152: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 152 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $1AND2_ + } + 1 { +return $1NOT2_ + } + 2 { +return $1ONLY_ + } + 3 { +return $2NOT1_ + } + 4 { +return $2ONLY_ + } + 5 { +return $ADD_ + } + 6 { +return $ALLCOLS_ + } + 7 { +return $ALLROWS_ + } + 8 { +return $ANGLE_ + } + 9 { +return $ARROW_ + } + 10 { +return $BROADCAST_ + } + 11 { +return $BOX_ + } + 12 { +return $BOXCIRCLE_ + } + 13 { +return $CANCEL_ + } + 14 { +return $CDS_ + } + 15 { +return $CIRCLE_ + } + 16 { +return $CLEAR_ + } + 17 { +return $CLOSE_ + } + 18 { +return $COLOR_ + } + 19 { +return $CONDITION_ + } + 20 { +return $COORDINATE_ + } + 21 { +return $CROSS_ + } + 22 { +return $CROSSHAIR_ + } + 23 { +return $CSV_ + } + 24 { +return $DEC_ + } + 25 { +return $DECR_ + } + 26 { +return $DIAMOND_ + } + 27 { +return $EDIT_ + } + 28 { +return $ELLIPSE_ + } + 29 { +return $ERROR_ + } + 30 { +return $EXPORT_ + } + 31 { +return $FILE_ + } + 32 { +return $FILTER_ + } + 33 { +return $FUNCTION_ + } + 34 { +return $HEADER_ + } + 35 { +return $HIDE_ + } + 36 { +return $IMPORT_ + } + 37 { +return $INCR_ + } + 38 { +return $LOAD_ + } + 39 { +return $LOCATION_ + } + 40 { +return $MATCH_ + } + 41 { +return $MAXROWS_ + } + 42 { +return $NAME_ + } + 43 { +return $NEW_ + } + 44 { +return $PANTO_ + } + 45 { +return $PLOT_ + } + 46 { +return $POINT_ + } + 47 { +return $PRINT_ + } + 48 { +return $PSKY_ + } + 49 { +return $PSYSTEM_ + } + 50 { +return $RA_ + } + 51 { +return $RADIUS_ + } + 52 { +return $REGIONS_ + } + 53 { +return $REMOVE_ + } + 54 { +return $RETRIEVE_ + } + 55 { +return $RETURN_ + } + 56 { +return $SAMP_ + } + 57 { +return $SAVE_ + } + 58 { +return $SB_ + } + 59 { +return $SERVER_ + } + 60 { +return $SHAPE_ + } + 61 { +return $SHOW_ + } + 62 { +return $SIZE_ + } + 63 { +return $SIZE2_ + } + 64 { +return $SKY_ + } + 65 { +return $SKYFORMAT_ + } + 66 { +return $SORT_ + } + 67 { +return $STARBASE_ + } + 68 { +return $SYMBOL_ + } + 69 { +return $SYSTEM_ + } + 70 { +return $TEXT_ + } + 71 { +return $TSV_ + } + 72 { +return $UNIQUE_ + } + 73 { +return $UNITS_ + } + 74 { +return $UPDATE_ + } + 75 { +return $VOT_ + } + 76 { +return $XML_ + } + 77 { +return $CDS_ + } + 78 { +return $ADAC_ + } + 79 { +return $CADC_ + } + 80 { +return $CAMBRIDGE_ + } + 81 { +return $SAO_ + } + 82 { +return $UKIRT_ + } + 83 { +return $IUCAA_ + } + 84 { +return $BEJING_ + } + 85 { +return $SAAO_ + } + 86 { +return $YES_ + } + 87 { +return $NO_ + } + 88 { +return $ON_ + } + 89 { +return $OFF_ + } + 90 { +return $TRUE_ + } + 91 { +return $FALSE_ + } + 92 { +return $FONT_ + } + 93 { +return $FONTSIZE_ + } + 94 { +return $FONTSLANT_ + } + 95 { +return $FONTSTYLE_ + } + 96 { +return $FONTWEIGHT_ + } + 97 { +return $TIMES_ + } + 98 { +return $HELVETICA_ + } + 99 { +return $COURIER_ + } + 100 { +return $NORMAL_ + } + 101 { +return $BOLD_ + } + 102 { +return $ROMAN_ + } + 103 { +return $ITALIC_ + } + 104 { +return $WCS_ + } + 105 { +return $WCSA_ + } + 106 { +return $WCSB_ + } + 107 { +return $WCSC_ + } + 108 { +return $WCSD_ + } + 109 { +return $WCSE_ + } + 110 { +return $WCSF_ + } + 111 { +return $WCSG_ + } + 112 { +return $WCSH_ + } + 113 { +return $WCSI_ + } + 114 { +return $WCSJ_ + } + 115 { +return $WCSK_ + } + 116 { +return $WCSL_ + } + 117 { +return $WCSM_ + } + 118 { +return $WCSN_ + } + 119 { +return $WCSO_ + } + 120 { +return $WCSP_ + } + 121 { +return $WCSQ_ + } + 122 { +return $WCSR_ + } + 123 { +return $WCSS_ + } + 124 { +return $WCST_ + } + 125 { +return $WCSU_ + } + 126 { +return $WCSV_ + } + 127 { +return $WCSW_ + } + 128 { +return $WCSX_ + } + 129 { +return $WCSY_ + } + 130 { +return $WCSZ_ + } + 131 { +return $FK4_ + } + 132 { +return $FK4_ + } + 133 { +return $FK5_ + } + 134 { +return $FK5_ + } + 135 { +return $ICRS_ + } + 136 { +return $GALACTIC_ + } + 137 { +return $ECLIPTIC_ + } + 138 { +return $DEGREES_ + } + 139 { +return $ARCMIN_ + } + 140 { +return $ARCSEC_ + } + 141 { +return $SEXAGESIMAL_ + } + 142 { +set yylval $yytext; return $INT_ + } + 143 - + 144 { +set yylval $yytext; return $REAL_ + } + 145 - + 146 { +set yylval $yytext; return $SEXSTR_ + } + 147 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 148 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 149 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 150 { +set yylval $yytext; return $STRING_ + } + 151 { +# ignore whitespace + } + 152 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/catparser.tab.tcl b/ds9/parsers/catparser.tab.tcl new file mode 100644 index 0000000..b2dbaea --- /dev/null +++ b/ds9/parsers/catparser.tab.tcl @@ -0,0 +1,146 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set WCS_ 275 +set WCSA_ 276 +set WCSB_ 277 +set WCSC_ 278 +set WCSD_ 279 +set WCSE_ 280 +set WCSF_ 281 +set WCSG_ 282 +set WCSH_ 283 +set WCSI_ 284 +set WCSJ_ 285 +set WCSK_ 286 +set WCSL_ 287 +set WCSM_ 288 +set WCSN_ 289 +set WCSO_ 290 +set WCSP_ 291 +set WCSQ_ 292 +set WCSR_ 293 +set WCSS_ 294 +set WCST_ 295 +set WCSU_ 296 +set WCSV_ 297 +set WCSW_ 298 +set WCSX_ 299 +set WCSY_ 300 +set WCSZ_ 301 +set FK4_ 302 +set B1950_ 303 +set FK5_ 304 +set J2000_ 305 +set ICRS_ 306 +set GALACTIC_ 307 +set ECLIPTIC_ 308 +set DEGREES_ 309 +set ARCMIN_ 310 +set ARCSEC_ 311 +set SEXAGESIMAL_ 312 +set INT_ 313 +set REAL_ 314 +set SEXSTR_ 315 +set STRING_ 316 +set 1AND2_ 317 +set 1NOT2_ 318 +set 1ONLY_ 319 +set 2NOT1_ 320 +set 2ONLY_ 321 +set ADD_ 322 +set ALLCOLS_ 323 +set ALLROWS_ 324 +set ANGLE_ 325 +set ARROW_ 326 +set BOX_ 327 +set BOXCIRCLE_ 328 +set BROADCAST_ 329 +set CANCEL_ 330 +set CDS_ 331 +set CIRCLE_ 332 +set CLEAR_ 333 +set CLOSE_ 334 +set COLOR_ 335 +set CONDITION_ 336 +set COORDINATE_ 337 +set CROSS_ 338 +set CROSSHAIR_ 339 +set CSV_ 340 +set DEC_ 341 +set DECR_ 342 +set DIAMOND_ 343 +set EDIT_ 344 +set ELLIPSE_ 345 +set EXPORT_ 346 +set ERROR_ 347 +set FILE_ 348 +set FILTER_ 349 +set FUNCTION_ 350 +set HEADER_ 351 +set HIDE_ 352 +set IMPORT_ 353 +set INCR_ 354 +set LOAD_ 355 +set LOCATION_ 356 +set MATCH_ 357 +set MAXROWS_ 358 +set NAME_ 359 +set NEW_ 360 +set PANTO_ 361 +set PLOT_ 362 +set POINT_ 363 +set PRINT_ 364 +set PSKY_ 365 +set PSYSTEM_ 366 +set RA_ 367 +set RADIUS_ 368 +set REGIONS_ 369 +set REMOVE_ 370 +set RETRIEVE_ 371 +set RETURN_ 372 +set SAMP_ 373 +set SAVE_ 374 +set SB_ 375 +set SEND_ 376 +set SERVER_ 377 +set SHAPE_ 378 +set SHOW_ 379 +set SIZE_ 380 +set SIZE2_ 381 +set SKY_ 382 +set SKYFORMAT_ 383 +set SORT_ 384 +set STARBASE_ 385 +set SYMBOL_ 386 +set SYSTEM_ 387 +set TEXT_ 388 +set TSV_ 389 +set UNIQUE_ 390 +set UNITS_ 391 +set UPDATE_ 392 +set VOT_ 393 +set XML_ 394 +set ADAC_ 395 +set CADC_ 396 +set CAMBRIDGE_ 397 +set SAO_ 398 +set UKIRT_ 399 +set IUCAA_ 400 +set BEJING_ 401 +set SAAO_ 402 diff --git a/ds9/parsers/catparser.tcl b/ds9/parsers/catparser.tcl new file mode 100644 index 0000000..eb0f2f2 --- /dev/null +++ b/ds9/parsers/catparser.tcl @@ -0,0 +1,4543 @@ +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 cat { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cat::YYABORT {} { + return -code return 1 +} + +proc cat::YYACCEPT {} { + return -code return 0 +} + +proc cat::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cat::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cat::yyerror {s} { + puts stderr $s +} + +proc cat::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 cat::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cat::table { + 257:0 reduce + 61:309,target 164 + 10:382 shift + 76:304,target 111 + 10:383 shift + 11:334,target 33 + 122:0,target 23 + 10:384 shift + 106:316 reduce + 63:266,target 111 + 10:386 shift + 81:316 reduce + 4:340 shift + 10:387 shift + 48:0 reduce + 70:412 goto + 10:392 shift + 111:316,target 47 + 51:316 shift + 202:271,target 230 + 156:316,target 153 + 135:0 reduce + 95:0,target 126 + 10:420,target 67 + 257:316,target 177 + 0:386,target 67 + 97:316,target 88 + 70:420 goto + 21:316 reduce + 1:369,target 70 + 177:0 reduce + 172:302 shift + 63:335,target 111 + 172:303 shift + 70:423 goto + 10:412 goto + 172:304 shift + 34:313,target 26 + 33:0,target 83 + 242:316 reduce + 172:305 shift + 50:297,target 139 + 49:307,target 114 + 38:389,target 91 + 172:306 shift + 9:316 reduce + 212:313 shift + 172:307 shift + 10:367,target 51 + 253:0,target 175 + 230:0 reduce + 229:0 reduce + 212:314 shift + 201:406 goto + 172:308 shift + 39:424 goto + 0:344,target 67 + 11:351,target 40 + 10:420 goto + 12:334,target 76 + 222:0,target 8 + 22:369,target 53 + 10:423 goto + 21:0 reduce + 172:316 reduce + 100:314,target 27 + 181:0,target 135 + 7:371,target 73 + 107:0 reduce + 59:412,target 162 + 150:0,target 103 + 149:0,target 102 + 142:316 reduce + 112:316,target 48 + 26:303,target 57 + 203:271,target 234 + 157:316,target 154 + 0:413,target 8 + 4:375 shift + 11:420,target 69 + 258:316,target 96 + 118:0,target 19 + 53:316,target 100 + 1:386,target 70 + 26:302 reduce + 150:0 reduce + 149:0 reduce + 112:316 reduce + 98:316,target 91 + 26:303 reduce + 26:304 reduce + 86:316 reduce + 26:305 reduce + 26:306 reduce + 26:307 reduce + 10:384,target 62 + 26:308 reduce + 192:0 reduce + 4:385 shift + 26:309 reduce + 26:310 reduce + 56:316 shift + 0:361,target 67 + 11:367,target 51 + 26:311 reduce + 1:344,target 70 + 12:351,target 76 + 26:313 reduce + 4:389 shift + 22:386,target 63 + 26:314 reduce + 170:266,target 202 + 169:266,target 113 + 244:0 reduce + 64:283,target 125 + 26:316 reduce + 63:421,target 170 + 4:393 shift + 4:394 shift + 7:387,target 73 + 101:426 goto + 30:0,target 1 + 29:0,target 1 + 247:316 reduce + 35:0 reduce + 250:0,target 179 + 249:0,target 185 + 113:316,target 49 + 22:344,target 37 + 27:303,target 58 + 158:316,target 155 + 242:363 shift + 217:316 reduce + 214:316,target 256 + 12:419,target 70 + 260:316,target 192 + 259:316,target 190 + 122:0 reduce + 218:0,target 128 + 170:335,target 206 + 169:335,target 113 + 77:0 reduce + 54:316,target 101 + 30:260,target 80 + 30:259,target 79 + 29:260,target 80 + 29:259,target 79 + 99:316,target 177 + 58:403,target 161 + 177:316 reduce + 9:0 reduce + 177:0,target 132 + 172:302,target 109 + 164:0 reduce + 0:377,target 67 + 11:384,target 62 + 147:316 reduce + 1:361,target 70 + 12:367,target 76 + 216:0 reduce + 64:299,target 141 + 115:0,target 51 + 50:288,target 130 + 4:428 goto + 117:316 reduce + 70:369,target 53 + 10:358,target 44 + 92:316 reduce + 49:409,target 116 + 258:0 reduce + 198:263,target 199 + 37:257 shift + 37:258 shift + 22:361,target 46 + 62:316 shift + 37:260 shift + 37:259 shift + 198:374,target 210 + 114:316,target 50 + 37:261 shift + 160:316,target 104 + 159:316,target 156 + 37:262 shift + 215:316,target 257 + 43:425,target 104 + 7:362,target 73 + 261:316,target 184 + 55:316,target 145 + 32:316 reduce + 136:0 reduce + 0:x,target 67 + 26:0,target 57 + 253:316 reduce + 1:377,target 70 + 12:384,target 76 + 246:0,target 193 + 247:363 shift + 223:316 reduce + 9:414 goto + 70:386,target 63 + 212:412 goto + 0:352,target 67 + 11:358,target 44 + 11:x,target 24 + 231:0 reduce + 183:316 reduce + 37:261,target 81 + 174:0,target 124 + 172:409 goto + 22:377,target 57 + 198:391,target 215 + 153:316 reduce + 143:0,target 44 + 115:316,target 51 + 60:308,target 115 + 161:316,target 105 + 70:344,target 37 + 10:333,target 32 + 216:316,target 112 + 262:316,target 194 + 112:0,target 48 + 123:316 reduce + 56:316,target 150 + 26:311,target 57 + 103:262,target 82 + 97:316 reduce + 43:390,target 103 + 151:0 reduce + 67:316 reduce + 85:0,target 84 + 10:392,target 65 + 54:0,target 101 + 37:316 reduce + 0:368,target 67 + 193:0 reduce + 9:414,target 23 + 1:352,target 70 + 12:358,target 76 + 43:347,target 100 + 258:316 reduce + 64:301,target 143 + 64:291,target 133 + 205:314,target 27 + 70:x,target 24 + 50:280,target 122 + 50:279,target 121 + 245:0 reduce + 243:0,target 195 + 70:361,target 46 + 39:355,target 96 + 10:349,target 39 + 116:316,target 98 + 228:316 reduce + 76:303,target 110 + 11:333,target 32 + 242:363,target 259 + 217:316,target 122 + 263:316,target 183 + 12:316,target 75 + 63:265,target 111 + 22:352,target 41 + 27:311,target 58 + 188:316 shift + 200:313,target 226 + 171:0,target 115 + 123:0 reduce + 211:332,target 247 + 78:0 reduce + 158:316 reduce + 140:0,target 41 + 139:0,target 40 + 39:424,target 97 + 11:392,target 65 + 165:0 reduce + 128:316 reduce + 1:368,target 70 + 50:296,target 138 + 49:306,target 113 + 217:0 reduce + 70:377,target 57 + 34:423,target 85 + 8:0,target 0 + 10:366,target 50 + 82:0,target 7 + 11:349,target 39 + 117:316,target 18 + 163:316,target 108 + 12:333,target 76 + 260:0 reduce + 259:0 reduce + 218:316,target 128 + 178:311,target 191 + 22:368,target 52 + 264:316,target 188 + 43:316 shift + 13:316,target 64 + 58:316,target 1 + 100:313,target 26 + 7:369,target 73 + 10:324,target 30 + 264:316 reduce + 13:316 reduce + 46:262,target 82 + 26:302,target 57 + 240:0,target 163 + 239:0,target 167 + 202:407,target 233 + 194:310 shift + 194:309 shift + 234:316 reduce + 194:311 shift + 137:0 reduce + 2:316 shift + 12:392,target 76 + 57:402,target 159 + 204:316 reduce + 62:431 goto + 180:0 reduce + 179:0 reduce + 167:0,target 157 + 10:383,target 61 + 199:268 shift + 170:263 shift + 169:263 reduce + 199:270 shift + 199:269 shift + 170:264 shift + 169:264 reduce + 0:359,target 67 + 0:360,target 6 + 11:366,target 50 + 22:x shift + 170:265 shift + 169:265 reduce + 164:316 reduce + 136:0,target 37 + 22:y shift + 170:266 shift + 169:266 reduce + 66:412,target 172 + 12:349,target 76 + 232:0 reduce + 170:267 shift + 169:267 reduce + 118:316,target 19 + 170:265,target 201 + 169:265,target 113 + 164:316,target 52 + 22:y,target 25 + 244:363,target 260 + 220:316,target 107 + 219:316,target 258 + 105:0,target 93 + 64:282,target 124 + 265:316,target 186 + 134:316 reduce + 14:316,target 143 + 7:386,target 73 + 70:352,target 41 + 10:341,target 36 + 43:347 shift + 11:324,target 30 + 104:316 reduce + 43:350 shift + 4:394,target 19 + 42:313,target 98 + 78:316 reduce + 37:403 goto + 27:302,target 58 + 110:0 reduce + 109:0 reduce + 78:0,target 5 + 65:0 reduce + 30:258,target 78 + 29:258,target 78 + 7:344,target 73 + 48:316 reduce + 152:0 reduce + 211:434,target 253 + 11:383,target 61 + 18:316 reduce + 1:359,target 70 + 12:366,target 76 + 236:0,target 170 + 204:0 reduce + 63:325,target 111 + 7:313 reduce + 22:412,target 66 + 7:314 reduce + 240:316 reduce + 239:316 reduce + 120:316,target 21 + 119:316,target 20 + 64:298,target 140 + 7:315 reduce + 165:316,target 53 + 50:287,target 129 + 7:316 reduce + 245:363,target 261 + 221:316,target 114 + 195:0,target 160 + 70:368,target 52 + 43:372 shift + 7:y,target 73 + 10:357,target 43 + 15:316,target 141 + 246:0 reduce + 50:408,target 144 + 210:316 shift + 209:316 reduce + 0:334,target 67 + 11:341,target 36 + 164:0,target 52 + 7:323 reduce + 12:324,target 76 + 7:324 reduce + 22:359,target 45 + 133:0,target 34 + 37:0 reduce + 7:361,target 73 + 7:330 reduce + 10:315,target 28 + 170:322 shift + 169:322 reduce + 140:316 reduce + 139:316 reduce + 124:0 reduce + 80:0 reduce + 79:0 reduce + 7:333 reduce + 7:334 reduce + 170:325 shift + 169:325 reduce + 167:342,target 195 + 43:390 shift + 110:316 reduce + 109:316 reduce + 7:337 reduce + 12:383,target 76 + 166:0 reduce + 84:316 reduce + 43:372,target 102 + 7:339 reduce + 75:0,target 119 + 7:341 reduce + 121:316,target 22 + 30:257 shift + 29:257 shift + 166:316,target 109 + 30:258 shift + 29:258 shift + 7:344 reduce + 10:374,target 56 + 246:363,target 262 + 222:316,target 8 + 218:0 reduce + 170:335 shift + 169:335 reduce + 54:316 reduce + 30:260 shift + 30:259 shift + 29:260 shift + 29:259 shift + 170:336 shift + 169:336 reduce + 30:261 shift + 29:261 shift + 0:351,target 67 + 7:346 reduce + 11:357,target 43 + 16:316,target 142 + 62:316,target 167 + 37:260,target 80 + 37:259,target 79 + 30:262 shift + 29:262 shift + 1:334,target 70 + 12:341,target 76 + 264:0,target 188 + 7:349 reduce + 13:0,target 64 + 7:351 reduce + 24:316 shift + 261:0 reduce + 7:352 reduce + 44:313,target 105 + 233:0,target 172 + 60:307,target 114 + 7:377,target 73 + 245:316 reduce + 7:356 reduce + 7:357 reduce + 11:315,target 28 + 192:0,target 106 + 4:385,target 16 + 7:358 reduce + 26:309,target 57 + 26:310,target 57 + 103:261,target 81 + 7:359 reduce + 7:361 reduce + 22:334,target 33 + 215:316 shift + 43:425 goto + 7:362 reduce + 161:0,target 105 + 194:411 goto + 138:0 reduce + 57:399,target 156 + 7:364 reduce + 170:325,target 205 + 170:355 shift + 169:355 reduce + 169:325,target 113 + 7:365 reduce + 7:366 reduce + 175:316 reduce + 130:0,target 31 + 129:0,target 30 + 7:367 reduce + 7:368 reduce + 70:412,target 66 + 7:369 reduce + 181:0 reduce + 122:316,target 23 + 7:371 reduce + 167:316,target 157 + 60:302 shift + 0:367,target 67 + 11:374,target 56 + 247:363,target 263 + 223:316,target 9 + 145:316 reduce + 60:303 shift + 7:373 reduce + 60:304 shift + 1:351,target 70 + 7:374 reduce + 12:357,target 76 + 17:316,target 144 + 60:305 shift + 60:306 shift + 233:0 reduce + 64:300,target 142 + 64:290,target 132 + 64:289,target 131 + 60:307 shift + 7:377 reduce + 205:313,target 26 + 115:316 reduce + 60:308 shift + 50:278,target 120 + 170:370 shift + 169:370 reduce + 7:379 reduce + 7:380 reduce + 90:316 reduce + 89:316 reduce + 70:359,target 45 + 72:0,target 74 + 7:382 reduce + 76:302,target 109 + 59:313 shift + 7:383 reduce + 170:374 shift + 169:374 reduce + 59:314 shift + 7:384 reduce + 12:315,target 76 + 63:264,target 111 + 41:0,target 90 + 7:386 reduce + 22:351,target 40 + 27:309,target 58 + 27:310,target 58 + 7:387 reduce + 170:378 shift + 169:378 reduce + 170:380 shift + 169:380 reduce + 111:0 reduce + 261:0,target 184 + 170:381 shift + 169:381 reduce + 7:352,target 73 + 30:316 reduce + 29:316 reduce + 7:392 reduce + 230:0,target 15 + 229:0,target 171 + 212:314,target 27 + 201:406,target 229 + 172:308,target 115 + 153:0 reduce + 251:316 reduce + 52:314,target 27 + 0:384,target 67 + 199:404 goto + 170:388 shift + 169:388 reduce + 123:316,target 24 + 198:322,target 204 + 168:316,target 110 + 1:367,target 70 + 12:374,target 76 + 248:363,target 264 + 224:316,target 10 + 170:391 shift + 169:391 reduce + 1:y,target 70 + 22:420,target 72 + 18:316,target 140 + 245:363 shift + 221:316 reduce + 198:433,target 221 + 195:0 reduce + 157:0,target 154 + 50:295,target 137 + 49:305,target 112 + 10:365,target 49 + 181:316 reduce + 126:0,target 27 + 102:321,target 185 + 7:418 goto + 247:0 reduce + 4:428,target 20 + 178:310,target 190 + 178:309,target 189 + 12:y,target 76 + 22:367,target 51 + 198:381,target 213 + 151:316 reduce + 7:368,target 73 + 70:334,target 33 + 10:323,target 29 + 121:316 reduce + 60:409,target 163 + 46:261,target 81 + 169:422 goto + 125:0 reduce + 95:316 reduce + 213:314,target 27 + 81:0 reduce + 68:0,target 78 + 1:384,target 70 + 124:316,target 25 + 57:401,target 158 + 65:316 reduce + 37:0,target 1 + 249:363,target 265 + 225:316,target 168 + 167:0 reduce + 19:316,target 139 + 20:316,target 71 + 65:316,target 116 + 257:0,target 177 + 10:382,target 60 + 10:x shift + 170:433 goto + 35:316 reduce + 10:y shift + 0:358,target 67 + 11:365,target 49 + 220:0 reduce + 226:0,target 169 + 22:384,target 62 + 256:316 reduce + 199:270,target 224 + 199:269,target 223 + 170:264,target 200 + 169:264,target 113 + 22:x,target 24 + 64:281,target 123 + 185:0,target 138 + 262:0 reduce + 70:351,target 40 + 10:339,target 35 + 226:316 reduce + 154:0,target 151 + 0:316,target 1 + 11:323,target 29 + 4:393,target 18 + 211:x,target 242 + 61:410,target 166 + 53:0 reduce + 186:316 reduce + 123:0,target 24 + 198:355,target 208 + 30:257,target 77 + 29:257,target 77 + 140:0 reduce + 139:0 reduce + 125:316,target 26 + 202:271 shift + 171:316,target 115 + 156:316 reduce + 95:0 reduce + 226:316,target 169 + 202:272 shift + 70:420,target 173 + 21:316,target 65 + 202:274 shift + 11:382,target 60 + 182:0 reduce + 126:316 reduce + 1:358,target 70 + 12:365,target 76 + 65:0,target 116 + 64:297,target 139 + 50:286,target 128 + 46:257 shift + 234:0 reduce + 46:258 shift + 71:316 reduce + 70:367,target 51 + 46:260 shift + 46:259 shift + 30:403 goto + 7:x,target 73 + 10:356,target 42 + 29:403 goto + 60:409 goto + 46:261 shift + 46:262 shift + 0:333,target 67 + 11:339,target 35 + 59:412 goto + 254:0,target 173 + 1:316,target 69 + 12:323,target 76 + 41:316 reduce + 22:358,target 44 + 11:313 shift + 223:0,target 9 + 11:314 shift + 7:359,target 73 + 11:315 shift + 262:316 reduce + 112:0 reduce + 10:314,target 27 + 211:338,target 248 + 67:0 reduce + 182:0,target 129 + 126:316,target 27 + 172:316,target 121 + 0:313 reduce + 227:316,target 13 + 0:0 reduce + 0:314 reduce + 232:316 reduce + 0:392,target 67 + 0:315 reduce + 154:0 reduce + 151:0,target 148 + 67:316,target 68 + 0:316 shift + 11:323 shift + 11:324 shift + 12:382,target 76 + 192:316 reduce + 120:0,target 21 + 119:0,target 20 + 196:0 reduce + 162:313 shift + 0:323 reduce + 11:330 shift + 162:314 shift + 70:384,target 62 + 0:324 reduce + 10:373,target 55 + 76:302 shift + 76:303 shift + 0:349,target 67 + 11:333 shift + 11:356,target 42 + 76:304 shift + 37:258,target 78 + 11:334 shift + 76:305 shift + 1:333,target 70 + 12:339,target 76 + 248:0 reduce + 76:306 shift + 0:330 reduce + 76:307 shift + 0:331 shift + 2:316,target 12 + 11:337 shift + 198:388,target 214 + 132:316 reduce + 76:308 shift + 0:333 reduce + 11:339 shift + 60:306,target 113 + 0:334 reduce + 11:341 shift + 40:0 reduce + 0:337 reduce + 11:344 shift + 11:314,target 27 + 102:317 shift + 26:308,target 57 + 127:316,target 28 + 103:260,target 80 + 103:259,target 79 + 76:316 reduce + 31:0,target 81 + 0:339 reduce + 11:346 shift + 173:316,target 77 + 102:319 shift + 0:341 reduce + 22:333,target 32 + 228:316,target 14 + 126:0 reduce + 102:321 shift + 82:0 reduce + 1:392,target 70 + 11:349 shift + 23:316,target 73 + 251:0,target 182 + 68:316,target 78 + 57:398,target 155 + 0:344 reduce + 11:351 shift + 46:316 reduce + 7:334,target 73 + 11:352 shift + 0:346 reduce + 220:0,target 107 + 168:0 reduce + 0:348 shift + 0:349 reduce + 11:356 shift + 0:351 reduce + 11:357 shift + 16:316 reduce + 0:366,target 67 + 0:352 reduce + 11:358 shift + 11:373,target 55 + 11:x shift + 0:353 shift + 11:359 shift + 11:y shift + 1:349,target 70 + 11:361 shift + 12:356,target 76 + 221:0 reduce + 0:355 shift + 11:362 shift + 22:392,target 65 + 237:316 reduce + 0:356 reduce + 147:0,target 146 + 64:288,target 130 + 0:357 reduce + 5:316 shift + 11:364 shift + 50:277,target 119 + 0:358 reduce + 3:316,target 13 + 11:365 shift + 0:359 reduce + 0:360 shift + 11:366 shift + 101:320,target 181 + 70:358,target 44 + 0:361 reduce + 11:367 shift + 263:0 reduce + 207:316 shift + 197:316 reduce + 116:0,target 98 + 0:362 reduce + 11:368 shift + 12:0 reduce + 162:314,target 27 + 0:324,target 67 + 11:369 shift + 0:364 reduce + 11:371 shift + 0:365 reduce + 12:314,target 76 + 63:263,target 111 + 0:366 reduce + 11:373 shift + 22:349,target 39 + 27:308,target 58 + 167:316 reduce + 128:316,target 29 + 0:367 reduce + 11:374 shift + 174:316,target 124 + 54:0 reduce + 0:368 reduce + 230:316,target 15 + 229:316,target 171 + 63:374,target 111 + 0:369 reduce + 0:371 reduce + 7:351,target 73 + 11:377 shift + 24:316,target 74 + 69:316,target 71 + 137:316 reduce + 0:373 reduce + 11:379 shift + 11:380 shift + 141:0 reduce + 0:374 reduce + 212:313,target 26 + 172:307,target 114 + 11:382 shift + 58:0,target 1 + 11:383 shift + 52:313,target 26 + 0:383,target 67 + 0:377 reduce + 11:384 shift + 107:316 reduce + 1:366,target 70 + 0:380 reduce + 0:379 reduce + 11:386 shift + 12:373,target 76 + 183:0 reduce + 82:316 reduce + 1:x,target 70 + 11:387 shift + 27:0,target 58 + 0:382 reduce + 52:313 shift + 0:383 reduce + 52:314 shift + 50:294,target 136 + 49:304,target 111 + 0:384 reduce + 247:0,target 178 + 11:392 shift + 0:386 reduce + 10:364,target 48 + 235:0 reduce + 211:388,target 252 + 0:387 reduce + 102:319,target 184 + 0:341,target 67 + 22:313 shift + 216:0,target 112 + 22:314 shift + 1:324,target 70 + 22:315 shift + 57:331,target 151 + 0:392 reduce + 12:x,target 76 + 22:366,target 50 + 167:342 shift + 198:380,target 212 + 175:0,target 87 + 0:x reduce + 26:0 reduce + 130:316,target 31 + 129:316,target 30 + 63:391,target 111 + 0:y reduce + 11:412 goto + 175:316,target 87 + 7:367,target 73 + 243:316 reduce + 231:316,target 16 + 70:333,target 32 + 144:0,target 99 + 0:398 shift + 22:323 shift + 25:316,target 75 + 213:313 shift + 113:0 reduce + 71:316,target 66 + 46:260,target 80 + 46:259,target 79 + 30:403,target 84 + 22:324 shift + 29:403,target 83 + 213:314 shift + 68:0 reduce + 4:375,target 15 + 202:407 goto + 213:313,target 26 + 113:0,target 49 + 0:413 goto + 11:420 goto + 22:324,target 30 + 1:0 reduce + 167:354 shift + 58:262,target 82 + 1:383,target 70 + 0:415 goto + 22:330 shift + 155:0 reduce + 57:400,target 157 + 0:416 goto + 11:423 goto + 173:316 reduce + 22:333 shift + 22:334 shift + 162:412 goto + 70:392,target 65 + 197:0 reduce + 86:0,target 120 + 22:337 shift + 143:316 reduce + 0:357,target 67 + 5:316,target 21 + 11:364,target 48 + 22:339 shift + 1:341,target 70 + 22:341 shift + 55:0,target 145 + 22:383,target 61 + 199:268,target 222 + 170:263,target 199 + 169:263,target 113 + 27:302 reduce + 250:0 reduce + 249:0 reduce + 113:316 reduce + 64:280,target 122 + 64:279,target 121 + 22:344 shift + 27:303 reduce + 27:304 reduce + 170:374,target 210 + 169:374,target 113 + 87:316 reduce + 59:314,target 27 + 46:403 goto + 7:384,target 73 + 22:346 shift + 27:305 reduce + 131:316,target 32 + 76:409 goto + 70:349,target 39 + 27:306 reduce + 211:363,target 251 + 176:316,target 125 + 146:311,target 191 + 27:307 reduce + 232:316,target 17 + 63:263 reduce + 0:315,target 67 + 22:349 shift + 27:308 reduce + 244:0,target 191 + 63:264 reduce + 41:0 reduce + 22:351 shift + 26:316,target 57 + 27:309 reduce + 27:310 reduce + 72:316,target 74 + 63:265 reduce + 22:352 shift + 27:311 reduce + 63:266 reduce + 22:341,target 36 + 63:267 reduce + 27:313 reduce + 203:405,target 236 + 27:314 reduce + 127:0 reduce + 22:356 shift + 83:0 reduce + 22:357 shift + 27:316 reduce + 22:358 shift + 172:0,target 121 + 22:359 shift + 22:361 shift + 22:362 shift + 248:316 reduce + 102:427 goto + 141:0,target 42 + 0:374,target 67 + 22:364 shift + 172:409,target 217 + 22:365 shift + 57:331 shift + 1:357,target 70 + 6:316,target 62 + 12:364,target 76 + 12:x reduce + 22:366 shift + 178:310 shift + 178:309 shift + 12:y reduce + 22:367 shift + 218:316 reduce + 178:311 shift + 110:0,target 46 + 109:0,target 45 + 22:368 shift + 222:0 reduce + 64:296,target 138 + 22:369 shift + 50:285,target 127 + 22:371 shift + 170:391,target 215 + 169:391,target 113 + 70:366,target 50 + 34:412,target 66 + 22:373 shift + 22:374 shift + 132:316,target 33 + 76:308,target 115 + 264:0 reduce + 177:316,target 132 + 9:0,target 59 + 13:0 reduce + 233:316,target 172 + 1:315,target 70 + 22:377 shift + 83:0,target 79 + 22:357,target 43 + 27:316,target 58 + 148:316 shift + 22:379 shift + 22:380 shift + 178:411,target 218 + 22:382 shift + 55:0 reduce + 7:358,target 73 + 22:383 shift + 70:324,target 30 + 10:313,target 26 + 22:384 shift + 118:316 reduce + 22:386 shift + 93:316 reduce + 21:0,target 65 + 22:387 shift + 142:0 reduce + 97:0 reduce + 63:313 shift + 22:315,target 28 + 241:0,target 164 + 1:374,target 70 + 22:392 shift + 7:316,target 72 + 184:0 reduce + 209:0,target 162 + 52:412 goto + 38:394,target 93 + 167:432 goto + 70:383,target 61 + 63:322 reduce + 33:316 reduce + 168:0,target 110 + 0:348,target 3 + 236:0 reduce + 63:325 reduce + 37:257,target 77 + 22:412 goto + 133:316,target 34 + 254:316 reduce + 22:374,target 56 + 234:316,target 11 + 194:311,target 191 + 137:0,target 38 + 74:316,target 117 + 60:305,target 112 + 1:x reduce + 27:0 reduce + 248:363 shift + 224:316 reduce + 106:0,target 94 + 70:341,target 36 + 1:y reduce + 10:330,target 31 + 22:420 goto + 55:329,target 147 + 63:335 reduce + 11:313,target 26 + 213:412 goto + 63:336 reduce + 22:423 goto + 26:307,target 57 + 114:0 reduce + 103:258,target 78 + 184:316 reduce + 69:0 reduce + 6:0,target 62 + 57:397,target 154 + 80:0,target 6 + 79:0,target 3 + 7:333,target 73 + 156:0 reduce + 154:316 reduce + 48:0,target 97 + 57:400 shift + 124:316 reduce + 57:401 shift + 0:365,target 67 + 57:402 shift + 98:316 reduce + 134:316,target 35 + 57:395 shift + 180:316,target 134 + 179:316,target 133 + 64:287,target 129 + 63:355 reduce + 57:396 shift + 237:0,target 165 + 235:316,target 12 + 57:397 shift + 50:276,target 118 + 251:0 reduce + 68:316 reduce + 57:398 shift + 30:316,target 1 + 29:316,target 1 + 7:392,target 73 + 101:318,target 180 + 75:316,target 119 + 70:357,target 43 + 64:408,target 171 + 57:399 shift + 10:346,target 38 + 196:0,target 159 + 162:313,target 26 + 0:323,target 67 + 11:330,target 31 + 12:313,target 76 + 27:307,target 58 + 165:0,target 53 + 1:417,target 11 + 260:316 reduce + 259:316 reduce + 7:349,target 73 + 134:0,target 35 + 128:0 reduce + 70:315,target 28 + 63:370 reduce + 211:328,target 246 + 84:0 reduce + 172:306,target 113 + 9:316,target 60 + 230:316 reduce + 229:316 reduce + 103:0,target 1 + 63:374 reduce + 0:382,target 67 + 200:313 shift + 171:0 reduce + 1:365,target 70 + 63:378 reduce + 57:430 goto + 190:316 reduce + 189:316 reduce + 63:380 reduce + 63:381 reduce + 178:411 goto + 135:316,target 36 + 50:293,target 135 + 49:303,target 110 + 38:385,target 90 + 223:0 reduce + 181:316,target 135 + 7:418,target 22 + 236:316,target 170 + 76:0,target 123 + 70:374,target 56 + 160:316 reduce + 159:316 reduce + 31:316,target 81 + 76:316,target 123 + 38:340 shift + 0:339,target 67 + 11:346,target 38 + 198:267,target 203 + 63:388 reduce + 1:323,target 70 + 12:330,target 76 + 265:0 reduce + 22:365,target 49 + 130:316 reduce + 129:316 reduce + 63:391 reduce + 198:378,target 211 + 265:0,target 186 + 100:313 shift + 100:314 shift + 7:366,target 73 + 211:345,target 250 + 234:0,target 11 + 46:258,target 78 + 74:316 reduce + 44:313 shift + 0:398,target 7 + 22:323,target 29 + 193:0,target 147 + 143:0 reduce + 198:336,target 207 + 98:0 reduce + 58:261,target 81 + 1:382,target 70 + 7:324,target 73 + 185:0 reduce + 265:316 reduce + 136:316,target 37 + 10:379,target 58 + 10:380,target 59 + 14:316 reduce + 182:316,target 129 + 131:0,target 32 + 63:421 goto + 237:316,target 165 + 0:356,target 67 + 32:316,target 82 + 77:316,target 2 + 50:275 shift + 1:339,target 70 + 12:346,target 76 + 237:0 reduce + 235:316 reduce + 50:276 shift + 22:382,target 60 + 50:277 shift + 3:316 shift + 205:313 shift + 64:278,target 120 + 50:278 shift + 205:314 shift + 70:x shift + 50:280 shift + 50:279 shift + 70:y shift + 59:313,target 26 + 50:281 shift + 7:383,target 73 + 195:316 reduce + 50:282 shift + 10:337,target 34 + 146:310,target 190 + 146:309,target 189 + 50:283 shift + 38:375 shift + 50:284 shift + 0:0,target 63 + 0:314,target 67 + 50:285 shift + 73:0,target 61 + 50:286 shift + 165:316 reduce + 50:287 shift + 22:339,target 35 + 115:0 reduce + 50:288 shift + 71:0 reduce + 50:300 shift + 50:290 shift + 50:289 shift + 50:301 shift + 50:291 shift + 50:292 shift + 49:302 shift + 7:341,target 73 + 201:274,target 228 + 135:316 reduce + 50:293 shift + 49:303 shift + 38:385 shift + 50:294 shift + 49:304 shift + 262:0,target 194 + 157:0 reduce + 50:295 shift + 49:305 shift + 50:296 shift + 49:306 shift + 66:314,target 27 + 50:297 shift + 49:307 shift + 38:389 shift + 137:316,target 38 + 105:316 reduce + 50:298 shift + 49:308 shift + 0:373,target 67 + 11:379,target 58 + 11:380,target 59 + 231:0,target 16 + 183:316,target 136 + 50:299 shift + 238:316,target 166 + 80:316 reduce + 79:316 reduce + 38:393 shift + 1:356,target 70 + 209:0 reduce + 63:322,target 111 + 38:394 shift + 33:316,target 83 + 78:316,target 5 + 37:403,target 87 + 190:0,target 55 + 189:0,target 54 + 64:295,target 137 + 50:284,target 126 + 70:365,target 49 + 252:0 reduce + 158:0,target 155 + 76:307,target 114 + 0:331,target 2 + 11:337,target 34 + 1:314,target 70 + 19:316 reduce + 20:316 shift + 127:0,target 28 + 22:356,target 42 + 198:370,target 209 + 43:0 reduce + 63:381,target 111 + 241:316 reduce + 7:357,target 73 + 70:323,target 29 + 100:412,target 178 + 202:274,target 232 + 130:0 reduce + 129:0 reduce + 85:0 reduce + 10:423,target 68 + 211:316 shift + 22:314,target 27 + 138:316,target 39 + 1:373,target 70 + 12:379,target 76 + 12:380,target 76 + 184:316,target 137 + 172:0 reduce + 69:0,target 71 + 240:316,target 163 + 239:316,target 167 + 171:316 reduce + 7:315,target 73 + 80:316,target 6 + 79:316,target 3 + 38:393,target 92 + 211:326 shift + 70:382,target 60 + 38:435 goto + 10:371,target 54 + 224:0 reduce + 211:327 shift + 141:316 reduce + 211:328 shift + 258:0,target 96 + 12:337,target 76 + 211:332 shift + 22:373,target 55 + 194:310,target 190 + 194:309,target 189 + 111:316 reduce + 227:0,target 13 + 28:315,target 76 + 85:316 reduce + 100:412 goto + 60:304,target 111 + 7:374,target 73 + 70:339,target 35 + 211:338 shift + 186:0,target 131 + 55:316 reduce + 26:306,target 57 + 103:257,target 77 + 211:343 shift + 155:0,target 152 + 0:416,target 10 + 11:423,target 68 + 211:345 shift + 144:0 reduce + 63:355,target 111 + 57:396,target 153 + 25:316 shift + 170:322,target 204 + 169:322,target 113 + 140:316,target 41 + 139:316,target 40 + 124:0,target 25 + 185:316,target 138 + 241:316,target 164 + 170:433,target 216 + 35:316,target 85 + 10:y,target 25 + 246:316 reduce + 81:316,target 4 + 4:340,target 14 + 10:387,target 64 + 186:0 reduce + 55:329 shift + 0:364,target 67 + 11:371,target 54 + 216:316 reduce + 97:0,target 88 + 63:313,target 169 + 238:0 reduce + 64:286,target 128 + 205:412 goto + 50:275,target 117 + 170:381,target 213 + 169:381,target 113 + 146:310 shift + 146:309 shift + 211:363 shift + 176:316 reduce + 146:311 shift + 101:317,target 179 + 70:356,target 42 + 35:0,target 85 + 30:0 reduce + 29:0 reduce + 76:409,target 174 + 27:306,target 58 + 255:0,target 174 + 116:0 reduce + 72:0 reduce + 116:316 reduce + 70:314,target 27 + 224:0,target 10 + 211:327,target 245 + 141:316,target 42 + 61:309 shift + 186:316,target 131 + 91:316 reduce + 242:316,target 189 + 172:305,target 112 + 61:312 shift + 158:0 reduce + 36:316,target 86 + 183:0,target 136 + 82:316,target 7 + 11:387,target 64 + 50:408 goto + 1:364,target 70 + 12:371,target 76 + 49:409 goto + 152:0,target 149 + 50:292,target 134 + 49:302,target 109 + 31:316 reduce + 211:388 shift + 121:0,target 22 + 70:373,target 55 + 10:362,target 47 + 102:317,target 183 + 253:0 reduce + 252:316 reduce + 198:266,target 202 + 22:364,target 48 + 63:388,target 111 + 246:363 shift + 222:316 reduce + 170:355,target 208 + 169:355,target 113 + 7:365,target 73 + 55:376 shift + 46:257,target 77 + 142:316,target 43 + 187:316,target 130 + 182:316 reduce + 131:0 reduce + 243:316,target 195 + 86:0 reduce + 37:316,target 1 + 198:335,target 206 + 83:316,target 79 + 58:260,target 80 + 58:259,target 79 + 32:0,target 82 + 12:387,target 76 + 152:316 reduce + 7:323,target 73 + 173:0 reduce + 252:0,target 181 + 122:316 reduce + 221:0,target 114 + 0:355,target 5 + 11:362,target 47 + 225:0 reduce + 96:316 shift + 66:313 shift + 180:0,target 134 + 179:0,target 133 + 66:314 shift + 64:277,target 119 + 211:434 goto + 7:382,target 73 + 205:412,target 237 + 0:313,target 67 + 36:316 shift + 4:389,target 17 + 26:314,target 57 + 117:0,target 18 + 103:0 reduce + 143:316,target 44 + 58:0 reduce + 188:316,target 219 + 244:316,target 191 + 257:316 reduce + 84:316,target 80 + 7:339,target 73 + 201:273,target 227 + 145:0 reduce + 227:316 reduce + 66:313,target 26 + 187:0 reduce + 55:429 goto + 12:362,target 76 + 187:316 reduce + 167:432,target 197 + 64:294,target 136 + 50:283,target 125 + 38:375,target 89 + 240:0 reduce + 239:0 reduce + 199:404,target 225 + 170:388,target 214 + 169:388,target 113 + 203:271 shift + 157:316 reduce + 70:364,target 48 + 203:272 shift + 61:312,target 165 + 248:0,target 187 + 146:411 goto + 76:306,target 113 + 0:330,target 67 + 103:257 shift + 103:258 shift + 1:313,target 70 + 127:316 reduce + 103:260 shift + 103:259 shift + 31:0 reduce + 27:314,target 58 + 217:0,target 122 + 103:261 shift + 144:316,target 99 + 103:262 shift + 103:403,target 187 + 190:316,target 55 + 189:316,target 54 + 63:380,target 111 + 245:316,target 180 + 7:356,target 73 + 176:0,target 125 + 117:0 reduce + 40:316,target 89 + 39:316,target 95 + 85:316,target 84 + 73:0 reduce + 72:316 reduce + 211:x shift + 61:410 goto + 145:0,target 118 + 42:313 shift + 22:313,target 26 + 160:0 reduce + 159:0 reduce + 114:0,target 50 + 7:314,target 73 + 12:313 reduce + 34:315,target 28 + 12:314 reduce + 50:299,target 141 + 12:315 reduce + 263:316 reduce + 12:316 reduce + 10:369,target 53 + 1:313 reduce + 0:346,target 67 + 1:314 reduce + 233:316 reduce + 87:0,target 86 + 1:330,target 70 + 1:315 reduce + 254:0 reduce + 1:316 reduce + 12:323 reduce + 12:324 reduce + 198:263 shift + 198:264 shift + 198:265 shift + 193:316 reduce + 145:316,target 118 + 60:303,target 110 + 7:373,target 73 + 198:266 shift + 191:316,target 56 + 246:316,target 193 + 198:267 shift + 1:323 reduce + 12:330 reduce + 41:316,target 90 + 1:324 reduce + 86:316,target 120 + 26:305,target 57 + 163:316 reduce + 146:411,target 192 + 12:333 reduce + 167:354,target 196 + 0:415,target 9 + 12:334 reduce + 22:330,target 31 + 245:0,target 180 + 132:0 reduce + 87:0 reduce + 1:330 reduce + 57:395,target 152 + 12:337 reduce + 133:316 reduce + 1:333 reduce + 12:339 reduce + 1:334 reduce + 12:341 reduce + 174:0 reduce + 10:x,target 24 + 10:386,target 63 + 173:0,target 77 + 103:316 reduce + 1:337 reduce + 12:344 reduce + 11:369,target 53 + 77:316 reduce + 1:339 reduce + 12:346 reduce + 1:346,target 70 + 1:341 reduce + 226:0 reduce + 142:0,target 43 + 66:412 goto + 12:349 reduce + 64:285,target 127 + 1:344 reduce + 12:351 reduce + 47:316 shift + 12:352 reduce + 170:380,target 212 + 169:380,target 113 + 111:0,target 47 + 1:346 reduce + 10:344,target 37 + 192:316,target 106 + 1:349 reduce + 12:356 reduce + 247:316,target 178 + 1:351 reduce + 12:357 reduce + 17:316 reduce + 1:352 reduce + 12:358 reduce + 87:316,target 86 + 46:403,target 107 + 12:359 reduce + 22:346,target 38 + 27:305,target 58 + 104:0 reduce + 12:361 reduce + 12:362 reduce + 238:316 reduce + 84:0,target 80 + 1:356 reduce + 30:262,target 82 + 29:262,target 82 + 1:357 reduce + 6:316 reduce + 12:364 reduce + 70:313,target 26 + 1:358 reduce + 12:365 reduce + 211:326,target 244 + 38:435,target 94 + 1:359 reduce + 12:366 reduce + 53:0,target 100 + 1:361 reduce + 12:367 reduce + 208:316 shift + 172:304,target 111 + 1:362 reduce + 12:368 reduce + 12:369 reduce + 1:364 reduce + 0:380,target 67 + 0:379,target 67 + 11:386,target 63 + 12:371 reduce + 1:365 reduce + 1:366 reduce + 12:369,target 76 + 12:373 reduce + 198:322 shift + 168:316 reduce + 1:367 reduce + 12:374 reduce + 1:368 reduce + 242:0,target 189 + 1:369 reduce + 198:325 shift + 50:301,target 143 + 50:291,target 133 + 1:371 reduce + 12:377 reduce + 138:316 reduce + 1:373 reduce + 10:361,target 46 + 12:379 reduce + 12:380 reduce + 241:0 reduce + 1:374 reduce + 0:337,target 67 + 11:344,target 37 + 12:382 reduce + 147:316,target 146 + 12:383 reduce + 198:265,target 201 + 193:316,target 147 + 1:377 reduce + 12:384 reduce + 248:316,target 187 + 108:316 shift + 102:427,target 186 + 58:257 shift + 58:258 shift + 43:316,target 99 + 1:380 reduce + 1:379 reduce + 12:386 reduce + 198:335 shift + 88:316,target 200 + 83:316 reduce + 58:260 shift + 58:259 shift + 32:0 reduce + 12:387 reduce + 198:336 shift + 58:261 shift + 1:382 reduce + 194:411,target 220 + 138:0,target 39 + 58:262 shift + 1:383 reduce + 7:364,target 73 + 70:330,target 31 + 1:384 reduce + 211:343,target 249 + 12:392 reduce + 118:0 reduce + 53:316 reduce + 1:386 reduce + 107:0,target 95 + 74:0 reduce + 1:387 reduce + 55:429,target 149 + 6:0 reduce + 58:258,target 78 + 1:392 reduce + 1:380,target 70 + 1:379,target 70 + 12:386,target 76 + 23:316 shift + 161:0 reduce + 7:0,target 72 + 244:316 reduce + 81:0,target 4 + 10:377,target 57 + 203:405 goto + 198:355 shift + 11:361,target 46 + 214:316 shift + 103:316,target 1 + 1:337,target 70 + 12:419 goto + 12:344,target 76 + 148:316,target 193 + 22:379,target 58 + 22:380,target 59 + 204:316,target 161 + 62:431,target 168 + 255:0 reduce + 250:316,target 179 + 249:316,target 185 + 64:276,target 118 + 1:417 goto + 174:316 reduce + 90:316,target 199 + 89:316,target 198 + 70:346,target 38 + 238:0,target 166 + 46:0 reduce + 26:313,target 57 + 144:316 reduce + 103:403 goto + 198:370 shift + 197:0,target 158 + 22:337,target 34 + 133:0 reduce + 198:374 shift + 166:0,target 109 + 114:316 reduce + 88:316 reduce + 198:378 shift + 135:0,target 36 + 198:380 shift + 175:0 reduce + 198:381 shift + 0:371,target 67 + 11:377,target 57 + 212:412,target 254 + 58:316 reduce + 104:0,target 92 + 12:361,target 76 + 52:412,target 146 + 104:316,target 92 + 43:350,target 101 + 227:0 reduce + 150:316,target 103 + 149:316,target 102 + 64:293,target 135 + 28:315 shift + 195:316,target 160 + 50:282,target 124 + 251:316,target 182 + 198:388 shift + 45:316,target 106 + 10:352,target 41 + 198:391 shift + 91:316,target 201 + 76:305,target 112 + 64:275 shift + 250:316 reduce + 249:316 reduce + 77:0,target 2 + 64:276 shift + 64:277 shift + 64:278 shift + 63:267,target 111 + 27:313,target 58 + 64:280 shift + 64:279 shift + 64:281 shift + 46:0,target 1 + 244:363 shift + 220:316 reduce + 219:316 shift + 105:0 reduce + 64:282 shift + 63:378,target 111 + 57:430,target 160 + 64:283 shift + 64:284 shift + 64:285 shift + 202:272,target 231 + 64:286 shift + 180:316 reduce + 179:316 reduce + 64:287 shift + 147:0 reduce + 64:288 shift + 235:0,target 12 + 64:300 shift + 64:290 shift + 64:289 shift + 0:387,target 67 + 64:301 shift + 64:291 shift + 198:325,target 205 + 64:292 shift + 1:371,target 70 + 12:377,target 76 + 213:412,target 255 + 150:316 reduce + 149:316 reduce + 64:293 shift + 63:336,target 111 + 22:423,target 68 + 204:0,target 161 + 64:294 shift + 7:313,target 73 + 190:0 reduce + 189:0 reduce + 64:295 shift + 34:314,target 27 + 105:316,target 93 + 64:296 shift + 50:298,target 140 + 49:308,target 115 + 151:316,target 148 + 64:297 shift + 206:316,target 238 + 196:316,target 159 + 163:0,target 108 + 120:316 reduce + 119:316 reduce + 70:380,target 59 + 70:379,target 58 + 64:298 shift + 10:368,target 52 + 252:316,target 181 + 64:299 shift + 94:316 shift + 46:316,target 1 + 11:352,target 41 + 242:0 reduce + 92:316,target 197 + 132:0,target 33 + 22:371,target 54 + 198:433 goto + 60:302,target 109 + 34:313 shift + 33:0 reduce + 70:337,target 34 + 34:314 shift + 34:315 shift + 26:304,target 57 + 203:272,target 235 + 120:0 reduce + 119:0 reduce + 75:0 reduce + 1:0,target 69 + 255:316 reduce + 74:0,target 117 + 1:387,target 70 + 7:0 reduce + 7:330,target 73 + 43:0,target 127 + 249:363 shift + 225:316 reduce + 106:316,target 94 + 152:316,target 149 + 263:0,target 183 + 207:316,target 239 + 197:316,target 158 + 0:362,target 67 + 11:368,target 52 + 12:0,target 75 + 253:316,target 175 + 185:316 reduce + 47:316,target 108 + 12:352,target 76 + 93:316,target 196 + 22:387,target 64 + 232:0,target 17 + 170:267,target 203 + 169:267,target 113 + 64:284,target 126 + 256:0 reduce + 170:378,target 211 + 169:378,target 113 + 155:316 reduce + 191:0,target 56 + 201:273 shift + 201:274 shift + 101:426,target 182 + 160:0,target 104 + 159:0,target 156 + 125:316 reduce + 27:304,target 58 + 99:316 shift + 58:403 goto + 128:0,target 29 + 70:313 shift + 63:370,target 111 + 170:336,target 207 + 169:336,target 113 + 70:314 shift + 30:261,target 81 + 29:261,target 81 + 7:346,target 73 + 134:0 reduce + 70:315 shift + 69:316 reduce + 172:303,target 110 + 70:423,target 68 + 10:412,target 66 + 107:316,target 95 + 176:0 reduce + 153:316,target 150 + 40:316 reduce + 39:316 shift + 208:316,target 240 + 70:323 shift + 1:362,target 70 + 12:368,target 76 + 254:316,target 173 + 70:324 shift + 10:313 shift + 48:316,target 97 + 10:314 shift + 94:316,target 175 + 10:315 shift + 261:316 reduce + 71:0,target 66 + 50:300,target 142 + 50:290,target 132 + 50:289,target 131 + 228:0 reduce + 70:371,target 54 + 70:330 shift + 10:359,target 45 + 40:0,target 89 + 231:316 reduce + 70:333 shift + 198:264,target 200 + 70:334 shift + 10:323 shift + 10:324 shift + 22:362,target 47 + 260:0,target 192 + 259:0,target 190 + 70:337 shift + 191:316 reduce + 38:340,target 88 + 70:339 shift + 228:0,target 14 + 106:0 reduce + 70:341 shift + 10:330 shift + 161:316 reduce + 70:344 shift + 10:333 shift + 187:0,target 130 + 10:334 shift + 70:346 shift + 0:y,target 67 + 11:412,target 66 + 108:316,target 188 + 58:257,target 77 + 10:337 shift + 156:0,target 153 + 154:316,target 151 + 131:316 reduce + 70:349 shift + 210:316,target 241 + 209:316,target 162 + 70:351 shift + 10:339 shift + 255:316,target 174 + 70:352 shift + 10:341 shift + 191:0 reduce + 169:422,target 198 + 125:0,target 26 + 95:316,target 126 + 70:387,target 64 + 10:344 shift + 101:317 shift + 70:356 shift + 55:376,target 148 + 101:318 shift + 75:316 reduce + 70:357 shift + 64:408 goto + 0:353,target 4 + 10:346 shift + 11:359,target 45 + 11:y,target 25 + 101:320 shift + 70:358 shift + 37:262,target 82 + 70:359 shift + 243:0 reduce + 70:361 shift + 39:355 shift + 10:349 shift + 70:362 shift + 10:351 shift + 64:275,target 117 + 45:316 shift + 10:352 shift + 98:0,target 91 + 70:364 shift + 170:370,target 209 + 169:370,target 113 + 70:365 shift + 7:379,target 73 + 7:380,target 73 + 70:366 shift + 34:412 goto + 10:334,target 33 + 70:367 shift + 7:x reduce + 10:356 shift + 70:368 shift + 67:0,target 68 + 7:y reduce + 10:357 shift + 15:316 reduce + 70:369 shift + 10:358 shift + 70:371 shift + 10:359 shift + 162:412,target 194 + 10:361 shift + 121:0 reduce + 70:373 shift + 10:362 shift + 236:316 reduce + 76:0 reduce + 70:374 shift + 10:364 shift + 110:316,target 46 + 109:316,target 45 + 7:337,target 73 + 10:365 shift + 256:0,target 176 + 155:316,target 152 + 70:377 shift + 34:423 goto + 8:0 accept + 10:366 shift + 211:316,target 243 + 10:367 shift + 256:316,target 176 + 206:316 shift + 196:316 reduce + 163:0 reduce + 70:380 shift + 70:379 shift + 10:368 shift + 51:316,target 145 + 10:369 shift + 225:0,target 168 + 96:316,target 176 + 70:382 shift + 10:371 shift + 70:383 shift + 0:369,target 67 + 70:384 shift + 10:373 shift + 166:316 reduce + 10:374 shift + 12:359,target 76 + 184:0,target 137 + 70:386 shift + 70:387 shift + 64:292,target 134 + 10:377 shift + 70:y,target 25 + 50:281,target 123 + 153:0,target 150 + 136:316 reduce + 10:379 shift + 10:380 shift + 70:392 shift + 70:362,target 47 + 10:351,target 40 +} + +array set cat::rules { + 9,l 404 + 164,l 433 + 49,l 409 + 50,l 409 + 136,l 427 + 92,l 420 + 178,l 434 + 22,l 408 + 108,l 420 + 64,l 415 + 151,l 430 + 193,l 434 + 36,l 408 + 123,l 423 + 78,l 420 + 165,l 433 + 51,l 409 + 137,l 427 + 93,l 420 + 180,l 434 + 179,l 434 + 23,l 408 + 109,l 420 + 110,l 420 + 65,l 415 + 152,l 430 + 194,l 434 + 37,l 408 + 124,l 423 + 79,l 420 + 80,l 420 + 166,l 433 + 10,l 404 + 52,l 410 + 138,l 427 + 94,l 420 + 181,l 434 + 24,l 408 + 111,l 421 + 66,l 415 + 153,l 430 + 195,l 434 + 38,l 408 + 125,l 424 + 81,l 420 + 167,l 433 + 11,l 405 + 53,l 410 + 139,l 428 + 140,l 428 + 95,l 420 + 182,l 434 + 25,l 408 + 112,l 420 + 67,l 416 + 0,l 436 + 154,l 430 + 196,l 435 + 39,l 408 + 40,l 408 + 126,l 424 + 82,l 420 + 168,l 433 + 12,l 405 + 54,l 411 + 141,l 428 + 96,l 420 + 183,l 434 + 26,l 408 + 113,l 422 + 68,l 415 + 1,l 403 + 155,l 430 + 197,l 435 + 41,l 408 + 127,l 425 + 83,l 420 + 170,l 433 + 169,l 433 + 13,l 406 + 100,l 420 + 55,l 411 + 142,l 428 + 97,l 420 + 184,l 434 + 27,l 408 + 114,l 420 + 69,l 415 + 70,l 417 + 2,l 403 + 156,l 430 + 198,l 435 + 42,l 408 + 128,l 425 + 84,l 420 + 171,l 433 + 14,l 406 + 101,l 420 + 56,l 411 + 143,l 428 + 98,l 420 + 185,l 434 + 28,l 408 + 115,l 420 + 71,l 415 + 3,l 403 + 157,l 431 + 199,l 435 + 43,l 408 + 129,l 425 + 130,l 425 + 85,l 420 + 172,l 433 + 15,l 407 + 102,l 420 + 57,l 412 + 144,l 428 + 99,l 420 + 186,l 434 + 30,l 408 + 29,l 408 + 116,l 420 + 72,l 415 + 4,l 403 + 158,l 431 + 44,l 408 + 131,l 425 + 86,l 420 + 173,l 433 + 16,l 407 + 103,l 420 + 58,l 412 + 145,l 429 + 187,l 434 + 31,l 408 + 117,l 420 + 73,l 418 + 5,l 403 + 160,l 432 + 159,l 432 + 45,l 409 + 132,l 425 + 87,l 420 + 174,l 433 + 17,l 407 + 104,l 420 + 59,l 413 + 60,l 414 + 146,l 429 + 188,l 434 + 32,l 408 + 118,l 420 + 74,l 415 + 6,l 403 + 161,l 433 + 46,l 409 + 133,l 426 + 88,l 420 + 175,l 433 + 18,l 408 + 105,l 420 + 61,l 413 + 147,l 429 + 200,l 435 + 190,l 434 + 189,l 434 + 33,l 408 + 119,l 420 + 120,l 420 + 75,l 415 + 7,l 403 + 162,l 433 + 47,l 409 + 134,l 426 + 89,l 420 + 90,l 420 + 176,l 433 + 20,l 408 + 19,l 408 + 106,l 420 + 62,l 415 + 148,l 430 + 201,l 435 + 191,l 434 + 34,l 408 + 121,l 423 + 76,l 419 + 8,l 404 + 163,l 433 + 48,l 409 + 135,l 426 + 91,l 420 + 177,l 433 + 21,l 408 + 107,l 420 + 63,l 415 + 149,l 430 + 150,l 430 + 192,l 434 + 35,l 408 + 122,l 423 + 77,l 415 +} + +array set cat::rules { + 122,dc 3 + 187,dc 1 + 12,dc 1 + 77,dc 4 + 114,dc 4 + 180,dc 1 + 179,dc 1 + 69,dc 1 + 70,dc 0 + 106,dc 3 + 9,dc 1 + 172,dc 2 + 62,dc 1 + 2,dc 1 + 164,dc 2 + 54,dc 1 + 156,dc 1 + 46,dc 1 + 148,dc 1 + 38,dc 1 + 141,dc 1 + 31,dc 1 + 96,dc 5 + 133,dc 1 + 198,dc 1 + 23,dc 1 + 88,dc 2 + 125,dc 2 + 201,dc 1 + 191,dc 1 + 15,dc 1 + 81,dc 1 + 117,dc 2 + 183,dc 2 + 73,dc 0 + 109,dc 2 + 110,dc 2 + 175,dc 2 + 65,dc 2 + 102,dc 2 + 5,dc 1 + 167,dc 2 + 57,dc 1 + 160,dc 1 + 159,dc 1 + 49,dc 1 + 50,dc 1 + 152,dc 1 + 42,dc 1 + 144,dc 1 + 34,dc 1 + 99,dc 2 + 136,dc 1 + 26,dc 1 + 92,dc 2 + 128,dc 3 + 194,dc 2 + 18,dc 1 + 84,dc 2 + 121,dc 2 + 186,dc 2 + 11,dc 1 + 76,dc 0 + 113,dc 0 + 178,dc 1 + 68,dc 2 + 105,dc 2 + 8,dc 1 + 171,dc 2 + 61,dc 3 + 1,dc 0 + 163,dc 2 + 53,dc 1 + 155,dc 1 + 45,dc 1 + 147,dc 2 + 37,dc 1 + 139,dc 1 + 140,dc 1 + 30,dc 1 + 29,dc 1 + 95,dc 2 + 132,dc 2 + 197,dc 1 + 22,dc 1 + 87,dc 3 + 124,dc 3 + 200,dc 1 + 190,dc 2 + 189,dc 1 + 14,dc 1 + 79,dc 2 + 80,dc 2 + 116,dc 1 + 182,dc 1 + 72,dc 1 + 108,dc 2 + 174,dc 2 + 64,dc 2 + 101,dc 1 + 4,dc 1 + 166,dc 2 + 56,dc 1 + 158,dc 2 + 48,dc 1 + 151,dc 1 + 41,dc 1 + 143,dc 1 + 33,dc 1 + 98,dc 2 + 135,dc 1 + 25,dc 1 + 91,dc 2 + 127,dc 0 + 193,dc 1 + 17,dc 1 + 83,dc 1 + 119,dc 2 + 120,dc 2 + 185,dc 1 + 10,dc 1 + 75,dc 2 + 112,dc 3 + 177,dc 2 + 67,dc 0 + 104,dc 2 + 7,dc 1 + 170,dc 2 + 169,dc 2 + 59,dc 1 + 60,dc 0 + 0,dc 1 + 162,dc 1 + 52,dc 1 + 154,dc 1 + 44,dc 1 + 146,dc 1 + 36,dc 1 + 138,dc 1 + 28,dc 1 + 94,dc 2 + 131,dc 2 + 196,dc 1 + 21,dc 1 + 86,dc 2 + 123,dc 2 + 188,dc 2 + 13,dc 1 + 78,dc 1 + 115,dc 2 + 181,dc 1 + 71,dc 3 + 107,dc 4 + 173,dc 2 + 63,dc 0 + 100,dc 1 + 3,dc 1 + 165,dc 2 + 55,dc 1 + 157,dc 1 + 47,dc 1 + 149,dc 1 + 150,dc 1 + 39,dc 1 + 40,dc 1 + 142,dc 1 + 32,dc 1 + 97,dc 1 + 134,dc 1 + 199,dc 1 + 24,dc 1 + 89,dc 1 + 90,dc 1 + 126,dc 1 + 192,dc 2 + 16,dc 1 + 82,dc 1 + 118,dc 2 + 184,dc 2 + 74,dc 3 + 111,dc 0 + 176,dc 2 + 66,dc 3 + 103,dc 2 + 6,dc 1 + 168,dc 2 + 58,dc 1 + 161,dc 1 + 51,dc 1 + 153,dc 1 + 43,dc 1 + 145,dc 0 + 35,dc 1 + 137,dc 1 + 27,dc 1 + 93,dc 2 + 129,dc 2 + 130,dc 2 + 195,dc 1 + 20,dc 1 + 19,dc 1 + 85,dc 1 +} + +array set cat::rules { + 41,line 292 + 37,line 288 + 34,line 285 + 31,line 282 + 27,line 278 + 24,line 275 + 21,line 272 + 17,line 266 + 14,line 261 + 11,line 256 + 9,line 252 + 6,line 248 + 3,line 245 + 198,line 493 + 195,line 488 + 192,line 483 + 188,line 479 + 185,line 476 + 182,line 473 + 178,line 468 + 175,line 463 + 172,line 460 + 168,line 455 + 165,line 452 + 162,line 448 + 158,line 440 + 155,line 435 + 152,line 432 + 148,line 428 + 111,e 1 + 145,line 423 + 142,line 418 + 138,line 412 + 135,line 407 + 132,line 402 + 128,line 398 + 125,line 393 + 122,line 388 + 118,line 382 + 115,line 379 + 99,line 364 + 112,line 377 + 96,line 361 + 108,line 374 + 93,line 358 + 105,line 370 + 89,line 354 + 90,line 355 + 102,line 367 + 86,line 350 + 83,line 347 + 79,line 342 + 80,line 343 + 67,e 0 + 76,line 337 + 73,line 333 + 69,line 329 + 70,line 329 + 66,line 327 + 63,line 323 + 59,line 317 + 60,line 317 + 56,line 311 + 53,line 306 + 49,line 301 + 50,line 302 + 46,line 298 + 43,line 294 + 39,line 290 + 40,line 291 + 36,line 287 + 33,line 284 + 30,line 281 + 29,line 280 + 26,line 277 + 113,e 2 + 23,line 274 + 20,line 271 + 19,line 270 + 16,line 265 + 13,line 260 + 10,line 253 + 8,line 251 + 5,line 247 + 2,line 244 + 70,e 1 + 197,line 492 + 194,line 487 + 201,line 496 + 191,line 482 + 187,line 478 + 184,line 475 + 181,line 472 + 177,line 465 + 174,line 462 + 171,line 459 + 167,line 454 + 164,line 451 + 161,line 447 + 157,line 439 + 154,line 434 + 151,line 431 + 147,line 425 + 144,line 420 + 141,line 417 + 137,line 411 + 134,line 406 + 131,line 401 + 127,line 397 + 124,line 390 + 121,line 387 + 117,line 381 + 114,line 378 + 98,line 363 + 111,line 376 + 95,line 360 + 107,line 373 + 92,line 357 + 104,line 369 + 88,line 352 + 101,line 366 + 85,line 349 + 82,line 345 + 78,line 341 + 75,line 337 + 72,line 333 + 68,line 328 + 65,line 325 + 62,line 322 + 58,line 314 + 55,line 310 + 52,line 305 + 48,line 300 + 45,line 297 + 42,line 293 + 38,line 289 + 73,e 1 + 35,line 286 + 32,line 283 + 28,line 279 + 25,line 276 + 22,line 273 + 18,line 269 + 15,line 264 + 12,line 257 + 60,e 1 + 7,line 249 + 4,line 246 + 1,line 243 + 199,line 494 + 196,line 491 + 193,line 484 + 200,line 495 + 190,line 481 + 189,line 480 + 186,line 477 + 183,line 474 + 180,line 470 + 179,line 469 + 176,line 464 + 173,line 461 + 170,line 457 + 169,line 456 + 166,line 453 + 163,line 449 + 160,line 444 + 159,line 443 + 156,line 436 + 153,line 433 + 149,line 429 + 150,line 430 + 146,line 424 + 143,line 419 + 139,line 415 + 140,line 416 + 136,line 410 + 133,line 405 + 129,line 399 + 130,line 400 + 126,line 394 + 123,line 389 + 119,line 383 + 120,line 384 + 116,line 380 + 76,e 2 + 113,line 377 + 97,line 362 + 109,line 375 + 110,line 376 + 94,line 359 + 106,line 372 + 91,line 356 + 103,line 368 + 87,line 351 + 100,line 365 + 84,line 348 + 81,line 344 + 77,line 338 + 74,line 335 + 71,line 332 + 67,line 327 + 64,line 324 + 61,line 318 + 57,line 313 + 54,line 309 + 51,line 303 + 47,line 299 + 44,line 295 +} + +array set cat::lr1_table { + 66,trans {{313 174} {314 175} {412 176}} + 35 {{85 {0 316} 1}} + 85,trans {} + 36 {{120 {0 316} 1}} + 37 {{86 {0 316} 1} {1 {0 316} 0} {2 {0 316} 0} {3 {0 316} 0} {4 {0 316} 0} {5 {0 316} 0} {6 {0 316} 0} {7 {0 316} 0}} + 38 {{87 {0 316} 1} {196 316 0} {197 316 0} {198 316 0} {199 316 0} {200 316 0} {201 316 0}} + 39 {{88 {0 316} 1} {125 {0 316} 0} {126 {0 316} 0}} + 40 {{89 {0 316} 1}} + 117,trans {} + 41 {{90 {0 316} 1}} + 136,trans {} + 42 {{91 {0 316} 1}} + 155,trans {} + 43 {{92 {0 316} 1} {127 {0 316} 0} {128 {0 316} 0} {129 {0 316} 0} {130 {0 316} 0} {131 {0 316} 0} {132 {0 316} 0}} + 174,trans {} + 44 {{93 {0 316} 1}} + 203,trans {{268 226} {269 227} {270 228} {404 229}} + 193,trans {} + 45 {{94 {0 316} 1}} + 222,trans {} + 46 {{95 {0 316} 1} {1 {0 316} 0} {2 {0 316} 0} {3 {0 316} 0} {4 {0 316} 0} {5 {0 316} 0} {6 {0 316} 0} {7 {0 316} 0}} + 241,trans {} + 47 {{96 {0 316} 1}} + 260,trans {} + 259,trans {} + 48 {{97 {0 316} 1}} + 49 {{98 {0 316} 1} {45 {0 316} 0} {46 {0 316} 0} {47 {0 316} 0} {48 {0 316} 0} {49 {0 316} 0} {50 {0 316} 0} {51 {0 316} 0}} + 50 {{99 {0 316} 1} {18 {0 316} 0} {19 {0 316} 0} {20 {0 316} 0} {21 {0 316} 0} {22 {0 316} 0} {23 {0 316} 0} {24 {0 316} 0} {25 {0 316} 0} {26 {0 316} 0} {27 {0 316} 0} {28 {0 316} 0} {29 {0 316} 0} {30 {0 316} 0} {31 {0 316} 0} {32 {0 316} 0} {33 {0 316} 0} {34 {0 316} 0} {35 {0 316} 0} {36 {0 316} 0} {37 {0 316} 0} {38 {0 316} 0} {39 {0 316} 0} {40 {0 316} 0} {41 {0 316} 0} {42 {0 316} 0} {43 {0 316} 0} {44 {0 316} 0}} + 27,trans {} + 51 {{118 {0 316} 1}} + 46,trans {{257 77} {258 78} {259 79} {260 80} {261 81} {262 82} {403 107}} + 65,trans {} + 52 {{106 {0 316} 1} {57 {309 310 311} 0} {58 {309 310 311} 0}} + 84,trans {} + 53 {{100 {0 316} 1}} + 54 {{101 {0 316} 1}} + 55 {{102 {0 316} 1} {145 {0 316} 0} {146 {0 316} 0} {147 {0 316} 0}} + 56 {{103 {0 316} 1}} + 116,trans {} + 57 {{104 {0 316} 1} {148 {0 316} 0} {149 {0 316} 0} {150 {0 316} 0} {151 {0 316} 0} {152 {0 316} 0} {153 {0 316} 0} {154 {0 316} 0} {155 {0 316} 0} {156 {0 316} 0}} + 135,trans {} + 58 {{105 {0 316} 1} {1 {0 316} 0} {2 {0 316} 0} {3 {0 316} 0} {4 {0 316} 0} {5 {0 316} 0} {6 {0 316} 0} {7 {0 316} 0}} + 154,trans {} + 59 {{107 {0 316} 1} {57 {313 314} 0} {58 {313 314} 0}} + 60 {{108 {0 316} 1} {45 {0 316} 0} {46 {0 316} 0} {47 {0 316} 0} {48 {0 316} 0} {49 {0 316} 0} {50 {0 316} 0} {51 {0 316} 0}} + 173,trans {} + 61 {{109 {0 316} 1} {52 {0 316} 0} {53 {0 316} 0}} + 202,trans {{263 203} {264 204} {265 205} {266 206} {267 207} {322 208} {325 209} {335 210} {336 211} {355 212} {370 213} {374 214} {378 215} {380 216} {381 217} {388 218} {391 219} {433 225}} + 192,trans {{316 223}} + 62 {{110 {0 316} 1} {157 {0 316} 0} {158 {0 316} 0}} + 221,trans {} + 63 {{112 {0 316} 1} {114 {0 316} 1} {111 {263 264 265 266 267 322 325 335 336 355 370 374 378 380 381 388 391} 0}} + 240,trans {} + 239,trans {} + 64 {{115 {0 316} 1} {18 {0 316} 0} {19 {0 316} 0} {20 {0 316} 0} {21 {0 316} 0} {22 {0 316} 0} {23 {0 316} 0} {24 {0 316} 0} {25 {0 316} 0} {26 {0 316} 0} {27 {0 316} 0} {28 {0 316} 0} {29 {0 316} 0} {30 {0 316} 0} {31 {0 316} 0} {32 {0 316} 0} {33 {0 316} 0} {34 {0 316} 0} {35 {0 316} 0} {36 {0 316} 0} {37 {0 316} 0} {38 {0 316} 0} {39 {0 316} 0} {40 {0 316} 0} {41 {0 316} 0} {42 {0 316} 0} {43 {0 316} 0} {44 {0 316} 0}} + 258,trans {} + 65 {{116 {0 316} 1}} + 66 {{121 {0 316} 1} {122 {0 316} 1} {57 {0 302 303 304 305 306 307 308 316} 0} {58 {0 302 303 304 305 306 307 308 316} 0}} + 26,trans {} + 67 {{68 {0 316} 2}} + 45,trans {{316 106}} + 64,trans {{275 117} {276 118} {277 119} {278 120} {279 121} {280 122} {281 123} {282 124} {283 125} {284 126} {285 127} {286 128} {287 129} {288 130} {289 131} {290 132} {291 133} {292 134} {293 135} {294 136} {295 137} {296 138} {297 139} {298 140} {299 141} {300 142} {301 143} {408 173}} + 68 {{78 {0 316} 1}} + 83,trans {} + 69 {{71 {0 316} 3}} + 70 {{77 {0 316} 3} {78 {0 316} 0} {79 {0 316} 0} {80 {0 316} 0} {81 {0 316} 0} {82 {0 316} 0} {83 {0 316} 0} {84 {0 316} 0} {85 {0 316} 0} {86 {0 316} 0} {87 {0 316} 0} {88 {0 316} 0} {89 {0 316} 0} {90 {0 316} 0} {91 {0 316} 0} {92 {0 316} 0} {93 {0 316} 0} {94 {0 316} 0} {95 {0 316} 0} {96 {0 316} 0} {97 {0 316} 0} {98 {0 316} 0} {99 {0 316} 0} {100 {0 316} 0} {101 {0 316} 0} {102 {0 316} 0} {103 {0 316} 0} {104 {0 316} 0} {105 {0 316} 0} {106 {0 316} 0} {107 {0 316} 0} {108 {0 316} 0} {109 {0 316} 0} {110 {0 316} 0} {112 {0 316} 0} {114 {0 316} 0} {115 {0 316} 0} {116 {0 316} 0} {117 {0 316} 0} {118 {0 316} 0} {119 {0 316} 0} {120 {0 316} 0} {121 {0 316} 0} {122 {0 316} 0} {123 {0 316} 0} {124 {0 316} 0} {57 {313 314} 0} {58 {313 314} 0}} + 71 {{66 {0 316} 3}} + 72 {{74 {0 316} 3}} + 73 {{61 0 3}} + 115,trans {} + 74 {{117 {0 316} 2}} + 134,trans {} + 75 {{119 {0 316} 2}} + 153,trans {} + 76 {{123 {0 316} 2} {124 {0 316} 2} {45 {0 316} 0} {46 {0 316} 0} {47 {0 316} 0} {48 {0 316} 0} {49 {0 316} 0} {50 {0 316} 0} {51 {0 316} 0}} + 172,trans {{263 203} {264 204} {265 205} {266 206} {267 207} {322 208} {325 209} {335 210} {336 211} {355 212} {370 213} {374 214} {378 215} {380 216} {381 217} {388 218} {391 219} {433 220}} + 77 {{2 {0 316} 1}} + 201,trans {} + 191,trans {} + 78 {{5 {0 316} 1}} + 220,trans {} + 219,trans {{316 263}} + 79 {{3 {0 316} 1}} + 80 {{6 {0 316} 1}} + 238,trans {} + 81 {{4 {0 316} 1}} + 257,trans {} + 82 {{7 {0 316} 1}} + 25,trans {{316 75}} + 83 {{79 {0 316} 2}} + 84 {{80 {0 316} 2}} + 44,trans {{313 105}} + 63,trans {{313 171} {421 172}} + 85 {{84 {0 316} 2}} + 82,trans {} + 86 {{120 {0 316} 2}} + 87 {{86 {0 316} 2}} + 0 {{0 0 0} {59 0 0} {61 0 0} {62 {0 316} 0} {63 {0 316} 0} {64 {0 316} 0} {65 {0 316} 0} {66 {0 316} 0} {68 {0 316} 0} {69 {0 316} 0} {71 {0 316} 0} {72 {0 316} 0} {74 {0 316} 0} {75 {0 316} 0} {77 {0 316} 0} {67 {313 314 315 323 324 330 333 334 337 339 341 344 346 349 351 352 356 357 358 359 361 362 364 365 366 367 368 369 371 373 374 377 379 380 382 383 384 386 387 392 x y} 0}} + 88 {{200 316 1}} + 1 {{69 {0 316} 1} {71 {0 316} 1} {70 {313 314 315 323 324 330 333 334 337 339 341 344 346 349 351 352 356 357 358 359 361 362 364 365 366 367 368 369 371 373 374 377 379 380 382 383 384 386 387 392 x y} 0}} + 89 {{198 316 1}} + 90 {{199 316 1}} + 114,trans {} + 2 {{75 {0 316} 1} {77 {0 316} 1}} + 91 {{201 316 1}} + 133,trans {} + 3 {{64 {0 316} 1}} + 92 {{197 316 1}} + 152,trans {} + 4 {{66 {0 316} 1} {139 316 0} {140 316 0} {141 316 0} {142 316 0} {143 316 0} {144 316 0}} + 93 {{196 316 1}} + 171,trans {{422 202}} + 5 {{65 {0 316} 1}} + 94 {{87 {0 316} 2}} + 200,trans {} + 190,trans {} + 189,trans {} + 6 {{62 {0 316} 1}} + 95 {{126 {0 316} 1}} + 218,trans {{316 262}} + 7 {{72 {0 316} 1} {74 {0 316} 1} {73 {313 314 315 323 324 330 333 334 337 339 341 344 346 349 351 352 356 357 358 359 361 362 364 365 366 367 368 369 371 373 374 377 379 380 382 383 384 386 387 392 x y} 0}} + 96 {{125 {0 316} 1}} + 237,trans {} + 8 {{0 0 1}} + 97 {{88 {0 316} 2}} + 256,trans {} + 9 {{59 0 1} {61 0 1} {60 316 0}} + 98 {{91 {0 316} 2}} + 24,trans {{316 74}} + 99 {{132 {0 316} 1}} + 43,trans {{316 99} {347 100} {350 101} {372 102} {390 103} {425 104}} + 62,trans {{316 169} {431 170}} + 81,trans {} + 99,trans {{316 181}} + 113,trans {} + 132,trans {} + 151,trans {} + 170,trans {} + 169,trans {{342 199} {354 200} {432 201}} + 188,trans {} + 217,trans {{313 241} {314 242} {412 261}} + 236,trans {} + 255,trans {{363 271}} + 23,trans {{316 73}} + 42,trans {{313 98}} + 61,trans {{309 166} {312 167} {410 168}} + 80,trans {} + 79,trans {} + 98,trans {} + 9,trans {{414 23}} + 112,trans {} + 131,trans {} + 150,trans {{316 197}} + 149,trans {} + 168,trans {} + 187,trans {} + 216,trans {{313 241} {314 242} {412 260}} + 235,trans {} + 254,trans {{363 270}} + 22,trans {{x 24} {y 25} {313 26} {314 27} {315 28} {323 29} {324 30} {330 31} {333 32} {334 33} {337 34} {339 35} {341 36} {344 37} {346 38} {349 39} {351 40} {352 41} {356 42} {357 43} {358 44} {359 45} {361 46} {362 47} {364 48} {365 49} {366 50} {367 51} {368 52} {369 53} {371 54} {373 55} {374 56} {377 57} {379 58} {380 59} {382 60} {383 61} {384 62} {386 63} {387 64} {392 65} {412 66} {420 72} {423 68}} + 41,trans {} + 60,trans {{302 109} {303 110} {304 111} {305 112} {306 113} {307 114} {308 115} {409 165}} + 59,trans {{313 26} {314 27} {412 164}} + 78,trans {} + 97,trans {} + 8,trans {} + 111,trans {} + 130,trans {} + 129,trans {} + 148,trans {{309 193} {310 194} {311 195} {411 196}} + 100 {{128 {0 316} 1} {57 {309 310 311} 0} {58 {309 310 311} 0}} + 167,trans {} + 101 {{129 {0 316} 1} {133 {0 316} 0} {134 {0 316} 0} {135 {0 316} 0}} + 186,trans {} + 102 {{131 {0 316} 1} {136 {0 316} 0} {137 {0 316} 0} {138 {0 316} 0}} + 215,trans {{x 248} {316 249} {326 250} {327 251} {328 252} {332 253} {338 254} {343 255} {345 256} {363 257} {388 258} {434 259}} + 103 {{130 {0 316} 1} {1 {0 316} 0} {2 {0 316} 0} {3 {0 316} 0} {4 {0 316} 0} {5 {0 316} 0} {6 {0 316} 0} {7 {0 316} 0}} + 234,trans {} + 104 {{92 {0 316} 2}} + 253,trans {{363 269}} + 105 {{93 {0 316} 2}} + 21,trans {} + 106 {{94 {0 316} 2}} + 39,trans {{316 95} {355 96} {424 97}} + 40,trans {} + 107 {{95 {0 316} 2}} + 58,trans {{257 77} {258 78} {259 79} {260 80} {261 81} {262 82} {403 163}} + 108 {{96 {0 316} 2}} + 77,trans {} + 109 {{45 {0 316} 1}} + 110 {{46 {0 316} 1}} + 96,trans {{316 180}} + 7,trans {{418 22}} + 111 {{47 {0 316} 1}} + 112 {{48 {0 316} 1}} + 113 {{49 {0 316} 1}} + 110,trans {} + 109,trans {} + 114 {{50 {0 316} 1}} + 128,trans {} + 115 {{51 {0 316} 1}} + 147,trans {} + 116 {{98 {0 316} 2}} + 166,trans {} + 117 {{18 {0 316} 1}} + 185,trans {} + 118 {{19 {0 316} 1}} + 214,trans {{316 247}} + 119 {{20 {0 316} 1}} + 120 {{21 {0 316} 1}} + 233,trans {} + 121 {{22 {0 316} 1}} + 252,trans {{363 268}} + 122 {{23 {0 316} 1}} + 271,trans {} + 19,trans {} + 20,trans {{316 71}} + 123 {{24 {0 316} 1}} + 38,trans {{340 88} {375 89} {385 90} {389 91} {393 92} {394 93} {435 94}} + 124 {{25 {0 316} 1}} + 57,trans {{331 153} {395 154} {396 155} {397 156} {398 157} {399 158} {400 159} {401 160} {402 161} {430 162}} + 125 {{26 {0 316} 1}} + 76,trans {{302 109} {303 110} {304 111} {305 112} {306 113} {307 114} {308 115} {409 178}} + 126 {{27 {0 316} 1}} + 95,trans {} + 6,trans {} + 127 {{28 {0 316} 1}} + 128 {{29 {0 316} 1}} + 129 {{30 {0 316} 1}} + 130 {{31 {0 316} 1}} + 108,trans {{316 192}} + 131 {{32 {0 316} 1}} + 127,trans {} + 132 {{33 {0 316} 1}} + 146,trans {} + 133 {{34 {0 316} 1}} + 165,trans {} + 134 {{35 {0 316} 1}} + 184,trans {} + 135 {{36 {0 316} 1}} + 213,trans {} + 136 {{37 {0 316} 1}} + 232,trans {} + 137 {{38 {0 316} 1}} + 251,trans {{363 267}} + 138 {{39 {0 316} 1}} + 270,trans {} + 269,trans {} + 18,trans {} + 139 {{40 {0 316} 1}} + 140 {{41 {0 316} 1}} + 37,trans {{257 77} {258 78} {259 79} {260 80} {261 81} {262 82} {403 87}} + 141 {{42 {0 316} 1}} + 56,trans {{316 152}} + 142 {{43 {0 316} 1}} + 75,trans {} + 143 {{44 {0 316} 1}} + 94,trans {{316 179}} + 144 {{99 {0 316} 2}} + 5,trans {{316 21}} + 145 {{118 {0 316} 2}} + 146 {{57 {309 310 311} 1}} + 107,trans {} + 147 {{58 {309 310 311} 1}} + 126,trans {} + 148 {{106 {0 316} 2} {54 {0 316} 0} {55 {0 316} 0} {56 {0 316} 0}} + 145,trans {} + 150 {{147 {0 316} 1}} + 149 {{146 {0 316} 1}} + 164,trans {{313 146} {314 147} {412 198}} + 151 {{102 {0 316} 2}} + 183,trans {} + 152 {{103 {0 316} 2}} + 212,trans {{316 246}} + 153 {{148 {0 316} 1}} + 231,trans {} + 154 {{149 {0 316} 1}} + 250,trans {{363 266}} + 249,trans {} + 155 {{150 {0 316} 1}} + 268,trans {} + 156 {{151 {0 316} 1}} + 17,trans {} + 157 {{152 {0 316} 1}} + 36,trans {{316 86}} + 158 {{153 {0 316} 1}} + 55,trans {{329 149} {376 150} {429 151}} + 74,trans {} + 160 {{155 {0 316} 1}} + 159 {{154 {0 316} 1}} + 93,trans {} + 161 {{156 {0 316} 1}} + 4,trans {{340 14} {375 15} {385 16} {389 17} {393 18} {394 19} {428 20}} + 162 {{104 {0 316} 2}} + 163 {{105 {0 316} 2}} + 106,trans {} + 164 {{107 {0 316} 2} {57 {309 310 311} 0} {58 {309 310 311} 0}} + 125,trans {} + 165 {{108 {0 316} 2}} + 144,trans {} + 166 {{52 {0 316} 1}} + 163,trans {} + 167 {{53 {0 316} 1}} + 182,trans {{309 193} {310 194} {311 195} {411 222}} + 168 {{109 {0 316} 2}} + 211,trans {{316 245}} + 170 {{110 {0 316} 2}} + 169 {{157 {0 316} 1} {158 {0 316} 1} {159 {0 316} 0} {160 {0 316} 0}} + 230,trans {} + 229,trans {} + 171 {{114 {0 316} 2} {113 {263 264 265 266 267 322 325 335 336 355 370 374 378 380 381 388 391} 0}} + 248,trans {{363 265}} + 172 {{112 {0 316} 2} {161 {0 316} 0} {162 {0 316} 0} {163 {0 316} 0} {164 {0 316} 0} {165 {0 316} 0} {166 {0 316} 0} {167 {0 316} 0} {168 {0 316} 0} {169 {0 316} 0} {170 {0 316} 0} {171 {0 316} 0} {172 {0 316} 0} {173 {0 316} 0} {174 {0 316} 0} {175 {0 316} 0} {176 {0 316} 0} {177 {0 316} 0}} + 267,trans {} + 173 {{115 {0 316} 2}} + 16,trans {} + 174 {{57 {0 302 303 304 305 306 307 308 316} 1}} + 35,trans {} + 175 {{58 {0 302 303 304 305 306 307 308 316} 1}} + 54,trans {} + 73,trans {} + 176 {{121 {0 316} 2} {122 {0 316} 2} {45 {0 316} 0} {46 {0 316} 0} {47 {0 316} 0} {48 {0 316} 0} {49 {0 316} 0} {50 {0 316} 0} {51 {0 316} 0}} + 92,trans {} + 177 {{77 {0 316} 4}} + 3,trans {{316 13}} + 178 {{124 {0 316} 3}} + 180 {{125 {0 316} 2}} + 179 {{87 {0 316} 3}} + 105,trans {} + 181 {{132 {0 316} 2}} + 124,trans {} + 182 {{128 {0 316} 2} {54 {0 316} 0} {55 {0 316} 0} {56 {0 316} 0}} + 143,trans {} + 183 {{133 {0 316} 1}} + 162,trans {} + 184 {{134 {0 316} 1}} + 181,trans {} + 185 {{135 {0 316} 1}} + 210,trans {{316 244}} + 209,trans {{313 241} {314 242} {412 243}} + 199,trans {} + 186 {{129 {0 316} 2}} + 228,trans {} + 187 {{136 {0 316} 1}} + 247,trans {} + 188 {{137 {0 316} 1}} + 266,trans {} + 200 {{159 {0 316} 1}} + 190 {{131 {0 316} 2}} + 189 {{138 {0 316} 1}} + 15,trans {} + 201 {{158 {0 316} 2}} + 191 {{130 {0 316} 2}} + 34,trans {{313 26} {314 27} {315 28} {412 66} {423 85}} + 202 {{114 {0 316} 3} {161 {0 316} 0} {162 {0 316} 0} {163 {0 316} 0} {164 {0 316} 0} {165 {0 316} 0} {166 {0 316} 0} {167 {0 316} 0} {168 {0 316} 0} {169 {0 316} 0} {170 {0 316} 0} {171 {0 316} 0} {172 {0 316} 0} {173 {0 316} 0} {174 {0 316} 0} {175 {0 316} 0} {176 {0 316} 0} {177 {0 316} 0}} + 192 {{96 {0 316} 3}} + 53,trans {} + 203 {{168 {0 316} 1} {8 {0 316} 0} {9 {0 316} 0} {10 {0 316} 0}} + 193 {{54 {0 316} 1}} + 72,trans {} + 204 {{169 {0 316} 1}} + 194 {{55 {0 316} 1}} + 91,trans {} + 2,trans {{316 12}} + 205 {{171 {0 316} 1} {13 {0 316} 0} {14 {0 316} 0}} + 195 {{56 {0 316} 1}} + 206 {{172 {0 316} 1} {15 {0 316} 0} {16 {0 316} 0} {17 {0 316} 0}} + 196 {{106 {0 316} 3}} + 207 {{170 {0 316} 1} {11 {0 316} 0} {12 {0 316} 0}} + 197 {{147 {0 316} 2}} + 104,trans {} + 208 {{161 {0 316} 1}} + 198 {{107 {0 316} 3} {54 {0 316} 0} {55 {0 316} 0} {56 {0 316} 0}} + 123,trans {} + 210 {{166 {0 316} 1}} + 209 {{165 {0 316} 1} {57 {0 316} 0} {58 {0 316} 0}} + 199 {{160 {0 316} 1}} + 142,trans {} + 211 {{167 {0 316} 1}} + 161,trans {} + 180,trans {} + 179,trans {} + 212 {{163 {0 316} 1}} + 208,trans {} + 198,trans {{309 193} {310 194} {311 195} {411 224}} + 213 {{162 {0 316} 1}} + 227,trans {} + 214 {{164 {0 316} 1}} + 246,trans {} + 215 {{175 {0 316} 1} {178 {0 316} 0} {179 {0 316} 0} {180 {0 316} 0} {181 {0 316} 0} {182 {0 316} 0} {183 {0 316} 0} {184 {0 316} 0} {185 {0 316} 0} {186 {0 316} 0} {187 {0 316} 0} {188 {0 316} 0} {189 {0 316} 0} {190 {0 316} 0} {191 {0 316} 0} {192 {0 316} 0} {193 {0 316} 0} {194 {0 316} 0} {195 {0 316} 0}} + 265,trans {} + 216 {{173 {0 316} 1} {57 {0 316} 0} {58 {0 316} 0}} + 14,trans {} + 217 {{174 {0 316} 1} {57 {0 316} 0} {58 {0 316} 0}} + 33,trans {} + 218 {{176 {0 316} 1}} + 52,trans {{313 146} {314 147} {412 148}} + 220 {{112 {0 316} 3}} + 219 {{177 {0 316} 1}} + 71,trans {} + 221 {{122 {0 316} 3}} + 90,trans {} + 89,trans {} + 1,trans {{417 11}} + 222 {{128 {0 316} 3}} + 223 {{96 {0 316} 4}} + 224 {{107 {0 316} 4}} + 103,trans {{257 77} {258 78} {259 79} {260 80} {261 81} {262 82} {403 191}} + 225 {{114 {0 316} 4}} + 122,trans {} + 226 {{8 {0 316} 1}} + 141,trans {} + 227 {{9 {0 316} 1}} + 160,trans {} + 159,trans {} + 228 {{10 {0 316} 1}} + 178,trans {} + 207,trans {{271 238} {272 239} {405 240}} + 230 {{169 {0 316} 2}} + 229 {{168 {0 316} 2}} + 197,trans {} + 226,trans {} + 231 {{13 {0 316} 1}} + 245,trans {} + 232 {{14 {0 316} 1}} + 264,trans {} + 233 {{171 {0 316} 2}} + 13,trans {} + 234 {{15 {0 316} 1}} + 32,trans {} + 235 {{16 {0 316} 1}} + 51,trans {{316 145}} + 236 {{17 {0 316} 1}} + 70,trans {{x 24} {y 25} {313 26} {314 27} {315 28} {323 29} {324 30} {330 31} {333 32} {334 33} {337 34} {339 35} {341 36} {344 37} {346 38} {349 39} {351 40} {352 41} {356 42} {357 43} {358 44} {359 45} {361 46} {362 47} {364 48} {365 49} {366 50} {367 51} {368 52} {369 53} {371 54} {373 55} {374 56} {377 57} {379 58} {380 59} {382 60} {383 61} {384 62} {386 63} {387 64} {392 65} {412 66} {420 177} {423 68}} + 69,trans {} + 237 {{172 {0 316} 2}} + 88,trans {} + 0,trans {{316 1} {331 2} {348 3} {353 4} {355 5} {360 6} {398 7} {413 8} {415 9} {416 10}} + 238 {{11 {0 316} 1}} + 240 {{170 {0 316} 2}} + 239 {{12 {0 316} 1}} + 241 {{57 {0 316} 1}} + 102,trans {{317 187} {319 188} {321 189} {427 190}} + 242 {{58 {0 316} 1}} + 121,trans {} + 243 {{165 {0 316} 2}} + 140,trans {} + 139,trans {} + 244 {{166 {0 316} 2}} + 158,trans {} + 245 {{167 {0 316} 2}} + 177,trans {} + 246 {{163 {0 316} 2}} + 206,trans {{271 234} {272 235} {274 236} {407 237}} + 196,trans {} + 225,trans {} + 247 {{164 {0 316} 2}} + 244,trans {} + 248 {{189 {0 316} 1} {190 {0 316} 1}} + 263,trans {} + 250 {{191 {0 316} 1} {192 {0 316} 1}} + 249 {{195 {0 316} 1}} + 12,trans {{419 70}} + 251 {{180 {0 316} 1} {184 {0 316} 1}} + 31,trans {} + 252 {{193 {0 316} 1} {194 {0 316} 1}} + 50,trans {{275 117} {276 118} {277 119} {278 120} {279 121} {280 122} {281 123} {282 124} {283 125} {284 126} {285 127} {286 128} {287 129} {288 130} {289 131} {290 132} {291 133} {292 134} {293 135} {294 136} {295 137} {296 138} {297 139} {298 140} {299 141} {300 142} {301 143} {408 144}} + 49,trans {{302 109} {303 110} {304 111} {305 112} {306 113} {307 114} {308 115} {409 116}} + 253 {{178 {0 316} 1} {183 {0 316} 1}} + 68,trans {} + 254 {{187 {0 316} 1} {188 {0 316} 1}} + 87,trans {} + 255 {{185 {0 316} 1} {186 {0 316} 1}} + 256 {{179 {0 316} 1}} + 257 {{182 {0 316} 1}} + 101,trans {{317 183} {318 184} {320 185} {426 186}} + 258 {{181 {0 316} 1}} + 120,trans {} + 119,trans {} + 260 {{173 {0 316} 2}} + 259 {{175 {0 316} 2}} + 138,trans {} + 261 {{174 {0 316} 2}} + 157,trans {} + 10 {{68 {0 316} 1} {78 {0 316} 0} {79 {0 316} 0} {80 {0 316} 0} {81 {0 316} 0} {82 {0 316} 0} {83 {0 316} 0} {84 {0 316} 0} {85 {0 316} 0} {86 {0 316} 0} {87 {0 316} 0} {88 {0 316} 0} {89 {0 316} 0} {90 {0 316} 0} {91 {0 316} 0} {92 {0 316} 0} {93 {0 316} 0} {94 {0 316} 0} {95 {0 316} 0} {96 {0 316} 0} {97 {0 316} 0} {98 {0 316} 0} {99 {0 316} 0} {100 {0 316} 0} {101 {0 316} 0} {102 {0 316} 0} {103 {0 316} 0} {104 {0 316} 0} {105 {0 316} 0} {106 {0 316} 0} {107 {0 316} 0} {108 {0 316} 0} {109 {0 316} 0} {110 {0 316} 0} {112 {0 316} 0} {114 {0 316} 0} {115 {0 316} 0} {116 {0 316} 0} {117 {0 316} 0} {118 {0 316} 0} {119 {0 316} 0} {120 {0 316} 0} {121 {0 316} 0} {122 {0 316} 0} {123 {0 316} 0} {124 {0 316} 0} {57 {313 314} 0} {58 {313 314} 0}} + 262 {{176 {0 316} 2}} + 176,trans {{302 109} {303 110} {304 111} {305 112} {306 113} {307 114} {308 115} {409 221}} + 11 {{71 {0 316} 2} {78 {0 316} 0} {79 {0 316} 0} {80 {0 316} 0} {81 {0 316} 0} {82 {0 316} 0} {83 {0 316} 0} {84 {0 316} 0} {85 {0 316} 0} {86 {0 316} 0} {87 {0 316} 0} {88 {0 316} 0} {89 {0 316} 0} {90 {0 316} 0} {91 {0 316} 0} {92 {0 316} 0} {93 {0 316} 0} {94 {0 316} 0} {95 {0 316} 0} {96 {0 316} 0} {97 {0 316} 0} {98 {0 316} 0} {99 {0 316} 0} {100 {0 316} 0} {101 {0 316} 0} {102 {0 316} 0} {103 {0 316} 0} {104 {0 316} 0} {105 {0 316} 0} {106 {0 316} 0} {107 {0 316} 0} {108 {0 316} 0} {109 {0 316} 0} {110 {0 316} 0} {112 {0 316} 0} {114 {0 316} 0} {115 {0 316} 0} {116 {0 316} 0} {117 {0 316} 0} {118 {0 316} 0} {119 {0 316} 0} {120 {0 316} 0} {121 {0 316} 0} {122 {0 316} 0} {123 {0 316} 0} {124 {0 316} 0} {57 {313 314} 0} {58 {313 314} 0}} + 263 {{177 {0 316} 2}} + 205,trans {{273 231} {274 232} {406 233}} + 195,trans {} + 12 {{75 {0 316} 2} {77 {0 316} 2} {76 {313 314 315 323 324 330 333 334 337 339 341 344 346 349 351 352 356 357 358 359 361 362 364 365 366 367 368 369 371 373 374 377 379 380 382 383 384 386 387 392 x y} 0}} + 224,trans {} + 264 {{96 {0 316} 5}} + 13 {{64 {0 316} 2}} + 265 {{190 {0 316} 2}} + 243,trans {} + 14 {{143 316 1}} + 262,trans {} + 266 {{192 {0 316} 2}} + 15 {{141 316 1}} + 11,trans {{x 24} {y 25} {313 26} {314 27} {315 28} {323 29} {324 30} {330 31} {333 32} {334 33} {337 34} {339 35} {341 36} {344 37} {346 38} {349 39} {351 40} {352 41} {356 42} {357 43} {358 44} {359 45} {361 46} {362 47} {364 48} {365 49} {366 50} {367 51} {368 52} {369 53} {371 54} {373 55} {374 56} {377 57} {379 58} {380 59} {382 60} {383 61} {384 62} {386 63} {387 64} {392 65} {412 66} {420 69} {423 68}} + 267 {{184 {0 316} 2}} + 16 {{142 316 1}} + 29,trans {{257 77} {258 78} {259 79} {260 80} {261 81} {262 82} {403 83}} + 30,trans {{257 77} {258 78} {259 79} {260 80} {261 81} {262 82} {403 84}} + 268 {{194 {0 316} 2}} + 17 {{144 316 1}} + 48,trans {} + 270 {{188 {0 316} 2}} + 269 {{183 {0 316} 2}} + 67,trans {} + 18 {{140 316 1}} + 271 {{186 {0 316} 2}} + 86,trans {} + 20 {{66 {0 316} 2}} + 19 {{139 316 1}} + 21 {{65 {0 316} 2}} + 22 {{74 {0 316} 2} {78 {0 316} 0} {79 {0 316} 0} {80 {0 316} 0} {81 {0 316} 0} {82 {0 316} 0} {83 {0 316} 0} {84 {0 316} 0} {85 {0 316} 0} {86 {0 316} 0} {87 {0 316} 0} {88 {0 316} 0} {89 {0 316} 0} {90 {0 316} 0} {91 {0 316} 0} {92 {0 316} 0} {93 {0 316} 0} {94 {0 316} 0} {95 {0 316} 0} {96 {0 316} 0} {97 {0 316} 0} {98 {0 316} 0} {99 {0 316} 0} {100 {0 316} 0} {101 {0 316} 0} {102 {0 316} 0} {103 {0 316} 0} {104 {0 316} 0} {105 {0 316} 0} {106 {0 316} 0} {107 {0 316} 0} {108 {0 316} 0} {109 {0 316} 0} {110 {0 316} 0} {112 {0 316} 0} {114 {0 316} 0} {115 {0 316} 0} {116 {0 316} 0} {117 {0 316} 0} {118 {0 316} 0} {119 {0 316} 0} {120 {0 316} 0} {121 {0 316} 0} {122 {0 316} 0} {123 {0 316} 0} {124 {0 316} 0} {57 {313 314} 0} {58 {313 314} 0}} + 100,trans {{313 146} {314 147} {412 182}} + 23 {{61 0 2}} + 118,trans {} + 24 {{117 {0 316} 1}} + 137,trans {} + 25 {{119 {0 316} 1}} + 156,trans {} + 26 {{57 {313 314} 1}} + 175,trans {} + 27 {{58 {313 314} 1}} + 204,trans {{313 230}} + 194,trans {} + 28 {{123 {0 316} 1} {124 {0 316} 1}} + 223,trans {{316 264}} + 30 {{80 {0 316} 1} {1 {0 316} 0} {2 {0 316} 0} {3 {0 316} 0} {4 {0 316} 0} {5 {0 316} 0} {6 {0 316} 0} {7 {0 316} 0}} + 29 {{79 {0 316} 1} {1 {0 316} 0} {2 {0 316} 0} {3 {0 316} 0} {4 {0 316} 0} {5 {0 316} 0} {6 {0 316} 0} {7 {0 316} 0}} + 242,trans {} + 31 {{81 {0 316} 1}} + 261,trans {} + 32 {{82 {0 316} 1}} + 10,trans {{x 24} {y 25} {313 26} {314 27} {315 28} {323 29} {324 30} {330 31} {333 32} {334 33} {337 34} {339 35} {341 36} {344 37} {346 38} {349 39} {351 40} {352 41} {356 42} {357 43} {358 44} {359 45} {361 46} {362 47} {364 48} {365 49} {366 50} {367 51} {368 52} {369 53} {371 54} {373 55} {374 56} {377 57} {379 58} {380 59} {382 60} {383 61} {384 62} {386 63} {387 64} {392 65} {412 66} {420 67} {423 68}} + 33 {{83 {0 316} 1}} + 28,trans {{315 76}} + 34 {{84 {0 316} 1} {121 {0 316} 0} {122 {0 316} 0} {123 {0 316} 0} {124 {0 316} 0} {57 {313 314} 0} {58 {313 314} 0}} + 47,trans {{316 108}} +} + +array set cat::token_id_table { + 426,line 404 + 286 WCSK_ + 286,t 0 + 287 WCSL_ + 292,line 44 + 302,line 55 + 415,t 1 + 288 WCSM_ + 357,line 118 + 317,t 0 + 265,title FONTSLANT + 289 WCSN_ + 290 WCSO_ + 300 WCSY_ + 284,title WCSI + 291 WCSP_ + 301 WCSZ_ + 436,t 1 + 423,line 386 + 313,title integer + 292 WCSQ_ + 302 FK4_ + 338,t 0 + 332,title CIRCLE + 288,line 40 + 293 WCSR_ + 303 B1950_ + 351,title HEADER + 294 WCSS_ + 304 FK5_ + 370,title REMOVE + 369,title REGIONS + 354,line 115 + 305 J2000_ + 295 WCST_ + 388,title TEXT + 360,t 0 + 359,t 0 + 306 ICRS_ + 296 WCSU_ + 420,line 340 + 419,line 337 + 417,title {} + 307 GALACTIC_ + 262,t 0 + 297 WCSV_ + 436,title {} + 308 ECLIPTIC_ + 285,line 37 + 298 WCSW_ + 381,t 0 + 310 ARCMIN_ + 309 DEGREES_ + 299 WCSX_ + 351,line 112 + 311 ARCSEC_ + 283,t 0 + 312 SEXAGESIMAL_ + 416,line 327 + 412,t 1 + 313 INT_ + 314,t 0 + 314 REAL_ + 282,line 34 + 315 SEXSTR_ + 433,t 1 + 347,line 108 + 316 STRING_ + 264,title FONTSIZE + 335,t 0 + 317 1AND2_ + 283,title WCSH + 413,line 316 + 318 1NOT2_ + 312,title SEXAGESIMAL + 331,title CDS + 320 2NOT1_ + 319 1ONLY_ + 278,line 30 + error,line 241 + 356,t 0 + 350,title FUNCTION + 349,title FILTER + 321 2ONLY_ + 368,title RADIUS + 344,line 105 + 322 ADD_ + 258,t 0 + 387,title SYSTEM + 323 ALLCOLS_ + 416,title {} + 410,line 304 + 409,line 296 + 399,line 162 + 377,t 0 + 324 ALLROWS_ + 435,title {} + 325 ANGLE_ + 275,line 27 + 279,t 0 + 280,t 0 + 326 ARROW_ + 408,t 1 + 398,t 0 + 341,line 102 + 327 BOX_ + 328 BOXCIRCLE_ + 311,t 0 + 406,line 259 + 396,line 159 + 330 CANCEL_ + 329 BROADCAST_ + 430,t 1 + 429,t 1 + 331 CDS_ + 272,line 23 + 332,t 0 + 332 CIRCLE_ + 337,line 98 + 333 CLEAR_ + 263,title FONT + 334 CLOSE_ + 282,title WCSG + 403,line 242 + 393,line 154 + 353,t 0 + 335 COLOR_ + 311,title ARCSEC + 336 CONDITION_ + 330,title CANCEL + 329,title BROADCAST + 268,line 19 + 348,title FILE + 337 COORDINATE_ + 374,t 0 + 367,title RA + 338 CROSS_ + 334,line 95 + 386,title SYMBOL + 340 CSV_ + 339 CROSSHAIR_ + 276,t 0 + 415,title {} + 400,line 163 + 390,line 151 + 389,line 150 + 341 DEC_ + 434,title {} + 405,t 1 + 395,t 0 + 342 DECR_ + 265,line 16 + 343 DIAMOND_ + 307,t 0 + 297,t 0 + 344 EDIT_ + 331,line 157 + 426,t 1 + 345 ELLIPSE_ + 386,line 147 + 346 EXPORT_ + 328,t 0 + 347 ERROR_ + 262,line 12 + 348 FILE_ + 0,t 0 + 0 {$} + 350,t 0 + 350 FUNCTION_ + 349,t 0 + 349 FILTER_ + 327,line 88 + 262,title FALSE + 351 HEADER_ + 281,title WCSF + error,t 0 + 383,line 144 + 352 HIDE_ + 310,title ARCMIN + 309,title DEGREES + 299,title WCSX + 371,t 0 + 353 IMPORT_ + 328,title BOXCIRCLE + 258,line 8 + 354 INCR_ + 347,title ERROR + 273,t 0 + 366,title PSYSTEM + 355 LOAD_ + 324,line 85 + 402,t 0 + 392,t 0 + 385,title STARBASE + 356 LOCATION_ + 414,title {} + 380,line 141 + 379,line 140 + 357 MATCH_ + 294,t 0 + 304,t 0 + 433,title {} + 358 MAXROWS_ + 423,t 1 + 360 NEW_ + 359 NAME_ + 361 PANTO_ + 325,t 0 + 321,line 82 + 362 PLOT_ + 376,line 137 + 363 POINT_ + 364 PRINT_ + 346,t 0 + 365 PSKY_ + 366 PSYSTEM_ + 317,line 78 + 261,title TRUE + 367,t 0 + 367 RA_ + 279,title WCSD + 280,title WCSE + 373,line 134 + 368 RADIUS_ + 308,title ECLIPTIC + 269,t 0 + 270,t 0 + 298,title WCSW + 370 REMOVE_ + 369 REGIONS_ + 327,title BOX + 388,t 0 + 371 RETRIEVE_ + 346,title EXPORT + 372 RETURN_ + 365,title PSKY + 314,line 70 + 291,t 0 + 301,t 0 + 384,title SORT + 373 SAMP_ + 420,t 1 + 419,t 1 + 413,title {} + 374 SAVE_ + 370,line 131 + 369,line 130 + 432,title {} + 375 SB_ + 322,t 0 + 435,line 490 + 376 SEND_ + y,t 0 + 377 SERVER_ + 311,line 65 + 378 SHAPE_ + 343,t 0 + 380 SIZE_ + 379 SHOW_ + 366,line 127 + 381 SIZE2_ + 432,line 442 + 382 SKY_ + 364,t 0 + 383 SKYFORMAT_ + 307,line 60 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 49 + 384 SORT_ + 278,title WCSC + 385,t 0 + 385 STARBASE_ + 363,line 124 + 307,title GALACTIC + 297,title WCSV + 386 SYMBOL_ + 326,title ARROW + 287,t 0 + 428,line 414 + 387 SYSTEM_ + 345,title ELLIPSE + 416,t 1 + 388 TEXT_ + 364,title PRINT + 294,line 46 + 304,line 57 + 400 IUCAA_ + 390 UNIQUE_ + 389 TSV_ + 383,title SKYFORMAT + 318,t 0 + 412,title {} + 401 BEJING_ + 391 UNITS_ + 360,line 121 + 359,line 120 + 431,title {} + 402 SAAO_ + 392 UPDATE_ + 425,line 396 + 403 yesno + 393 VOT_ + 340,t 0 + 339,t 0 + 404 font + error,title {} + 394 XML_ + 291,line 43 + 301,line 53 + 405 fontWeight + 395 ADAC_ + 406 fontSlant + 396 CADC_ + 361,t 0 + 356,line 117 + 407 fontStyle + 397 CAMBRIDGE_ + 263,t 0 + 422,line 377 + 408 wcssys + 398 SAO_ + 410 skyformat + 409 skyframe + 399 UKIRT_ + 382,t 0 + 258,title NO + 287,line 39 + 411 rformat + 277,title WCSB + 284,t 0 + 412 numeric + 353,line 114 + 306,title ICRS + 296,title WCSU + 413,t 1 + 413 command + 325,title ANGLE + 418,line 333 + 414 @PSEUDO1 + 344,title EDIT + 315,t 0 + 415 catalog + 363,title POINT + 284,line 36 + 434,t 1 + 416 @PSEUDO2 + 382,title SKY + 417 @PSEUDO3 + 411,title {} + 350,line 111 + 349,line 110 + 336,t 0 + 430,title {} + 429,title {} + 418 @PSEUDO4 + 420 catCmd + 419 @PSEUDO5 + 415,line 320 + 421 @PSEUDO6 + 357,t 0 + 281,line 33 + 422 @PSEUDO7 + 260,t 0 + 259,t 0 + 423 coordinate + 346,line 107 + 424 filter + 378,t 0 + 425 match + 412,line 312 + 281,t 0 + 426 matchFunction + 257,title YES + 277,line 29 + 427 matchReturn + 410,t 1 + 409,t 1 + 399,t 0 + 276,title WCSA + 428 reader + 343,line 104 + 312,t 0 + 305,title J2000 + 295,title WCST + 430 server + 429 samp + 324,title ALLROWS + 431,t 1 + 431 sort + 408,line 268 + 398,line 161 + 343,title DIAMOND + 432 sortDir + 362,title PLOT + 333,t 0 + 274,line 25 + 433 symbol + 381,title SIZE2 + 434 symbolShape + 410,title {} + 409,title {} + 399,title UKIRT + 340,line 101 + 339,line 100 + 435 writer + 428,title {} + 354,t 0 + 436 start' + 405,line 255 + 395,line 158 + 271,line 22 + 375,t 0 + x x + 336,line 97 + 277,t 0 + y y + 406,t 1 + 402,line 165 + 396,t 0 + 392,line 153 + 308,t 0 + 267,line 18 + 298,t 0 + 275,title WCS + 427,t 1 + 333,line 94 + 294,title WCSS + 304,title FK5 + 330,t 0 + 329,t 0 + 323,title ALLCOLS + 388,line 149 + 342,title DECR + 361,title PANTO + 264,line 15 + 380,title SIZE + 379,title SHOW + 351,t 0 + 408,title {} + 398,title SAO + 330,line 91 + 329,line 90 + 427,title {} + 385,line 146 + 372,t 0 + 261,line 11 + 274,t 0 + 403,t 1 + 393,t 0 + 326,line 87 + 305,t 0 + 295,t 0 + 382,line 143 + 424,t 1 + 257,line 7 + 326,t 0 + 274,title ITALIC + 323,line 84 + 293,title WCSR + 303,title B1950 + 322,title ADD + 378,line 139 + 347,t 0 + 341,title DEC + 360,title NEW + 359,title NAME + 378,title SHAPE + 407,title {} + 397,title CAMBRIDGE + 368,t 0 + 320,line 81 + 319,line 80 + 426,title {} + error error + 271,t 0 + 375,line 136 + 400,t 0 + 390,t 0 + 389,t 0 + y,line 382 + 292,t 0 + 302,t 0 + 316,line 74 + 421,t 1 + 372,line 133 + 323,t 0 + 273,title ROMAN + 344,t 0 + 313,line 69 + 292,title WCSQ + 302,title FK4 + 321,title 2ONLY + 368,line 129 + 340,title CSV + 339,title CROSSHAIR + 365,t 0 + 358,title MAXROWS + 434,line 467 + 377,title SERVER + 267,t 0 + 406,title {} + 396,title CADC + 310,line 64 + 309,line 63 + 299,line 51 + 425,title {} + 386,t 0 + 365,line 126 + 288,t 0 + 431,line 438 + 417,t 1 + 320,t 0 + 319,t 0 + 306,line 59 + 296,line 48 + 362,line 123 + 341,t 0 + 427,line 409 + 272,title BOLD + 291,title WCSP + 293,line 45 + 301,title WCSZ + 303,line 56 + 362,t 0 + 320,title 2NOT1 + 319,title 1ONLY + 358,line 119 + 338,title CROSS + 264,t 0 + 357,title MATCH + 424,line 392 + 383,t 0 + 376,title SEND + 405,title {} + 395,title ADAC + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 52 + 424,title {} + 414,t 1 + 355,line 116 + 316,t 0 + 421,line 376 + 435,t 1 + 286,line 38 + 337,t 0 + 352,line 113 + 417,line 329 + 358,t 0 + 271,title NORMAL + 261,t 0 + 283,line 35 + 289,title WCSN + 290,title WCSO + 300,title WCSY + 318,title 1NOT2 + 380,t 0 + 379,t 0 + 348,line 109 + 337,title COORDINATE + 356,title LOCATION + 282,t 0 + 414,line 317 + 375,title SB + 411,t 1 + 404,title {} + 394,title XML + 279,line 31 + 280,line 32 + 423,title {} + 313,t 0 + 345,line 106 + 432,t 1 + 411,line 308 + 334,t 0 + 276,line 28 + 355,t 0 + 342,line 103 + 257,t 0 + 407,line 263 + 397,line 160 + 269,title HELVETICA + 270,title COURIER + 376,t 0 + 273,line 24 + 288,title WCSM + 317,title 1AND2 + 278,t 0 + 338,line 99 + 336,title CONDITION + 407,t 1 + 397,t 0 + 355,title LOAD + 404,line 250 + 394,line 155 + 374,title SAVE + 310,t 0 + 309,t 0 + 299,t 0 + 403,title {} + 393,title VOT + 269,line 20 + 270,line 21 + 428,t 1 + 422,title {} + y,title {} + 335,line 96 + 331,t 0 + 401,line 164 + 391,line 152 + 352,t 0 + 266,line 17 + 332,line 93 + 373,t 0 + 387,line 148 + 268,title TIMES + 275,t 0 + 263,line 14 + 287,title WCSL + 404,t 1 + 394,t 0 + 316,title string + 335,title COLOR + 328,line 89 + 306,t 0 + 296,t 0 + 354,title INCR + 425,t 1 + 384,line 145 + 373,title SAMP + 402,title SAAO + 392,title UPDATE + 327,t 0 + 260,line 10 + 259,line 9 + 421,title {} + x,title {} + 325,line 86 + 348,t 0 + 381,line 142 + 370,t 0 + 369,t 0 + 322,line 83 + 272,t 0 + 401,t 0 + 391,t 0 + 377,line 138 + 267,title FONTWEIGHT + 257 YES_ + 286,title WCSK + 293,t 0 + 303,t 0 + 315,title sexagesimal + 258 NO_ + 422,t 1 + 334,title CLOSE + 318,line 79 + 260 OFF_ + 259 ON_ + 353,title IMPORT + 324,t 0 + 261 TRUE_ + 374,line 135 + 372,title RETURN + 262 FALSE_ + 401,title BEJING + 391,title UNITS + 263 FONT_ + x,line 480 + 420,title {} + 419,title {} + 345,t 0 + 264 FONTSIZE_ + 315,line 72 + 265 FONTSLANT_ + 266 FONTSTYLE_ + 371,line 132 + 366,t 0 + 267 FONTWEIGHT_ + 268,t 0 + 268 TIMES_ + 436,line 497 + 269 HELVETICA_ + 270 COURIER_ + 387,t 0 + 312,line 67 + 271 NORMAL_ + 272 BOLD_ + 289,t 0 + 290,t 0 + 300,t 0 + 367,line 128 + 266,title FONTSTYLE + 273 ROMAN_ + 418,t 1 + 274 ITALIC_ + 285,title WCSJ + 433,line 446 + 321,t 0 + 314,title float + 275 WCS_ + 333,title CLEAR + 308,line 61 + 276 WCSA_ + 298,line 50 + x,t 0 + 352,title HIDE + 277 WCSB_ + 371,title RETRIEVE + 364,line 125 + 342,t 0 + 278 WCSC_ + 400,title IUCAA + 390,title UNIQUE + 389,title TSV + 279 WCSD_ + 280 WCSE_ + 430,line 427 + 429,line 422 + 418,title {} + 281 WCSF_ + 363,t 0 + 305,line 58 + 282 WCSG_ + 295,line 47 + 265,t 0 + 283 WCSH_ + 361,line 122 + 284 WCSI_ + 384,t 0 + 285 WCSJ_ +} + +proc cat::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ times } + 9 { set _ helvetica } + 10 { set _ courier } + 11 { set _ normal } + 12 { set _ bold } + 13 { set _ roman } + 14 { set _ italic } + 15 { set _ normal } + 16 { set _ bold } + 17 { set _ italic } + 18 { set _ wcs } + 19 { set _ wcsa } + 20 { set _ wcsb } + 21 { set _ wcsc } + 22 { set _ wcsd } + 23 { set _ wcse } + 24 { set _ wcsf } + 25 { set _ wcsg } + 26 { set _ wcsh } + 27 { set _ wcsi } + 28 { set _ wcsj } + 29 { set _ wcsk } + 30 { set _ wcsl } + 31 { set _ wcsm } + 32 { set _ wcsn } + 33 { set _ wcso } + 34 { set _ wcsp } + 35 { set _ wcsq } + 36 { set _ wcsr } + 37 { set _ wcss } + 38 { set _ wcst } + 39 { set _ wcsu } + 40 { set _ wcsv } + 41 { set _ wcsw } + 42 { set _ wcsx } + 43 { set _ wcsy } + 44 { set _ wcsz } + 45 { set _ fk4 } + 46 { set _ fk4 } + 47 { set _ fk5 } + 48 { set _ fk5 } + 49 { set _ icrs } + 50 { set _ galactic } + 51 { set _ ecliptic } + 52 { set _ degrees } + 53 { set _ sexagesimal } + 54 { set _ degrees } + 55 { set _ arcmin } + 56 { set _ arcsec } + 57 { set _ $1 } + 58 { set _ $1 } + 60 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 62 { CATTool } + 63 { CATTool } + 64 { CatalogCmdLoad $2 VOTRead } + 65 { CatalogCmdLoad $2 VOTRead } + 66 { CatalogCmdLoad $3 $2 } + 67 { if {![CatalogCmdCheck]} {cat::YYABORT} } + 69 { CatalogCmdRef $1 } + 70 { CatalogCmdRef $1 } + 72 { CatalogCmdRef sao } + 73 { CatalogCmdRef sao } + 75 { CatalogCmdRef $2 } + 76 { CatalogCmdRef $2 } + 79 { ProcessCmdCVAR allcols $2 } + 80 { ProcessCmdCVAR allrows $2 } + 81 { ProcessCmdCVAR0 ARCancel } + 82 { ProcessCmdCVAR0 CATOff } + 83 { ProcessCmdCVAR0 CATDestroy } + 85 { ProcessCmdCVAR0 CATCrosshair } + 86 { ProcessCmdCVAR edit $2 CATEdit } + 87 { CatalogCmdSave $3 $2 } + 89 { ProcessCmdCVAR0 CATHeader } + 90 { ProcessCmdCVAR show 0 CATGenerate } + 91 { ProcessCmdCVAR loc $2 CATGenerate } + 93 { ProcessCmdCVAR max $2 } + 94 { ProcessCmdCVAR name $2 } + 95 { ProcessCmdCVAR panto $2 } + 96 { ProcessCmdCVAR4 plot,x $2 plot,y $3 plot,xerr $4 plot,yerr $5 CATPlotGenerate } + 97 { ProcessCmdCVAR0 CATPrint } + 98 { ProcessCmdCVAR psky $2 CATGenerate } + 99 { ProcessCmdCVAR psystem $2 CATGenerate } + 100 { ProcessCmdCVAR0 CATGenerateRegions } + 101 { global cvarname; CATApply $cvarname 1 } + 103 { CatalogCmdSave $2 VOTWrite } + 104 { ProcessCmdCVAR server $2 } + 105 { ProcessCmdCVAR show $2 CATGenerate } + 106 { ProcessCmdCVAR3 radius $2 rformat $3 rformat,msg $3 } + 107 { ProcessCmdCVAR3 radius [expr ($2+$3)/2.] rformat $4 rformat,msg $4 } + 108 { CatalogCmdSkyframe $2 } + 109 { ProcessCmdCVAR skyformat $2 } + 111 { ProcessCmdCVAR row 1 } + 113 { CagtalogCmdCat row $2 } + 115 { CatalogCmdSystem $2 } + 116 { ProcessCmdCVAR0 CATUpdate } + 117 { ProcessCmdCVAR colx $2 CATGenerate } + 118 { ProcessCmdCVAR colx $2 CATGenerate } + 119 { ProcessCmdCVAR coly $2 CATGenerate } + 120 { ProcessCmdCVAR coly $2 CATGenerate } + 121 { ProcessCmdCVAR3 x $1 y $2 sky fk5 } + 122 { ProcessCmdCVAR3 x $1 y $2 sky $3 } + 123 { ProcessCmdCVAR3 x $1 y $2 sky fk5 } + 124 { ProcessCmdCVAR3 x $1 y $2 sky $3 } + 125 { CatalogCmdFilterLoad $2 } + 126 { ProcessCmdCVAR filter $1 CATTable } + 127 { CatalogCmdMatch } + 128 { ProcessCmdSet2 icat error $2 eformat $3 } + 129 { ProcessCmdSet icat function $2 } + 130 { ProcessCmdSet icat unique $2 } + 131 { ProcessCmdSet icat return $2 } + 132 { CatalogCmdMatchParams "cat$1" "cat$2" } + 133 { set _ 1and2 } + 134 { set _ 1not2 } + 135 { set _ 2not1 } + 136 { set _ 1and2 } + 137 { set _ 1only } + 138 { set _ 2only } + 139 { set _ VOTRead } + 140 { set _ VOTRead } + 141 { set _ starbase_read } + 142 { set _ starbase_read } + 143 { set _ TSVRead } + 144 { set _ TSVRead } + 145 { CatalogCmdSAMP } + 146 { CatalogCmdSAMP } + 147 { CatalogCmdSAMPSend $2 } + 148 { set _ cds } + 149 { set _ adac } + 150 { set _ cadc } + 151 { set _ cambridge } + 152 { set _ sao } + 153 { set _ ukirt } + 154 { set _ iucaa } + 155 { set _ bejing } + 156 { set _ saao } + 157 { ProcessCmdCVAR sort $1; ProcessCmdCVAR sort,dir "-increasing" CATTable } + 158 { ProcessCmdCVAR sort $1; ProcessCmdCVAR sort,dir $2 CATTable } + 159 { set _ "-increasing" } + 160 { set _ "-decreasing" } + 161 { CatalogCmdSymbolAdd } + 162 { CatalogCmdSymbolRemove } + 163 { CatalogCmdSymbolLoad $2 } + 164 { CatalogCmdSymbolSave $2 } + 165 { CatalogCmdSymbol angle $2 } + 166 { CatalogCmdSymbol color $2 } + 167 { CatalogCmdSymbol condition $2 } + 168 { CatalogCmdSymbol font $2 } + 169 { CatalogCmdSymbol fontsize $2 } + 170 { CatalogCmdSymbol fontweight $2 } + 171 { CatalogCmdSymbol fontslant $2 } + 172 { CatalogCmdSymbolFontStyle $2 } + 173 { CatalogCmdSymbol size $2 } + 174 { CatalogCmdSymbol size2 $2 } + 175 { CatalogCmdSymbol shape $2 } + 176 { CatalogCmdSymbol text $2 } + 177 { CatalogCmdSymbol units $2 } + 178 { set _ circle } + 179 { set _ ellipse } + 180 { set _ box } + 181 { set _ text } + 182 { set _ "circle point" } + 183 { set _ "circle point" } + 184 { set _ "box point" } + 185 { set _ "diamond point" } + 186 { set _ "diamond point" } + 187 { set _ "cross point" } + 188 { set _ "cross point" } + 189 { set _ "x point" } + 190 { set _ "x point" } + 191 { set _ "arrow point" } + 192 { set _ "arrow point" } + 193 { set _ "boxcircle point" } + 194 { set _ "boxcircle point" } + 195 { set _ $1 } + 196 { set _ VOTWrite } + 197 { set _ VOTWrite } + 198 { set _ starbase_write } + 199 { set _ starbase_write } + 200 { set _ TSVWrite } + 201 { set _ TSVWrite } + } + 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 cat::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/catsendlex.tcl b/ds9/parsers/catsendlex.tcl new file mode 100644 index 0000000..2efabea --- /dev/null +++ b/ds9/parsers/catsendlex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval catsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc catsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc catsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc catsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc catsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc catsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc catsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc catsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc catsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc catsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set HEADER_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: header + if {[regexp -start $index_ -indices -line -nocase -- {\A(header)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $HEADER_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/catsendparser.tab.tcl b/ds9/parsers/catsendparser.tab.tcl new file mode 100644 index 0000000..70317a3 --- /dev/null +++ b/ds9/parsers/catsendparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set HEADER_ 258 diff --git a/ds9/parsers/catsendparser.tcl b/ds9/parsers/catsendparser.tcl new file mode 100644 index 0000000..248221e --- /dev/null +++ b/ds9/parsers/catsendparser.tcl @@ -0,0 +1,322 @@ +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 catsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc catsend::YYABORT {} { + return -code return 1 +} + +proc catsend::YYACCEPT {} { + return -code return 0 +} + +proc catsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc catsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc catsend::yyerror {s} { + puts stderr $s +} + +proc catsend::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 catsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set catsend::table { + 6:0 reduce + 3:0,target 5 + 0:257 shift + 7:0 reduce + 0:258 reduce + 5:0,target 6 + 1:258 reduce + 0:259 goto + 0:260 goto + 4:262,target 7 + 7:0,target 4 + 3:258 shift + 0:258,target 1 + 1:261 goto + 4:258 shift + 0:0,target 1 + 3:262 goto + 2:0,target 0 + 4:258,target 5 + 4:262 goto + 4:0,target 5 + 3:262,target 6 + 0:0 reduce + 6:0,target 2 + 1:0 reduce + 0:257,target 1 + 2:0 accept + 3:0 reduce + 1:258,target 3 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 3 + 5:0 reduce + 3:258,target 5 + 1:261,target 4 +} + +array set catsend::rules { + 0,l 263 + 1,l 260 + 2,l 259 + 3,l 261 + 4,l 259 + 5,l 262 + 6,l 262 +} + +array set catsend::rules { + 5,dc 0 + 0,dc 1 + 2,dc 2 + 4,dc 3 + 6,dc 1 + 1,dc 0 + 3,dc 0 +} + +array set catsend::rules { + 5,line 20 + 1,e 0 + 3,e 1 + 2,line 16 + 4,line 17 + 6,line 21 + 1,line 15 + 3,line 16 +} + +array set catsend::lr1_table { + 0 {{0 0 0} {2 0 0} {4 0 0} {1 {0 258} 0}} + 1 {{4 0 1} {3 {0 258} 0}} + 2 {{0 0 1}} + 3 {{2 0 1} {5 0 0} {6 0 0}} + 0,trans {{257 1} {259 2} {260 3}} + 4 {{4 0 2} {5 0 0} {6 0 0}} + 1,trans {{261 4}} + 5 {{6 0 1}} + 2,trans {} + 6 {{2 0 2}} + 3,trans {{258 5} {262 6}} + 7 {{4 0 3}} + 4,trans {{258 5} {262 7}} + 5,trans {} + 6,trans {} + 7,trans {} +} + +array set catsend::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 16 + error,line 14 + 257 STRING_ + 257,t 0 + 263,line 22 + 258 HEADER_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 catsend + error,title {} + 261,t 1 + 261 @PSEUDO2 + 262,t 1 + 262 catsendCmd + 257,line 7 + 263,t 1 + 263 start' + 260,line 15 + 259,line 15 + 257,title string + 258,title HEADER + 262,line 19 + 260,title {} + 259,title {} + 261,title {} +} + +proc catsend::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 { if {![CatalogCmdCheck]} {catsend::YYABORT} } + 3 { if {![CatalogSendCmdRef cat${1}]} {catsend::YYABORT} } + 5 { ProcessSendCmdGet icat cats } + 6 { CatalogSendCmdHeader } + } + 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 catsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/cmaplex.tcl b/ds9/parsers/cmaplex.tcl new file mode 100644 index 0000000..849e804 --- /dev/null +++ b/ds9/parsers/cmaplex.tcl @@ -0,0 +1,503 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cmap { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cmap::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cmap::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cmap::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cmap::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cmap::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cmap::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cmap::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cmap::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cmap::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set CLOSE_ 266 +set DELETE_ 267 +set FILE_ 268 +set INVERT_ 269 +set LOAD_ 270 +set LOCK_ 271 +set MATCH_ 272 +set OPEN_ 273 +set SAVE_ 274 +set TAG_ 275 +set VALUE_ 276 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: delete + if {[regexp -start $index_ -indices -line -nocase -- {\A(delete)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: file + if {[regexp -start $index_ -indices -line -nocase -- {\A(file)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: invert + if {[regexp -start $index_ -indices -line -nocase -- {\A(invert)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: tag + if {[regexp -start $index_ -indices -line -nocase -- {\A(tag)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: value + if {[regexp -start $index_ -indices -line -nocase -- {\A(value)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $DELETE_ + } + 2 { +return $FILE_ + } + 3 { +return $INVERT_ + } + 4 { +return $LOAD_ + } + 5 { +return $LOCK_ + } + 6 { +return $MATCH_ + } + 7 { +return $OPEN_ + } + 8 { +return $SAVE_ + } + 9 { +return $TAG_ + } + 10 { +return $VALUE_ + } + 11 { +return $YES_ + } + 12 { +return $NO_ + } + 13 { +return $ON_ + } + 14 { +return $OFF_ + } + 15 { +return $TRUE_ + } + 16 { +return $FALSE_ + } + 17 { +set yylval $yytext; return $INT_ + } + 18 - + 19 { +set yylval $yytext; return $REAL_ + } + 20 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 21 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 22 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 23 { +set yylval $yytext; return $STRING_ + } + 24 { +# ignore whitespace + } + 25 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/cmapparser.tab.tcl b/ds9/parsers/cmapparser.tab.tcl new file mode 100644 index 0000000..70f0f29 --- /dev/null +++ b/ds9/parsers/cmapparser.tab.tcl @@ -0,0 +1,20 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set CLOSE_ 266 +set DELETE_ 267 +set FILE_ 268 +set INVERT_ 269 +set LOAD_ 270 +set LOCK_ 271 +set MATCH_ 272 +set OPEN_ 273 +set SAVE_ 274 +set TAG_ 275 +set VALUE_ 276 diff --git a/ds9/parsers/cmapparser.tcl b/ds9/parsers/cmapparser.tcl new file mode 100644 index 0000000..0242cb6 --- /dev/null +++ b/ds9/parsers/cmapparser.tcl @@ -0,0 +1,793 @@ +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 cmap { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cmap::YYABORT {} { + return -code return 1 +} + +proc cmap::YYACCEPT {} { + return -code return 0 +} + +proc cmap::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cmap::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cmap::yyerror {s} { + puts stderr $s +} + +proc cmap::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 cmap::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cmap::table { + 9:283 goto + 34:265,target 40 + 27:0 reduce + 15:278,target 36 + 10:258,target 23 + 14:274,target 34 + 23:265,target 5 + 7:283,target 21 + 0:275,target 14 + 6:0,target 15 + 2:0 reduce + 6:265 reduce + 12:265,target 14 + 10:277,target 30 + 26:265 reduce + 24:0 reduce + 41:0,target 24 + 25:0,target 6 + 3:265,target 8 + 17:0,target 0 + 10:0,target 1 + 35:265 reduce + 0:273,target 12 + 35:265,target 22 + 16:278,target 37 + 21:0 reduce + 42:0 reduce + 24:265,target 3 + 3:263,target 8 + 14:270,target 33 + 13:265,target 31 + 14:267 shift + 0:271,target 10 + 8:262,target 27 + 3:263 reduce + 14:270 shift + 3:264 reduce + 3:265 reduce + 17:0 accept + 14:274 shift + 23:265 reduce + 4:265,target 9 + 3:0,target 8 + 14:267,target 32 + 32:265 reduce + 0:268,target 7 + 8:259,target 24 + 8:260,target 25 + 14:284 goto + 37:0,target 23 + 30:0,target 17 + 29:0,target 18 + 22:0,target 2 + 25:265,target 6 + 35:0 reduce + 9:283,target 29 + 41:265 reduce + 4:263,target 9 + 36:263,target 3 + 11:265 reduce + 0:266,target 6 + 8:257,target 22 + 11:0 reduce + 0:263 shift + 0:264 shift + 32:0 reduce + 0:265 shift + 5:265,target 25 + 0:266 shift + 8:257 shift + 14:284,target 35 + 8:258 shift + 19:265 reduce + 20:265 reduce + 0:268 shift + 8:259 shift + 8:260 shift + 0:269 shift + 0:270 shift + 8:261 shift + 37:265,target 23 + 0:271 shift + 8:262 shift + 0:272 shift + 0:273 shift + 0:274 shift + 8:265 reduce + 0:275 shift + 6:0 reduce + 0:264,target 4 + 0:276 shift + 28:265 reduce + 26:265,target 4 + 0:278 goto + 0:279 goto + 28:0 reduce + 0:281 goto + 0:282 goto + 37:265 reduce + 8:277 goto + 42:0,target 12 + 3:0 reduce + 26:0,target 4 + 18:0,target 10 + 11:0,target 16 + 6:265,target 15 + 25:0 reduce + 16:263 shift + 38:265,target 42 + 16:264 shift + 15:263,target 3 + 0:281,target 18 + 27:265,target 7 + 5:265 reduce + 22:0 reduce + 25:265 reduce + 10:262,target 27 + 16:278 goto + 34:265 shift + 0:278,target 16 + 4:0,target 9 + 7:265,target 20 + 18:0 reduce + 40:265,target 30 + 40:0 reduce + 39:265,target 29 + 39:0 reduce + 0:a,target 1 + 10:259,target 24 + 10:260,target 25 + 16:263,target 3 + 31:0,target 20 + 23:0,target 5 + 13:265 shift + 28:265,target 21 + 0:276,target 15 + 2:265 reduce + 22:265 reduce + 10:257,target 22 + 0:274,target 13 + 8:265,target 1 + 31:265 reduce + 12:0 reduce + 41:265,target 24 + 10:257 shift + 10:258 shift + 40:265 reduce + 39:265 reduce + 0:a shift + 10:259 shift + 10:260 shift + 0:b shift + 3:264,target 8 + 10:261 shift + 30:265,target 17 + 29:265,target 18 + 8:0,target 1 + 10:262 shift + 1:0,target 26 + 0:272,target 11 + 10:265 reduce + 18:265,target 11 + 35:0,target 22 + 30:0 reduce + 29:0 reduce + 27:0,target 7 + 19:0,target 13 + 20:0,target 28 + 12:0,target 14 + 18:265 reduce + 9:265,target 20 + 10:277 goto + 0:269,target 8 + 0:270,target 9 + 4:0 reduce + 7:265 shift + 8:261,target 26 + 27:265 reduce + 26:0 reduce + 4:264,target 9 + 18:280 goto + 36:263 shift + 31:265,target 20 + 36:264 shift + 36:264,target 4 + 1:0 reduce + 8:258,target 23 + 19:265,target 13 + 20:265,target 28 + 7:283 goto + 23:0 reduce + 5:0,target 25 + 15:263 shift + 36:278 goto + 15:264 shift + 8:277,target 28 + 18:280,target 38 + 40:0,target 30 + 39:0,target 29 + 4:263 reduce + 32:0,target 31 + 0:265,target 5 + 4:264 reduce + 4:265 reduce + 24:0,target 3 + 19:0 reduce + 20:0 reduce + 24:265 reduce + 41:0 reduce + 32:265,target 31 + 15:278 goto + 33:265 shift + 21:265,target 19 + 0:263,target 3 + 10:265,target 1 + 37:0 reduce + 36:278,target 41 + 15:264,target 4 + 0:282,target 19 + 12:265 reduce + 1:265,target 26 + 2:0,target 27 + 33:265,target 39 + 1:265 reduce + 21:265 reduce + 22:265,target 2 + 0:279,target 17 + 28:0,target 21 + 9:265 shift + 21:0,target 19 + 30:265 reduce + 29:265 reduce + 8:0 reduce + 10:0 reduce + 11:265,target 16 + 31:0 reduce + 0:b,target 2 + 10:261,target 26 + 16:264,target 4 + 38:265 shift + 2:265,target 27 + 5:0 reduce +} + +array set cmap::rules { + 27,l 282 + 9,l 278 + 11,l 280 + 15,l 281 + 20,l 281 + 19,l 281 + 2,l 277 + 24,l 281 + 6,l 277 + 28,l 283 + 12,l 279 + 16,l 281 + 21,l 281 + 3,l 277 + 25,l 282 + 7,l 277 + 30,l 284 + 29,l 284 + 13,l 281 + 0,l 285 + 17,l 281 + 22,l 281 + 4,l 277 + 26,l 282 + 8,l 278 + 10,l 279 + 31,l 284 + 14,l 281 + 18,l 281 + 1,l 277 + 23,l 281 + 5,l 277 +} + +array set cmap::rules { + 23,dc 2 + 5,dc 1 + 0,dc 1 + 17,dc 2 + 12,dc 3 + 26,dc 1 + 8,dc 1 + 21,dc 2 + 3,dc 1 + 15,dc 1 + 10,dc 1 + 30,dc 2 + 29,dc 2 + 24,dc 3 + 6,dc 1 + 18,dc 2 + 1,dc 0 + 13,dc 1 + 27,dc 1 + 9,dc 1 + 22,dc 2 + 4,dc 1 + 16,dc 1 + 11,dc 0 + 31,dc 1 + 25,dc 1 + 7,dc 1 + 20,dc 2 + 19,dc 2 + 2,dc 1 + 14,dc 1 + 28,dc 1 +} + +array set cmap::rules { + 13,line 63 + 25,line 85 + 7,line 53 + 10,line 59 + 22,line 79 + 4,line 50 + 18,line 73 + 1,line 47 + 31,line 95 + 15,line 67 + 27,line 87 + 9,line 56 + 12,line 60 + 24,line 82 + 6,line 52 + 21,line 77 + 3,line 49 + 17,line 71 + 30,line 94 + 29,line 93 + 14,line 64 + 26,line 86 + 8,line 55 + 11,line 59 + 23,line 81 + 5,line 51 + 20,line 76 + 19,line 75 + 2,line 48 + 16,line 69 + 11,e 1 + 28,line 90 +} + +array set cmap::lr1_table { + 35 {{22 {0 265} 2}} + 36 {{24 {0 265} 2} {8 {0 265} 0} {9 {0 265} 0}} + 14,trans {{267 32} {270 33} {274 34} {284 35}} + 33,trans {{265 41}} + 37 {{8 {0 265} 1}} + 38 {{9 {0 265} 1}} + 40 {{12 0 2}} + 39 {{23 {0 265} 2}} + 41 {{29 {0 265} 2}} + 18,trans {{280 40}} + 1,trans {} + 37,trans {} + 42 {{30 {0 265} 2}} + 43 {{24 {0 265} 3}} + 44 {{12 0 3}} + 23,trans {} + 5,trans {} + 42,trans {} + 27,trans {} + 9,trans {{265 20} {283 29}} + 13,trans {{265 31}} + 32,trans {} + 17,trans {} + 0,trans {{a 1} {b 2} {263 3} {264 4} {265 5} {266 6} {268 7} {269 8} {270 9} {271 10} {272 11} {273 12} {274 13} {275 14} {276 15} {278 16} {279 17} {281 18} {282 19}} + 36,trans {{263 37} {264 38} {278 43}} + 22,trans {} + 4,trans {} + 41,trans {} + 26,trans {} + 8,trans {{257 22} {258 23} {259 24} {260 25} {261 26} {262 27} {277 28}} + 12,trans {} + 31,trans {} + 16,trans {{263 37} {264 38} {278 39}} + 35,trans {} + 21,trans {} + 3,trans {} + 40,trans {{265 44}} + 39,trans {} + 10 {{17 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 11 {{16 {0 265} 1}} + 25,trans {} + 12 {{14 {0 265} 1}} + 7,trans {{265 20} {283 21}} + 44,trans {} + 13 {{20 {0 265} 1}} + 14 {{22 {0 265} 1} {29 {0 265} 0} {30 {0 265} 0} {31 {0 265} 0}} + 15 {{24 {0 265} 1} {8 {263 264} 0} {9 {263 264} 0}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{23 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {18 {0 265} 0} {19 {0 265} 0} {20 {0 265} 0} {21 {0 265} 0} {22 {0 265} 0} {23 {0 265} 0} {24 {0 265} 0} {25 {0 265} 0} {26 {0 265} 0} {27 {0 265} 0} {8 {263 264} 0} {9 {263 264} 0}} + 17 {{0 0 1}} + 1 {{26 {0 265} 1}} + 18 {{10 0 1} {12 0 1} {11 265 0}} + 15,trans {{263 3} {264 4} {278 36}} + 2 {{27 {0 265} 1}} + 19 {{13 {0 265} 1}} + 20 {{28 {0 265} 1}} + 34,trans {{265 42}} + 3 {{8 {263 264} 1}} + 21 {{19 {0 265} 2}} + 4 {{9 {263 264} 1}} + 22 {{2 {0 265} 1}} + 5 {{25 {0 265} 1}} + 23 {{5 {0 265} 1}} + 20,trans {} + 19,trans {} + 6 {{15 {0 265} 1}} + 2,trans {} + 24 {{3 {0 265} 1}} + 38,trans {} + 7 {{19 {0 265} 1} {28 {0 265} 0}} + 25 {{6 {0 265} 1}} + 8 {{21 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 26 {{4 {0 265} 1}} + 9 {{18 {0 265} 1} {28 {0 265} 0}} + 27 {{7 {0 265} 1}} + 24,trans {} + 6,trans {} + 28 {{21 {0 265} 2}} + 43,trans {} + 29 {{18 {0 265} 2}} + 30 {{17 {0 265} 2}} + 31 {{20 {0 265} 2}} + 10,trans {{257 22} {258 23} {259 24} {260 25} {261 26} {262 27} {277 30}} + 32 {{31 {0 265} 1}} + 28,trans {} + 33 {{29 {0 265} 1}} + 34 {{30 {0 265} 1}} +} + +array set cmap::token_id_table { + 280,title {} + 279,title {} + 264,line 15 + 270,t 0 + 269,t 0 + b,t 0 + 276,line 31 + 265,title string + 284,title {} + 274,t 0 + 261,line 11 + 257,t 0 + 270,title LOAD + 269,title INVERT + 273,line 28 + 278,t 1 + 257,line 7 + 262,t 0 + 285,line 96 + 274,title SAVE + 283,t 1 + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 278,title {} + 282,line 84 + error error + 271,t 0 + 264,title float + 266,line 21 + 283,title {} + 278,line 54 + error,line 45 + 275,t 0 + 268,title FILE + 258,t 0 + 263,line 14 + error,title {} + 280,t 1 + 279,t 1 + 275,line 30 + 273,title OPEN + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 284,t 1 + 277,title {} + 272,line 27 + 267,t 0 + a a + 263,title integer + 284,line 92 + b b + 282,title {} + 272,t 0 + 268,line 23 + 267,title DELETE + b,line 86 + 257 YES_ + 281,line 62 + 276,t 0 + 258 NO_ + b,title {} + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title MATCH + 261 TRUE_ + 265,line 17 + 262 FALSE_ + 281,t 1 + 263 INT_ + 277,line 46 + 257,title YES + 264 REAL_ + 264,t 0 + 276,title VALUE + 265 STRING_ + 262,line 12 + 266 CLOSE_ + 285,t 1 + 267 DELETE_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FILE_ + 268,t 0 + a,t 0 + 281,title {} + 274,line 29 + 270 LOAD_ + 269 INVERT_ + error,t 0 + 271 LOCK_ + 272 MATCH_ + 258,line 8 + 273,t 0 + 273 OPEN_ + 266,title CLOSE + 285,title {} + 274 SAVE_ + 275 TAG_ + 271,line 26 + a,title {} + 276 VALUE_ + 277,t 1 + 277 yesno + 271,title LOCK + 283,line 89 + 278 numeric + 261,t 0 + 280 @PSEUDO1 + 279 command + 281 cmap + 267,line 22 + 282,t 1 + 282 cmapSelect + 275,title TAG + 283 cmapLoad + a,line 85 + 265,t 0 + 284 cmapTag + 280,line 59 + 279,line 58 + 285 start' + 261,title TRUE +} + +proc cmap::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 14 { ColormapDialog } + 15 { ColormapDestroyDialog } + 16 { MatchColorCurrent } + 17 { ProcessCmdSet colorbar lock $2 LockColorCurrent } + 20 { SaveColormapFile $2; FileLast colormapfbox $2 } + 21 { ProcessCmdSet colorbar invert $2 InvertColorbar } + 23 { CmapValueCmd $1 $2 } + 24 { CmapValueCmd $2 $3 } + 25 { CmapCmd $1 } + 26 { CmapCmd a } + 27 { CmapCmd b } + 28 { LoadColormapFile $1; FileLast colormapfbox $1 } + 29 { LoadColorTag $2 } + 30 { ProcessCmdCurrent colorbar "tag save $2" } + 31 { DeleteColorTag } + } + 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 cmap::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/cmapsendlex.tcl b/ds9/parsers/cmapsendlex.tcl new file mode 100644 index 0000000..bed9351 --- /dev/null +++ b/ds9/parsers/cmapsendlex.tcl @@ -0,0 +1,289 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cmapsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cmapsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cmapsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cmapsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cmapsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cmapsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cmapsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cmapsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cmapsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cmapsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set FILE_ 257 +set INVERT_ 258 +set LOCK_ 259 +set VALUE_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: file + if {[regexp -start $index_ -indices -line -nocase -- {\A(file)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: invert + if {[regexp -start $index_ -indices -line -nocase -- {\A(invert)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: value + if {[regexp -start $index_ -indices -line -nocase -- {\A(value)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $FILE_ + } + 1 { +return $INVERT_ + } + 2 { +return $LOCK_ + } + 3 { +return $VALUE_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/cmapsendparser.tab.tcl b/ds9/parsers/cmapsendparser.tab.tcl new file mode 100644 index 0000000..5424c17 --- /dev/null +++ b/ds9/parsers/cmapsendparser.tab.tcl @@ -0,0 +1,4 @@ +set FILE_ 257 +set INVERT_ 258 +set LOCK_ 259 +set VALUE_ 260 diff --git a/ds9/parsers/cmapsendparser.tcl b/ds9/parsers/cmapsendparser.tcl new file mode 100644 index 0000000..6770f1c --- /dev/null +++ b/ds9/parsers/cmapsendparser.tcl @@ -0,0 +1,296 @@ +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 cmapsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cmapsend::YYABORT {} { + return -code return 1 +} + +proc cmapsend::YYACCEPT {} { + return -code return 0 +} + +proc cmapsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cmapsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cmapsend::yyerror {s} { + puts stderr $s +} + +proc cmapsend::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 cmapsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cmapsend::table { + 3:0,target 5 + 0:257 shift + 0:258 shift + 5:0,target 0 + 0:260 shift + 0:259 shift + 0:261 goto + 0:258,target 2 + 0:0,target 1 + 0:261,target 5 + 2:0,target 3 + 4:0,target 4 + 0:0 reduce + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 2 + 5:0 accept +} + +array set cmapsend::rules { + 0,l 262 + 1,l 261 + 2,l 261 + 3,l 261 + 4,l 261 + 5,l 261 +} + +array set cmapsend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set cmapsend::rules { + 5,line 22 + 2,line 17 + 4,line 21 + 1,line 16 + 3,line 19 +} + +array set cmapsend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0}} + 1 {{2 0 1}} + 2 {{3 0 1}} + 3 {{5 0 1}} + 4 {{4 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5}} + 5 {{0 0 1}} + 1,trans {} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} +} + +array set cmapsend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 9 + 261,line 15 + error,line 14 + 257 FILE_ + 257,t 0 + 258 INVERT_ + 258,t 0 + error,title {} + 260,t 0 + 260 VALUE_ + 259 LOCK_ + 259,t 0 + 261,t 1 + 261 cmapsend + 262,t 1 + 262 start' + 257,line 8 + 260,line 11 + 257,title FILE + 259,line 10 + 258,title INVERT + 262,line 23 + 260,title VALUE + 259,title LOCK + 261,title {} +} + +proc cmapsend::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 { ColorbarSendCmdCurrent "get name" } + 2 { ColorbarSendCmdCurrent "get file name" } + 3 { ProcessSendCmdYesNo colorbar invert } + 4 { ColorbarSendCmdContrastBias } + 5 { ProcessSendCmdYesNo colorbar lock } + } + 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 cmapsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/colorbarlex.tcl b/ds9/parsers/colorbarlex.tcl new file mode 100644 index 0000000..cee03a2 --- /dev/null +++ b/ds9/parsers/colorbarlex.tcl @@ -0,0 +1,616 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval colorbar { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc colorbar::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc colorbar::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc colorbar::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc colorbar::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc colorbar::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc colorbar::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc colorbar::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc colorbar::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc colorbar::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set INT_ 275 +set STRING_ 276 +set DISTANCE_ 277 +set HORIZONTAL_ 278 +set LOCK_ 279 +set MATCH_ 280 +set NUMERICS_ 281 +set ORIENTATION_ 282 +set SIZE_ 283 +set SPACE_ 284 +set TICKS_ 285 +set VALUE_ 286 +set VERTICAL_ 287 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: distance + if {[regexp -start $index_ -indices -line -nocase -- {\A(distance)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: horizontal + if {[regexp -start $index_ -indices -line -nocase -- {\A(horizontal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: numerics + if {[regexp -start $index_ -indices -line -nocase -- {\A(numerics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: orientation + if {[regexp -start $index_ -indices -line -nocase -- {\A(orientation)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: space + if {[regexp -start $index_ -indices -line -nocase -- {\A(space)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: ticks + if {[regexp -start $index_ -indices -line -nocase -- {\A(ticks)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: value + if {[regexp -start $index_ -indices -line -nocase -- {\A(value)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: vertical + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: times + if {[regexp -start $index_ -indices -line -nocase -- {\A(times)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: helvetica + if {[regexp -start $index_ -indices -line -nocase -- {\A(helvetica)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: courier + if {[regexp -start $index_ -indices -line -nocase -- {\A(courier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: normal + if {[regexp -start $index_ -indices -line -nocase -- {\A(normal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: bold + if {[regexp -start $index_ -indices -line -nocase -- {\A(bold)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: roman + if {[regexp -start $index_ -indices -line -nocase -- {\A(roman)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: italic + if {[regexp -start $index_ -indices -line -nocase -- {\A(italic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $DISTANCE_ + } + 1 { +return $HORIZONTAL_ + } + 2 { +return $LOCK_ + } + 3 { +return $MATCH_ + } + 4 { +return $NUMERICS_ + } + 5 { +return $ORIENTATION_ + } + 6 { +return $SIZE_ + } + 7 { +return $SPACE_ + } + 8 { +return $TICKS_ + } + 9 { +return $VALUE_ + } + 10 { +return $VERTICAL_ + } + 11 { +return $YES_ + } + 12 { +return $NO_ + } + 13 { +return $ON_ + } + 14 { +return $OFF_ + } + 15 { +return $TRUE_ + } + 16 { +return $FALSE_ + } + 17 { +return $FONT_ + } + 18 { +return $FONTSIZE_ + } + 19 { +return $FONTSLANT_ + } + 20 { +return $FONTSTYLE_ + } + 21 { +return $FONTWEIGHT_ + } + 22 { +return $TIMES_ + } + 23 { +return $HELVETICA_ + } + 24 { +return $COURIER_ + } + 25 { +return $NORMAL_ + } + 26 { +return $BOLD_ + } + 27 { +return $ROMAN_ + } + 28 { +return $ITALIC_ + } + 29 { +set yylval $yytext; return $INT_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 33 { +set yylval $yytext; return $STRING_ + } + 34 { +# ignore whitespace + } + 35 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/colorbarparser.tab.tcl b/ds9/parsers/colorbarparser.tab.tcl new file mode 100644 index 0000000..ce2d224 --- /dev/null +++ b/ds9/parsers/colorbarparser.tab.tcl @@ -0,0 +1,31 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set INT_ 275 +set STRING_ 276 +set DISTANCE_ 277 +set HORIZONTAL_ 278 +set LOCK_ 279 +set MATCH_ 280 +set NUMERICS_ 281 +set ORIENTATION_ 282 +set SIZE_ 283 +set SPACE_ 284 +set TICKS_ 285 +set VALUE_ 286 +set VERTICAL_ 287 diff --git a/ds9/parsers/colorbarparser.tcl b/ds9/parsers/colorbarparser.tcl new file mode 100644 index 0000000..26d1219 --- /dev/null +++ b/ds9/parsers/colorbarparser.tcl @@ -0,0 +1,919 @@ +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 colorbar { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc colorbar::YYABORT {} { + return -code return 1 +} + +proc colorbar::YYACCEPT {} { + return -code return 0 +} + +proc colorbar::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc colorbar::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc colorbar::yyerror {s} { + puts stderr $s +} + +proc colorbar::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 colorbar::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set colorbar::table { + 48:276,target 49 + 5:276,target 4 + 27:0 reduce + 38:276 reduce + 37:276,target 11 + 9:291 goto + 15:257,target 1 + 6:0,target 7 + 47:276 reduce + 26:276,target 9 + 2:0 reduce + 17:275 shift + 24:0 reduce + 41:0,target 24 + 15:276,target 1 + 45:0 reduce + 33:0,target 15 + 13:288,target 40 + 25:0,target 8 + 6:276 reduce + 26:276 reduce + 6:276,target 7 + 16:278,target 12 + 21:0 reduce + 38:276,target 12 + 42:0 reduce + 35:276 reduce + 27:276,target 10 + 16:297,target 42 + 44:276 reduce + 38:0 reduce + 14:276 reduce + 3:0,target 3 + 10:292,target 36 + 3:276 reduce + 45:0,target 35 + 23:276 reduce + 37:0,target 11 + 14:0 reduce + 40:276,target 23 + 39:276,target 28 + 30:0,target 13 + 29:0,target 27 + 10:271,target 33 + 22:0,target 0 + 35:0 reduce + 14:0,target 22 + 32:276 reduce + 28:276,target 26 + 0:287,target 20 + 0:257 shift + 0:258 shift + 0:260 shift + 0:259 shift + 13:261,target 5 + 0:261 shift + 0:266,target 10 + 0:262 shift + 0:263 shift + 15:288,target 41 + 41:276 reduce + 0:264 shift + 11:271 shift + 23:294 goto + 32:0 reduce + 0:265 shift + 11:272 shift + 0:266 shift + 0:267 shift + 0:285,target 19 + 6:0 reduce + 13:258,target 2 + 41:276,target 24 + 0:276 reduce + 0:264,target 8 + 11:271,target 37 + 23:294,target 48 + 19:275 shift + 0:278 shift + 20:276 reduce + 28:0 reduce + 0:280 shift + 0:279 shift + 0:0,target 1 + 0:281 shift + 0:282 shift + 49:0 reduce + 30:276,target 13 + 29:276,target 27 + 0:283 shift + 11:290 goto + 0:284 shift + 8:275 shift + 0:285 shift + 49:0,target 20 + 0:283,target 17 + 11:290,target 39 + 42:0,target 32 + 28:276 reduce + 0:287 shift + 34:0,target 16 + 0:288 goto + 26:0,target 9 + 3:0 reduce + 7:269,target 26 + 7:270,target 27 + 0:262,target 6 + 0:293 goto + 25:0 reduce + 0:295 goto + 37:276 reduce + 46:0 reduce + 0:297 goto + 0:281,target 15 + 42:276,target 32 + 0:0 reduce + 46:276 reduce + 0:260,target 4 + 0:259,target 3 + 22:0 accept + 31:276,target 14 + 43:0 reduce + 16:278 shift + 9:274,target 31 + 15:261,target 5 + 0:278,target 12 + 5:276 reduce + 20:276,target 37 + 25:276 reduce + 4:0,target 6 + 16:287 shift + 0:257,target 1 + 13:257 shift + 13:258 shift + 40:0 reduce + 39:0 reduce + 13:259 shift + 13:260 shift + 46:0,target 25 + 0:297,target 24 + 13:261 shift + 38:0,target 12 + 34:276 reduce + 13:262 shift + 31:0,target 14 + 15:258,target 2 + 23:0,target 18 + 43:276,target 33 + 15:0,target 1 + 16:297 goto + 0:276,target 1 + 43:276 reduce + 15:0 reduce + 32:276,target 29 + 9:291,target 32 + 36:0 reduce + 0:295,target 23 + 13:276 reduce + 21:276,target 21 + 2:276 reduce + 12:0 reduce + 33:0 reduce + 13:288 goto + 0:293,target 22 + 44:276,target 36 + 31:276 reduce + 1:276,target 2 + 1:0,target 2 + 18:286,target 45 + 33:276,target 15 + 10:274,target 35 + 43:0,target 33 + 40:276 reduce + 39:276 reduce + 35:0,target 17 + 30:0 reduce + 29:0 reduce + 10:271 shift + 27:0,target 10 + 10:272 shift + 20:0,target 37 + 10:274 shift + 12:0,target 38 + 48:276 shift + 4:0 reduce + 7:268 shift + 10:272,target 34 + 7:269 shift + 7:270 shift + 26:0 reduce + 18:277 shift + 47:0 reduce + 45:276,target 35 + 2:276,target 5 + 0:288,target 21 + 10:292 goto + 27:276 reduce + 34:276,target 16 + 1:0 reduce + 13:262,target 6 + 18:286 shift + 0:267,target 11 + 15:257 shift + 15:258 shift + 23:0 reduce + 15:259 shift + 15:260 shift + 15:261 shift + 23:276,target 19 + 44:0 reduce + 36:276 reduce + 5:0,target 4 + 15:262 shift + 7:289 goto + 18:296 goto + 12:276,target 38 + 47:0,target 34 + 40:0,target 23 + 39:0,target 28 + 13:259,target 3 + 13:260,target 4 + 45:276 reduce + 32:0,target 29 + 0:265,target 9 + 11:272,target 38 + 17:275,target 43 + 24:0,target 31 + 20:0 reduce + 46:276,target 25 + 41:0 reduce + 3:276,target 3 + 15:276 reduce + 0:284,target 18 + 8:275,target 29 + 35:276,target 17 + 4:276 reduce + 18:277,target 44 + 13:257,target 1 + 24:276 reduce + 0:263,target 7 + 15:288 goto + 24:276,target 31 + 37:0 reduce + 33:276 reduce + 7:289,target 28 + 18:296,target 46 + 13:276,target 1 + 0:282,target 16 + 7:268,target 25 + 16:287,target 20 + 0:261,target 5 + 13:0 reduce + 47:276,target 34 + 42:276 reduce + 2:0,target 5 + 4:276,target 6 + 34:0 reduce + 12:276 reduce + 44:0,target 36 + 36:276,target 30 + 15:262,target 6 + 36:0,target 30 + 28:0,target 26 + 0:280,target 14 + 0:279,target 13 + 21:0,target 21 + 13:0,target 1 + 1:276 reduce + 25:276,target 8 + 0:258,target 2 + 21:276 reduce + 31:0 reduce + 9:273 shift + 9:274 shift + 14:276,target 22 + 9:273,target 30 + 15:259,target 3 + 15:260,target 4 + 30:276 reduce + 29:276 reduce + 19:275,target 47 + 5:0 reduce +} + +array set colorbar::rules { + 9,l 289 + 11,l 290 + 32,l 295 + 6,l 288 + 28,l 295 + 3,l 288 + 25,l 295 + 0,l 298 + 22,l 295 + 18,l 293 + 15,l 292 + 36,l 296 + 12,l 290 + 33,l 295 + 7,l 288 + 29,l 295 + 30,l 295 + 4,l 288 + 26,l 295 + 1,l 288 + 23,l 295 + 19,l 294 + 20,l 293 + 16,l 292 + 37,l 297 + 13,l 291 + 34,l 295 + 8,l 289 + 10,l 289 + 31,l 295 + 5,l 288 + 27,l 295 + 2,l 288 + 24,l 295 + 21,l 295 + 17,l 292 + 38,l 297 + 14,l 291 + 35,l 296 +} + +array set colorbar::rules { + 12,dc 1 + 26,dc 2 + 3,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 2 + 2,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 1 + 10,dc 1 + 24,dc 2 + 1,dc 0 + 38,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 23,dc 2 + 0,dc 1 + 37,dc 1 + 15,dc 1 + 29,dc 2 + 30,dc 2 + 6,dc 1 + 22,dc 1 + 36,dc 1 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 21,dc 1 + 35,dc 1 + 13,dc 1 + 27,dc 2 + 4,dc 1 + 19,dc 0 + 20,dc 3 + 34,dc 2 +} + +array set colorbar::rules { + 7,line 80 + 37,line 130 + 4,line 77 + 34,line 123 + 1,line 74 + 31,line 119 + 27,line 112 + 24,line 109 + 21,line 105 + 17,line 97 + 14,line 92 + 11,line 87 + 9,line 83 + 6,line 79 + 36,line 127 + 3,line 76 + 33,line 122 + 29,line 115 + 30,line 117 + 26,line 111 + 23,line 108 + 19,line 101 + 20,line 102 + 16,line 96 + 13,line 91 + 19,e 1 + 10,line 84 + 8,line 82 + 38,line 131 + 5,line 78 + 35,line 126 + 2,line 75 + 32,line 121 + 28,line 113 + 25,line 110 + 22,line 106 + 18,line 101 + 15,line 95 + 12,line 88 +} + +array set colorbar::lr1_table { + 35 {{17 {0 276} 1}} + 14,trans {} + 36 {{30 {0 276} 2}} + 33,trans {} + 37 {{11 {0 276} 1}} + 38 {{12 {0 276} 1}} + 40 {{23 {0 276} 2}} + 39 {{28 {0 276} 2}} + 18,trans {{277 44} {286 45} {296 46}} + 41 {{24 {0 276} 2}} + 1,trans {} + 37,trans {} + 42 {{32 {0 276} 2}} + 43 {{33 {0 276} 2}} + 44 {{36 {0 276} 1}} + 23,trans {{294 48}} + 45 {{35 {0 276} 1}} + 5,trans {} + 42,trans {} + 46 {{25 {0 276} 2}} + 47 {{34 {0 276} 2}} + 48 {{20 0 2}} + 49 {{20 0 3}} + 27,trans {} + 9,trans {{273 30} {274 31} {291 32}} + 46,trans {} + 13,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {288 40}} + 32,trans {} + 17,trans {{275 43}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {278 12} {279 13} {280 14} {281 15} {282 16} {283 17} {284 18} {285 19} {287 20} {288 21} {293 22} {295 23} {297 24}} + 36,trans {} + 22,trans {} + 4,trans {} + 41,trans {} + 26,trans {} + 8,trans {{275 29}} + 45,trans {} + 12,trans {} + 31,trans {} + 49,trans {} + 16,trans {{278 12} {287 20} {297 42}} + 35,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 10 {{30 {0 276} 1} {15 {0 276} 0} {16 {0 276} 0} {17 {0 276} 0}} + 11 {{28 {0 276} 1} {11 {0 276} 0} {12 {0 276} 0}} + 25,trans {} + 12 {{38 {0 276} 1}} + 7,trans {{268 25} {269 26} {270 27} {289 28}} + 44,trans {} + 13 {{23 {0 276} 1} {1 {0 276} 0} {2 {0 276} 0} {3 {0 276} 0} {4 {0 276} 0} {5 {0 276} 0} {6 {0 276} 0} {7 {0 276} 0}} + 14 {{22 {0 276} 1}} + 11,trans {{271 37} {272 38} {290 39}} + 15 {{24 {0 276} 1} {1 {0 276} 0} {2 {0 276} 0} {3 {0 276} 0} {4 {0 276} 0} {5 {0 276} 0} {6 {0 276} 0} {7 {0 276} 0}} + 30,trans {} + 29,trans {} + 16 {{32 {0 276} 1} {37 {0 276} 0} {38 {0 276} 0}} + 48,trans {{276 49}} + 0 {{0 0 0} {18 0 0} {20 0 0} {21 {0 276} 0} {22 {0 276} 0} {23 {0 276} 0} {24 {0 276} 0} {25 {0 276} 0} {26 {0 276} 0} {27 {0 276} 0} {28 {0 276} 0} {29 {0 276} 0} {30 {0 276} 0} {31 {0 276} 0} {32 {0 276} 0} {33 {0 276} 0} {34 {0 276} 0} {1 {0 276} 0} {2 {0 276} 0} {3 {0 276} 0} {4 {0 276} 0} {5 {0 276} 0} {6 {0 276} 0} {7 {0 276} 0} {37 {0 276} 0} {38 {0 276} 0}} + 17 {{33 {0 276} 1}} + 1 {{2 {0 276} 1}} + 18 {{25 {0 276} 1} {35 {0 276} 0} {36 {0 276} 0}} + 15,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {288 41}} + 2 {{5 {0 276} 1}} + 19 {{34 {0 276} 1}} + 20 {{37 {0 276} 1}} + 34,trans {} + 3 {{3 {0 276} 1}} + 21 {{21 {0 276} 1}} + 4 {{6 {0 276} 1}} + 22 {{0 0 1}} + 5 {{4 {0 276} 1}} + 23 {{18 0 1} {20 0 1} {19 276 0}} + 20,trans {} + 19,trans {{275 47}} + 6 {{7 {0 276} 1}} + 24 {{31 {0 276} 1}} + 2,trans {} + 38,trans {} + 7 {{26 {0 276} 1} {8 {0 276} 0} {9 {0 276} 0} {10 {0 276} 0}} + 25 {{8 {0 276} 1}} + 8 {{27 {0 276} 1}} + 26 {{9 {0 276} 1}} + 9 {{29 {0 276} 1} {13 {0 276} 0} {14 {0 276} 0}} + 27 {{10 {0 276} 1}} + 24,trans {} + 6,trans {} + 28 {{26 {0 276} 2}} + 43,trans {} + 29 {{27 {0 276} 2}} + 30 {{13 {0 276} 1}} + 31 {{14 {0 276} 1}} + 32 {{29 {0 276} 2}} + 10,trans {{271 33} {272 34} {274 35} {292 36}} + 28,trans {} + 33 {{15 {0 276} 1}} + 47,trans {} + 34 {{16 {0 276} 1}} +} + +array set colorbar::token_id_table { + 286,t 0 + 286 VALUE_ + 280,title MATCH + 279,title LOCK + 264,line 15 + 298,title {} + 292,line 94 + 287 VERTICAL_ + 270,t 0 + 269,t 0 + 288 yesno + 290 fontWeight + 289 font + 276,line 29 + 265,title FONTSLANT + 291,t 1 + 291 fontSlant + 284,title SPACE + 292 fontStyle + 274,t 0 + 261,line 11 + 293 command + 288,line 73 + 257,t 0 + 294 @PSEUDO1 + 270,title COURIER + 269,title HELVETICA + 295,t 1 + 295 colorbar + 288,title {} + 273,line 24 + 296 space + 278,t 0 + 297 orientation + 257,line 7 + 262,t 0 + 298 start' + 285,line 41 + 274,title ITALIC + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 297,line 129 + 259,title ON + 260,title OFF + 266,t 0 + 278,title HORIZONTAL + 297,title {} + 282,line 38 + 287,t 0 + error error + 271,t 0 + 264,title FONTSIZE + 266,line 17 + 294,line 101 + 283,title SIZE + 292,t 1 + 278,line 34 + error,line 72 + 275,t 0 + 268,title TIMES + 287,title VERTICAL + 258,t 0 + 263,line 14 + 291,line 90 + error,title {} + 296,t 1 + 280,t 0 + 279,t 0 + 275,line 27 + 273,title ROMAN + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 43 + 258,title NO + 284,t 0 + 277,title DISTANCE + 296,title {} + 272,line 23 + 267,t 0 + 263,title FONT + 288,t 1 + 284,line 40 + 282,title ORIENTATION + 272,t 0 + 268,line 19 + 296,line 125 + 267,title FONTWEIGHT + 293,t 1 + 286,title VALUE + 257 YES_ + 281,line 37 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title BOLD + 261 TRUE_ + 265,line 16 + 297,t 1 + 293,line 100 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 FONT_ + 277,line 33 + 257,title YES + 264 FONTSIZE_ + 264,t 0 + 276,title string + 265 FONTSLANT_ + 295,title {} + 262,line 12 + 266 FONTSTYLE_ + 290,line 86 + 289,line 81 + 285,t 0 + 267 FONTWEIGHT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 TIMES_ + 268,t 0 + 281,title NUMERICS + 274,line 25 + 270 COURIER_ + 269 HELVETICA_ + error,t 0 + 271 NORMAL_ + 290,t 1 + 289,t 1 + 272 BOLD_ + 258,line 8 + 286,line 42 + 273,t 0 + 273 ROMAN_ + 266,title FONTSTYLE + 285,title TICKS + 274 ITALIC_ + 275 INT_ + 271,line 22 + 298,line 132 + 294,t 1 + 276 STRING_ + 277,t 0 + 277 DISTANCE_ + 271,title NORMAL + 290,title {} + 289,title {} + 283,line 39 + 278 HORIZONTAL_ + 261,t 0 + 280 MATCH_ + 279 LOCK_ + 298,t 1 + 281 NUMERICS_ + 267,line 18 + 295,line 104 + 282,t 0 + 282 ORIENTATION_ + 275,title integer + 294,title {} + 283 SIZE_ + 265,t 0 + 284 SPACE_ + 280,line 36 + 279,line 35 + 285 TICKS_ + 261,title TRUE +} + +proc colorbar::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ times } + 9 { set _ helvetica } + 10 { set _ courier } + 11 { set _ normal } + 12 { set _ bold } + 13 { set _ roman } + 14 { set _ italic } + 15 { set _ normal } + 16 { set _ bold } + 17 { set _ italic } + 19 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 21 { ProcessCmdSet view colorbar $1 UpdateView } + 22 { MatchColorCurrent } + 23 { ProcessCmdSet colorbar lock $2 LockColorCurrent } + 24 { ProcessCmdSet colorbar numerics $2 UpdateView } + 25 { ProcessCmdSet colorbar space $2 UpdateView } + 26 { ProcessCmdSet colorbar font $2 UpdateView } + 27 { ProcessCmdSet colorbar font,size $2 UpdateView } + 28 { ProcessCmdSet colorbar font,weight $2 UpdateView } + 29 { ProcessCmdSet colorbar font,slant $2 UpdateView } + 30 { ProcessCmdFontStyle colorbar font $2 UpdateView } + 31 { ProcessCmdSet colorbar orientation $1 UpdateView } + 32 { ProcessCmdSet colorbar orientation $2 UpdateView } + 33 { ProcessCmdSet colorbar size $2 UpdateView } + 34 { ProcessCmdSet colorbar ticks $2 UpdateView } + 35 { set _ 1 } + 36 { set _ 0 } + 37 { set _ vertical } + 38 { set _ horizontal } + } + 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 colorbar::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/colorbarsendlex.tcl b/ds9/parsers/colorbarsendlex.tcl new file mode 100644 index 0000000..87a6d48 --- /dev/null +++ b/ds9/parsers/colorbarsendlex.tcl @@ -0,0 +1,377 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval colorbarsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc colorbarsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc colorbarsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc colorbarsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc colorbarsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc colorbarsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc colorbarsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc colorbarsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc colorbarsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc colorbarsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set FONT_ 257 +set FONTSIZE_ 258 +set FONTSLANT_ 259 +set FONTSTYLE_ 260 +set FONTWEIGHT_ 261 +set LOCK_ 262 +set NUMERICS_ 263 +set ORIENTATION_ 264 +set SIZE_ 265 +set SPACE_ 266 +set TICKS_ 267 +set VALUE_ 268 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: numerics + if {[regexp -start $index_ -indices -line -nocase -- {\A(numerics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: orientation + if {[regexp -start $index_ -indices -line -nocase -- {\A(orientation)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: space + if {[regexp -start $index_ -indices -line -nocase -- {\A(space)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: ticks + if {[regexp -start $index_ -indices -line -nocase -- {\A(ticks)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: value + if {[regexp -start $index_ -indices -line -nocase -- {\A(value)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $LOCK_ + } + 1 { +return $NUMERICS_ + } + 2 { +return $ORIENTATION_ + } + 3 { +return $SIZE_ + } + 4 { +return $SPACE_ + } + 5 { +return $TICKS_ + } + 6 { +return $VALUE_ + } + 7 { +return $FONT_ + } + 8 { +return $FONTSIZE_ + } + 9 { +return $FONTSLANT_ + } + 10 { +return $FONTSTYLE_ + } + 11 { +return $FONTWEIGHT_ + } + 12 { +# ignore whitespace + } + 13 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/colorbarsendparser.tab.tcl b/ds9/parsers/colorbarsendparser.tab.tcl new file mode 100644 index 0000000..ff88182 --- /dev/null +++ b/ds9/parsers/colorbarsendparser.tab.tcl @@ -0,0 +1,12 @@ +set FONT_ 257 +set FONTSIZE_ 258 +set FONTSLANT_ 259 +set FONTSTYLE_ 260 +set FONTWEIGHT_ 261 +set LOCK_ 262 +set NUMERICS_ 263 +set ORIENTATION_ 264 +set SIZE_ 265 +set SPACE_ 266 +set TICKS_ 267 +set VALUE_ 268 diff --git a/ds9/parsers/colorbarsendparser.tcl b/ds9/parsers/colorbarsendparser.tcl new file mode 100644 index 0000000..81cff22 --- /dev/null +++ b/ds9/parsers/colorbarsendparser.tcl @@ -0,0 +1,398 @@ +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 colorbarsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc colorbarsend::YYABORT {} { + return -code return 1 +} + +proc colorbarsend::YYACCEPT {} { + return -code return 0 +} + +proc colorbarsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc colorbarsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc colorbarsend::yyerror {s} { + puts stderr $s +} + +proc colorbarsend::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 colorbarsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set colorbarsend::table { + 0:257 shift + 0:258 shift + 0:259 shift + 0:260 shift + 5:0,target 8 + 0:266,target 10 + 0:261 shift + 9:0 reduce + 0:262 shift + 11:0 reduce + 0:263 shift + 0:264 shift + 0:265 shift + 0:266 shift + 0:267 shift + 0:265,target 9 + 0:269 goto + 6:0,target 2 + 2:0 reduce + 6:0 reduce + 0:264,target 8 + 7:0,target 4 + 12:0 accept + 0:0,target 1 + 10:0,target 5 + 0:263,target 7 + 3:0 reduce + 8:0,target 3 + 1:0,target 6 + 11:0,target 12 + 0:262,target 6 + 7:0 reduce + 0:261,target 5 + 9:0,target 11 + 2:0,target 7 + 12:0,target 0 + 0:0 reduce + 0:259,target 3 + 0:260,target 4 + 0:269,target 12 + 4:0 reduce + 3:0,target 9 + 8:0 reduce + 10:0 reduce + 0:258,target 2 + 4:0,target 10 + 0:257,target 1 + 1:0 reduce + 0:267,target 11 + 5:0 reduce +} + +array set colorbarsend::rules { + 9,l 269 + 11,l 269 + 2,l 269 + 6,l 269 + 12,l 269 + 3,l 269 + 7,l 269 + 0,l 270 + 4,l 269 + 8,l 269 + 10,l 269 + 1,l 269 + 5,l 269 +} + +array set colorbarsend::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 1 + 10,dc 1 + 6,dc 1 + 1,dc 0 + 9,dc 1 + 4,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set colorbarsend::rules { + 7,line 32 + 10,line 36 + 4,line 29 + 1,line 26 + 9,line 35 + 12,line 38 + 6,line 31 + 3,line 28 + 8,line 33 + 11,line 37 + 5,line 30 + 2,line 27 +} + +array set colorbarsend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0}} + 1 {{6 0 1}} + 2 {{7 0 1}} + 3 {{9 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {269 12}} + 4 {{10 0 1}} + 1,trans {} + 5 {{8 0 1}} + 2,trans {} + 6 {{2 0 1}} + 3,trans {} + 7 {{4 0 1}} + 4,trans {} + 8 {{3 0 1}} + 5,trans {} + 9 {{11 0 1}} + 10 {{5 0 1}} + 6,trans {} + 11 {{12 0 1}} + 7,trans {} + 12 {{0 0 1}} + 8,trans {} + 10,trans {} + 9,trans {} + 11,trans {} + 12,trans {} +} + +array set colorbarsend::token_id_table { + 264,line 17 + 270,t 1 + 269,t 1 + 265,title SIZE + 261,line 11 + 257,t 0 + 270,title {} + 269,title {} + 257,line 7 + 262,t 0 + 270,line 39 + 269,line 25 + 259,title FONTSLANT + 260,title FONTSTYLE + 266,t 0 + error error + 264,title ORIENTATION + 266,line 19 + error,line 24 + 268,title VALUE + 258,t 0 + 263,line 16 + error,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title FONTSIZE + 267,t 0 + 263,title NUMERICS + 268,line 21 + 267,title TICKS + 257 FONT_ + 258 FONTSIZE_ + 259,t 0 + 259 FONTSLANT_ + 260 FONTSTYLE_ + 260,t 0 + 261 FONTWEIGHT_ + 265,line 18 + 262 LOCK_ + 263 NUMERICS_ + 257,title FONT + 264 ORIENTATION_ + 264,t 0 + 265 SIZE_ + 262,line 15 + 266 SPACE_ + 267 TICKS_ + 0,t 0 + 0 {$} + 262,title LOCK + 268 VALUE_ + 268,t 0 + 270 start' + 269 colorbarsend + error,t 0 + 258,line 8 + 266,title SPACE + 261,t 0 + 267,line 20 + 265,t 0 + 261,title FONTWEIGHT +} + +proc colorbarsend::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 { ProcessSendCmdYesNo view colorbar } + 2 { ProcessSendCmdYesNo colorbar lock } + 3 { ProcessSendCmdGet colorbar orientation } + 4 { ProcessSendCmdYesNo colorbar numerics } + 5 { ColorbarSendCmdSpace } + 6 { ProcessSendCmdGet colorbar font } + 7 { ProcessSendCmdGet colorbar font,size } + 8 { ProcessSendCmdGet colorbar font,weight } + 9 { ProcessSendCmdGet colorbar font,slant } + 10 { ProcessSendCmdGet colorbar font,weight } + 11 { ProcessSendCmdGet colorbar size } + 12 { ProcessSendCmdGet colorbar ticks } + } + 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 colorbarsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/contourlex.tcl b/ds9/parsers/contourlex.tcl new file mode 100644 index 0000000..1d3632f --- /dev/null +++ b/ds9/parsers/contourlex.tcl @@ -0,0 +1,1207 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval contour { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc contour::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc contour::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc contour::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc contour::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc contour::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc contour::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc contour::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc contour::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc contour::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set FK4_ 294 +set B1950_ 295 +set FK5_ 296 +set J2000_ 297 +set ICRS_ 298 +set GALACTIC_ 299 +set ECLIPTIC_ 300 +set INT_ 301 +set REAL_ 302 +set STRING_ 303 +set ASINH_ 304 +set BLOCK_ 305 +set CLEAR_ 306 +set CLOSE_ 307 +set COLOR_ 308 +set CONVERT_ 309 +set COPY_ 310 +set DASH_ 311 +set EXP_ 312 +set GENERATE_ 313 +set GLOBAL_ 314 +set HISTEQU_ 315 +set LEVELS_ 316 +set LIMITS_ 317 +set LINEAR_ 318 +set LOAD_ 319 +set LOADLEVELS_ 320 +set LOCAL_ 321 +set LOG_ 322 +set METHOD_ 323 +set MINMAX_ 324 +set MODE_ 325 +set NLEVELS_ 326 +set OPEN_ 327 +set PASTE_ 328 +set POW_ 329 +set SAVE_ 330 +set SAVELEVELS_ 331 +set SCALE_ 332 +set SCOPE_ 333 +set SINH_ 334 +set SMOOTH_ 335 +set SQRT_ 336 +set SQUARED_ 337 +set WIDTH_ 338 +set ZMAX_ 339 +set ZSCALE_ 340 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: asinh + if {[regexp -start $index_ -indices -line -nocase -- {\A(asinh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: block + if {[regexp -start $index_ -indices -line -nocase -- {\A(block)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: convert + if {[regexp -start $index_ -indices -line -nocase -- {\A(convert)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: copy + if {[regexp -start $index_ -indices -line -nocase -- {\A(copy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: dash + if {[regexp -start $index_ -indices -line -nocase -- {\A(dash)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: exp + if {[regexp -start $index_ -indices -line -nocase -- {\A(exp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: generate + if {[regexp -start $index_ -indices -line -nocase -- {\A(generate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: global + if {[regexp -start $index_ -indices -line -nocase -- {\A(global)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: histequ + if {[regexp -start $index_ -indices -line -nocase -- {\A(histequ)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: levels + if {[regexp -start $index_ -indices -line -nocase -- {\A(levels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: limits + if {[regexp -start $index_ -indices -line -nocase -- {\A(limits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: linear + if {[regexp -start $index_ -indices -line -nocase -- {\A(linear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: loadlevels + if {[regexp -start $index_ -indices -line -nocase -- {\A(loadlevels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: local + if {[regexp -start $index_ -indices -line -nocase -- {\A(local)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: log + if {[regexp -start $index_ -indices -line -nocase -- {\A(log)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: method + if {[regexp -start $index_ -indices -line -nocase -- {\A(method)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: minmax + if {[regexp -start $index_ -indices -line -nocase -- {\A(minmax)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: nlevels + if {[regexp -start $index_ -indices -line -nocase -- {\A(nlevels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: paste + if {[regexp -start $index_ -indices -line -nocase -- {\A(paste)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: pow + if {[regexp -start $index_ -indices -line -nocase -- {\A(pow)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: savelevels + if {[regexp -start $index_ -indices -line -nocase -- {\A(savelevels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: scope + if {[regexp -start $index_ -indices -line -nocase -- {\A(scope)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: sinh + if {[regexp -start $index_ -indices -line -nocase -- {\A(sinh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: sqrt + if {[regexp -start $index_ -indices -line -nocase -- {\A(sqrt)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: squared + if {[regexp -start $index_ -indices -line -nocase -- {\A(squared)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: zmax + if {[regexp -start $index_ -indices -line -nocase -- {\A(zmax)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: zscale + if {[regexp -start $index_ -indices -line -nocase -- {\A(zscale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + # rule 80: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 80 + } + # rule 81: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 81 + } + # rule 82: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 82 + } + # rule 83: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 83 + } + # rule 84: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 84 + } + # rule 85: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 85 + } + # rule 86: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 86 + } + # rule 87: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 87 + } + # rule 88: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 88 + } + # rule 89: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 89 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ASINH_ + } + 1 { +return $BLOCK_ + } + 2 { +return $CLEAR_ + } + 3 { +return $CLOSE_ + } + 4 { +return $COLOR_ + } + 5 { +return $CONVERT_ + } + 6 { +return $COPY_ + } + 7 { +return $DASH_ + } + 8 { +return $EXP_ + } + 9 { +return $GENERATE_ + } + 10 { +return $GLOBAL_ + } + 11 { +return $HISTEQU_ + } + 12 { +return $LEVELS_ + } + 13 { +return $LIMITS_ + } + 14 { +return $LINEAR_ + } + 15 { +return $LOAD_ + } + 16 { +return $LOADLEVELS_ + } + 17 { +return $LOCAL_ + } + 18 { +return $LOG_ + } + 19 { +return $METHOD_ + } + 20 { +return $MINMAX_ + } + 21 { +return $MODE_ + } + 22 { +return $NLEVELS_ + } + 23 { +return $OPEN_ + } + 24 { +return $PASTE_ + } + 25 { +return $POW_ + } + 26 { +return $SAVE_ + } + 27 { +return $SAVELEVELS_ + } + 28 { +return $SCALE_ + } + 29 { +return $SCOPE_ + } + 30 { +return $SINH_ + } + 31 { +return $SMOOTH_ + } + 32 { +return $SQRT_ + } + 33 { +return $SQUARED_ + } + 34 { +return $WIDTH_ + } + 35 { +return $ZMAX_ + } + 36 { +return $ZSCALE_ + } + 37 { +return $YES_ + } + 38 { +return $NO_ + } + 39 { +return $ON_ + } + 40 { +return $OFF_ + } + 41 { +return $TRUE_ + } + 42 { +return $FALSE_ + } + 43 { +return $IMAGE_ + } + 44 { +return $PHYSICAL_ + } + 45 { +return $AMPLIFIER_ + } + 46 { +return $DETECTOR_ + } + 47 { +return $WCS_ + } + 48 { +return $WCSA_ + } + 49 { +return $WCSB_ + } + 50 { +return $WCSC_ + } + 51 { +return $WCSD_ + } + 52 { +return $WCSE_ + } + 53 { +return $WCSF_ + } + 54 { +return $WCSG_ + } + 55 { +return $WCSH_ + } + 56 { +return $WCSI_ + } + 57 { +return $WCSJ_ + } + 58 { +return $WCSK_ + } + 59 { +return $WCSL_ + } + 60 { +return $WCSM_ + } + 61 { +return $WCSN_ + } + 62 { +return $WCSO_ + } + 63 { +return $WCSP_ + } + 64 { +return $WCSQ_ + } + 65 { +return $WCSR_ + } + 66 { +return $WCSS_ + } + 67 { +return $WCST_ + } + 68 { +return $WCSU_ + } + 69 { +return $WCSV_ + } + 70 { +return $WCSW_ + } + 71 { +return $WCSX_ + } + 72 { +return $WCSY_ + } + 73 { +return $WCSZ_ + } + 74 { +return $FK4_ + } + 75 { +return $FK4_ + } + 76 { +return $FK5_ + } + 77 { +return $FK5_ + } + 78 { +return $ICRS_ + } + 79 { +return $GALACTIC_ + } + 80 { +return $ECLIPTIC_ + } + 81 { +set yylval $yytext; return $INT_ + } + 82 - + 83 { +set yylval $yytext; return $REAL_ + } + 84 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 85 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 86 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 87 { +set yylval $yytext; return $STRING_ + } + 88 { +# ignore whitespace + } + 89 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/contourparser.tab.tcl b/ds9/parsers/contourparser.tab.tcl new file mode 100644 index 0000000..ec32674 --- /dev/null +++ b/ds9/parsers/contourparser.tab.tcl @@ -0,0 +1,84 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set FK4_ 294 +set B1950_ 295 +set FK5_ 296 +set J2000_ 297 +set ICRS_ 298 +set GALACTIC_ 299 +set ECLIPTIC_ 300 +set INT_ 301 +set REAL_ 302 +set STRING_ 303 +set ASINH_ 304 +set BLOCK_ 305 +set CLEAR_ 306 +set CLOSE_ 307 +set COLOR_ 308 +set CONVERT_ 309 +set COPY_ 310 +set DASH_ 311 +set EXP_ 312 +set GENERATE_ 313 +set GLOBAL_ 314 +set HISTEQU_ 315 +set LEVELS_ 316 +set LIMITS_ 317 +set LINEAR_ 318 +set LOAD_ 319 +set LOADLEVELS_ 320 +set LOCAL_ 321 +set LOG_ 322 +set METHOD_ 323 +set MINMAX_ 324 +set MODE_ 325 +set NLEVELS_ 326 +set OPEN_ 327 +set PASTE_ 328 +set POW_ 329 +set SAVE_ 330 +set SAVELEVELS_ 331 +set SCALE_ 332 +set SCOPE_ 333 +set SINH_ 334 +set SMOOTH_ 335 +set SQRT_ 336 +set SQUARED_ 337 +set WIDTH_ 338 +set ZMAX_ 339 +set ZSCALE_ 340 diff --git a/ds9/parsers/contourparser.tcl b/ds9/parsers/contourparser.tcl new file mode 100644 index 0000000..4f7430e --- /dev/null +++ b/ds9/parsers/contourparser.tcl @@ -0,0 +1,3008 @@ +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 contour { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc contour::YYABORT {} { + return -code return 1 +} + +proc contour::YYACCEPT {} { + return -code return 0 +} + +proc contour::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc contour::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc contour::yyerror {s} { + puts stderr $s +} + +proc contour::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 contour::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set contour::table { + 76:294,target 25 + 21:301 shift + 0:327,target 22 + 15:345 goto + 88:296,target 37 + 48:0 reduce + 129:303,target 142 + 101:271,target 67 + 9:303 shift + 25:303,target 104 + 135:0 reduce + 95:0,target 44 + 71:303,target 20 + 91:0 reduce + 42:271,target 67 + 64:0,target 13 + 83:295,target 32 + 23:284,target 80 + 98:300,target 96 + 33:0,target 62 + 20:302,target 36 + 142:301 shift + 5:303,target 4 + 77:294,target 26 + 86:300 reduce + 112:303 reduce + 23:353,target 100 + 86:303 reduce + 14:301,target 35 + 89:296,target 38 + 86:294 reduce + 131:303,target 86 + 101:287,target 83 + 86:295 reduce + 86:296 reduce + 107:0 reduce + 86:297 reduce + 150:0,target 93 + 149:0,target 92 + 86:298 reduce + 56:303 reduce + 63:0 reduce + 86:299 reduce + 42:287,target 83 + 72:303,target 21 + 118:0,target 63 + 150:0 reduce + 149:0 reduce + 145:262,target 6 + 84:295,target 33 + 26:304 shift + 92:0,target 41 + 6:303,target 7 + 63:299,target 12 + 140:261,target 5 + 78:294,target 27 + 26:315 shift + 120:301,target 77 + 61:0,target 10 + 26:318 shift + 15:301,target 35 + 30:0,target 51 + 132:303,target 87 + 26:322 shift + 147:301 shift + 35:0 reduce + 73:303,target 22 + 77:0 reduce + 26:329 shift + 117:303 reduce + 146:262,target 6 + 85:295,target 34 + 19:335,target 50 + 92:303 reduce + 26:334 shift + 26:336 shift + 123:299,target 95 + 26:337 shift + 146:0,target 1 + 23:275,target 71 + 62:303 reduce + 7:303,target 54 + 64:299,target 13 + 141:261,target 5 + 115:0,target 113 + 80:294,target 29 + 79:294,target 28 + 32:303 reduce + 0:335,target 28 + 26:336,target 111 + 133:303,target 88 + 88:0,target 37 + 23:344,target 99 + 74:303,target 23 + 26:355 goto + 49:0 reduce + 50:0 reduce + 155:341,target 158 + 101:278,target 74 + 57:0,target 109 + 86:295,target 35 + 42:278,target 74 + 92:0 reduce + 23:292,target 88 + 98:297,target 93 + 153:303 reduce + 123:300 shift + 8:303,target 53 + 65:299,target 14 + 81:294,target 30 + 123:303 shift + 123:294 shift + 123:295 shift + 97:303 shift + 123:296 shift + 123:297 shift + 67:300 reduce + 134:303,target 90 + 123:298 shift + 123:299 shift + 143:0,target 1 + 67:303 reduce + 22:0 reduce + 30:303,target 51 + 67:294 reduce + 101:295,target 91 + 75:303,target 24 + 67:295 reduce + 67:296 reduce + 112:0,target 101 + 0:309,target 10 + 0:310,target 11 + 67:297 reduce + 37:303 reduce + 67:298 reduce + 108:0 reduce + 42:295,target 91 + 67:299 reduce + 148:262,target 6 + 87:295,target 36 + 64:0 reduce + 32:347 goto + 151:0 reduce + 85:0,target 34 + 0:257,target 1 + 9:303,target 33 + 66:299,target 15 + 143:261,target 5 + 82:294,target 31 + 54:0,target 111 + 23:266,target 62 + 18:301,target 35 + 23:0,target 91 + 158:303 reduce + 76:303,target 25 + 0:326,target 21 + 128:301 shift + 123:344 goto + 36:0 reduce + 88:295,target 37 + 73:300 reduce + 101:270,target 66 + 101:269,target 65 + 78:0 reduce + 140:0,target 1 + 73:303 reduce + 73:294 reduce + 42:269,target 65 + 42:270,target 66 + 73:295 reduce + 16:351,target 44 + 73:296 reduce + 108:0,target 99 + 67:299,target 16 + 73:297 reduce + 83:294,target 32 + 23:283,target 79 + 43:303 shift + 73:298 reduce + 73:299 reduce + 20:301,target 35 + 13:303 reduce + 8:0,target 53 + 82:0,target 31 + 32:303,target 49 + 77:303,target 26 + 2:303 reduce + 51:0,target 66 + 151:262,target 6 + 89:295,target 38 + 101:286,target 82 + 51:0 reduce + 42:286,target 82 + 93:0 reduce + 23:299,target 95 + 68:299,target 17 + 145:261,target 5 + 134:303 reduce + 84:294,target 33 + 78:300 reduce + 21:301,target 58 + 140:257 shift + 104:303 reduce + 140:258 shift + 132:344,target 144 + 140:260 shift + 140:259 shift + 78:303 reduce + 140:261 shift + 78:294 reduce + 140:262 shift + 78:295 reduce + 33:303,target 62 + 63:298,target 12 + 140:260,target 4 + 140:259,target 3 + 78:303,target 27 + 78:296 reduce + 105:0,target 103 + 78:297 reduce + 78:298 reduce + 48:303 reduce + 78:299 reduce + 24:352,target 103 + 18:301 shift + 23:0 reduce + 18:302 shift + 0:317,target 15 + 26:318,target 107 + 5:0,target 4 + 110:0 reduce + 109:0 reduce + 78:0,target 27 + 65:0 reduce + 7:303 reduce + 47:0,target 106 + 69:299,target 18 + 70:299,target 19 + 146:261,target 5 + 85:294,target 34 + 18:312 shift + 152:0 reduce + 123:298,target 94 + 138:303,target 147 + 23:274,target 70 + 34:303,target 64 + 64:298,target 13 + 141:260,target 4 + 141:259,target 3 + 139:301 shift + 80:303,target 29 + 79:303,target 28 + 140:303 reduce + 84:300 reduce + 145:257 shift + 110:303 reduce + 109:303 reduce + 145:258 shift + 145:260 shift + 145:259 shift + 133:0,target 88 + 84:303 reduce + 23:343,target 98 + 37:0 reduce + 145:261 shift + 84:294 reduce + 145:262 shift + 84:295 reduce + 101:277,target 73 + 84:296 reduce + 84:297 reduce + 84:298 reduce + 54:303 reduce + 71:299,target 20 + 86:294,target 35 + 84:299 reduce + 80:0 reduce + 79:0 reduce + 127:301,target 140 + 42:277,target 73 + 23:291,target 87 + 24:303 shift + 98:296,target 92 + 18:345 goto + 2:0,target 5 + 140:303,target 1 + 75:0,target 24 + 14:350,target 40 + 14:349,target 39 + 35:303,target 46 + 65:298,target 14 + 81:303,target 30 + 44:0,target 55 + 16:316,target 43 + 12:341,target 34 + 18:356 goto + 13:0,target 74 + 63:300,target 12 + 24:316 shift + 10:0 reduce + 101:294,target 90 + 140:341 goto + 0:308,target 9 + 52:0 reduce + 145:303 reduce + 42:294,target 90 + 72:299,target 21 + 148:261,target 5 + 87:294,target 36 + 128:301,target 141 + 89:300 reduce + 151:257 shift + 115:303 reduce + 94:0 reduce + 151:258 shift + 151:260 shift + 151:259 shift + 141:303,target 1 + 90:303 reduce + 89:303 reduce + 151:261 shift + 89:294 reduce + 151:262 shift + 89:295 reduce + 89:296 reduce + 36:303,target 47 + 66:298,target 15 + 143:260,target 4 + 143:259,target 3 + 89:297 reduce + 82:303,target 31 + 123:300,target 96 + 89:298 reduce + 59:303 reduce + 60:303 reduce + 89:299 reduce + 23:265,target 61 + 29:301 shift + 155:262,target 6 + 64:300,target 13 + 30:303 reduce + 72:0,target 21 + 132:299,target 95 + 0:325,target 20 + 24:352 goto + 73:299,target 22 + 88:294,target 37 + 130:301,target 143 + 111:0 reduce + 10:0,target 57 + 66:0 reduce + 101:268,target 64 + 153:0 reduce + 42:268,target 64 + 145:341 goto + 37:303,target 76 + 67:298,target 16 + 83:303,target 32 + 23:282,target 78 + 151:303 reduce + 157:0,target 95 + 65:300,target 14 + 121:303 reduce + 126:0,target 107 + 95:303 reduce + 65:300 reduce + 65:303 reduce + 65:294 reduce + 74:299,target 23 + 151:261,target 5 + 89:294,target 38 + 38:0 reduce + 65:295 reduce + 101:285,target 81 + 35:301 reduce + 65:296 reduce + 20:358,target 57 + 35:302 reduce + 65:297 reduce + 35:303 reduce + 65:298 reduce + 65:299 reduce + 125:0 reduce + 42:285,target 81 + 143:303,target 1 + 81:0 reduce + 68:0,target 17 + 23:298,target 94 + 38:303,target 78 + 68:298,target 17 + 145:260,target 4 + 145:259,target 3 + 84:303,target 33 + 37:0,target 76 + 66:300,target 15 + 0:257 shift + 63:297,target 12 + 151:341 goto + 140:258,target 2 + 0:258 shift + 0:260 shift + 0:259 shift + 0:261 shift + 156:303 reduce + 11:0 reduce + 0:262 shift + 75:299,target 24 + 40:345,target 120 + 154:0,target 82 + 0:316,target 14 + 126:303 reduce + 53:0 reduce + 144:303,target 89 + 71:300 reduce + 140:0 reduce + 39:303,target 73 + 40:303,target 75 + 69:298,target 18 + 70:298,target 19 + 146:260,target 4 + 146:259,target 3 + 95:0 reduce + 85:303,target 34 + 71:303 reduce + 71:294 reduce + 71:295 reduce + 41:301 shift + 71:296 reduce + 96:0,target 45 + 41:302 shift + 71:297 reduce + 123:297,target 93 + 67:300,target 16 + 71:298 reduce + 23:273,target 69 + 71:299 reduce + 27:359,target 116 + 65:0,target 14 + 64:297,target 13 + 141:258,target 2 + 11:303 reduce + 34:0,target 64 + 76:299,target 25 + 0:333,target 27 + 41:345,target 121 + 26:334,target 110 + 0:303 reduce + 0:306 shift + 23:342,target 97 + 28:301,target 117 + 100:303,target 61 + 0:307 shift + 145:303,target 1 + 0:308 shift + 112:0 reduce + 101:276,target 72 + 0:309 shift + 0:310 shift + 0:311 shift + 67:0 reduce + 71:298,target 20 + 86:303,target 35 + 0:313 shift + 0:0 reduce + 42:276,target 72 + 132:300 shift + 154:0 reduce + 151:0,target 1 + 0:316 shift + 0:317 shift + 23:289,target 85 + 23:290,target 86 + 23:300,target 96 + 132:303 reduce + 98:295,target 91 + 68:300,target 17 + 132:294 shift + 0:319 shift + 0:320 shift + 132:295 shift + 120:0,target 77 + 132:296 shift + 0:322 shift + 132:297 shift + 76:300 reduce + 0:323 shift + 35:302,target 46 + 65:297,target 14 + 132:298 shift + 102:303 shift + 132:299 shift + 0:325 shift + 76:303 reduce + 0:326 shift + 76:294 reduce + 0:327 shift + 77:299,target 26 + 76:295 reduce + 0:328 shift + 76:296 reduce + 0:330 shift + 46:301 shift + 93:0,target 42 + 76:297 reduce + 0:331 shift + 46:302 shift + 76:298 reduce + 0:332 shift + 76:299 reduce + 0:333 shift + 41:345 goto + 29:301,target 118 + 101:293,target 89 + 101:303,target 85 + 0:335 shift + 62:0,target 11 + 146:303,target 1 + 39:0 reduce + 40:0 reduce + 16:303 shift + 0:307,target 8 + 0:338 shift + 31:0,target 0 + 42:303,target 79 + 42:293,target 89 + 72:298,target 21 + 148:260,target 4 + 148:259,target 3 + 87:303,target 36 + 0:341 goto + 126:0 reduce + 82:0 reduce + 5:303 reduce + 0:346 goto + 69:300,target 18 + 70:300,target 19 + 20:324,target 52 + 0:348 goto + 16:316 shift + 36:302,target 47 + 66:297,target 15 + 143:258,target 2 + 23:264,target 60 + 78:299,target 27 + 155:261,target 5 + 137:301 shift + 132:344 goto + 116:0,target 71 + 12:0 reduce + 132:298,target 94 + 102:303,target 134 + 82:300 reduce + 143:257 shift + 107:303 reduce + 143:258 shift + 143:260 shift + 143:259 shift + 82:303 reduce + 43:303,target 125 + 73:298,target 22 + 143:261 shift + 88:303,target 37 + 82:294 reduce + 54:0 reduce + 143:262 shift + 82:295 reduce + 82:296 reduce + 24:316,target 102 + 101:267,target 63 + 90:0,target 39 + 89:0,target 38 + 82:297 reduce + 82:298 reduce + 52:303 reduce + 141:0 reduce + 82:299 reduce + 46:345 goto + 71:300,target 20 + 96:0 reduce + 12:262,target 6 + 42:267,target 63 + 58:0,target 67 + 22:303 reduce + 67:297,target 16 + 23:281,target 77 + 80:299,target 29 + 79:299,target 28 + 16:351 goto + 136:301,target 145 + 0:341,target 30 + 103:303,target 56 + 148:303,target 1 + 44:303,target 55 + 74:298,target 23 + 151:260,target 4 + 151:259,target 3 + 90:303,target 39 + 89:303,target 38 + 101:284,target 80 + 144:0,target 89 + 20:357,target 56 + 113:0 reduce + 143:303 reduce + 68:0 reduce + 42:284,target 80 + 72:300,target 21 + 113:0,target 68 + 1:0 reduce + 87:300 reduce + 23:297,target 93 + 155:0 reduce + 148:257 shift + 113:303 reduce + 38:302,target 78 + 68:297,target 17 + 148:258 shift + 145:258,target 2 + 148:260 shift + 148:259 shift + 87:303 reduce + 148:261 shift + 87:294 reduce + 148:262 shift + 87:295 reduce + 87:296 reduce + 81:299,target 30 + 87:297 reduce + 86:0,target 35 + 137:301,target 146 + 87:298 reduce + 57:303 reduce + 87:299 reduce + 55:0,target 108 + 63:296,target 12 + 140:257,target 1 + 104:303,target 59 + 150:303,target 93 + 149:303,target 92 + 75:298,target 24 + 45:303,target 58 + 91:303,target 40 + 132:300,target 96 + 73:300,target 22 + 27:314 shift + 83:0 reduce + 40:302,target 36 + 69:297,target 18 + 70:297,target 19 + 146:258,target 2 + 27:321 shift + 143:341 goto + 141:0,target 1 + 82:299,target 31 + 46:345,target 126 + 123:296,target 92 + 148:303 reduce + 23:272,target 68 + 110:0,target 104 + 109:0,target 100 + 64:296,target 13 + 141:257,target 1 + 105:303,target 103 + 151:303,target 1 + 118:303 reduce + 93:303 reduce + 76:298,target 25 + 0:332,target 26 + 92:303,target 41 + 13:0 reduce + 63:300 reduce + 83:0,target 32 + 63:303 reduce + 63:294 reduce + 100:0 reduce + 74:300,target 23 + 63:295 reduce + 52:0,target 110 + 55:0 reduce + 63:296 reduce + 101:275,target 71 + 63:297 reduce + 33:303 reduce + 63:298 reduce + 41:302,target 36 + 63:299 reduce + 71:297,target 20 + 42:275,target 71 + 83:299,target 32 + 23:288,target 84 + 98:294,target 90 + 139:301,target 148 + 35:301,target 46 + 65:296,target 14 + 106:303,target 105 + 101:344,target 133 + 152:303,target 94 + 0:348,target 32 + 27:359 goto + 77:298,target 26 + 42:344,target 124 + 47:303,target 106 + 148:341 goto + 93:303,target 42 + 154:303 reduce + 106:0,target 105 + 101:292,target 88 + 75:300,target 24 + 98:300 shift + 0:306,target 7 + 124:303 shift + 114:0 reduce + 42:292,target 88 + 72:297,target 21 + 148:258,target 2 + 98:303 shift + 69:0 reduce + 70:0 reduce + 98:294 shift + 98:295 shift + 6:0,target 7 + 68:300 reduce + 98:296 shift + 2:0 reduce + 98:297 shift + 84:299,target 33 + 80:0,target 29 + 79:0,target 28 + 156:0 reduce + 98:298 shift + 68:303 reduce + 98:299 shift + 68:294 reduce + 68:295 reduce + 38:301 reduce + 48:0,target 69 + 68:296 reduce + 36:301,target 47 + 38:302 reduce + 66:296,target 15 + 68:297 reduce + 143:257,target 1 + 107:303,target 98 + 38:303 reduce + 68:298 reduce + 153:303,target 81 + 68:299 reduce + 23:263,target 59 + 78:298,target 27 + 48:303,target 69 + 155:260,target 4 + 155:259,target 3 + 94:303,target 43 + 132:297,target 93 + 76:300,target 25 + 0:323,target 19 + 42:0 reduce + 73:297,target 22 + 18:356,target 48 + 134:0,target 90 + 101:266,target 62 + 85:299,target 34 + 84:0 reduce + 20:339,target 53 + 20:340,target 54 + 142:301,target 151 + 103:0,target 56 + 12:261,target 5 + 42:266,target 62 + 130:301 shift + 67:296,target 16 + 129:303 shift + 108:303,target 99 + 23:279,target 75 + 23:280,target 76 + 154:303,target 82 + 98:344 goto + 80:298,target 29 + 79:298,target 28 + 3:0,target 3 + 49:303,target 96 + 50:303,target 97 + 74:300 reduce + 100:303 reduce + 95:303,target 44 + 76:0,target 25 + 74:303 reduce + 74:294 reduce + 74:295 reduce + 77:300,target 26 + 45:0,target 58 + 74:296 reduce + 74:297 reduce + 44:303 reduce + 74:298 reduce + 74:299 reduce + 74:297,target 23 + 151:258,target 2 + 14:301 shift + 101:283,target 79 + 101:0 reduce + 14:302 shift + 14:303 shift + 56:0 reduce + 86:299,target 35 + 42:283,target 79 + 143:0 reduce + 3:303 reduce + 23:296,target 92 + 38:301,target 78 + 68:296,target 17 + 145:257,target 1 + 110:303,target 104 + 109:303,target 100 + 155:303,target 1 + 81:298,target 30 + 51:303,target 66 + 131:0,target 86 + 96:303,target 45 + 100:0,target 61 + 63:295,target 12 + 78:300,target 27 + 101:299,target 95 + 75:297,target 24 + 80:300 reduce + 79:300 reduce + 0:0,target 1 + 141:257 shift + 105:303 reduce + 26:315,target 106 + 141:258 shift + 42:299,target 95 + 73:0,target 22 + 141:260 shift + 141:259 shift + 87:299,target 36 + 80:303 reduce + 79:303 reduce + 141:261 shift + 115:0 reduce + 80:294 reduce + 79:294 reduce + 141:262 shift + 80:295 reduce + 79:295 reduce + 71:0 reduce + 80:296 reduce + 79:296 reduce + 42:0,target 79 + 80:297 reduce + 79:297 reduce + 80:298 reduce + 79:298 reduce + 3:0 reduce + 40:301,target 35 + 49:303 reduce + 50:303 reduce + 69:296,target 18 + 70:296,target 19 + 146:257,target 1 + 111:303,target 102 + 80:299 reduce + 79:299 reduce + 157:0 reduce + 156:303,target 83 + 11:0,target 60 + 0:262,target 6 + 20:301 shift + 20:302 shift + 82:298,target 31 + 52:303,target 110 + 123:295,target 91 + 97:303,target 127 + 14:345 goto + 19:305 shift + 23:271,target 67 + 14:350 goto + 14:349 goto + 64:295,target 13 + 80:300,target 29 + 79:300,target 28 + 8:303 reduce + 158:0,target 84 + 76:297,target 25 + 0:331,target 25 + 46:302,target 36 + 88:299,target 37 + 101:274,target 70 + 20:324 shift + 141:303 reduce + 41:301,target 35 + 71:296,target 20 + 112:303,target 101 + 85:0 reduce + 157:303,target 95 + 42:274,target 70 + 85:300 reduce + 146:257 shift + 111:303 reduce + 83:298,target 32 + 23:287,target 83 + 53:303,target 112 + 146:258 shift + 98:303,target 128 + 69:0,target 18 + 70:0,target 19 + 146:260 shift + 146:259 shift + 85:303 reduce + 146:261 shift + 85:294 reduce + 146:262 shift + 85:295 reduce + 19:335 shift + 19:305,target 49 + 85:296 reduce + 38:0,target 78 + 65:295,target 14 + 101:343,target 132 + 85:297 reduce + 81:300,target 30 + 85:298 reduce + 55:303 reduce + 85:299 reduce + 20:339 shift + 20:340 shift + 77:297,target 26 + 42:343,target 123 + 25:303 shift + 20:345 goto + 89:299,target 38 + 101:291,target 87 + 57:0 reduce + 42:291,target 87 + 72:296,target 21 + 155:0,target 1 + 148:257,target 1 + 113:303,target 68 + 19:354 goto + 158:303,target 84 + 144:0 reduce + 20:357 goto + 84:298,target 33 + 20:358 goto + 54:303,target 111 + 99:303,target 130 + 141:341 goto + 66:295,target 15 + 82:300,target 31 + 146:303 reduce + 78:297,target 27 + 155:258,target 2 + 116:303 reduce + 66:0,target 15 + 91:303 reduce + 132:296,target 92 + 0:322,target 18 + 147:301,target 155 + 30:0 reduce + 35:0,target 46 + 61:303 reduce + 73:296,target 22 + 114:303,target 114 + 116:0 reduce + 72:0 reduce + 101:265,target 61 + 10:303,target 57 + 85:298,target 34 + 55:303,target 108 + 4:0 reduce + 158:0 reduce + 12:260,target 4 + 12:259,target 3 + 42:265,target 61 + 67:295,target 16 + 83:300,target 32 + 23:278,target 74 + 152:0,target 94 + 80:297,target 29 + 79:297,target 28 + 121:0,target 72 + 0:338,target 29 + 146:341 goto + 152:303 reduce + 74:296,target 23 + 151:257,target 1 + 115:303,target 113 + 94:0,target 43 + 44:0 reduce + 101:282,target 78 + 122:303 shift + 11:303,target 60 + 86:298,target 35 + 56:303,target 70 + 63:0,target 12 + 131:0 reduce + 96:303 reduce + 42:282,target 78 + 86:0 reduce + 66:300 reduce + 23:295,target 91 + 32:0,target 48 + 68:295,target 17 + 84:300,target 33 + 66:303 reduce + 66:294 reduce + 66:295 reduce + 36:301 reduce + 66:296 reduce + 81:297,target 30 + 36:302 reduce + 66:297 reduce + 36:303 reduce + 66:298 reduce + 66:299 reduce + 63:294,target 12 + 148:0,target 1 + 101:298,target 94 + 75:296,target 24 + 116:303,target 71 + 12:257 shift + 42:263 shift + 12:258 shift + 0:313,target 13 + 42:264 shift + 12:260 shift + 12:259 shift + 42:265 shift + 117:0,target 65 + 103:0 reduce + 12:261 shift + 12:303,target 1 + 42:266 shift + 42:298,target 94 + 87:298,target 36 + 12:262 shift + 42:267 shift + 57:303,target 109 + 58:0 reduce + 42:268 shift + 42:269 shift + 42:270 shift + 42:271 shift + 42:272 shift + 145:0 reduce + 42:273 shift + 69:295,target 18 + 70:295,target 19 + 157:303 reduce + 85:300,target 34 + 42:274 shift + 0:261,target 5 + 42:275 shift + 91:0,target 40 + 42:276 shift + 127:301 shift + 42:277 shift + 82:297,target 31 + 42:278 shift + 123:294,target 90 + 42:279 shift + 42:280 shift + 23:269,target 65 + 23:270,target 66 + 42:281 shift + 59:0,target 8 + 60:0,target 9 + 42:282 shift + 42:283 shift + 42:284 shift + 64:294,target 13 + 72:300 reduce + 42:285 shift + 42:286 shift + 42:287 shift + 72:303 reduce + 42:288 shift + 72:294 reduce + 76:296,target 25 + 0:330,target 24 + 42:289 shift + 42:290 shift + 42:300 shift + 46:301,target 35 + 72:295 reduce + 117:303,target 65 + 42:291 shift + 72:296 reduce + 42:292 shift + 72:297 reduce + 27:314,target 114 + 31:0 accept + 42:303 reduce + 42:293 shift + 72:298 reduce + 13:303,target 74 + 42:294 shift + 72:299 reduce + 88:298,target 37 + 42:295 shift + 58:303,target 67 + 98:344,target 129 + 42:296 shift + 140:341,target 149 + 42:297 shift + 117:0 reduce + 101:273,target 69 + 12:303 reduce + 42:298 shift + 42:299 shift + 73:0 reduce + 71:295,target 20 + 86:300,target 35 + 145:0,target 1 + 5:0 reduce + 42:273,target 69 + 1:303 reduce + 83:297,target 32 + 23:286,target 82 + 114:0,target 114 + 14:345,target 38 + 65:294,target 14 + 101:342,target 131 + 0:346,target 31 + 87:0,target 36 + 77:296,target 26 + 42:342,target 122 + 118:303,target 63 + 133:303 reduce + 14:303,target 37 + 56:0,target 70 + 89:298,target 38 + 59:303,target 8 + 60:303,target 9 + 101:300,target 96 + 101:290,target 86 + 101:289,target 85 + 141:341,target 150 + 77:300 reduce + 45:0 reduce + 103:303 reduce + 77:303 reduce + 42:289,target 85 + 42:290,target 86 + 42:300,target 96 + 72:295,target 21 + 87:300,target 36 + 77:294 reduce + 132:0 reduce + 77:295 reduce + 87:0 reduce + 77:296 reduce + 42:342 goto + 77:297 reduce + 42:343 goto + 84:297,target 33 + 77:298 reduce + 42:344 goto + 47:303 reduce + 77:299 reduce + 12:341 goto + 15:345,target 41 + 17:303 shift + 66:294,target 15 + 78:296,target 27 + 155:257,target 1 + 120:303,target 77 + 119:303,target 135 + 6:303 reduce + 111:0,target 102 + 23:263 shift + 61:303,target 10 + 132:295,target 91 + 23:264 shift + 23:265 shift + 26:322,target 108 + 23:266 shift + 23:267 shift + 104:0 reduce + 23:268 shift + 73:295,target 22 + 88:300,target 37 + 23:269 shift + 23:270 shift + 59:0 reduce + 60:0 reduce + 84:0,target 33 + 23:271 shift + 23:272 shift + 101:264,target 60 + 23:273 shift + 138:303 shift + 85:297,target 34 + 23:274 shift + 146:0 reduce + 23:275 shift + 53:0,target 112 + 23:276 shift + 12:258,target 2 + 23:277 shift + 42:264,target 60 + 83:300 reduce + 23:278 shift + 108:303 reduce + 22:0,target 52 + 23:279 shift + 23:280 shift + 67:294,target 16 + 23:277,target 73 + 23:281 shift + 83:303 reduce + 23:282 shift + 83:294 reduce + 18:312,target 46 + 23:283 shift + 83:295 reduce + 23:284 shift + 83:296 reduce + 80:296,target 29 + 79:296,target 28 + 23:285 shift + 121:303,target 72 + 83:297 reduce + 23:286 shift + 83:298 reduce + 23:287 shift + 53:303 reduce + 83:299 reduce + 23:288 shift + 16:303,target 42 + 23:289 shift + 23:290 shift + 23:300 shift + 23:291 shift + 62:303,target 11 + 23:292 shift + 143:341,target 152 + 23:303 reduce + 23:293 shift + 23:294 shift + 23:295 shift + 32:0 reduce + 23:296 shift + 74:295,target 23 + 89:300,target 38 + 23:297 shift + 101:281,target 77 + 23:298 shift + 19:354,target 51 + 23:299 shift + 118:0 reduce + 107:0,target 98 + 86:297,target 35 + 74:0 reduce + 42:281,target 77 + 6:0 reduce + 23:294,target 90 + 98:299,target 95 + 68:294,target 17 + 7:0,target 54 + 81:0,target 30 + 81:296,target 30 + 122:303,target 136 + 144:303 reduce + 26:355,target 113 + 49:0,target 96 + 50:0,target 97 + 17:303,target 45 + 63:303,target 12 + 88:300 reduce + 114:303 reduce + 88:303 reduce + 101:297,target 93 + 88:294 reduce + 75:295,target 24 + 88:295 reduce + 88:296 reduce + 88:297 reduce + 88:298 reduce + 42:297,target 93 + 58:303 reduce + 88:299 reduce + 87:297,target 36 + 23:342 goto + 28:301 shift + 133:0 reduce + 23:343 goto + 88:0 reduce + 18:345,target 47 + 23:344 goto + 69:294,target 18 + 70:294,target 19 + 0:260,target 4 + 0:259,target 3 + 135:0,target 50 + 82:296,target 31 + 123:303,target 137 + 104:0,target 59 + 23:353 goto + 23:268,target 64 + 64:303,target 13 + 145:341,target 153 + 4:0,target 6 + 76:295,target 25 + 0:328,target 23 + 77:0,target 26 + 26:329,target 109 + 150:303 reduce + 149:303 reduce + 88:297,target 37 + 105:0 reduce + 120:301 reduce + 61:0 reduce + 120:302 reduce + 101:272,target 68 + 155:257 shift + 120:303 reduce + 119:303 shift + 20:345,target 55 + 155:258 shift + 71:294,target 20 + 155:260 shift + 155:259 shift + 94:303 reduce + 155:261 shift + 42:272,target 68 + 155:262 shift + 64:300 reduce + 32:347,target 119 + 83:296,target 32 + 23:285,target 81 + 124:303,target 139 + 64:303 reduce + 64:294 reduce + 64:295 reduce + 64:296 reduce + 64:297 reduce + 65:303,target 14 + 34:303 reduce + 64:298 reduce + 146:341,target 154 + 64:299 reduce + 132:0,target 87 + 77:295,target 26 + 101:0,target 85 + 14:302,target 36 + 89:297,target 38 + 33:0 reduce + 101:288,target 84 + 0:303,target 1 + 26:304,target 105 + 120:0 reduce + 42:288,target 84 + 72:294,target 21 + 75:0 reduce + 1:0,target 2 + 74:0,target 23 + 7:0 reduce + 84:296,target 33 + 155:303 reduce + 125:303,target 80 + 66:303,target 15 + 125:303 reduce + 12:0,target 1 + 99:303 shift + 140:262,target 6 + 78:295,target 27 + 69:300 reduce + 70:300 reduce + 120:302,target 77 + 69:303 reduce + 70:303 reduce + 15:302,target 36 + 69:294 reduce + 70:294 reduce + 69:295 reduce + 70:295 reduce + 132:294,target 90 + 0:319,target 16 + 0:320,target 17 + 40:301 shift + 69:296 reduce + 70:296 reduce + 40:302 shift + 69:297 reduce + 70:297 reduce + 1:303,target 2 + 39:303 reduce + 40:303 reduce + 69:298 reduce + 70:298 reduce + 47:0 reduce + 69:299 reduce + 70:299 reduce + 73:294,target 22 + 101:263 shift + 101:264 shift + 101:265 shift + 10:303 reduce + 134:0 reduce + 101:266 shift + 101:263,target 59 + 101:267 shift + 90:0 reduce + 89:0 reduce + 85:296,target 34 + 126:303,target 107 + 101:268 shift + 101:270 shift + 101:269 shift + 101:271 shift + 12:257,target 1 + 42:263,target 59 + 101:272 shift + 22:303,target 52 + 101:273 shift + 67:303,target 16 + 101:274 shift + 23:276,target 72 + 148:341,target 156 + 101:275 shift + 101:276 shift + 101:277 shift + 155:341 goto + 141:262,target 6 + 101:278 shift + 80:295,target 29 + 79:295,target 28 + 71:0,target 20 + 101:280 shift + 101:279 shift + 101:281 shift + 101:282 shift + 101:283 shift + 39:0,target 73 + 40:0,target 75 + 101:284 shift + 26:337,target 112 + 101:285 shift + 101:286 shift + 27:321,target 115 + 131:303 reduce + 101:287 shift + 2:303,target 5 + 101:288 shift + 101:300 shift + 101:290 shift + 101:289 shift + 74:294,target 23 + 101:291 shift + 106:0 reduce + 101:292 shift + 101:280,target 76 + 101:279,target 75 + 75:300 reduce + 101:293 shift + 101:303 reduce + 62:0 reduce + 101:294 shift + 101:295 shift + 86:296,target 35 + 75:303 reduce + 101:296 shift + 75:294 reduce + 42:279,target 75 + 42:280,target 76 + 101:297 shift + 75:295 reduce + 148:0 reduce + 101:298 shift + 75:296 reduce + 101:299 shift + 75:297 reduce + 23:303,target 91 + 23:293,target 89 + 156:0,target 83 + 98:298,target 94 + 75:298 reduce + 45:303 reduce + 68:303,target 17 + 75:299 reduce + 40:345 goto + 15:301 shift + 125:0,target 80 + 15:302 shift + 81:295,target 30 + 4:303 reduce + 3:303,target 3 + 101:296,target 92 + 75:294,target 24 + 34:0 reduce + 0:311,target 12 + 67:0,target 16 + 42:296,target 92 + 87:296,target 36 + 123:344,target 138 + 121:0 reduce + 36:0,target 47 + 76:0 reduce + 136:301 shift + 24:303,target 101 + 8:0 reduce + 69:303,target 18 + 70:303,target 19 + 151:341,target 157 + 0:258,target 2 + 101:342 goto + 101:343 goto + 81:300 reduce + 143:262,target 6 + 106:303 reduce + 101:344 goto + 82:295,target 31 + 81:303 reduce + 23:267,target 63 + 81:294 reduce + 81:295 reduce + 18:302,target 36 + 81:296 reduce + 81:297 reduce + 153:0,target 81 + 81:298 reduce + 51:303 reduce + 81:299 reduce + 4:303,target 6 +} + +array set contour::rules { + 98,l 355 + 9,l 342 + 11,l 342 + 32,l 343 + 53,l 348 + 74,l 348 + 95,l 353 + 6,l 341 + 28,l 343 + 50,l 346 + 49,l 347 + 71,l 348 + 92,l 353 + 3,l 341 + 25,l 343 + 46,l 345 + 112,l 358 + 67,l 348 + 0,l 360 + 88,l 352 + 22,l 343 + 43,l 344 + 108,l 357 + 64,l 348 + 85,l 352 + 18,l 343 + 40,l 344 + 39,l 344 + 105,l 355 + 61,l 348 + 82,l 351 + 15,l 343 + 36,l 343 + 102,l 355 + 57,l 348 + 78,l 350 + 99,l 355 + 12,l 343 + 33,l 343 + 54,l 348 + 75,l 349 + 96,l 354 + 7,l 341 + 29,l 343 + 30,l 343 + 51,l 348 + 72,l 348 + 93,l 353 + 4,l 341 + 26,l 343 + 47,l 345 + 113,l 359 + 68,l 348 + 90,l 352 + 89,l 352 + 1,l 341 + 23,l 343 + 44,l 344 + 110,l 358 + 109,l 357 + 65,l 348 + 86,l 352 + 19,l 343 + 20,l 343 + 41,l 344 + 106,l 356 + 62,l 348 + 83,l 351 + 16,l 343 + 37,l 343 + 103,l 355 + 58,l 348 + 80,l 351 + 79,l 351 + 13,l 343 + 34,l 343 + 100,l 355 + 55,l 348 + 76,l 349 + 97,l 354 + 8,l 342 + 10,l 342 + 31,l 343 + 52,l 348 + 73,l 348 + 94,l 353 + 5,l 341 + 27,l 343 + 48,l 346 + 114,l 359 + 70,l 348 + 69,l 348 + 91,l 353 + 2,l 341 + 24,l 343 + 45,l 344 + 111,l 358 + 66,l 348 + 87,l 352 + 21,l 343 + 42,l 344 + 107,l 356 + 63,l 348 + 84,l 351 + 17,l 343 + 38,l 343 + 104,l 355 + 60,l 348 + 59,l 348 + 81,l 351 + 14,l 343 + 35,l 343 + 101,l 355 + 56,l 348 + 77,l 350 +} + +array set contour::rules { + 63,dc 2 + 12,dc 1 + 77,dc 2 + 26,dc 1 + 100,dc 1 + 92,dc 4 + 3,dc 1 + 41,dc 1 + 114,dc 1 + 55,dc 2 + 70,dc 2 + 69,dc 2 + 18,dc 1 + 84,dc 6 + 33,dc 1 + 106,dc 1 + 98,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 2 + 11,dc 1 + 76,dc 1 + 25,dc 1 + 91,dc 0 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 113,dc 1 + 54,dc 1 + 68,dc 2 + 17,dc 1 + 83,dc 5 + 32,dc 1 + 105,dc 1 + 97,dc 1 + 8,dc 1 + 46,dc 1 + 61,dc 2 + 10,dc 1 + 75,dc 1 + 24,dc 1 + 90,dc 2 + 89,dc 3 + 1,dc 0 + 38,dc 1 + 112,dc 1 + 53,dc 1 + 67,dc 2 + 16,dc 1 + 82,dc 5 + 31,dc 1 + 104,dc 1 + 96,dc 1 + 7,dc 1 + 45,dc 1 + 60,dc 1 + 59,dc 2 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 88,dc 2 + 37,dc 1 + 111,dc 1 + 52,dc 1 + 66,dc 2 + 15,dc 1 + 81,dc 5 + 29,dc 1 + 30,dc 1 + 103,dc 1 + 95,dc 5 + 6,dc 1 + 44,dc 1 + 58,dc 2 + 73,dc 2 + 22,dc 1 + 87,dc 2 + 36,dc 1 + 110,dc 1 + 109,dc 1 + 51,dc 1 + 65,dc 2 + 14,dc 1 + 80,dc 2 + 79,dc 1 + 28,dc 1 + 102,dc 1 + 94,dc 4 + 5,dc 1 + 43,dc 1 + 57,dc 1 + 72,dc 3 + 21,dc 1 + 86,dc 2 + 35,dc 1 + 108,dc 1 + 50,dc 3 + 49,dc 0 + 64,dc 2 + 13,dc 1 + 78,dc 1 + 27,dc 1 + 101,dc 1 + 93,dc 4 + 4,dc 1 + 42,dc 1 + 56,dc 2 + 71,dc 2 + 19,dc 1 + 20,dc 1 + 85,dc 1 + 34,dc 1 + 107,dc 2 + 99,dc 1 + 48,dc 1 +} + +array set contour::rules { + 112,line 307 + 41,line 198 + 96,line 283 + 7,line 161 + 108,line 301 + 37,line 193 + 93,line 275 + 4,line 158 + 105,line 294 + 34,line 190 + 90,line 270 + 89,line 266 + 1,line 155 + 49,e 1 + 102,line 291 + 31,line 187 + 86,line 263 + 27,line 183 + 83,line 256 + 24,line 180 + 80,line 253 + 79,line 251 + 21,line 177 + 76,line 244 + 17,line 173 + 73,line 238 + 14,line 170 + 70,line 235 + 69,line 234 + 11,line 166 + 66,line 231 + 63,line 228 + 60,line 225 + 59,line 224 + 56,line 217 + 53,line 214 + 50,line 209 + 49,line 208 + 46,line 204 + 114,line 311 + 43,line 200 + 98,line 287 + 9,line 164 + 111,line 306 + 40,line 197 + 39,line 196 + 95,line 280 + 6,line 160 + 107,line 298 + 36,line 192 + 92,line 274 + 3,line 157 + 104,line 293 + 33,line 189 + 88,line 265 + 101,line 290 + 29,line 185 + 30,line 186 + 85,line 262 + 26,line 182 + 82,line 255 + 23,line 179 + 78,line 248 + 19,line 175 + 20,line 176 + 75,line 243 + 16,line 172 + 72,line 237 + 13,line 169 + 68,line 233 + 10,line 165 + 65,line 230 + 62,line 227 + 58,line 222 + 55,line 216 + 52,line 213 + 48,line 208 + 45,line 202 + 113,line 310 + 42,line 199 + 97,line 284 + 8,line 163 + 110,line 305 + 109,line 302 + 38,line 194 + 94,line 276 + 5,line 159 + 106,line 297 + 35,line 191 + 91,line 273 + 2,line 156 + 103,line 292 + 32,line 188 + 87,line 264 + 100,line 289 + 28,line 184 + 84,line 259 + 25,line 181 + 81,line 254 + 22,line 178 + 77,line 247 + 18,line 174 + 74,line 239 + 15,line 171 + 71,line 236 + 12,line 168 + 67,line 232 + 64,line 229 + 61,line 226 + 57,line 220 + 54,line 215 + 51,line 212 + 47,line 205 + 44,line 201 + 99,line 288 +} + +array set contour::lr1_table { + 66,trans {} + 35 {{46 {0 301 302 303} 1}} + 85,trans {} + 36 {{47 {0 301 302 303} 1}} + 37 {{76 {0 303} 1}} + 38 {{78 {0 301 302 303} 1}} + 39 {{73 {0 303} 2}} + 40 {{75 {0 303} 1} {77 {0 301 302 303} 1} {46 {0 301 302 303} 0} {47 {0 301 302 303} 0}} + 117,trans {} + 41 {{46 {301 302} 1}} + 136,trans {} + 42 {{47 {301 302} 1}} + 155,trans {} + 43 {{72 {0 303} 2} {46 {0 303} 0} {47 {0 303} 0}} + 174,trans {{294 166} {295 167} {296 168} {297 169} {298 170} {299 171} {300 172} {344 186}} + 44 {{79 {0 303} 1} {81 {0 303} 1} {82 {0 303} 1} {83 {0 303} 1} {84 {0 303} 1} {8 303 0} {9 303 0} {10 303 0} {11 303 0} {12 {294 295 296 297 298 299 300 303} 0} {13 {294 295 296 297 298 299 300 303} 0} {14 {294 295 296 297 298 299 300 303} 0} {15 {294 295 296 297 298 299 300 303} 0} {16 {294 295 296 297 298 299 300 303} 0} {17 {294 295 296 297 298 299 300 303} 0} {18 {294 295 296 297 298 299 300 303} 0} {19 {294 295 296 297 298 299 300 303} 0} {20 {294 295 296 297 298 299 300 303} 0} {21 {294 295 296 297 298 299 300 303} 0} {22 {294 295 296 297 298 299 300 303} 0} {23 {294 295 296 297 298 299 300 303} 0} {24 {294 295 296 297 298 299 300 303} 0} {25 {294 295 296 297 298 299 300 303} 0} {26 {294 295 296 297 298 299 300 303} 0} {27 {294 295 296 297 298 299 300 303} 0} {28 {294 295 296 297 298 299 300 303} 0} {29 {294 295 296 297 298 299 300 303} 0} {30 {294 295 296 297 298 299 300 303} 0} {31 {294 295 296 297 298 299 300 303} 0} {32 {294 295 296 297 298 299 300 303} 0} {33 {294 295 296 297 298 299 300 303} 0} {34 {294 295 296 297 298 299 300 303} 0} {35 {294 295 296 297 298 299 300 303} 0} {36 {294 295 296 297 298 299 300 303} 0} {37 {294 295 296 297 298 299 300 303} 0} {38 {294 295 296 297 298 299 300 303} 0} {39 303 0} {40 303 0} {41 303 0} {42 303 0} {43 303 0} {44 303 0} {45 303 0}} + 193,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 199}} + 45 {{80 {0 303} 1}} + 46 {{55 {0 303} 2}} + 47 {{58 {0 303} 2}} + 48 {{46 {0 303} 1}} + 49 {{47 {0 303} 1}} + 50 {{107 {0 303} 1} {46 {0 303} 0} {47 {0 303} 0}} + 27,trans {{314 118} {321 119} {359 120}} + 51 {{106 {0 303} 1}} + 46,trans {} + 65,trans {} + 52 {{69 {0 303} 2}} + 84,trans {} + 53 {{96 {0 303} 1}} + 54 {{97 {0 303} 1}} + 55 {{66 {0 303} 2}} + 56 {{110 {0 303} 1}} + 116,trans {} + 57 {{112 {0 303} 1}} + 135,trans {} + 58 {{111 {0 303} 1}} + 154,trans {} + 59 {{108 {0 303} 1}} + 60 {{70 {0 303} 2}} + 173,trans {} + 61 {{109 {0 303} 1}} + 192,trans {} + 62 {{67 {0 303} 2}} + 63 {{8 303 1}} + 64 {{9 303 1}} + 65 {{10 303 1}} + 66 {{11 303 1}} + 26,trans {{304 109} {315 110} {318 111} {322 112} {329 113} {334 114} {336 115} {337 116} {355 117}} + 67 {{12 {294 295 296 297 298 299 300 303} 1}} + 45,trans {{303 129}} + 64,trans {} + 68 {{13 {294 295 296 297 298 299 300 303} 1}} + 83,trans {} + 69 {{14 {294 295 296 297 298 299 300 303} 1}} + 70 {{15 {294 295 296 297 298 299 300 303} 1}} + 71 {{16 {294 295 296 297 298 299 300 303} 1}} + 72 {{17 {294 295 296 297 298 299 300 303} 1}} + 73 {{18 {294 295 296 297 298 299 300 303} 1}} + 115,trans {} + 74 {{19 {294 295 296 297 298 299 300 303} 1}} + 134,trans {{301 185}} + 75 {{20 {294 295 296 297 298 299 300 303} 1}} + 153,trans {} + 76 {{21 {294 295 296 297 298 299 300 303} 1}} + 172,trans {} + 77 {{22 {294 295 296 297 298 299 300 303} 1}} + 191,trans {} + 78 {{23 {294 295 296 297 298 299 300 303} 1}} + 79 {{24 {294 295 296 297 298 299 300 303} 1}} + 80 {{25 {294 295 296 297 298 299 300 303} 1}} + 81 {{26 {294 295 296 297 298 299 300 303} 1}} + 82 {{27 {294 295 296 297 298 299 300 303} 1}} + 83 {{28 {294 295 296 297 298 299 300 303} 1}} + 25,trans {{303 108}} + 84 {{29 {294 295 296 297 298 299 300 303} 1}} + 44,trans {{263 63} {264 64} {265 65} {266 66} {267 67} {268 68} {269 69} {270 70} {271 71} {272 72} {273 73} {274 74} {275 75} {276 76} {277 77} {278 78} {279 79} {280 80} {281 81} {282 82} {283 83} {284 84} {285 85} {286 86} {287 87} {288 88} {289 89} {290 90} {291 91} {292 92} {293 93} {294 94} {295 95} {296 96} {297 97} {298 98} {299 99} {300 100} {342 126} {343 127} {344 128}} + 63,trans {} + 85 {{30 {294 295 296 297 298 299 300 303} 1}} + 82,trans {} + 86 {{31 {294 295 296 297 298 299 300 303} 1}} + 87 {{32 {294 295 296 297 298 299 300 303} 1}} + 0 {{0 0 0} {48 0 0} {50 0 0} {51 {0 303} 0} {52 {0 303} 0} {53 {0 303} 0} {54 {0 303} 0} {55 {0 303} 0} {56 {0 303} 0} {57 {0 303} 0} {58 {0 303} 0} {59 {0 303} 0} {60 {0 303} 0} {61 {0 303} 0} {62 {0 303} 0} {63 {0 303} 0} {64 {0 303} 0} {65 {0 303} 0} {66 {0 303} 0} {67 {0 303} 0} {68 {0 303} 0} {69 {0 303} 0} {70 {0 303} 0} {71 {0 303} 0} {72 {0 303} 0} {73 {0 303} 0} {74 {0 303} 0} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 88 {{33 {294 295 296 297 298 299 300 303} 1}} + 1 {{2 {0 303} 1}} + 89 {{34 {294 295 296 297 298 299 300 303} 1}} + 90 {{35 {294 295 296 297 298 299 300 303} 1}} + 114,trans {} + 2 {{5 {0 303} 1}} + 91 {{36 {294 295 296 297 298 299 300 303} 1}} + 133,trans {{303 184}} + 3 {{3 {0 303} 1}} + 92 {{37 {294 295 296 297 298 299 300 303} 1}} + 152,trans {} + 4 {{6 {0 303} 1}} + 93 {{38 {294 295 296 297 298 299 300 303} 1}} + 171,trans {} + 5 {{4 {0 303} 1}} + 94 {{39 303 1}} + 200,trans {} + 190,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 198}} + 189,trans {{301 197}} + 6 {{7 {0 303} 1}} + 95 {{40 303 1}} + 7 {{54 {0 303} 1}} + 96 {{41 303 1}} + 8 {{53 {0 303} 1}} + 97 {{42 303 1}} + 9 {{62 {0 303} 1}} + 98 {{43 303 1}} + 99 {{44 303 1}} + 24,trans {{303 105} {316 106} {352 107}} + 43,trans {{301 48} {302 49} {345 125}} + 62,trans {} + 81,trans {} + 99,trans {} + 113,trans {} + 132,trans {{301 183}} + 151,trans {} + 170,trans {} + 169,trans {} + 188,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 196}} + 23,trans {{263 63} {264 64} {265 65} {266 66} {267 67} {268 68} {269 69} {270 70} {271 71} {272 72} {273 73} {274 74} {275 75} {276 76} {277 77} {278 78} {279 79} {280 80} {281 81} {282 82} {283 83} {284 84} {285 85} {286 86} {287 87} {288 88} {289 89} {290 90} {291 91} {292 92} {293 93} {294 94} {295 95} {296 96} {297 97} {298 98} {299 99} {300 100} {342 101} {343 102} {344 103} {353 104}} + 42,trans {} + 61,trans {} + 80,trans {} + 79,trans {} + 98,trans {} + 9,trans {{303 33}} + 112,trans {} + 131,trans {{301 182}} + 150,trans {} + 149,trans {} + 168,trans {} + 187,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 195}} + 22,trans {} + 41,trans {} + 59,trans {} + 60,trans {} + 78,trans {} + 97,trans {} + 8,trans {} + 111,trans {} + 130,trans {} + 129,trans {} + 148,trans {} + 100 {{45 303 1}} + 167,trans {} + 101 {{92 {0 303} 1}} + 186,trans {} + 102 {{93 {0 303} 1} {95 {0 303} 1} {39 303 0} {40 303 0} {41 303 0} {42 303 0} {43 303 0} {44 303 0} {45 303 0}} + 103 {{94 {0 303} 1}} + 104 {{61 {0 303} 2}} + 105 {{85 {0 303} 1} {86 {0 303} 1} {87 {0 303} 1} {88 {0 303} 1} {89 {0 303} 1} {8 {0 303} 0} {9 {0 303} 0} {10 {0 303} 0} {11 {0 303} 0} {12 {0 294 295 296 297 298 299 300 303} 0} {13 {0 294 295 296 297 298 299 300 303} 0} {14 {0 294 295 296 297 298 299 300 303} 0} {15 {0 294 295 296 297 298 299 300 303} 0} {16 {0 294 295 296 297 298 299 300 303} 0} {17 {0 294 295 296 297 298 299 300 303} 0} {18 {0 294 295 296 297 298 299 300 303} 0} {19 {0 294 295 296 297 298 299 300 303} 0} {20 {0 294 295 296 297 298 299 300 303} 0} {21 {0 294 295 296 297 298 299 300 303} 0} {22 {0 294 295 296 297 298 299 300 303} 0} {23 {0 294 295 296 297 298 299 300 303} 0} {24 {0 294 295 296 297 298 299 300 303} 0} {25 {0 294 295 296 297 298 299 300 303} 0} {26 {0 294 295 296 297 298 299 300 303} 0} {27 {0 294 295 296 297 298 299 300 303} 0} {28 {0 294 295 296 297 298 299 300 303} 0} {29 {0 294 295 296 297 298 299 300 303} 0} {30 {0 294 295 296 297 298 299 300 303} 0} {31 {0 294 295 296 297 298 299 300 303} 0} {32 {0 294 295 296 297 298 299 300 303} 0} {33 {0 294 295 296 297 298 299 300 303} 0} {34 {0 294 295 296 297 298 299 300 303} 0} {35 {0 294 295 296 297 298 299 300 303} 0} {36 {0 294 295 296 297 298 299 300 303} 0} {37 {0 294 295 296 297 298 299 300 303} 0} {38 {0 294 295 296 297 298 299 300 303} 0} {39 {0 303} 0} {40 {0 303} 0} {41 {0 303} 0} {42 {0 303} 0} {43 {0 303} 0} {44 {0 303} 0} {45 {0 303} 0}} + 21,trans {{301 62}} + 106 {{90 {0 303} 1}} + 107 {{56 {0 303} 2}} + 39,trans {} + 40,trans {{301 35} {302 36} {345 124}} + 108 {{59 {0 303} 2}} + 58,trans {} + 77,trans {} + 109 {{103 {0 303} 1}} + 110 {{105 {0 303} 1}} + 96,trans {} + 7,trans {} + 111 {{98 {0 303} 1}} + 112 {{99 {0 303} 1}} + 113 {{100 {0 303} 1}} + 110,trans {} + 109,trans {} + 114 {{104 {0 303} 1}} + 128,trans {{303 181}} + 115 {{102 {0 303} 1}} + 147,trans {} + 116 {{101 {0 303} 1}} + 166,trans {} + 117 {{68 {0 303} 2}} + 185,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 194}} + 118 {{114 {0 303} 1}} + 119 {{113 {0 303} 1}} + 120 {{71 {0 303} 2}} + 121 {{65 {0 303} 2}} + 122 {{63 {0 303} 2}} + 19,trans {{305 53} {335 54} {354 55}} + 20,trans {{301 48} {302 49} {324 56} {339 57} {340 58} {345 59} {357 60} {358 61}} + 123 {{50 0 2}} + 38,trans {} + 124 {{77 {0 301 302 303} 2}} + 125 {{72 {0 303} 3}} + 57,trans {} + 76,trans {} + 126 {{81 {0 303} 2}} + 95,trans {} + 6,trans {} + 127 {{82 {0 303} 2} {84 {0 303} 2} {39 303 0} {40 303 0} {41 303 0} {42 303 0} {43 303 0} {44 303 0} {45 303 0}} + 128 {{83 {0 303} 2}} + 129 {{80 {0 303} 2}} + 130 {{107 {0 303} 2}} + 108,trans {} + 131 {{92 {0 303} 2}} + 127,trans {{294 94} {295 95} {296 96} {297 97} {298 98} {299 99} {300 100} {303 179} {344 180}} + 132 {{93 {0 303} 2}} + 146,trans {} + 133 {{95 {0 303} 2}} + 165,trans {} + 134 {{94 {0 303} 2}} + 184,trans {{301 193}} + 135 {{8 {0 303} 1}} + 136 {{9 {0 303} 1}} + 137 {{10 {0 303} 1}} + 138 {{11 {0 303} 1}} + 140 {{13 {0 294 295 296 297 298 299 300 303} 1}} + 139 {{12 {0 294 295 296 297 298 299 300 303} 1}} + 18,trans {{301 48} {302 49} {312 50} {345 51} {356 52}} + 141 {{14 {0 294 295 296 297 298 299 300 303} 1}} + 37,trans {} + 142 {{15 {0 294 295 296 297 298 299 300 303} 1}} + 56,trans {} + 143 {{16 {0 294 295 296 297 298 299 300 303} 1}} + 75,trans {} + 144 {{17 {0 294 295 296 297 298 299 300 303} 1}} + 94,trans {} + 5,trans {} + 145 {{18 {0 294 295 296 297 298 299 300 303} 1}} + 146 {{19 {0 294 295 296 297 298 299 300 303} 1}} + 107,trans {} + 147 {{20 {0 294 295 296 297 298 299 300 303} 1}} + 126,trans {{303 178}} + 148 {{21 {0 294 295 296 297 298 299 300 303} 1}} + 145,trans {} + 150 {{23 {0 294 295 296 297 298 299 300 303} 1}} + 149 {{22 {0 294 295 296 297 298 299 300 303} 1}} + 164,trans {} + 151 {{24 {0 294 295 296 297 298 299 300 303} 1}} + 183,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 192}} + 152 {{25 {0 294 295 296 297 298 299 300 303} 1}} + 153 {{26 {0 294 295 296 297 298 299 300 303} 1}} + 154 {{27 {0 294 295 296 297 298 299 300 303} 1}} + 155 {{28 {0 294 295 296 297 298 299 300 303} 1}} + 156 {{29 {0 294 295 296 297 298 299 300 303} 1}} + 17,trans {{303 47}} + 157 {{30 {0 294 295 296 297 298 299 300 303} 1}} + 36,trans {} + 158 {{31 {0 294 295 296 297 298 299 300 303} 1}} + 55,trans {} + 160 {{33 {0 294 295 296 297 298 299 300 303} 1}} + 159 {{32 {0 294 295 296 297 298 299 300 303} 1}} + 74,trans {} + 161 {{34 {0 294 295 296 297 298 299 300 303} 1}} + 93,trans {} + 4,trans {} + 162 {{35 {0 294 295 296 297 298 299 300 303} 1}} + 163 {{36 {0 294 295 296 297 298 299 300 303} 1}} + 106,trans {{303 176}} + 164 {{37 {0 294 295 296 297 298 299 300 303} 1}} + 125,trans {} + 165 {{38 {0 294 295 296 297 298 299 300 303} 1}} + 144,trans {} + 166 {{39 {0 303} 1}} + 163,trans {} + 167 {{40 {0 303} 1}} + 182,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 191}} + 168 {{41 {0 303} 1}} + 170 {{43 {0 303} 1}} + 169 {{42 {0 303} 1}} + 171 {{44 {0 303} 1}} + 172 {{45 {0 303} 1}} + 173 {{86 {0 303} 2}} + 16,trans {{303 44} {316 45} {351 46}} + 174 {{87 {0 303} 2} {89 {0 303} 2} {39 {0 303} 0} {40 {0 303} 0} {41 {0 303} 0} {42 {0 303} 0} {43 {0 303} 0} {44 {0 303} 0} {45 {0 303} 0}} + 35,trans {} + 175 {{88 {0 303} 2}} + 54,trans {} + 176 {{90 {0 303} 2}} + 73,trans {} + 177 {{50 0 3}} + 92,trans {} + 3,trans {} + 178 {{81 {0 303} 3}} + 180 {{84 {0 303} 3}} + 179 {{82 {0 303} 3}} + 181 {{83 {0 303} 3}} + 105,trans {{263 135} {264 136} {265 137} {266 138} {267 139} {268 140} {269 141} {270 142} {271 143} {272 144} {273 145} {274 146} {275 147} {276 148} {277 149} {278 150} {279 151} {280 152} {281 153} {282 154} {283 155} {284 156} {285 157} {286 158} {287 159} {288 160} {289 161} {290 162} {291 163} {292 164} {293 165} {294 166} {295 167} {296 168} {297 169} {298 170} {299 171} {300 172} {342 173} {343 174} {344 175}} + 182 {{92 {0 303} 3} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 124,trans {} + 143,trans {} + 183 {{93 {0 303} 3} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 162,trans {} + 184 {{95 {0 303} 3}} + 181,trans {{301 190}} + 185 {{94 {0 303} 3} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 199,trans {} + 186 {{89 {0 303} 3}} + 187 {{81 {0 303} 4} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 188 {{82 {0 303} 4} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 200 {{84 {0 303} 6}} + 190 {{83 {0 303} 4} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 189 {{84 {0 303} 4}} + 15,trans {{301 41} {302 42} {345 43}} + 191 {{92 {0 303} 4}} + 34,trans {} + 192 {{93 {0 303} 4}} + 53,trans {} + 193 {{95 {0 303} 4} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 72,trans {} + 194 {{94 {0 303} 4}} + 91,trans {} + 2,trans {} + 195 {{81 {0 303} 5}} + 196 {{82 {0 303} 5}} + 197 {{84 {0 303} 5} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 104,trans {} + 198 {{83 {0 303} 5}} + 123,trans {{303 177}} + 199 {{95 {0 303} 5}} + 142,trans {} + 161,trans {} + 180,trans {{303 189}} + 179,trans {{301 188}} + 198,trans {} + 14,trans {{301 35} {302 36} {303 37} {345 38} {349 39} {350 40}} + 33,trans {} + 52,trans {} + 71,trans {} + 90,trans {} + 89,trans {} + 1,trans {} + 103,trans {{303 134}} + 122,trans {} + 141,trans {} + 160,trans {} + 159,trans {} + 178,trans {{301 187}} + 197,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 200}} + 13,trans {} + 32,trans {{347 123}} + 51,trans {} + 70,trans {} + 69,trans {} + 88,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {306 7} {307 8} {308 9} {309 10} {310 11} {311 12} {313 13} {316 14} {317 15} {319 16} {320 17} {322 18} {323 19} {325 20} {326 21} {327 22} {328 23} {330 24} {331 25} {332 26} {333 27} {335 28} {338 29} {341 30} {346 31} {348 32}} + 102,trans {{294 94} {295 95} {296 96} {297 97} {298 98} {299 99} {300 100} {303 132} {344 133}} + 121,trans {} + 140,trans {} + 139,trans {} + 158,trans {} + 177,trans {} + 196,trans {} + 12,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {341 34}} + 31,trans {} + 49,trans {} + 50,trans {{301 48} {302 49} {345 130}} + 68,trans {} + 87,trans {} + 101,trans {{303 131}} + 120,trans {} + 119,trans {} + 138,trans {} + 157,trans {} + 10 {{57 {0 303} 1}} + 176,trans {} + 11 {{60 {0 303} 1}} + 195,trans {} + 12 {{64 {0 303} 1} {1 {0 303} 0} {2 {0 303} 0} {3 {0 303} 0} {4 {0 303} 0} {5 {0 303} 0} {6 {0 303} 0} {7 {0 303} 0}} + 13 {{74 {0 303} 1}} + 14 {{73 {0 303} 1} {75 {0 303} 0} {76 {0 303} 0} {77 {0 301 302 303} 0} {78 {0 301 302 303} 0} {46 {0 301 302 303} 0} {47 {0 301 302 303} 0}} + 11,trans {} + 15 {{72 {0 303} 1} {46 {301 302} 0} {47 {301 302} 0}} + 16 {{55 {0 303} 1} {79 {0 303} 0} {80 {0 303} 0} {81 {0 303} 0} {82 {0 303} 0} {83 {0 303} 0} {84 {0 303} 0}} + 29,trans {{301 122}} + 30,trans {} + 17 {{58 {0 303} 1}} + 48,trans {} + 67,trans {} + 18 {{69 {0 303} 1} {106 {0 303} 0} {107 {0 303} 0} {46 {0 303} 0} {47 {0 303} 0}} + 86,trans {} + 20 {{70 {0 303} 1} {108 {0 303} 0} {109 {0 303} 0} {46 {0 303} 0} {47 {0 303} 0} {110 {0 303} 0} {111 {0 303} 0} {112 {0 303} 0}} + 19 {{66 {0 303} 1} {96 {0 303} 0} {97 {0 303} 0}} + 21 {{67 {0 303} 1}} + 22 {{52 {0 303} 1}} + 100,trans {} + 23 {{61 {0 303} 1} {91 {0 303} 0} {92 {0 303} 0} {93 {0 303} 0} {94 {0 303} 0} {95 {0 303} 0} {8 303 0} {9 303 0} {10 303 0} {11 303 0} {12 {294 295 296 297 298 299 300 303} 0} {13 {294 295 296 297 298 299 300 303} 0} {14 {294 295 296 297 298 299 300 303} 0} {15 {294 295 296 297 298 299 300 303} 0} {16 {294 295 296 297 298 299 300 303} 0} {17 {294 295 296 297 298 299 300 303} 0} {18 {294 295 296 297 298 299 300 303} 0} {19 {294 295 296 297 298 299 300 303} 0} {20 {294 295 296 297 298 299 300 303} 0} {21 {294 295 296 297 298 299 300 303} 0} {22 {294 295 296 297 298 299 300 303} 0} {23 {294 295 296 297 298 299 300 303} 0} {24 {294 295 296 297 298 299 300 303} 0} {25 {294 295 296 297 298 299 300 303} 0} {26 {294 295 296 297 298 299 300 303} 0} {27 {294 295 296 297 298 299 300 303} 0} {28 {294 295 296 297 298 299 300 303} 0} {29 {294 295 296 297 298 299 300 303} 0} {30 {294 295 296 297 298 299 300 303} 0} {31 {294 295 296 297 298 299 300 303} 0} {32 {294 295 296 297 298 299 300 303} 0} {33 {294 295 296 297 298 299 300 303} 0} {34 {294 295 296 297 298 299 300 303} 0} {35 {294 295 296 297 298 299 300 303} 0} {36 {294 295 296 297 298 299 300 303} 0} {37 {294 295 296 297 298 299 300 303} 0} {38 {294 295 296 297 298 299 300 303} 0} {39 303 0} {40 303 0} {41 303 0} {42 303 0} {43 303 0} {44 303 0} {45 303 0}} + 118,trans {} + 24 {{56 {0 303} 1} {85 {0 303} 0} {86 {0 303} 0} {87 {0 303} 0} {88 {0 303} 0} {89 {0 303} 0} {90 {0 303} 0}} + 137,trans {} + 25 {{59 {0 303} 1}} + 156,trans {} + 26 {{68 {0 303} 1} {98 {0 303} 0} {99 {0 303} 0} {100 {0 303} 0} {101 {0 303} 0} {102 {0 303} 0} {103 {0 303} 0} {104 {0 303} 0} {105 {0 303} 0}} + 175,trans {} + 27 {{71 {0 303} 1} {113 {0 303} 0} {114 {0 303} 0}} + 194,trans {} + 28 {{65 {0 303} 1}} + 30 {{51 {0 303} 1}} + 29 {{63 {0 303} 1}} + 31 {{0 0 1}} + 10,trans {} + 32 {{48 0 1} {50 0 1} {49 303 0}} + 33 {{62 {0 303} 2}} + 28,trans {{301 121}} + 34 {{64 {0 303} 2}} + 47,trans {} +} + +array set contour::token_id_table { + 286 WCSS_ + 286,t 0 + 287 WCST_ + 292,line 44 + 302,line 56 + 288 WCSU_ + 357,line 300 + 317,t 0 + 265,title AMPLIFIER + 289 WCSV_ + 290 WCSW_ + 300 ECLIPTIC_ + 284,title WCSQ + 291 WCSX_ + 301 INT_ + 313,title GENERATE + 292 WCSY_ + 302 REAL_ + 338,t 0 + 332,title SCALE + 288,line 40 + 293 WCSZ_ + 303 STRING_ + 351,title {} + 294 FK4_ + 304 ASINH_ + 354,line 282 + 305 BLOCK_ + 295 B1950_ + 360,t 1 + 359,t 1 + 306 CLEAR_ + 296 FK5_ + 307 CLOSE_ + 262,t 0 + 297 J2000_ + 308 COLOR_ + 285,line 37 + 298 ICRS_ + 310 COPY_ + 309 CONVERT_ + 299 GALACTIC_ + 351,line 250 + 311 DASH_ + 283,t 0 + 312 EXP_ + 313 GENERATE_ + 314,t 0 + 314 GLOBAL_ + 282,line 34 + 315 HISTEQU_ + 347,line 208 + 316 LEVELS_ + 264,title PHYSICAL + 335,t 0 + 317 LIMITS_ + 283,title WCSP + 318 LINEAR_ + 312,title EXP + 331,title SAVELEVELS + 320 LOADLEVELS_ + 319 LOAD_ + 278,line 30 + 356,t 1 + 350,title {} + 349,title {} + error,line 153 + 321 LOCAL_ + 344,line 195 + 322 LOG_ + 258,t 0 + 323 METHOD_ + 324 MINMAX_ + 325 MODE_ + 275,line 27 + 279,t 0 + 280,t 0 + 326 NLEVELS_ + 341,line 154 + 327 OPEN_ + 328 PASTE_ + 311,t 0 + 330 SAVE_ + 329 POW_ + 331 SAVELEVELS_ + 272,line 24 + 332,t 0 + 332 SCALE_ + 337,line 95 + 333 SCOPE_ + 263,title IMAGE + 334 SINH_ + 282,title WCSO + 353,t 1 + 335 SMOOTH_ + 311,title DASH + 336 SQRT_ + 330,title SAVE + 329,title POW + 268,line 20 + 348,title {} + 337 SQUARED_ + 338 WIDTH_ + 334,line 92 + 340 ZSCALE_ + 339 ZMAX_ + 276,t 0 + 341 yesno + 342 coordsys + 265,line 16 + 343 wcssys + 307,t 0 + 297,t 0 + 344 skyframe + 331,line 89 + 345 numeric + 346 command + 328,t 0 + 347 @PSEUDO1 + 262,line 12 + 348 contour + 350,t 1 + 350 numerics + 349,t 1 + 349 levels + 0,t 0 + 0 {$} + 327,line 85 + 262,title FALSE + 351 load + 281,title WCSN + 352 save + error,t 0 + 310,title COPY + 309,title CONVERT + 299,title GALACTIC + 353 paste + 328,title PASTE + 258,line 8 + 354 method + 347,title {} + 273,t 0 + 355 scale + 324,line 82 + 356 log + 357 modes + 294,t 0 + 304,t 0 + 358 mode + 360 start' + 359 scope + 325,t 0 + 321,line 79 + 346,t 1 + 317,line 75 + 261,title TRUE + 279,title WCSL + 280,title WCSM + 308,title COLOR + 269,t 0 + 270,t 0 + 298,title ICRS + 327,title OPEN + 346,title {} + 314,line 72 + 291,t 0 + 301,t 0 + 322,t 0 + 311,line 69 + 343,t 1 + 307,line 65 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 50 + 278,title WCSK + 307,title CLOSE + 297,title J2000 + 326,title NLEVELS + 287,t 0 + 345,title {} + 294,line 47 + 304,line 62 + 318,t 0 + 360,line 312 + 359,line 309 + 340,t 0 + 339,t 0 + error,title {} + 291,line 43 + 301,line 55 + 356,line 296 + 263,t 0 + 258,title NO + 287,line 39 + 277,title WCSJ + 284,t 0 + 353,line 272 + 306,title CLEAR + 296,title FK5 + 325,title MODE + 344,title {} + 315,t 0 + 284,line 36 + 350,line 246 + 349,line 241 + 336,t 0 + 357,t 1 + 281,line 33 + 260,t 0 + 259,t 0 + 346,line 207 + 281,t 0 + 257,title YES + 277,line 29 + 276,title WCSI + 343,line 167 + 312,t 0 + 305,title BLOCK + 295,title B1950 + 324,title MINMAX + 343,title {} + 333,t 0 + 274,line 26 + 340,line 98 + 339,line 97 + 354,t 1 + 271,line 23 + 336,line 94 + 277,t 0 + 308,t 0 + 267,line 19 + 298,t 0 + 275,title WCSH + 333,line 91 + 294,title FK4 + 304,title ASINH + 330,t 0 + 329,t 0 + 323,title METHOD + 342,title {} + 264,line 15 + 351,t 1 + 330,line 88 + 329,line 87 + 261,line 11 + 274,t 0 + 326,line 84 + 305,t 0 + 295,t 0 + 257,line 7 + 326,t 0 + 274,title WCSG + 323,line 81 + 293,title WCSZ + 303,title string + 322,title LOG + 347,t 1 + 341,title {} + 360,title {} + 359,title {} + 320,line 78 + 319,line 77 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 74 + 323,t 0 + 273,title WCSF + 344,t 1 + 313,line 71 + 292,title WCSY + 302,title float + 321,title LOCAL + 340,title ZSCALE + 339,title ZMAX + 358,title {} + 267,t 0 + 310,line 68 + 309,line 67 + 299,line 52 + 288,t 0 + 320,t 0 + 319,t 0 + 306,line 64 + 296,line 49 + 341,t 1 + 272,title WCSE + 291,title WCSX + 293,line 45 + 301,title integer + 303,line 58 + 320,title LOADLEVELS + 319,title LOAD + 358,line 304 + 338,title WIDTH + 264,t 0 + 357,title {} + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 53 + 355,line 286 + 316,t 0 + 286,line 38 + 337,t 0 + 352,line 261 + 358,t 1 + 271,title WCSD + 261,t 0 + 283,line 35 + 289,title WCSV + 290,title WCSW + 300,title ECLIPTIC + 318,title LINEAR + 348,line 211 + 337,title SQUARED + 356,title {} + 282,t 0 + 279,line 31 + 280,line 32 + 313,t 0 + 345,line 203 + 334,t 0 + 276,line 28 + 355,t 1 + 342,line 162 + 257,t 0 + 269,title WCSB + 270,title WCSC + 273,line 25 + 288,title WCSU + 317,title LIMITS + 278,t 0 + 338,line 96 + 336,title SQRT + 355,title {} + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 21 + 270,line 22 + 335,line 93 + 331,t 0 + 352,t 1 + 266,line 17 + 332,line 90 + 268,title WCSA + 275,t 0 + 263,line 14 + 287,title WCST + 316,title LEVELS + 335,title SMOOTH + 328,line 86 + 306,t 0 + 296,t 0 + 354,title {} + 327,t 0 + 260,line 10 + 259,line 9 + 325,line 83 + 348,t 1 + 322,line 80 + 272,t 0 + 267,title WCS + 257 YES_ + 286,title WCSS + 293,t 0 + 303,t 0 + 315,title HISTEQU + 258 NO_ + 334,title SINH + 318,line 76 + 260 OFF_ + 259 ON_ + 353,title {} + 324,t 0 + 261 TRUE_ + 262 FALSE_ + 263 IMAGE_ + 345,t 1 + 264 PHYSICAL_ + 315,line 73 + 265 AMPLIFIER_ + 266 DETECTOR_ + 267 WCS_ + 268,t 0 + 268 WCSA_ + 269 WCSB_ + 270 WCSC_ + 312,line 70 + 271 WCSD_ + 272 WCSE_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title DETECTOR + 273 WCSF_ + 274 WCSG_ + 285,title WCSR + 321,t 0 + 314,title GLOBAL + 275 WCSH_ + 333,title SCOPE + 308,line 66 + 276 WCSI_ + 298,line 51 + 352,title {} + 277 WCSJ_ + 342,t 1 + 278 WCSK_ + 279 WCSL_ + 280 WCSM_ + 281 WCSN_ + 305,line 63 + 282 WCSO_ + 295,line 48 + 265,t 0 + 283 WCSP_ + 284 WCSQ_ + 285 WCSR_ +} + +proc contour::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ image } + 9 { set _ physical } + 10 { set _ amplifier } + 11 { set _ detector } + 12 { set _ wcs } + 13 { set _ wcsa } + 14 { set _ wcsb } + 15 { set _ wcsc } + 16 { set _ wcsd } + 17 { set _ wcse } + 18 { set _ wcsf } + 19 { set _ wcsg } + 20 { set _ wcsh } + 21 { set _ wcsi } + 22 { set _ wcsj } + 23 { set _ wcsk } + 24 { set _ wcsl } + 25 { set _ wcsm } + 26 { set _ wcsn } + 27 { set _ wcso } + 28 { set _ wcsp } + 29 { set _ wcsq } + 30 { set _ wcsr } + 31 { set _ wcss } + 32 { set _ wcst } + 33 { set _ wcsu } + 34 { set _ wcsv } + 35 { set _ wcsw } + 36 { set _ wcsx } + 37 { set _ wcsy } + 38 { set _ wcsz } + 39 { set _ fk4 } + 40 { set _ fk4 } + 41 { set _ fk5 } + 42 { set _ fk5 } + 43 { set _ icrs } + 44 { set _ galactic } + 45 { set _ ecliptic } + 46 { set _ $1 } + 47 { set _ $1 } + 49 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 51 { ProcessCmdSet contour view $1 UpdateContour } + 52 { ContourDialog } + 53 { ContourDestroyDialog } + 54 { ContourOffDialog } + 57 { Contour2Polygons } + 58 { ContourCmdLoadLevels $2 } + 59 { ContourCmdSaveLevels $2 } + 60 { ContourCCopyDialog } + 62 { ContourDialog; ProcessCmdSet contour color $2 UpdateContour } + 63 { ContourDialog; ProcessCmdSet contour width $2 UpdateContour } + 64 { ContourDialog; ProcessCmdSet contour dash $2 UpdateContour } + 65 { ContourCmdGenerateDialog smooth $2 } + 66 { ContourCmdGenerateDialog method $2 } + 67 { ContourCmdGenerateDialog numlevel $2 } + 68 { ContourCmdScale scale $2 } + 71 { ContourCmdMode scope $2 } + 72 { ContourCmdLimits $2 $3 } + 74 { ContourDialog; ContourGenerateDialog; UpdateContour } + 75 { ContourCmdLevels $1 } + 76 { ContourCmdLevels $1 } + 77 { append _ " $2" } + 79 { ContourCmdLoad $1 } + 80 { ContourCmdLoadLevels $2 } + 81 { ContourCmdLoadOrg $1 $2 fk5 $3 $4 $5 } + 82 { ContourCmdLoadOrg $1 $2 fk5 $3 $4 $5 } + 83 { ContourCmdLoadOrg $1 wcs $2 $3 $4 $5 } + 84 { ContourCmdLoadOrg $1 $2 $3 $4 $5 $6 } + 85 { ContourCmdSave $1 physical fk5 } + 86 { ContourCmdSave $1 $2 fk5 } + 87 { ContourCmdSave $1 $2 fk5 } + 88 { ContourCmdSave $1 wcs $2 } + 89 { ContourCmdSave $1 $2 $3 } + 90 { ContourCmdSaveLevels $2 } + 91 { ContourCmdPaste wcs fk5 green 1 no } + 92 { ContourCmdPaste $1 fk5 $2 $3 $4 } + 93 { ContourCmdPaste $1 fk5 $2 $3 $4 } + 94 { ContourCmdPaste wcs $1 $2 $3 $4 } + 95 { ContourCmdPaste $1 $2 $3 $4 $5 } + 96 { set _ block } + 97 { set _ smooth } + 98 { set _ linear } + 99 { set _ log } + 100 { set _ pow } + 101 { set _ squared } + 102 { set _ sqrt } + 103 { set _ asinh } + 104 { set _ sinh } + 105 { set _ histequ } + 106 { ContourCmdScale log $1 } + 107 { ContourCmdScale log $2 } + 108 { ContourCmdMode mode $1 } + 109 { ContourCmdMode mode $1 } + 110 { set _ minmax } + 111 { set _ zscale } + 112 { set _ zmax } + 113 { set _ local } + 114 { set _ global } + } + 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 contour::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/contoursendlex.tcl b/ds9/parsers/contoursendlex.tcl new file mode 100644 index 0000000..afb9e84 --- /dev/null +++ b/ds9/parsers/contoursendlex.tcl @@ -0,0 +1,806 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval contoursend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc contoursend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc contoursend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc contoursend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc contoursend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc contoursend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc contoursend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc contoursend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc contoursend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc contoursend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set COLOR_ 295 +set DASH_ 296 +set EXP_ 297 +set LEVELS_ 298 +set LIMITS_ 299 +set LOG_ 300 +set METHOD_ 301 +set MODE_ 302 +set NLEVELS_ 303 +set SCALE_ 304 +set SCOPE_ 305 +set SMOOTH_ 306 +set WIDTH_ 307 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: dash + if {[regexp -start $index_ -indices -line -nocase -- {\A(dash)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: exp + if {[regexp -start $index_ -indices -line -nocase -- {\A(exp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: levels + if {[regexp -start $index_ -indices -line -nocase -- {\A(levels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: limits + if {[regexp -start $index_ -indices -line -nocase -- {\A(limits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: log + if {[regexp -start $index_ -indices -line -nocase -- {\A(log)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: method + if {[regexp -start $index_ -indices -line -nocase -- {\A(method)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: nlevels + if {[regexp -start $index_ -indices -line -nocase -- {\A(nlevels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: scope + if {[regexp -start $index_ -indices -line -nocase -- {\A(scope)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COLOR_ + } + 1 { +return $DASH_ + } + 2 { +return $EXP_ + } + 3 { +return $LEVELS_ + } + 4 { +return $LIMITS_ + } + 5 { +return $LOG_ + } + 6 { +return $METHOD_ + } + 7 { +return $MODE_ + } + 8 { +return $NLEVELS_ + } + 9 { +return $SCALE_ + } + 10 { +return $SCOPE_ + } + 11 { +return $SMOOTH_ + } + 12 { +return $WIDTH_ + } + 13 { +return $IMAGE_ + } + 14 { +return $PHYSICAL_ + } + 15 { +return $AMPLIFIER_ + } + 16 { +return $DETECTOR_ + } + 17 { +return $WCS_ + } + 18 { +return $WCSA_ + } + 19 { +return $WCSB_ + } + 20 { +return $WCSC_ + } + 21 { +return $WCSD_ + } + 22 { +return $WCSE_ + } + 23 { +return $WCSF_ + } + 24 { +return $WCSG_ + } + 25 { +return $WCSH_ + } + 26 { +return $WCSI_ + } + 27 { +return $WCSJ_ + } + 28 { +return $WCSK_ + } + 29 { +return $WCSL_ + } + 30 { +return $WCSM_ + } + 31 { +return $WCSN_ + } + 32 { +return $WCSO_ + } + 33 { +return $WCSP_ + } + 34 { +return $WCSQ_ + } + 35 { +return $WCSR_ + } + 36 { +return $WCSS_ + } + 37 { +return $WCST_ + } + 38 { +return $WCSU_ + } + 39 { +return $WCSV_ + } + 40 { +return $WCSW_ + } + 41 { +return $WCSX_ + } + 42 { +return $WCSY_ + } + 43 { +return $WCSZ_ + } + 44 { +return $FK4_ + } + 45 { +return $FK4_ + } + 46 { +return $FK5_ + } + 47 { +return $FK5_ + } + 48 { +return $ICRS_ + } + 49 { +return $GALACTIC_ + } + 50 { +return $ECLIPTIC_ + } + 51 { +# ignore whitespace + } + 52 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/contoursendparser.tab.tcl b/ds9/parsers/contoursendparser.tab.tcl new file mode 100644 index 0000000..a421e08 --- /dev/null +++ b/ds9/parsers/contoursendparser.tab.tcl @@ -0,0 +1,51 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set COLOR_ 295 +set DASH_ 296 +set EXP_ 297 +set LEVELS_ 298 +set LIMITS_ 299 +set LOG_ 300 +set METHOD_ 301 +set MODE_ 302 +set NLEVELS_ 303 +set SCALE_ 304 +set SCOPE_ 305 +set SMOOTH_ 306 +set WIDTH_ 307 diff --git a/ds9/parsers/contoursendparser.tcl b/ds9/parsers/contoursendparser.tcl new file mode 100644 index 0000000..837d324 --- /dev/null +++ b/ds9/parsers/contoursendparser.tcl @@ -0,0 +1,1398 @@ +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 contoursend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc contoursend::YYABORT {} { + return -code return 1 +} + +proc contoursend::YYACCEPT {} { + return -code return 0 +} + +proc contoursend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc contoursend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc contoursend::yyerror {s} { + puts stderr $s +} + +proc contoursend::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 contoursend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set contoursend::table { + 31:294,target 31 + 21:290 reduce + 21:289 reduce + 21:291 reduce + 21:292 reduce + 30:290,target 30 + 30:289,target 30 + 29:290,target 29 + 29:289,target 29 + 27:0 reduce + 21:293 reduce + 9:292,target 9 + 21:294 reduce + 13:291,target 13 + 9:288 reduce + 48:0 reduce + 20:294,target 20 + 19:294,target 19 + 0:306,target 49 + 0:296,target 40 + 9:289 reduce + 9:290 reduce + 30:288 reduce + 29:288 reduce + 9:291 reduce + 30:290 reduce + 30:289 reduce + 29:290 reduce + 29:289 reduce + 9:292 reduce + 30:291 reduce + 29:291 reduce + 18:290,target 18 + 18:289,target 18 + 9:293 reduce + 30:292 reduce + 29:292 reduce + 25:293,target 25 + 9:294 reduce + 30:293 reduce + 29:293 reduce + 0:275,target 19 + 6:0,target 6 + 30:294 reduce + 29:294 reduce + 2:0 reduce + 24:288,target 24 + 31:292,target 31 + 56:0,target 56 + 24:0 reduce + 14:293,target 14 + 48:0,target 50 + 9:289,target 9 + 9:290,target 9 + 41:0,target 52 + 45:0 reduce + 33:0,target 33 + 13:288,target 13 + 25:0,target 25 + 20:292,target 20 + 19:292,target 19 + 0:304,target 47 + 0:294,target 38 + 17:0,target 17 + 10:0,target 10 + 25:291,target 25 + 5:293,target 5 + 0:273,target 17 + 31:290,target 31 + 31:289,target 31 + 17:288 reduce + 21:0 reduce + 17:290 reduce + 17:289 reduce + 17:291 reduce + 14:291,target 14 + 21:294,target 21 + 17:292 reduce + 42:0 reduce + 17:293 reduce + 17:294 reduce + 20:290,target 20 + 20:289,target 20 + 19:290,target 19 + 19:289,target 19 + 0:302,target 45 + 0:292,target 36 + 6:288 reduce + 26:293,target 26 + 6:289 reduce + 6:290 reduce + 26:288 reduce + 6:291 reduce + 26:290 reduce + 26:289 reduce + 10:294,target 10 + 6:292 reduce + 26:291 reduce + 25:288,target 25 + 5:291,target 5 + 6:293 reduce + 26:292 reduce + 0:271,target 15 + 6:294 reduce + 26:293 reduce + 26:294 reduce + 15:293,target 15 + 17:0 reduce + 14:288,target 14 + 38:0 reduce + 21:292,target 21 + 0:300,target 43 + 0:289,target 33 + 0:290,target 34 + 3:0,target 3 + 26:291,target 26 + 6:293,target 6 + 10:292,target 10 + 5:288,target 5 + 53:0,target 55 + 0:268,target 12 + 45:0,target 49 + 37:0,target 37 + 15:291,target 15 + 14:0 reduce + 52:310,target 56 + 30:0,target 30 + 29:0,target 29 + 22:294,target 22 + 22:0,target 22 + 14:288 reduce + 35:0 reduce + 14:290 reduce + 14:289 reduce + 14:0,target 14 + 21:290,target 21 + 21:289,target 21 + 14:291 reduce + 27:293,target 27 + 14:292 reduce + 56:0 reduce + 14:293 reduce + 14:294 reduce + 11:294,target 11 + 0:287,target 31 + 26:288,target 26 + 6:291,target 6 + 0:257 shift + 23:288 reduce + 10:290,target 10 + 10:289,target 10 + 0:258 shift + 23:290 reduce + 23:289 reduce + 16:293,target 16 + 0:260 shift + 0:259 shift + 23:291 reduce + 0:261 shift + 0:266,target 10 + 9:0 reduce + 23:292 reduce + 11:0 reduce + 0:262 shift + 23:293 reduce + 15:288,target 15 + 0:263 shift + 23:294 reduce + 22:292,target 22 + 0:264 shift + 32:0 reduce + 0:265 shift + 0:266 shift + 0:267 shift + 53:0 reduce + 27:291,target 27 + 0:268 shift + 7:293,target 7 + 0:269 shift + 0:270 shift + 11:292,target 11 + 0:271 shift + 0:285,target 29 + 0:272 shift + 6:288,target 6 + 0:273 shift + 0:274 shift + 16:291,target 16 + 0:275 shift + 6:0 reduce + 23:294,target 23 + 0:264,target 8 + 0:276 shift + 0:277 shift + 0:278 shift + 28:0 reduce + 22:290,target 22 + 22:289,target 22 + 0:279 shift + 0:280 shift + 7:0,target 7 + 28:293,target 28 + 0:0,target 39 + 0:281 shift + 11:288 reduce + 0:282 shift + 50:0 reduce + 49:0 reduce + 12:294,target 12 + 11:290 reduce + 11:289 reduce + 0:283 shift + 27:288,target 27 + 11:291 reduce + 0:284 shift + 7:291,target 7 + 11:292 reduce + 0:285 shift + 50:0,target 41 + 49:0,target 43 + 11:293 reduce + 11:290,target 11 + 11:289,target 11 + 0:283,target 27 + 0:286 shift + 42:0,target 51 + 17:293,target 17 + 11:294 reduce + 0:287 shift + 34:0,target 34 + 0:288 shift + 26:0,target 26 + 0:300 shift + 0:289 shift + 0:290 shift + 3:0 reduce + 20:288 reduce + 19:288 reduce + 18:0,target 18 + 16:288,target 16 + 0:301 shift + 0:291 shift + 23:292,target 23 + 20:290 reduce + 20:289 reduce + 19:290 reduce + 19:289 reduce + 11:0,target 11 + 0:262,target 6 + 0:302 shift + 0:292 shift + 20:291 reduce + 19:291 reduce + 0:303 shift + 0:293 shift + 25:0 reduce + 20:292 reduce + 19:292 reduce + 0:304 shift + 0:294 shift + 52:293,target 37 + 20:293 reduce + 19:293 reduce + 0:305 shift + 0:295 shift + 28:291,target 28 + 20:294 reduce + 19:294 reduce + 0:296 shift + 0:306 shift + 8:293,target 8 + 46:0 reduce + 0:307 shift + 8:288 reduce + 12:292,target 12 + 0:308 goto + 0:298 shift + 8:289 reduce + 8:290 reduce + 28:288 reduce + 0:310 goto + 0:309 goto + 0:299 shift + 7:288,target 7 + 8:291 reduce + 28:290 reduce + 28:289 reduce + 0:311 goto + 8:292 reduce + 28:291 reduce + 0:281,target 25 + 8:293 reduce + 28:292 reduce + 17:291,target 17 + 8:294 reduce + 28:293 reduce + 24:294,target 24 + 0:0 reduce + 28:294 reduce + 23:290,target 23 + 23:289,target 23 + 0:260,target 4 + 0:259,target 3 + 30:293,target 30 + 29:293,target 29 + 22:0 reduce + 52:291,target 35 + 13:294,target 13 + 43:0 reduce + 28:288,target 28 + 0:310,target 53 + 0:309,target 52 + 0:299,target 42 + 8:291,target 8 + 12:290,target 12 + 12:289,target 12 + 18:293,target 18 + 0:278,target 22 + 17:288,target 17 + 24:292,target 24 + 4:0,target 4 + 18:0 reduce + 16:288 reduce + 0:257,target 1 + 30:291,target 30 + 29:291,target 29 + 16:290 reduce + 16:289 reduce + 9:293,target 9 + 16:291 reduce + 54:0,target 0 + 52:288,target 32 + 43:297,target 55 + 40:0 reduce + 39:0 reduce + 16:292 reduce + 13:292,target 13 + 46:0,target 45 + 16:293 reduce + 0:307,target 50 + 8:288,target 8 + 38:0,target 38 + 16:294 reduce + 31:0,target 31 + 5:288 reduce + 23:0,target 23 + 18:291,target 18 + 5:289 reduce + 5:290 reduce + 25:294,target 25 + 25:288 reduce + 15:0,target 15 + 5:291 reduce + 25:290 reduce + 25:289 reduce + 0:276,target 20 + 5:292 reduce + 25:291 reduce + 5:293 reduce + 25:292 reduce + 24:290,target 24 + 24:289,target 24 + 5:294 reduce + 31:293,target 31 + 25:293 reduce + 25:294 reduce + 15:0 reduce + 14:294,target 14 + 30:288,target 30 + 29:288,target 29 + 9:291,target 9 + 36:0 reduce + 13:290,target 13 + 13:289,target 13 + 20:293,target 20 + 19:293,target 19 + 0:305,target 48 + 0:295,target 39 + 18:288,target 18 + 25:292,target 25 + 5:294,target 5 + 0:274,target 18 + 31:291,target 31 + 12:0 reduce + 14:292,target 14 + 33:0 reduce + 13:288 reduce + 9:288,target 9 + 13:290 reduce + 13:289 reduce + 13:291 reduce + 54:0 accept + 52:288 shift + 43:297 shift + 20:291,target 20 + 19:291,target 19 + 13:292 reduce + 0:303,target 46 + 0:293,target 37 + 52:290 shift + 52:289 shift + 26:294,target 26 + 13:293 reduce + 52:291 shift + 13:294 reduce + 8:0,target 8 + 52:292 shift + 1:0,target 1 + 52:293 shift + 25:290,target 25 + 25:289,target 25 + 5:292,target 5 + 52:294 shift + 22:288 reduce + 0:272,target 16 + 22:290 reduce + 22:289 reduce + 7:0 reduce + 22:291 reduce + 15:294,target 15 + 51:0,target 53 + 31:288,target 31 + 22:292 reduce + 43:0,target 48 + 22:293 reduce + 52:310 goto + 35:0,target 35 + 30:0 reduce + 29:0 reduce + 22:294 reduce + 14:290,target 14 + 14:289,target 14 + 27:0,target 27 + 21:293,target 21 + 20:0,target 20 + 19:0,target 19 + 51:0 reduce + 31:288 reduce + 12:0,target 12 + 31:290 reduce + 31:289 reduce + 20:288,target 20 + 19:288,target 19 + 0:301,target 44 + 0:291,target 35 + 31:291 reduce + 26:292,target 26 + 6:294,target 6 + 31:292 reduce + 31:293 reduce + 10:293,target 10 + 31:294 reduce + 5:289,target 5 + 5:290,target 5 + 0:269,target 13 + 0:270,target 14 + 4:0 reduce + 15:292,target 15 + 26:0 reduce + 21:291,target 21 + 47:0 reduce + 27:294,target 27 + 10:288 reduce + 10:290 reduce + 10:289 reduce + 10:291 reduce + 0:288,target 32 + 26:290,target 26 + 26:289,target 26 + 10:292 reduce + 6:292,target 6 + 10:293 reduce + 10:294 reduce + 10:291,target 10 + 16:294,target 16 + 1:0 reduce + 0:267,target 11 + 18:288 reduce + 18:290 reduce + 18:289 reduce + 15:290,target 15 + 15:289,target 15 + 23:0 reduce + 22:293,target 22 + 18:291 reduce + 18:292 reduce + 18:293 reduce + 44:0 reduce + 21:288,target 21 + 18:294 reduce + 5:0,target 5 + 27:292,target 27 + 7:288 reduce + 7:294,target 7 + 7:289 reduce + 7:290 reduce + 27:288 reduce + 11:293,target 11 + 0:286,target 30 + 7:291 reduce + 27:290 reduce + 27:289 reduce + 6:289,target 6 + 6:290,target 6 + 7:292 reduce + 55:0,target 47 + 27:291 reduce + 7:293 reduce + 47:0,target 46 + 27:292 reduce + 10:288,target 10 + 7:294 reduce + 40:0,target 42 + 39:0,target 40 + 27:293 reduce + 16:292,target 16 + 32:0,target 32 + 27:294 reduce + 0:265,target 9 + 24:0,target 24 + 20:0 reduce + 19:0 reduce + 16:0,target 16 + 22:291,target 22 + 28:294,target 28 + 41:0 reduce + 27:290,target 27 + 27:289,target 27 + 7:292,target 7 + 11:291,target 11 + 0:284,target 28 + 17:294,target 17 + 16:290,target 16 + 16:289,target 16 + 23:293,target 23 + 0:263,target 7 + 16:0 reduce + 15:288 reduce + 52:294,target 38 + 22:288,target 22 + 15:290 reduce + 15:289 reduce + 37:0 reduce + 28:292,target 28 + 15:291 reduce + 8:294,target 8 + 15:292 reduce + 15:293 reduce + 12:293,target 12 + 15:294 reduce + 7:289,target 7 + 7:290,target 7 + 11:288,target 11 + 0:282,target 26 + 24:288 reduce + 17:292,target 17 + 24:290 reduce + 24:289 reduce + 24:291 reduce + 24:292 reduce + 24:293 reduce + 23:291,target 23 + 13:0 reduce + 0:261,target 5 + 9:0,target 9 + 30:294,target 30 + 29:294,target 29 + 24:294 reduce + 2:0,target 2 + 52:292,target 36 + 34:0 reduce + 28:290,target 28 + 28:289,target 28 + 0:311,target 54 + 8:292,target 8 + 55:0 reduce + 52:0,target 54 + 12:291,target 12 + 44:0,target 44 + 18:294,target 18 + 36:0,target 36 + 28:0,target 28 + 0:279,target 23 + 0:280,target 24 + 21:0,target 21 + 17:290,target 17 + 17:289,target 17 + 24:293,target 24 + 13:0,target 13 + 8:0 reduce + 10:0 reduce + 23:288,target 23 + 0:258,target 2 + 30:292,target 30 + 29:292,target 29 + 9:294,target 9 + 31:0 reduce + 52:290,target 34 + 52:289,target 33 + 13:293,target 13 + 12:288 reduce + 12:290 reduce + 12:289 reduce + 0:308,target 51 + 0:298,target 41 + 8:289,target 8 + 8:290,target 8 + 52:0 reduce + 12:291 reduce + 12:292 reduce + 12:288,target 12 + 18:292,target 18 + 12:293 reduce + 12:294 reduce + 0:277,target 21 + 24:291,target 24 + 21:288 reduce + 5:0 reduce +} + +array set contoursend::rules { + 9,l 309 + 11,l 309 + 32,l 310 + 53,l 311 + 6,l 309 + 28,l 309 + 50,l 311 + 49,l 311 + 3,l 308 + 25,l 309 + 46,l 311 + 0,l 312 + 22,l 309 + 43,l 311 + 18,l 309 + 40,l 311 + 39,l 311 + 15,l 309 + 36,l 310 + 12,l 309 + 33,l 310 + 54,l 311 + 7,l 309 + 29,l 309 + 30,l 309 + 51,l 311 + 4,l 308 + 26,l 309 + 47,l 311 + 1,l 308 + 23,l 309 + 44,l 311 + 19,l 309 + 20,l 309 + 41,l 311 + 16,l 309 + 37,l 310 + 13,l 309 + 34,l 310 + 55,l 311 + 8,l 309 + 10,l 309 + 31,l 309 + 52,l 311 + 5,l 309 + 27,l 309 + 48,l 311 + 2,l 308 + 24,l 309 + 45,l 311 + 21,l 309 + 42,l 311 + 17,l 309 + 38,l 310 + 14,l 309 + 35,l 310 + 56,l 311 +} + +array set contoursend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 0 + 54,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 1 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 2 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set contoursend::rules { + 41,line 152 + 7,line 115 + 37,line 146 + 4,line 111 + 34,line 143 + 1,line 108 + 31,line 139 + 27,line 135 + 24,line 132 + 21,line 129 + 17,line 125 + 14,line 122 + 11,line 119 + 56,line 169 + 53,line 166 + 50,line 162 + 49,line 161 + 46,line 157 + 43,line 154 + 9,line 117 + 40,line 151 + 39,line 150 + 6,line 114 + 36,line 145 + 3,line 110 + 33,line 142 + 29,line 137 + 30,line 138 + 26,line 134 + 23,line 131 + 19,line 127 + 20,line 128 + 16,line 124 + 13,line 121 + 10,line 118 + 55,line 168 + 52,line 165 + 48,line 160 + 45,line 156 + 42,line 153 + 8,line 116 + 38,line 147 + 5,line 113 + 35,line 144 + 2,line 109 + 32,line 141 + 28,line 136 + 25,line 133 + 22,line 130 + 18,line 126 + 15,line 123 + 12,line 120 + 54,line 167 + 51,line 163 + 47,line 159 + 44,line 155 +} + +array set contoursend::lr1_table { + 35 {{35 0 1}} + 14,trans {} + 36 {{36 0 1}} + 33,trans {} + 37 {{37 0 1}} + 52,trans {{288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {310 56}} + 38 {{38 0 1}} + 39 {{40 0 1}} + 40 {{42 0 1}} + 18,trans {} + 1,trans {} + 41 {{52 0 1}} + 37,trans {} + 42 {{51 0 1}} + 56,trans {} + 43 {{47 0 1} {48 0 1}} + 44 {{44 0 1}} + 23,trans {} + 5,trans {} + 45 {{49 0 1}} + 42,trans {} + 46 {{45 0 1}} + 47 {{46 0 1}} + 48 {{50 0 1}} + 27,trans {} + 9,trans {} + 50 {{41 0 1}} + 49 {{43 0 1}} + 46,trans {} + 51 {{53 0 1}} + 52 {{54 0 1} {56 0 1} {32 0 0} {33 0 0} {34 0 0} {35 0 0} {36 0 0} {37 0 0} {38 0 0}} + 13,trans {} + 53 {{55 0 1}} + 32,trans {} + 54 {{0 0 1}} + 51,trans {} + 55 {{47 0 2}} + 56 {{56 0 2}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {295 39} {296 40} {298 41} {299 42} {300 43} {301 44} {302 45} {303 46} {304 47} {305 48} {306 49} {307 50} {308 51} {309 52} {310 53} {311 54}} + 36,trans {} + 55,trans {} + 22,trans {} + 4,trans {} + 41,trans {} + 26,trans {} + 8,trans {} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 10 {{10 {0 288 289 290 291 292 293 294} 1}} + 11 {{11 {0 288 289 290 291 292 293 294} 1}} + 25,trans {} + 7,trans {} + 12 {{12 {0 288 289 290 291 292 293 294} 1}} + 44,trans {} + 13 {{13 {0 288 289 290 291 292 293 294} 1}} + 14 {{14 {0 288 289 290 291 292 293 294} 1}} + 11,trans {} + 15 {{15 {0 288 289 290 291 292 293 294} 1}} + 30,trans {} + 29,trans {} + 16 {{16 {0 288 289 290 291 292 293 294} 1}} + 48,trans {} + 0 {{0 0 0} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 0 0} {55 0 0} {56 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 {0 288 289 290 291 292 293 294} 0} {6 {0 288 289 290 291 292 293 294} 0} {7 {0 288 289 290 291 292 293 294} 0} {8 {0 288 289 290 291 292 293 294} 0} {9 {0 288 289 290 291 292 293 294} 0} {10 {0 288 289 290 291 292 293 294} 0} {11 {0 288 289 290 291 292 293 294} 0} {12 {0 288 289 290 291 292 293 294} 0} {13 {0 288 289 290 291 292 293 294} 0} {14 {0 288 289 290 291 292 293 294} 0} {15 {0 288 289 290 291 292 293 294} 0} {16 {0 288 289 290 291 292 293 294} 0} {17 {0 288 289 290 291 292 293 294} 0} {18 {0 288 289 290 291 292 293 294} 0} {19 {0 288 289 290 291 292 293 294} 0} {20 {0 288 289 290 291 292 293 294} 0} {21 {0 288 289 290 291 292 293 294} 0} {22 {0 288 289 290 291 292 293 294} 0} {23 {0 288 289 290 291 292 293 294} 0} {24 {0 288 289 290 291 292 293 294} 0} {25 {0 288 289 290 291 292 293 294} 0} {26 {0 288 289 290 291 292 293 294} 0} {27 {0 288 289 290 291 292 293 294} 0} {28 {0 288 289 290 291 292 293 294} 0} {29 {0 288 289 290 291 292 293 294} 0} {30 {0 288 289 290 291 292 293 294} 0} {31 {0 288 289 290 291 292 293 294} 0} {32 0 0} {33 0 0} {34 0 0} {35 0 0} {36 0 0} {37 0 0} {38 0 0}} + 17 {{17 {0 288 289 290 291 292 293 294} 1}} + 1 {{1 0 1}} + 18 {{18 {0 288 289 290 291 292 293 294} 1}} + 15,trans {} + 2 {{2 0 1}} + 19 {{19 {0 288 289 290 291 292 293 294} 1}} + 20 {{20 {0 288 289 290 291 292 293 294} 1}} + 34,trans {} + 3 {{3 0 1}} + 21 {{21 {0 288 289 290 291 292 293 294} 1}} + 53,trans {} + 4 {{4 0 1}} + 22 {{22 {0 288 289 290 291 292 293 294} 1}} + 5 {{5 {0 288 289 290 291 292 293 294} 1}} + 23 {{23 {0 288 289 290 291 292 293 294} 1}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{6 {0 288 289 290 291 292 293 294} 1}} + 24 {{24 {0 288 289 290 291 292 293 294} 1}} + 38,trans {} + 7 {{7 {0 288 289 290 291 292 293 294} 1}} + 25 {{25 {0 288 289 290 291 292 293 294} 1}} + 8 {{8 {0 288 289 290 291 292 293 294} 1}} + 26 {{26 {0 288 289 290 291 292 293 294} 1}} + 9 {{9 {0 288 289 290 291 292 293 294} 1}} + 27 {{27 {0 288 289 290 291 292 293 294} 1}} + 24,trans {} + 6,trans {} + 28 {{28 {0 288 289 290 291 292 293 294} 1}} + 43,trans {{297 55}} + 29 {{29 {0 288 289 290 291 292 293 294} 1}} + 30 {{30 {0 288 289 290 291 292 293 294} 1}} + 31 {{31 {0 288 289 290 291 292 293 294} 1}} + 10,trans {} + 32 {{32 0 1}} + 28,trans {} + 33 {{33 0 1}} + 47,trans {} + 34 {{34 0 1}} +} + +array set contoursend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 57 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 LOG_ + 284,title WCSW + 291 J2000_ + 301 METHOD_ + 292 ICRS_ + 302 MODE_ + 288,line 40 + 293 GALACTIC_ + 303 NLEVELS_ + 294 ECLIPTIC_ + 304 SCALE_ + 305 SCOPE_ + 295 COLOR_ + 306 SMOOTH_ + 296 DASH_ + 307 WIDTH_ + 262,t 0 + 297 EXP_ + 308 coordsys + 285,line 36 + 298 LEVELS_ + 310 skyframe + 309 wcssys + 299 LIMITS_ + 311 contoursend + 283,t 0 + 312 start' + 282,line 33 + 264,title WCSC + 283,title WCSV + 312,title {} + 278,line 29 + error,line 106 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title LIMITS + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title LEVELS + 291,t 0 + 301,t 0 + 311,line 149 + 307,line 62 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 52 + 278,title WCSQ + 307,title WIDTH + 297,title EXP + 287,t 0 + 294,line 46 + 304,line 59 + error,title {} + 291,line 43 + 301,line 56 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title SMOOTH + 296,title DASH + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title SCOPE + 295,title COLOR + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title ECLIPTIC + 304,title SCALE + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title NLEVELS + error error + 271,t 0 + 292,t 0 + 302,t 0 + 273,title WCSL + 292,title ICRS + 302,title MODE + 267,t 0 + 310,line 140 + 309,line 112 + 299,line 54 + 288,t 0 + 306,line 61 + 296,line 51 + 272,title WCSK + 291,title J2000 + 293,line 45 + 301,title METHOD + 303,line 58 + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 55 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title LOG + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 170 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 107 + 276 WCSO_ + 298,line 53 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 60 + 282 WCSU_ + 295,line 50 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc contoursend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { ProcessSendCmdYesNo contour view } + 40 { ProcessSendCmdGet contour color } + 41 { ProcessSendCmdGet contour width } + 42 { ProcessSendCmdYesNo contour dash } + 43 { ProcessSendCmdGet contour smooth } + 44 { ProcessSendCmdGet contour method } + 45 { ProcessSendCmdGet contour numlevel } + 46 { ProcessSendCmdGet contour scale } + 47 { ProcessSendCmdGet contour log } + 48 { ProcessSendCmdGet contour log } + 49 { ProcessSendCmdGet contour mode } + 50 { ProcessSendCmdGet contour scope } + 51 { ContourSendCmdLimits } + 52 { ContourSendCmdLevels } + 53 { ProcessSendCmdSend {.ctr} "get contour $1 fk5" } + 54 { ProcessSendCmdSend {.ctr} "get contour $1 fk5" } + 55 { ProcessSendCmdSend {.ctr} "get contour wcs $1" } + 56 { ProcessSendCmdSend {.ctr} "get contour $1 $2" } + } + 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 contoursend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/croplex.tcl b/ds9/parsers/croplex.tcl new file mode 100644 index 0000000..5e4a18f --- /dev/null +++ b/ds9/parsers/croplex.tcl @@ -0,0 +1,864 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval crop { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc crop::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc crop::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc crop::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc crop::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc crop::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc crop::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc crop::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc crop::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc crop::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set ARCMIN_ 296 +set ARCSEC_ 297 +set INT_ 298 +set REAL_ 299 +set SEXSTR_ 300 +set STRING_ 301 +set 3D_ 302 +set CLOSE_ 303 +set LOCK_ 304 +set MATCH_ 305 +set NONE_ 306 +set OPEN_ 307 +set RESET_ 308 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: reset + if {[regexp -start $index_ -indices -line -nocase -- {\A(reset)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $CLOSE_ + } + 2 { +return $LOCK_ + } + 3 { +return $MATCH_ + } + 4 { +return $NONE_ + } + 5 { +return $OPEN_ + } + 6 { +return $RESET_ + } + 7 { +return $IMAGE_ + } + 8 { +return $PHYSICAL_ + } + 9 { +return $AMPLIFIER_ + } + 10 { +return $DETECTOR_ + } + 11 { +return $WCS_ + } + 12 { +return $WCSA_ + } + 13 { +return $WCSB_ + } + 14 { +return $WCSC_ + } + 15 { +return $WCSD_ + } + 16 { +return $WCSE_ + } + 17 { +return $WCSF_ + } + 18 { +return $WCSG_ + } + 19 { +return $WCSH_ + } + 20 { +return $WCSI_ + } + 21 { +return $WCSJ_ + } + 22 { +return $WCSK_ + } + 23 { +return $WCSL_ + } + 24 { +return $WCSM_ + } + 25 { +return $WCSN_ + } + 26 { +return $WCSO_ + } + 27 { +return $WCSP_ + } + 28 { +return $WCSQ_ + } + 29 { +return $WCSR_ + } + 30 { +return $WCSS_ + } + 31 { +return $WCST_ + } + 32 { +return $WCSU_ + } + 33 { +return $WCSV_ + } + 34 { +return $WCSW_ + } + 35 { +return $WCSX_ + } + 36 { +return $WCSY_ + } + 37 { +return $WCSZ_ + } + 38 { +return $FK4_ + } + 39 { +return $FK4_ + } + 40 { +return $FK5_ + } + 41 { +return $FK5_ + } + 42 { +return $ICRS_ + } + 43 { +return $GALACTIC_ + } + 44 { +return $ECLIPTIC_ + } + 45 { +return $DEGREES_ + } + 46 { +return $ARCMIN_ + } + 47 { +return $ARCSEC_ + } + 48 { +set yylval $yytext; return $INT_ + } + 49 - + 50 { +set yylval $yytext; return $REAL_ + } + 51 - + 52 { +set yylval $yytext; return $SEXSTR_ + } + 53 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 54 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 55 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 56 { +set yylval $yytext; return $STRING_ + } + 57 { +# ignore whitespace + } + 58 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + + diff --git a/ds9/parsers/cropparser.tab.tcl b/ds9/parsers/cropparser.tab.tcl new file mode 100644 index 0000000..46aeefe --- /dev/null +++ b/ds9/parsers/cropparser.tab.tcl @@ -0,0 +1,52 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set ARCMIN_ 296 +set ARCSEC_ 297 +set INT_ 298 +set REAL_ 299 +set SEXSTR_ 300 +set STRING_ 301 +set 3D_ 302 +set CLOSE_ 303 +set LOCK_ 304 +set MATCH_ 305 +set NONE_ 306 +set OPEN_ 307 +set RESET_ 308 diff --git a/ds9/parsers/cropparser.tcl b/ds9/parsers/cropparser.tcl new file mode 100644 index 0000000..1b18cb4 --- /dev/null +++ b/ds9/parsers/cropparser.tcl @@ -0,0 +1,2562 @@ +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 crop { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc crop::YYABORT {} { + return -code return 1 +} + +proc crop::YYACCEPT {} { + return -code return 0 +} + +proc crop::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc crop::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc crop::yyerror {s} { + puts stderr $s +} + +proc crop::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 crop::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set crop::table { + 21:289 reduce + 21:290 reduce + 31:294,target 16 + 46:288,target 31 + 21:291 reduce + 21:301 reduce + 21:292 reduce + 6:259,target 18 + 6:260,target 19 + 21:293 reduce + 63:266,target 25 + 21:294 reduce + 43:296,target 28 + 2:284,target 43 + 21:295 reduce + 48:0 reduce + 21:296 reduce + 9:301 reduce + 21:297 reduce + 60:274,target 33 + 10:298,target 1 + 25:293,target 10 + 71:293,target 69 + 1:258,target 42 + 57:265,target 24 + 64:0,target 32 + 37:295,target 22 + 33:0,target 18 + 20:292,target 5 + 32:294,target 17 + 6:276,target 35 + 63:283,target 42 + 86:301 reduce + 7:259,target 18 + 7:260,target 19 + 21:0 reduce + 74:312,target 83 + 44:296,target 29 + 60:291,target 67 + 60:301,target 61 + 0:302,target 4 + 63:0 reduce + 56:298,target 1 + 26:293,target 11 + 1:275,target 42 + 26:288 reduce + 57:282,target 41 + 26:289 reduce + 26:290 reduce + 2:258,target 43 + 26:291 reduce + 26:301 reduce + 26:292 reduce + 56:298 shift + 38:295,target 23 + 26:293 reduce + 56:299 shift + 26:294 reduce + 26:295 reduce + 26:296 reduce + 56:313 goto + 26:297 reduce + 21:292,target 6 + 63:310,target 74 + 63:309,target 73 + 33:294,target 18 + 7:276,target 35 + 61:0,target 69 + 75:312,target 84 + 45:296,target 30 + 15:301,target 52 + 61:301,target 69 + 29:0,target 14 + 30:0,target 15 + 35:0 reduce + 1:292,target 42 + 63:257,target 16 + 27:293,target 12 + 2:275,target 43 + 77:0 reduce + 60:265,target 24 + 40:295,target 25 + 39:295,target 24 + 9:0 reduce + 62:301 reduce + 22:292,target 7 + 32:288 reduce + 32:289 reduce + 32:290 reduce + 32:291 reduce + 32:301 reduce + 34:294,target 19 + 32:292 reduce + 32:293 reduce + 32:294 reduce + 32:295 reduce + 46:296,target 31 + 16:301,target 1 + 32:296 reduce + 62:301,target 70 + 32:297 reduce + 6:267,target 26 + 63:274,target 33 + 2:292,target 43 + 13:298,target 1 + 58:298,target 1 + 28:293,target 13 + 74:293,target 69 + 60:282,target 41 + 50:0 reduce + 49:0 reduce + 57:0,target 68 + 71:311,target 79 + 41:295,target 26 + 1:266,target 42 + 57:273,target 32 + 26:0,target 11 + 23:292,target 8 + 7:319,target 53 + 35:294,target 20 + 6:284,target 43 + 17:301,target 2 + 63:291,target 67 + 63:301,target 53 + 67:301 reduce + 7:267,target 26 + 14:298,target 1 + 37:288 reduce + 22:0 reduce + 29:293,target 14 + 30:293,target 15 + 67:295 reduce + 37:290 reduce + 37:289 reduce + 67:296 reduce + 37:301 reduce + 37:291 reduce + 67:297 reduce + 37:292 reduce + 0:299,target 2 + 37:293 reduce + 42:295,target 27 + 37:294 reduce + 1:283,target 42 + 64:0 reduce + 37:295 reduce + 37:296 reduce + 2:266,target 43 + 37:297 reduce + 24:292,target 9 + 85:0,target 67 + 36:294,target 21 + 2:257 reduce + 7:284,target 43 + 18:301,target 3 + 23:0,target 8 + 64:301,target 32 + 2:258 reduce + 2:260 reduce + 2:259 reduce + 2:261 reduce + 2:262 reduce + 2:263 reduce + 31:293,target 16 + 2:264 reduce + 2:265 reduce + 2:266 reduce + 1:299,target 42 + 6:258,target 17 + 63:265,target 24 + 36:0 reduce + 2:267 reduce + 43:295,target 28 + 2:283,target 43 + 2:268 reduce + 2:270 reduce + 2:269 reduce + 2:271 reduce + 60:273,target 32 + 2:272 reduce + 73:301 reduce + 2:273 reduce + 78:0 reduce + 2:274 reduce + 25:292,target 10 + 71:292,target 68 + 2:275 reduce + 43:288 reduce + 2:276 reduce + 43:290 reduce + 43:289 reduce + 2:277 reduce + 1:257,target 42 + 57:264,target 23 + 43:301 reduce + 43:291 reduce + 2:278 reduce + 43:292 reduce + 37:294,target 22 + 2:280 reduce + 2:279 reduce + 43:293 reduce + 2:281 reduce + 43:294 reduce + 2:282 reduce + 43:295 reduce + 2:283 reduce + 43:296 reduce + 2:284 reduce + 79:312,target 85 + 43:297 reduce + 2:285 reduce + 19:301,target 4 + 20:291,target 5 + 20:301,target 5 + 65:301,target 33 + 2:286 reduce + 2:287 reduce + 8:0,target 47 + 2:288 reduce + 82:0,target 59 + 2:290 reduce + 2:289 reduce + 2:301 reduce + 2:291 reduce + 32:293,target 17 + 2:292 reduce + 6:275,target 34 + 13:298 shift + 63:282,target 41 + 2:293 reduce + 13:299 shift + 51:0,target 74 + 2:299,target 43 + 2:294 reduce + 7:258,target 17 + 74:311,target 82 + 44:295,target 29 + 13:313 goto + 60:290,target 66 + 60:289,target 65 + 2:298 reduce + 7:257 shift + 19:0,target 4 + 20:0,target 5 + 51:0 reduce + 2:299 reduce + 7:258 shift + 7:259 shift + 7:260 shift + 7:261 shift + 26:292,target 11 + 1:274,target 42 + 7:262 shift + 57:281,target 40 + 7:263 shift + 2:257,target 43 + 7:264 shift + 7:265 shift + 38:294,target 23 + 7:266 shift + 7:267 shift + 7:268 shift + 7:269 shift + 7:270 shift + 7:271 shift + 7:272 shift + 21:291,target 6 + 21:301,target 6 + 78:301 reduce + 66:301,target 34 + 7:273 shift + 7:274 shift + 7:275 shift + 7:276 shift + 7:277 shift + 33:293,target 18 + 48:301 reduce + 7:275,target 34 + 7:278 shift + 7:279 shift + 7:280 shift + 7:281 shift + 7:282 shift + 45:295,target 30 + 7:283 shift + 7:284 shift + 18:301 reduce + 23:0 reduce + 7:285 shift + 7:286 shift + 1:301,target 42 + 1:291,target 42 + 5:0,target 48 + 7:287 shift + 27:292,target 12 + 78:0,target 41 + 2:274,target 43 + 65:0 reduce + 60:264,target 23 + 47:0,target 73 + 40:294,target 25 + 39:294,target 24 + 16:0,target 1 + 82:312,target 86 + 7:309 goto + 7:310 goto + 22:291,target 7 + 22:301,target 7 + 67:301,target 35 + 6:318,target 50 + 34:293,target 19 + 4:299,target 2 + 7:319 goto + 46:295,target 31 + 6:266,target 25 + 84:301 reduce + 63:273,target 32 + 2:291,target 43 + 2:301,target 43 + 37:0 reduce + 28:292,target 13 + 74:292,target 68 + 60:281,target 40 + 41:294,target 26 + 80:0 reduce + 79:0 reduce + 24:288 reduce + 1:265,target 42 + 24:289 reduce + 24:290 reduce + 57:272,target 31 + 24:291 reduce + 24:301 reduce + 24:292 reduce + 54:298 shift + 23:291,target 8 + 23:301,target 8 + 24:293 reduce + 68:301,target 36 + 54:299 shift + 2:0,target 43 + 24:294 reduce + 24:295 reduce + 75:0,target 57 + 60:261 shift + 24:296 reduce + 60:262 shift + 54:313 goto + 24:297 reduce + 60:263 shift + 35:293,target 20 + 60:264 shift + 60:265 shift + 44:0,target 29 + 60:266 shift + 60:267 shift + 60:268 shift + 6:283,target 42 + 63:290,target 66 + 63:289,target 65 + 60:270 shift + 60:269 shift + 60:271 shift + 7:266,target 25 + 60:272 shift + 60:273 shift + 60:274 shift + 29:292,target 14 + 30:292,target 15 + 60:275 shift + 60:276 shift + 60:277 shift + 0:308,target 9 + 0:298,target 1 + 60:278 shift + 52:0 reduce + 60:280 shift + 60:279 shift + 42:294,target 27 + 1:282,target 42 + 60:281 shift + 60:282 shift + 2:265,target 43 + 60:283 shift + 60:284 shift + 60:285 shift + 24:291,target 9 + 24:301,target 9 + 70:301,target 38 + 69:301,target 37 + 60:286 shift + 60:287 shift + 60:288 shift + 60:290 shift + 60:289 shift + 60:291 shift + 60:301 reduce + 36:293,target 21 + 60:292 shift + 60:293 shift + 60:294 shift + 6:309,target 48 + 6:310,target 49 + 29:288 reduce + 30:288 reduce + 29:289 reduce + 29:290 reduce + 30:289 reduce + 30:290 reduce + 7:283,target 42 + 29:291 reduce + 29:301 reduce + 30:291 reduce + 30:301 reduce + 29:292 reduce + 30:292 reduce + 29:293 reduce + 30:293 reduce + 60:310 goto + 29:294 reduce + 30:294 reduce + 60:311 goto + 29:295 reduce + 30:295 reduce + 72:0,target 64 + 29:296 reduce + 30:296 reduce + 31:292,target 16 + 29:297 reduce + 30:297 reduce + 24:0 reduce + 1:298,target 42 + 6:257,target 16 + 12:315,target 55 + 63:264,target 23 + 41:0,target 26 + 43:294,target 28 + 2:282,target 43 + 66:0 reduce + 60:272,target 31 + 25:291,target 10 + 25:301,target 10 + 71:291,target 67 + 71:301,target 62 + 57:263,target 22 + 37:293,target 22 + 7:309,target 51 + 7:310,target 52 + 20:289,target 5 + 20:290,target 5 + 4:317,target 15 + 5:301,target 48 + 32:292,target 17 + 6:274,target 33 + 65:301 reduce + 63:281,target 40 + 2:298,target 43 + 7:257,target 16 + 44:294,target 29 + 35:288 reduce + 65:295 reduce + 60:288,target 64 + 38:0 reduce + 35:289 reduce + 35:290 reduce + 65:296 reduce + 35:301 reduce + 35:291 reduce + 65:297 reduce + 35:292 reduce + 35:293 reduce + 0:300,target 3 + 35:294 reduce + 26:291,target 11 + 26:301,target 11 + 72:301,target 64 + 35:295 reduce + 1:273,target 42 + 81:0 reduce + 68:0,target 36 + 57:280,target 39 + 57:279,target 38 + 35:296 reduce + 35:297 reduce + 38:293,target 23 + 37:0,target 22 + 21:289,target 6 + 21:290,target 6 + 33:292,target 18 + 7:274,target 33 + 11:0 accept + 45:294,target 30 + 0:316,target 12 + 1:290,target 42 + 1:289,target 42 + 53:0 reduce + 27:291,target 12 + 27:301,target 12 + 73:301,target 54 + 2:273,target 43 + 71:288 shift + 71:290 shift + 71:289 shift + 71:291 shift + 71:301 reduce + 60:263,target 22 + 71:292 shift + 40:293,target 25 + 39:293,target 24 + 71:293 shift + 71:294 shift + 41:288 reduce + 71:295 shift + 41:290 reduce + 41:289 reduce + 71:296 shift + 41:301 reduce + 41:291 reduce + 71:297 shift + 41:292 reduce + 22:289,target 7 + 22:290,target 7 + 41:293 reduce + 41:294 reduce + 71:311 goto + 41:295 reduce + 71:312 goto + 65:0,target 33 + 41:296 reduce + 64:297,target 32 + 41:297 reduce + 34:292,target 19 + 4:298,target 1 + 34:0,target 19 + 0:300 shift + 46:294,target 31 + 0:302 shift + 0:303 shift + 6:265,target 24 + 63:272,target 31 + 0:304 shift + 25:0 reduce + 2:290,target 43 + 2:289,target 43 + 0:305 shift + 28:291,target 13 + 28:301,target 13 + 74:291,target 67 + 74:301,target 55 + 0:307 shift + 60:280,target 39 + 60:279,target 38 + 0:308 shift + 0:298 shift + 0:299 shift + 67:0 reduce + 41:293,target 26 + 0:313 goto + 0:314 goto + 1:264,target 42 + 57:271,target 30 + 0:316 goto + 23:289,target 8 + 23:290,target 8 + 8:301,target 47 + 20:297,target 5 + 65:297,target 33 + 35:292,target 20 + 76:301 reduce + 46:288 reduce + 46:290 reduce + 46:289 reduce + 6:282,target 41 + 63:288,target 64 + 46:301 reduce + 46:291 reduce + 46:292 reduce + 7:265,target 24 + 46:293 reduce + 46:294 reduce + 3:300,target 13 + 46:295 reduce + 29:291,target 14 + 29:301,target 14 + 30:291,target 15 + 30:301,target 15 + 75:301,target 57 + 62:0,target 70 + 46:296 reduce + 16:301 reduce + 46:297 reduce + 40:0 reduce + 39:0 reduce + 0:307,target 8 + 42:293,target 27 + 1:281,target 42 + 31:0,target 16 + 57:287,target 46 + 2:264,target 43 + 5:301 reduce + 82:0 reduce + 24:289,target 9 + 24:290,target 9 + 9:301,target 51 + 21:297,target 6 + 66:297,target 34 + 36:292,target 21 + 7:282,target 41 + 12:0 reduce + 31:291,target 16 + 31:301,target 16 + 76:301,target 39 + 82:301 reduce + 63:263,target 22 + 43:293,target 28 + 2:281,target 43 + 82:295 shift + 82:296 shift + 60:271,target 30 + 52:301 reduce + 82:297 shift + 25:289,target 10 + 25:290,target 10 + 71:290,target 66 + 71:289,target 65 + 22:288 reduce + 22:289 reduce + 22:290 reduce + 82:312 goto + 22:291 reduce + 22:301 reduce + 57:262,target 21 + 22:292 reduce + 22:297,target 7 + 67:297,target 35 + 57:257 shift + 37:292,target 22 + 22:293 reduce + 57:258 shift + 22:294 reduce + 57:260 shift + 57:259 shift + 22:295 reduce + 27:0,target 12 + 57:261 shift + 22:296 reduce + 57:262 shift + 22:297 reduce + 57:263 shift + 20:288,target 5 + 57:264 shift + 57:265 shift + 57:266 shift + 57:267 shift + 57:268 shift + 32:291,target 17 + 32:301,target 17 + 77:301,target 40 + 57:270 shift + 57:269 shift + 6:273,target 32 + 63:280,target 39 + 63:279,target 38 + 57:271 shift + 57:272 shift + 57:273 shift + 26:0 reduce + 57:274 shift + 44:293,target 29 + 60:287,target 46 + 57:275 shift + 57:276 shift + 57:277 shift + 57:278 shift + 68:0 reduce + 57:280 shift + 57:279 shift + 26:289,target 11 + 26:290,target 11 + 57:281 shift + 1:272,target 42 + 57:282 shift + 57:278,target 37 + 57:283 shift + 1:0 reduce + 57:284 shift + 23:297,target 8 + 68:297,target 36 + 57:285 shift + 38:292,target 23 + 57:286 shift + 57:287 shift + 57:301 reduce + 21:288,target 6 + 86:0,target 60 + 27:288 reduce + 27:289 reduce + 27:290 reduce + 27:291 reduce + 27:301 reduce + 33:291,target 18 + 33:301,target 18 + 78:301,target 41 + 7:273,target 32 + 27:292 reduce + 63:257 shift + 27:293 reduce + 63:258 shift + 57:310 goto + 57:309 goto + 27:294 reduce + 63:260 shift + 63:259 shift + 24:0,target 9 + 27:295 reduce + 63:261 shift + 45:293,target 30 + 27:296 reduce + 63:262 shift + 27:297 reduce + 63:263 shift + 63:264 shift + 41:0 reduce + 63:265 shift + 1:288,target 42 + 63:266 shift + 27:289,target 12 + 27:290,target 12 + 63:267 shift + 2:272,target 43 + 63:268 shift + 63:270 shift + 63:269 shift + 83:0 reduce + 63:271 shift + 60:262,target 21 + 54:313,target 58 + 24:297,target 9 + 70:297,target 38 + 69:297,target 37 + 63:272 shift + 40:292,target 25 + 39:292,target 24 + 63:273 shift + 63:274 shift + 63:275 shift + 63:276 shift + 63:277 shift + 22:288,target 7 + 63:278 shift + 63:280 shift + 63:279 shift + 63:281 shift + 63:282 shift + 64:296,target 32 + 63:283 shift + 34:291,target 19 + 34:301,target 19 + 80:301,target 63 + 79:301,target 66 + 63:284 shift + 63:285 shift + 63:286 shift + 63:287 shift + 63:288 shift + 46:293,target 31 + 63:290 shift + 63:289 shift + 9:0,target 51 + 63:291 shift + 63:301 reduce + 6:264,target 23 + 83:0,target 56 + 63:292 shift + 63:271,target 30 + 63:293 shift + 2:288,target 43 + 63:294 shift + 28:289,target 13 + 28:290,target 13 + 33:288 reduce + 74:290,target 66 + 74:289,target 65 + 33:289 reduce + 33:290 reduce + 60:278,target 37 + 52:0,target 75 + 33:291 reduce + 33:301 reduce + 10:313,target 54 + 33:292 reduce + 25:297,target 10 + 33:293 reduce + 71:297,target 78 + 63:310 goto + 63:309 goto + 41:292,target 26 + 33:294 reduce + 63:311 goto + 21:0,target 6 + 33:295 reduce + 1:263,target 42 + 33:296 reduce + 57:270,target 29 + 57:269,target 28 + 33:297 reduce + 23:288,target 8 + 20:296,target 5 + 65:296,target 33 + 35:301,target 20 + 35:291,target 20 + 81:301,target 65 + 6:281,target 40 + 63:287,target 46 + 7:264,target 23 + 27:0 reduce + 29:289,target 14 + 29:290,target 14 + 30:289,target 15 + 30:290,target 15 + 56:313,target 60 + 26:297,target 11 + 72:297,target 78 + 42:292,target 27 + 1:280,target 42 + 1:279,target 42 + 70:0 reduce + 69:0 reduce + 57:286,target 45 + 2:263,target 43 + 68:301 reduce + 2:0 reduce + 80:0,target 63 + 79:0,target 66 + 24:288,target 9 + 38:288 reduce + 68:295 reduce + 38:290 reduce + 38:289 reduce + 68:296 reduce + 48:0,target 71 + 38:301 reduce + 38:291 reduce + 21:296,target 6 + 68:297 reduce + 66:296,target 34 + 38:292 reduce + 36:301,target 21 + 36:291,target 21 + 82:301,target 59 + 38:293 reduce + 38:294 reduce + 38:295 reduce + 17:0,target 2 + 38:296 reduce + 38:297 reduce + 7:281,target 40 + 31:289,target 16 + 31:290,target 16 + 63:262,target 21 + 42:0 reduce + 27:297,target 12 + 43:292,target 28 + 2:280,target 43 + 2:279,target 43 + 60:270,target 29 + 60:269,target 28 + 84:0 reduce + 25:288,target 10 + 71:288,target 64 + 57:261,target 20 + 22:296,target 7 + 67:296,target 35 + 37:301,target 22 + 37:291,target 22 + 83:301,target 56 + 74:288 shift + 74:290 shift + 74:289 shift + 74:291 shift + 74:301 reduce + 76:0,target 39 + 74:292 shift + 74:293 shift + 74:294 shift + 44:288 reduce + 74:295 shift + 44:290 reduce + 44:289 reduce + 32:289,target 17 + 32:290,target 17 + 74:296 shift + 45:0,target 30 + 44:301 reduce + 44:291 reduce + 6:272,target 31 + 74:297 shift + 63:278,target 37 + 44:292 reduce + 44:293 reduce + 13:313,target 56 + 58:313,target 63 + 44:294 reduce + 28:297,target 13 + 74:297,target 78 + 74:311 goto + 44:295 reduce + 44:292,target 29 + 74:312 goto + 60:286,target 45 + 44:296 reduce + 44:297 reduce + 26:288,target 11 + 1:271,target 42 + 3:300 shift + 57:277,target 36 + 14:298 shift + 14:299 shift + 23:296,target 8 + 68:296,target 36 + 38:301,target 23 + 38:291,target 23 + 84:301,target 58 + 14:313 goto + 33:289,target 18 + 33:290,target 18 + 7:272,target 31 + 14:313,target 57 + 29:297,target 14 + 30:297,target 15 + 75:297,target 78 + 45:292,target 30 + 28:0 reduce + 0:314,target 11 + 80:301 reduce + 79:301 reduce + 73:0,target 54 + 1:287,target 42 + 27:288,target 12 + 2:271,target 43 + 79:295 shift + 71:0 reduce + 79:296 shift + 50:301 reduce + 49:301 reduce + 42:0,target 27 + 79:297 shift + 60:261,target 20 + 24:296,target 9 + 70:296,target 38 + 69:296,target 37 + 40:301,target 25 + 40:291,target 25 + 39:301,target 24 + 39:291,target 24 + 85:301,target 67 + 20:288 reduce + 11:0,target 0 + 20:289 reduce + 20:290 reduce + 79:312 goto + 19:301 reduce + 20:291 reduce + 20:301 reduce + 20:292 reduce + 20:293 reduce + 20:294 reduce + 20:295 reduce + 20:296 reduce + 8:301 reduce + 20:297 reduce + 64:295,target 32 + 34:289,target 19 + 34:290,target 19 + 31:297,target 16 + 46:292,target 31 + 6:263,target 22 + 63:270,target 29 + 63:269,target 28 + 2:287,target 43 + 43:0 reduce + 28:288,target 13 + 74:288,target 64 + 60:277,target 36 + 25:296,target 10 + 71:296,target 77 + 41:301,target 26 + 41:291,target 26 + 86:301,target 60 + 85:0 reduce + 1:262,target 42 + 57:268,target 27 + 85:301 reduce + 70:0,target 38 + 69:0,target 37 + 20:295,target 5 + 65:295,target 33 + 55:301 shift + 38:0,target 23 + 35:289,target 20 + 35:290,target 20 + 25:288 reduce + 25:289 reduce + 25:290 reduce + 32:297,target 17 + 6:279,target 38 + 6:280,target 39 + 25:291 reduce + 25:301 reduce + 63:286,target 45 + 25:292 reduce + 7:263,target 22 + 25:293 reduce + 15:0 reduce + 25:294 reduce + 25:295 reduce + 60:294,target 70 + 25:296 reduce + 29:288,target 14 + 30:288,target 15 + 25:297 reduce + 0:305,target 7 + 57:0 reduce + 26:296,target 11 + 72:296,target 77 + 42:301,target 27 + 42:291,target 27 + 1:278,target 42 + 57:285,target 44 + 2:262,target 43 + 21:295,target 6 + 66:295,target 34 + 36:290,target 21 + 36:289,target 21 + 6:306,target 47 + 33:297,target 18 + 7:279,target 38 + 7:280,target 39 + 66:0,target 34 + 31:288,target 16 + 61:301 reduce + 29:0 reduce + 30:0 reduce + 35:0,target 20 + 63:261,target 20 + 27:296,target 12 + 43:301,target 28 + 43:291,target 28 + 2:278,target 43 + 31:288 reduce + 31:289 reduce + 31:290 reduce + 31:291 reduce + 31:301 reduce + 72:0 reduce + 60:268,target 27 + 31:292 reduce + 31:293 reduce + 31:294 reduce + 31:295 reduce + 31:296 reduce + 31:297 reduce + 57:260,target 19 + 57:259,target 18 + 22:295,target 7 + 67:295,target 35 + 37:290,target 22 + 37:289,target 22 + 34:297,target 19 + 79:297,target 78 + 32:288,target 17 + 6:271,target 30 + 63:277,target 36 + 28:296,target 13 + 74:296,target 77 + 44:301,target 29 + 44:291,target 29 + 60:285,target 44 + 44:0 reduce + 63:0,target 53 + 1:270,target 42 + 1:269,target 42 + 86:0 reduce + 57:276,target 35 + 66:301 reduce + 23:295,target 8 + 32:0,target 17 + 68:295,target 36 + 38:290,target 23 + 38:289,target 23 + 36:288 reduce + 66:295 reduce + 36:290 reduce + 36:289 reduce + 66:296 reduce + 36:301 reduce + 36:291 reduce + 35:297,target 20 + 66:297 reduce + 36:292 reduce + 36:293 reduce + 36:294 reduce + 36:295 reduce + 36:296 reduce + 6:287,target 46 + 63:294,target 70 + 36:297 reduce + 33:288,target 18 + 7:271,target 30 + 16:0 reduce + 29:296,target 14 + 30:296,target 15 + 75:296,target 77 + 45:301,target 30 + 45:291,target 30 + 0:313,target 10 + 1:286,target 42 + 2:270,target 43 + 2:269,target 43 + 1:257 reduce + 1:258 reduce + 1:259 reduce + 1:260 reduce + 24:295,target 9 + 70:295,target 38 + 69:295,target 37 + 40:290,target 25 + 40:289,target 25 + 39:290,target 24 + 39:289,target 24 + 1:261 reduce + 1:262 reduce + 1:263 reduce + 1:264 reduce + 36:297,target 21 + 1:265 reduce + 82:297,target 78 + 1:266 reduce + 1:267 reduce + 60:0,target 61 + 59:0,target 46 + 1:268 reduce + 1:270 reduce + 1:269 reduce + 1:271 reduce + 7:287,target 46 + 1:272 reduce + 34:288,target 19 + 72:301 reduce + 1:273 reduce + 28:0,target 13 + 1:274 reduce + 1:275 reduce + 42:288 reduce + 1:276 reduce + 31:296,target 16 + 72:295 shift + 46:301,target 31 + 46:291,target 31 + 42:290 reduce + 42:289 reduce + 1:277 reduce + 72:296 shift + 42:301 reduce + 42:291 reduce + 1:278 reduce + 72:297 shift + 42:292 reduce + 1:280 reduce + 1:279 reduce + 6:262,target 21 + 63:268,target 27 + 42:293 reduce + 1:281 reduce + 31:0 reduce + 42:294 reduce + 2:286,target 43 + 1:282 reduce + 42:295 reduce + 1:283 reduce + 72:312 goto + 42:296 reduce + 1:284 reduce + 12:301 reduce + 60:276,target 35 + 42:297 reduce + 1:285 reduce + 1:286 reduce + 73:0 reduce + 1:287 reduce + 25:295,target 10 + 71:295,target 76 + 41:290,target 26 + 41:289,target 26 + 1:288 reduce + 1:290 reduce + 1:289 reduce + 1:301 reduce + 1:291 reduce + 1:261,target 42 + 5:0 reduce + 57:267,target 26 + 1:292 reduce + 37:297,target 22 + 1:293 reduce + 1:294 reduce + 1:298 reduce + 6:257 shift + 12:315 goto + 20:294,target 5 + 1:299 reduce + 6:258 shift + 35:288,target 20 + 6:259 shift + 6:260 shift + 6:261 shift + 6:262 shift + 6:263 shift + 32:296,target 17 + 47:301,target 73 + 6:264 shift + 6:278,target 37 + 63:285,target 44 + 6:265 shift + 6:266 shift + 7:262,target 21 + 6:267 shift + 6:268 shift + 60:293,target 69 + 6:269 shift + 6:270 shift + 6:271 shift + 45:0 reduce + 6:272 shift + 77:301 reduce + 0:304,target 6 + 6:273 shift + 25:0,target 10 + 6:274 shift + 26:295,target 11 + 72:295,target 76 + 42:290,target 27 + 42:289,target 27 + 1:277,target 42 + 6:275 shift + 57:284,target 43 + 6:276 shift + 2:261,target 43 + 6:277 shift + 47:301 reduce + 6:278 shift + 38:297,target 23 + 6:279 shift + 6:280 shift + 6:281 shift + 6:282 shift + 6:283 shift + 6:284 shift + 17:301 reduce + 6:285 shift + 21:294,target 6 + 36:288,target 21 + 6:286 shift + 6:287 shift + 33:296,target 18 + 48:301,target 71 + 7:278,target 37 + 6:306 shift + 17:0 reduce + 6:309 goto + 6:310 goto + 1:294,target 42 + 63:260,target 19 + 63:259,target 18 + 27:295,target 12 + 43:290,target 28 + 43:289,target 28 + 2:277,target 43 + 60:0 reduce + 59:0 reduce + 84:0,target 58 + 60:267,target 26 + 40:297,target 25 + 39:297,target 24 + 6:318 goto + 53:0,target 49 + 57:258,target 17 + 22:294,target 7 + 83:301 reduce + 37:288,target 22 + 22:0,target 7 + 34:296,target 19 + 79:296,target 77 + 53:301 reduce + 50:301,target 50 + 49:301,target 72 + 4:313,target 14 + 23:288 reduce + 23:289 reduce + 23:290 reduce + 23:291 reduce + 23:301 reduce + 6:269,target 28 + 6:270,target 29 + 23:292 reduce + 63:276,target 35 + 23:293 reduce + 2:294,target 43 + 23:294 reduce + 23:295 reduce + 28:295,target 13 + 32:0 reduce + 74:295,target 76 + 44:290,target 29 + 44:289,target 29 + 23:296 reduce + 60:284,target 43 + 23:297 reduce + 41:297,target 26 + 74:0 reduce + 1:268,target 42 + 57:275,target 34 + 23:294,target 8 + 38:288,target 23 + 81:0,target 65 + 35:296,target 20 + 51:301,target 74 + 50:0,target 50 + 49:0,target 72 + 6:286,target 45 + 63:293,target 69 + 7:269,target 28 + 7:270,target 29 + 18:0,target 3 + 60:311,target 72 + 29:295,target 14 + 30:295,target 15 + 75:295,target 76 + 45:290,target 30 + 45:289,target 30 + 46:0 reduce + 42:297,target 27 + 1:285,target 42 + 28:288 reduce + 2:268,target 43 + 28:289 reduce + 28:290 reduce + 28:291 reduce + 28:301 reduce + 28:292 reduce + 58:298 shift + 54:299,target 2 + 24:294,target 9 + 28:293 reduce + 58:299 shift + 40:288,target 25 + 39:288,target 24 + 28:294 reduce + 28:295 reduce + 28:296 reduce + 58:313 goto + 28:297 reduce + 36:296,target 21 + 82:296,target 77 + 52:301,target 75 + 7:286,target 45 + 31:295,target 16 + 46:290,target 31 + 46:289,target 31 + 77:0,target 40 + 18:0 reduce + 6:261,target 20 + 63:267,target 26 + 43:297,target 28 + 2:285,target 43 + 46:0,target 31 + 61:0 reduce + 60:275,target 34 + 10:299,target 2 + 15:0,target 52 + 25:294,target 10 + 71:294,target 70 + 41:288,target 26 + 1:259,target 42 + 1:260,target 42 + 57:266,target 25 + 64:301 reduce + 37:296,target 22 + 53:301,target 49 + 34:288 reduce + 64:295 reduce + 34:289 reduce + 34:290 reduce + 64:296 reduce + 20:293,target 5 + 34:291 reduce + 34:301 reduce + 64:297 reduce + 34:292 reduce + 34:293 reduce + 34:294 reduce + 34:295 reduce + 32:295,target 17 + 34:296 reduce + 6:277,target 36 + 34:297 reduce + 63:284,target 43 + 7:261,target 20 + 44:297,target 29 + 60:292,target 68 + 33:0 reduce + 0:303,target 5 + 56:299,target 2 + 26:294,target 11 + 42:288,target 27 + 1:276,target 42 + 75:0 reduce + 57:283,target 42 + 1:0,target 42 + 2:260,target 43 + 2:259,target 43 + 74:0,target 55 + 38:296,target 23 + 43:0,target 28 + 21:293,target 6 + 12:0,target 44 + 63:311,target 75 + 33:295,target 18 + 7:277,target 36 + 70:301 reduce + 69:301 reduce + 45:297,target 30 + 40:288 reduce + 39:288 reduce + 70:295 reduce + 69:295 reduce + 40:290 reduce + 40:289 reduce + 39:290 reduce + 39:289 reduce + 70:296 reduce + 69:296 reduce + 40:301 reduce + 40:291 reduce + 39:301 reduce + 39:291 reduce + 70:297 reduce + 69:297 reduce + 40:292 reduce + 39:292 reduce + 40:293 reduce + 39:293 reduce + 1:293,target 42 + 63:258,target 17 + 57:310,target 62 + 57:309,target 61 + 47:0 reduce + 40:294 reduce + 39:294 reduce + 27:294,target 12 + 43:288,target 28 + 40:295 reduce + 39:295 reduce + 2:276,target 43 + 40:296 reduce + 39:296 reduce + 40:297 reduce + 39:297 reduce + 60:266,target 25 + 40:296,target 25 + 39:296,target 24 + 55:301,target 59 + 10:298 shift + 57:257,target 16 + 10:299 shift + 22:293,target 7 + 10:313 goto + 34:295,target 19 + 79:295,target 76 + 71:0,target 62 + 46:297,target 31 + 40:0,target 25 + 39:0,target 24 + 6:268,target 27 + 63:275,target 34 + 19:0 reduce + 20:0 reduce + 2:293,target 43 + 13:299,target 2 + 58:299,target 2 + 28:294,target 13 + 74:294,target 70 + 44:288,target 29 + 60:283,target 42 + 75:301 reduce + 62:0 reduce + 71:312,target 80 + 41:296,target 26 + 45:288 reduce + 1:267,target 42 + 75:295 shift + 57:274,target 33 + 45:290 reduce + 45:289 reduce + 75:296 shift + 45:301 reduce + 45:291 reduce + 75:297 shift + 45:292 reduce + 23:293,target 8 + 45:293 reduce + 45:294 reduce + 45:295 reduce + 75:312 goto + 45:296 reduce + 15:301 reduce + 45:297 reduce + 35:295,target 20 + 6:285,target 44 + 63:292,target 68 + 7:268,target 27 + 14:299,target 2 + 60:310,target 71 + 29:294,target 14 + 30:294,target 15 + 45:288,target 30 + 4:298 shift + 34:0 reduce + 67:0,target 35 + 4:299 shift + 72:312,target 81 + 42:296,target 27 + 1:284,target 42 + 12:301,target 45 + 57:301,target 68 + 4:313 goto + 36:0,target 21 + 2:267,target 43 + 76:0 reduce + 54:298,target 1 + 4:317 goto + 24:293,target 9 + 8:0 reduce + 36:295,target 21 + 82:295,target 76 + 81:301 reduce + 7:285,target 44 + 51:301 reduce + 21:288 reduce +} + +array set crop::rules { + 9,l 310 + 11,l 310 + 32,l 311 + 53,l 316 + 74,l 319 + 6,l 310 + 28,l 310 + 50,l 316 + 49,l 316 + 71,l 318 + 3,l 309 + 25,l 310 + 46,l 314 + 67,l 316 + 0,l 320 + 22,l 310 + 43,l 313 + 64,l 316 + 18,l 310 + 40,l 312 + 39,l 312 + 61,l 316 + 15,l 310 + 36,l 311 + 57,l 316 + 12,l 310 + 33,l 311 + 54,l 316 + 75,l 319 + 7,l 310 + 29,l 310 + 30,l 310 + 51,l 316 + 72,l 318 + 4,l 309 + 26,l 310 + 47,l 316 + 68,l 317 + 1,l 309 + 23,l 310 + 44,l 314 + 65,l 316 + 19,l 310 + 20,l 310 + 41,l 312 + 62,l 316 + 16,l 310 + 37,l 311 + 58,l 316 + 13,l 310 + 34,l 311 + 55,l 316 + 8,l 310 + 10,l 310 + 31,l 310 + 52,l 316 + 73,l 318 + 5,l 310 + 27,l 310 + 48,l 316 + 70,l 317 + 69,l 317 + 2,l 309 + 24,l 310 + 45,l 315 + 66,l 316 + 21,l 310 + 42,l 313 + 63,l 316 + 17,l 310 + 38,l 311 + 60,l 316 + 59,l 316 + 14,l 310 + 35,l 311 + 56,l 316 +} + +array set crop::rules { + 63,dc 6 + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 5 + 70,dc 3 + 69,dc 3 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 5 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 5 + 68,dc 2 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 3 + 61,dc 4 + 10,dc 1 + 75,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 4 + 67,dc 7 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 0 + 60,dc 7 + 59,dc 6 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 2 + 66,dc 6 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 58,dc 6 + 73,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 65,dc 6 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 57,dc 5 + 72,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 2 + 49,dc 2 + 64,dc 5 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 6 + 71,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set crop::rules { + 41,line 164 + 7,line 128 + 37,line 159 + 4,line 124 + 34,line 156 + 1,line 121 + 31,line 152 + 27,line 148 + 24,line 145 + 21,line 142 + 17,line 138 + 73,line 208 + 14,line 135 + 70,line 203 + 69,line 202 + 11,line 132 + 66,line 197 + 63,line 194 + 60,line 191 + 59,line 189 + 56,line 186 + 53,line 182 + 50,line 178 + 49,line 177 + 46,line 172 + 43,line 168 + 9,line 130 + 40,line 163 + 39,line 162 + 6,line 127 + 36,line 158 + 3,line 123 + 33,line 155 + 29,line 150 + 30,line 151 + 26,line 147 + 23,line 144 + 19,line 140 + 20,line 141 + 75,line 212 + 16,line 137 + 72,line 207 + 13,line 134 + 68,line 201 + 10,line 131 + 65,line 196 + 62,line 193 + 58,line 188 + 55,line 185 + 52,line 181 + 48,line 176 + 45,line 171 + 42,line 167 + 8,line 129 + 38,line 160 + 5,line 126 + 35,line 157 + 2,line 122 + 32,line 154 + 28,line 149 + 25,line 146 + 22,line 143 + 45,e 1 + 18,line 139 + 74,line 211 + 15,line 136 + 71,line 206 + 12,line 133 + 67,line 198 + 64,line 195 + 61,line 192 + 57,line 187 + 54,line 184 + 51,line 179 + 47,line 175 + 44,line 171 +} + +array set crop::lr1_table { + 35 {{20 {0 301} 1}} + 66,trans {} + 85,trans {} + 36 {{21 {0 301} 1}} + 37 {{22 {0 301} 1}} + 38 {{23 {0 301} 1}} + 40 {{25 {0 301} 1}} + 39 {{24 {0 301} 1}} + 117,trans {} + 41 {{26 {0 301} 1}} + 42 {{27 {0 301} 1}} + 43 {{28 {0 301} 1}} + 44 {{29 {0 301} 1}} + 45 {{30 {0 301} 1}} + 46 {{31 {0 301} 1}} + 47 {{73 {0 301} 1}} + 48 {{71 {0 301} 1}} + 49 {{72 {0 301} 1}} + 50 {{50 {0 301} 2}} + 27,trans {} + 51 {{74 {0 301} 1}} + 46,trans {} + 52 {{75 {0 301} 1}} + 65,trans {} + 84,trans {} + 53 {{49 {0 301} 2}} + 54 {{53 {0 301} 2} {54 {0 301} 2} {55 {0 301} 2} {56 {0 301} 2} {57 {0 301} 2} {58 {0 301} 2} {59 {0 301} 2} {60 {0 301} 2} {42 {298 299} 0} {43 {298 299} 0}} + 55 {{46 0 2}} + 56 {{61 {0 301} 3} {62 {0 301} 3} {63 {0 301} 3} {64 {0 301} 3} {65 {0 301} 3} {66 {0 301} 3} {67 {0 301} 3} {42 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 301} 0} {43 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 301} 0}} + 116,trans {} + 57 {{42 {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 285 286 287 301} 1}} + 58 {{43 {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 285 286 287 301} 1}} + 59 {{68 {0 301} 2} {69 {0 301} 2} {70 {0 301} 2} {1 {0 301} 0} {2 {0 301} 0} {3 {0 301} 0} {4 {0 301} 0} {5 {0 301} 0} {6 {0 301} 0} {7 {0 301} 0} {8 {0 301} 0} {9 {0 301} 0} {10 {0 301} 0} {11 {0 301} 0} {12 {0 301} 0} {13 {0 301} 0} {14 {0 301} 0} {15 {0 301} 0} {16 {0 301} 0} {17 {0 301} 0} {18 {0 301} 0} {19 {0 301} 0} {20 {0 301} 0} {21 {0 301} 0} {22 {0 301} 0} {23 {0 301} 0} {24 {0 301} 0} {25 {0 301} 0} {26 {0 301} 0} {27 {0 301} 0} {28 {0 301} 0} {29 {0 301} 0} {30 {0 301} 0} {31 {0 301} 0}} + 60 {{53 {0 301} 3} {54 {0 301} 3} {55 {0 301} 3} {56 {0 301} 3} {57 {0 301} 3} {58 {0 301} 3} {59 {0 301} 3} {60 {0 301} 3} {42 {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 285 286 287 288 289 290 291 292 293 294 301} 0} {43 {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 285 286 287 288 289 290 291 292 293 294 301} 0}} + 61 {{46 0 3}} + 62 {{42 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 301} 1}} + 63 {{43 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 301} 1}} + 64 {{61 {0 301} 4} {62 {0 301} 4} {63 {0 301} 4} {64 {0 301} 4} {65 {0 301} 4} {66 {0 301} 4} {67 {0 301} 4} {5 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {6 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {7 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {8 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {9 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {10 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {11 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {12 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {13 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {14 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {15 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {16 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {17 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {18 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {19 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {20 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {21 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {22 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {23 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {24 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {25 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {26 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {27 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {28 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {29 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {30 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {31 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {32 {0 295 296 297 301} 0} {33 {0 295 296 297 301} 0} {34 {0 295 296 297 301} 0} {35 {0 295 296 297 301} 0} {36 {0 295 296 297 301} 0} {37 {0 295 296 297 301} 0} {38 {0 295 296 297 301} 0}} + 65 {{69 {0 301} 3}} + 26,trans {} + 66 {{70 {0 301} 3}} + 45,trans {} + 67 {{42 {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 285 286 287 288 289 290 291 292 293 294 301} 1}} + 68 {{43 {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 285 286 287 288 289 290 291 292 293 294 301} 1}} + 64,trans {{261 70} {262 71} {263 72} {264 73} {265 74} {266 75} {267 76} {268 77} {269 78} {270 79} {271 80} {272 81} {273 82} {274 83} {275 84} {276 85} {277 86} {278 87} {279 88} {280 89} {281 90} {282 91} {283 92} {284 93} {285 94} {286 95} {287 96} {288 97} {289 98} {290 99} {291 100} {292 101} {293 102} {294 103} {310 104} {311 105}} + 83,trans {} + 69 {{53 {0 301} 4} {54 {0 301} 4} {55 {0 301} 4} {56 {0 301} 4} {57 {0 301} 4} {58 {0 301} 4} {59 {0 301} 4} {60 {0 301} 4} {1 {0 301} 0} {2 {0 301} 0} {3 {0 301} 0} {4 {0 301} 0} {5 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {6 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {7 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {8 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {9 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {10 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {11 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {12 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {13 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {14 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {15 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {16 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {17 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {18 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {19 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {20 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {21 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {22 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {23 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {24 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {25 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {26 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {27 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {28 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {29 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {30 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {31 {0 288 289 290 291 292 293 294 295 296 297 301} 0} {32 {0 295 296 297 301} 0} {33 {0 295 296 297 301} 0} {34 {0 295 296 297 301} 0} {35 {0 295 296 297 301} 0} {36 {0 295 296 297 301} 0} {37 {0 295 296 297 301} 0} {38 {0 295 296 297 301} 0}} + 70 {{5 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 71 {{6 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 72 {{7 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 73 {{8 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 115,trans {{295 109} {296 110} {297 111} {312 119}} + 74 {{9 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 75 {{10 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 76 {{11 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 77 {{12 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 78 {{13 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 79 {{14 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 80 {{15 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 81 {{16 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 82 {{17 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 25,trans {} + 83 {{18 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 44,trans {} + 84 {{19 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 63,trans {} + 85 {{20 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 86 {{21 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 82,trans {} + 87 {{22 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 0 {{0 0 0} {44 0 0} {46 0 0} {47 {0 301} 0} {48 {0 301} 0} {49 {0 301} 0} {50 {0 301} 0} {51 {0 301} 0} {52 {0 301} 0} {53 {0 301} 0} {54 {0 301} 0} {55 {0 301} 0} {56 {0 301} 0} {57 {0 301} 0} {58 {0 301} 0} {59 {0 301} 0} {60 {0 301} 0} {61 {0 301} 0} {62 {0 301} 0} {63 {0 301} 0} {64 {0 301} 0} {65 {0 301} 0} {66 {0 301} 0} {67 {0 301} 0} {42 {298 299} 0} {43 {298 299} 0}} + 88 {{23 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 1 {{42 {298 299} 1}} + 89 {{24 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 90 {{25 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 114,trans {} + 2 {{43 {298 299} 1}} + 91 {{26 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 3 {{61 {0 301} 1} {62 {0 301} 1} {63 {0 301} 1} {64 {0 301} 1} {65 {0 301} 1} {66 {0 301} 1} {67 {0 301} 1}} + 92 {{27 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 4 {{52 {0 301} 1} {68 {0 301} 0} {69 {0 301} 0} {70 {0 301} 0} {42 {298 299} 0} {43 {298 299} 0}} + 93 {{28 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 5 {{48 {0 301} 1}} + 94 {{29 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 6 {{50 {0 301} 1} {71 {0 301} 0} {72 {0 301} 0} {73 {0 301} 0} {1 {0 301} 0} {2 {0 301} 0} {3 {0 301} 0} {4 {0 301} 0} {5 {0 301} 0} {6 {0 301} 0} {7 {0 301} 0} {8 {0 301} 0} {9 {0 301} 0} {10 {0 301} 0} {11 {0 301} 0} {12 {0 301} 0} {13 {0 301} 0} {14 {0 301} 0} {15 {0 301} 0} {16 {0 301} 0} {17 {0 301} 0} {18 {0 301} 0} {19 {0 301} 0} {20 {0 301} 0} {21 {0 301} 0} {22 {0 301} 0} {23 {0 301} 0} {24 {0 301} 0} {25 {0 301} 0} {26 {0 301} 0} {27 {0 301} 0} {28 {0 301} 0} {29 {0 301} 0} {30 {0 301} 0} {31 {0 301} 0}} + 95 {{30 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 7 {{49 {0 301} 1} {74 {0 301} 0} {75 {0 301} 0} {1 {0 301} 0} {2 {0 301} 0} {3 {0 301} 0} {4 {0 301} 0} {5 {0 301} 0} {6 {0 301} 0} {7 {0 301} 0} {8 {0 301} 0} {9 {0 301} 0} {10 {0 301} 0} {11 {0 301} 0} {12 {0 301} 0} {13 {0 301} 0} {14 {0 301} 0} {15 {0 301} 0} {16 {0 301} 0} {17 {0 301} 0} {18 {0 301} 0} {19 {0 301} 0} {20 {0 301} 0} {21 {0 301} 0} {22 {0 301} 0} {23 {0 301} 0} {24 {0 301} 0} {25 {0 301} 0} {26 {0 301} 0} {27 {0 301} 0} {28 {0 301} 0} {29 {0 301} 0} {30 {0 301} 0} {31 {0 301} 0}} + 96 {{31 {0 288 289 290 291 292 293 294 295 296 297 301} 1}} + 8 {{47 {0 301} 1}} + 97 {{32 {0 295 296 297 301} 1}} + 9 {{51 {0 301} 1}} + 98 {{33 {0 295 296 297 301} 1}} + 24,trans {} + 99 {{34 {0 295 296 297 301} 1}} + 43,trans {} + 62,trans {} + 81,trans {} + 99,trans {} + 113,trans {} + 23,trans {} + 42,trans {} + 61,trans {} + 79,trans {} + 80,trans {} + 98,trans {} + 9,trans {} + 112,trans {{295 109} {296 110} {297 111} {312 118}} + 22,trans {} + 41,trans {} + 59,trans {{257 16} {258 17} {259 18} {260 19} {261 20} {262 21} {263 22} {264 23} {265 24} {266 25} {267 26} {268 27} {269 28} {270 29} {271 30} {272 31} {273 32} {274 33} {275 34} {276 35} {277 36} {278 37} {279 38} {280 39} {281 40} {282 41} {283 42} {284 43} {285 44} {286 45} {287 46} {309 65} {310 66}} + 60,trans {{298 67} {299 68} {313 69}} + 78,trans {} + 97,trans {} + 8,trans {} + 111,trans {} + 100 {{35 {0 295 296 297 301} 1}} + 101 {{36 {0 295 296 297 301} 1}} + 102 {{37 {0 295 296 297 301} 1}} + 103 {{38 {0 295 296 297 301} 1}} + 104 {{62 {0 301} 5} {63 {0 301} 5} {66 {0 301} 5} {67 {0 301} 5} {39 {0 301} 0} {40 {0 301} 0} {41 {0 301} 0} {32 {0 295 296 297 301} 0} {33 {0 295 296 297 301} 0} {34 {0 295 296 297 301} 0} {35 {0 295 296 297 301} 0} {36 {0 295 296 297 301} 0} {37 {0 295 296 297 301} 0} {38 {0 295 296 297 301} 0}} + 105 {{64 {0 301} 5} {65 {0 301} 5} {39 {0 301} 0} {40 {0 301} 0} {41 {0 301} 0}} + 21,trans {} + 106 {{54 {0 301} 5}} + 39,trans {} + 40,trans {} + 107 {{55 {0 301} 5} {56 {0 301} 5} {59 {0 301} 5} {60 {0 301} 5} {39 {0 301} 0} {40 {0 301} 0} {41 {0 301} 0} {32 {0 295 296 297 301} 0} {33 {0 295 296 297 301} 0} {34 {0 295 296 297 301} 0} {35 {0 295 296 297 301} 0} {36 {0 295 296 297 301} 0} {37 {0 295 296 297 301} 0} {38 {0 295 296 297 301} 0}} + 58,trans {} + 108 {{57 {0 301} 5} {58 {0 301} 5} {39 {0 301} 0} {40 {0 301} 0} {41 {0 301} 0}} + 110 {{40 {0 301} 1}} + 109 {{39 {0 301} 1}} + 77,trans {} + 111 {{41 {0 301} 1}} + 96,trans {} + 7,trans {{257 16} {258 17} {259 18} {260 19} {261 20} {262 21} {263 22} {264 23} {265 24} {266 25} {267 26} {268 27} {269 28} {270 29} {271 30} {272 31} {273 32} {274 33} {275 34} {276 35} {277 36} {278 37} {279 38} {280 39} {281 40} {282 41} {283 42} {284 43} {285 44} {286 45} {287 46} {309 51} {310 52} {319 53}} + 112 {{66 {0 301} 6} {67 {0 301} 6} {39 {0 301} 0} {40 {0 301} 0} {41 {0 301} 0}} + 113 {{63 {0 301} 6}} + 110,trans {} + 109,trans {} + 114 {{65 {0 301} 6}} + 115 {{59 {0 301} 6} {60 {0 301} 6} {39 {0 301} 0} {40 {0 301} 0} {41 {0 301} 0}} + 116 {{56 {0 301} 6}} + 117 {{58 {0 301} 6}} + 118 {{67 {0 301} 7}} + 119 {{60 {0 301} 7}} + 19,trans {} + 20,trans {} + 38,trans {} + 57,trans {} + 76,trans {} + 95,trans {} + 6,trans {{257 16} {258 17} {259 18} {260 19} {261 20} {262 21} {263 22} {264 23} {265 24} {266 25} {267 26} {268 27} {269 28} {270 29} {271 30} {272 31} {273 32} {274 33} {275 34} {276 35} {277 36} {278 37} {279 38} {280 39} {281 40} {282 41} {283 42} {284 43} {285 44} {286 45} {287 46} {306 47} {309 48} {310 49} {318 50}} + 108,trans {{295 109} {296 110} {297 111} {312 117}} + 18,trans {} + 37,trans {} + 56,trans {{298 62} {299 63} {313 64}} + 75,trans {} + 94,trans {} + 5,trans {} + 107,trans {{288 97} {289 98} {290 99} {291 100} {292 101} {293 102} {294 103} {295 109} {296 110} {297 111} {311 115} {312 116}} + 17,trans {} + 36,trans {} + 55,trans {{301 61}} + 74,trans {} + 93,trans {} + 4,trans {{298 1} {299 2} {313 14} {317 15}} + 106,trans {} + 16,trans {} + 35,trans {} + 54,trans {{298 1} {299 2} {313 60}} + 73,trans {} + 92,trans {} + 3,trans {{300 13}} + 105,trans {{295 109} {296 110} {297 111} {312 114}} + 15,trans {} + 34,trans {} + 53,trans {} + 72,trans {} + 91,trans {} + 2,trans {} + 104,trans {{288 97} {289 98} {290 99} {291 100} {292 101} {293 102} {294 103} {295 109} {296 110} {297 111} {311 112} {312 113}} + 14,trans {{298 57} {299 58} {313 59}} + 33,trans {} + 52,trans {} + 71,trans {} + 90,trans {} + 89,trans {} + 1,trans {} + 103,trans {} + 13,trans {{298 1} {299 2} {313 56}} + 32,trans {} + 51,trans {} + 69,trans {{257 16} {258 17} {259 18} {260 19} {261 70} {262 71} {263 72} {264 73} {265 74} {266 75} {267 76} {268 77} {269 78} {270 79} {271 80} {272 81} {273 82} {274 83} {275 84} {276 85} {277 86} {278 87} {279 88} {280 89} {281 90} {282 91} {283 92} {284 93} {285 94} {286 95} {287 96} {288 97} {289 98} {290 99} {291 100} {292 101} {293 102} {294 103} {309 106} {310 107} {311 108}} + 70,trans {} + 88,trans {} + 0,trans {{298 1} {299 2} {300 3} {302 4} {303 5} {304 6} {305 7} {307 8} {308 9} {313 10} {314 11} {316 12}} + 102,trans {} + 12,trans {{315 55}} + 31,trans {} + 49,trans {} + 50,trans {} + 68,trans {} + 87,trans {} + 101,trans {} + 119,trans {} + 10 {{53 {0 301} 1} {54 {0 301} 1} {55 {0 301} 1} {56 {0 301} 1} {57 {0 301} 1} {58 {0 301} 1} {59 {0 301} 1} {60 {0 301} 1} {42 {298 299} 0} {43 {298 299} 0}} + 11 {{0 0 1}} + 12 {{44 0 1} {46 0 1} {45 301 0}} + 13 {{61 {0 301} 2} {62 {0 301} 2} {63 {0 301} 2} {64 {0 301} 2} {65 {0 301} 2} {66 {0 301} 2} {67 {0 301} 2} {42 {298 299} 0} {43 {298 299} 0}} + 14 {{68 {0 301} 1} {69 {0 301} 1} {70 {0 301} 1} {42 {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 285 286 287 301} 0} {43 {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 285 286 287 301} 0}} + 15 {{52 {0 301} 2}} + 11,trans {} + 16 {{1 {0 301} 1}} + 29,trans {} + 30,trans {} + 17 {{2 {0 301} 1}} + 48,trans {} + 18 {{3 {0 301} 1}} + 67,trans {} + 86,trans {} + 20 {{5 {0 301} 1}} + 19 {{4 {0 301} 1}} + 21 {{6 {0 301} 1}} + 22 {{7 {0 301} 1}} + 100,trans {} + 23 {{8 {0 301} 1}} + 118,trans {} + 24 {{9 {0 301} 1}} + 25 {{10 {0 301} 1}} + 26 {{11 {0 301} 1}} + 27 {{12 {0 301} 1}} + 28 {{13 {0 301} 1}} + 30 {{15 {0 301} 1}} + 29 {{14 {0 301} 1}} + 31 {{16 {0 301} 1}} + 32 {{17 {0 301} 1}} + 10,trans {{298 1} {299 2} {313 54}} + 33 {{18 {0 301} 1}} + 28,trans {} + 34 {{19 {0 301} 1}} + 47,trans {} +} + +array set crop::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 61 + 288 FK4_ + 317,t 1 + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 SEXSTR_ + 284,title WCSW + 291 J2000_ + 301 STRING_ + 313,title {} + 292 ICRS_ + 302 3D_ + 288,line 40 + 293 GALACTIC_ + 303 CLOSE_ + 294 ECLIPTIC_ + 304 LOCK_ + 305 MATCH_ + 295 DEGREES_ + 306 NONE_ + 296 ARCMIN_ + 307 OPEN_ + 262,t 0 + 297 ARCSEC_ + 308 RESET_ + 285,line 36 + 298 INT_ + 310 wcssys + 309 coordsys + 299 REAL_ + 311 skyframe + 283,t 0 + 312 rformat + 313 numeric + 314,t 1 + 314 command + 282,line 33 + 315 @PSEUDO1 + 316 crop + 264,title WCSC + 317 3d + 283,title WCSV + 318 lock + 312,title {} + 320 start' + 319 match + 278,line 29 + error,line 119 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title float + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 317,line 200 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title RESET + 269,t 0 + 270,t 0 + 298,title integer + 314,line 170 + 291,t 0 + 301,t 0 + 311,line 153 + 307,line 66 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 50 + 278,title WCSQ + 307,title OPEN + 297,title ARCSEC + 287,t 0 + 294,line 46 + 304,line 63 + 318,t 1 + error,title {} + 291,line 43 + 301,line 57 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title NONE + 296,title ARCMIN + 315,t 1 + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title MATCH + 295,title DEGREES + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 0 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title ECLIPTIC + 304,title LOCK + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title CLOSE + 320,line 213 + 319,line 210 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 174 + 273,title WCSL + 313,line 166 + 292,title ICRS + 302,title 3D + 267,t 0 + 310,line 125 + 309,line 120 + 299,line 53 + 288,t 0 + 320,t 1 + 319,t 1 + 306,line 65 + 296,line 49 + 272,title WCSK + 291,title J2000 + 293,line 45 + 301,title string + 303,line 62 + 320,title {} + 319,title {} + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 55 + 316,t 1 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title sexagesimal + 318,title {} + 282,t 0 + 279,line 30 + 280,line 31 + 313,t 1 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 317,title {} + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 316,title {} + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 315,title {} + 258 PHYSICAL_ + 318,line 205 + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 315,line 171 + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 161 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 314,title {} + 275 WCSN_ + 308,line 67 + 276 WCSO_ + 298,line 52 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 64 + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc crop::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ degrees } + 40 { set _ arcmin } + 41 { set _ arcsec } + 42 { set _ $1 } + 43 { set _ $1 } + 45 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 47 { CropDialog } + 48 { CropDestroyDialog } + 49 { MatchCropCurrent $2 } + 50 { ProcessCmdSet crop lock $2 LockCropCurrent } + 51 { CropReset } + 53 { ProcessCmdCurrent frame "crop center $1 $2 physical fk5 $3 $4 physical degrees" } + 54 { ProcessCmdCurrent frame "crop center $1 $2 $5 fk5 $3 $4 $5 degrees" } + 55 { ProcessCmdCurrent frame "crop center $1 $2 $5 fk5 $3 $4 $5 degrees" } + 56 { ProcessCmdCurrent frame "crop center $1 $2 $5 fk5 $3 $4 $5 $6" } + 57 { ProcessCmdCurrent frame "crop center $1 $2 wcs $5 $3 $4 wcs degrees" } + 58 { ProcessCmdCurrent frame "crop center $1 $2 wcs $5 $3 $4 wcs $6" } + 59 { ProcessCmdCurrent frame "crop center $1 $2 $5 $6 $3 $4 $5 degrees" } + 60 { ProcessCmdCurrent frame "crop center $1 $2 $5 $6 $3 $4 $5 $7" } + 61 { ProcessCmdCurrent frame "crop center $1 $2 wcs fk5 $3 $4 wcs degrees" } + 62 { ProcessCmdCurrent frame "crop center $1 $2 $5 fk5 $3 $4 $5 degrees" } + 63 { ProcessCmdCurrent frame "crop center $1 $2 $5 fk5 $3 $4 $5 $6" } + 64 { ProcessCmdCurrent frame "crop center $1 $2 wcs $5 $3 $4 wcs degrees" } + 65 { ProcessCmdCurrent frame "crop center $1 $2 wcs $5 $3 $4 wcs $6" } + 66 { ProcessCmdCurrent frame "crop center $1 $2 $5 $6 $3 $4 $5 degrees" } + 67 { ProcessCmdCurrent frame "crop center $1 $2 $5 $6 $3 $4 $5 $7" } + 68 { ProcessCmdCurrent frame "crop 3d $1 $2 image" } + 69 { ProcessCmdCurrent frame "crop 3d $1 $2 $3" } + 70 { ProcessCmdCurrent frame "crop 3d $1 $2 $3" } + 71 { set _ $1 } + 72 { set _ $1 } + 73 { set _ none } + 74 { set _ $1 } + 75 { set _ $1 } + } + 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 crop::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/cropsendlex.tcl b/ds9/parsers/cropsendlex.tcl new file mode 100644 index 0000000..531ad98 --- /dev/null +++ b/ds9/parsers/cropsendlex.tcl @@ -0,0 +1,730 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cropsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cropsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cropsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cropsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cropsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cropsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cropsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cropsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cropsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cropsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set ARCMIN_ 296 +set ARCSEC_ 297 +set SEXAGESIMAL_ 298 +set 3D_ 299 +set LOCK_ 300 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $LOCK_ + } + 2 { +return $IMAGE_ + } + 3 { +return $PHYSICAL_ + } + 4 { +return $AMPLIFIER_ + } + 5 { +return $DETECTOR_ + } + 6 { +return $WCS_ + } + 7 { +return $WCSA_ + } + 8 { +return $WCSB_ + } + 9 { +return $WCSC_ + } + 10 { +return $WCSD_ + } + 11 { +return $WCSE_ + } + 12 { +return $WCSF_ + } + 13 { +return $WCSG_ + } + 14 { +return $WCSH_ + } + 15 { +return $WCSI_ + } + 16 { +return $WCSJ_ + } + 17 { +return $WCSK_ + } + 18 { +return $WCSL_ + } + 19 { +return $WCSM_ + } + 20 { +return $WCSN_ + } + 21 { +return $WCSO_ + } + 22 { +return $WCSP_ + } + 23 { +return $WCSQ_ + } + 24 { +return $WCSR_ + } + 25 { +return $WCSS_ + } + 26 { +return $WCST_ + } + 27 { +return $WCSU_ + } + 28 { +return $WCSV_ + } + 29 { +return $WCSW_ + } + 30 { +return $WCSX_ + } + 31 { +return $WCSY_ + } + 32 { +return $WCSZ_ + } + 33 { +return $FK4_ + } + 34 { +return $FK4_ + } + 35 { +return $FK5_ + } + 36 { +return $FK5_ + } + 37 { +return $ICRS_ + } + 38 { +return $GALACTIC_ + } + 39 { +return $ECLIPTIC_ + } + 40 { +return $DEGREES_ + } + 41 { +return $ARCMIN_ + } + 42 { +return $ARCSEC_ + } + 43 { +return $SEXAGESIMAL_ + } + 44 { +# ignore whitespace + } + 45 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + + diff --git a/ds9/parsers/cropsendparser.tab.tcl b/ds9/parsers/cropsendparser.tab.tcl new file mode 100644 index 0000000..a3580e0 --- /dev/null +++ b/ds9/parsers/cropsendparser.tab.tcl @@ -0,0 +1,44 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set ARCMIN_ 296 +set ARCSEC_ 297 +set SEXAGESIMAL_ 298 +set 3D_ 299 +set LOCK_ 300 diff --git a/ds9/parsers/cropsendparser.tcl b/ds9/parsers/cropsendparser.tcl new file mode 100644 index 0000000..7249b97 --- /dev/null +++ b/ds9/parsers/cropsendparser.tcl @@ -0,0 +1,1701 @@ +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 cropsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cropsend::YYABORT {} { + return -code return 1 +} + +proc cropsend::YYACCEPT {} { + return -code return 0 +} + +proc cropsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cropsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cropsend::yyerror {s} { + puts stderr $s +} + +proc cropsend::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 cropsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cropsend::table { + 51:295 shift + 51:305 goto + 21:289 reduce + 21:290 reduce + 31:294,target 31 + 51:296 shift + 21:291 reduce + 51:297 shift + 21:292 reduce + 21:293 reduce + 21:294 reduce + 9:288 reduce + 13:291,target 13 + 21:295 reduce + 48:0 reduce + 9:290 reduce + 9:289 reduce + 9:291 reduce + 9:292 reduce + 21:298 reduce + 9:293 reduce + 10:298,target 10 + 9:294 reduce + 25:293,target 25 + 0:275,target 19 + 9:295 reduce + 9:298 reduce + 37:295,target 37 + 33:0,target 33 + 39:262,target 6 + 49:297,target 40 + 19:292,target 19 + 20:292,target 20 + 5:293,target 5 + 21:0 reduce + 14:291,target 14 + 0:292,target 36 + 0:302,target 42 + 11:298,target 11 + 26:293,target 26 + 26:288 reduce + 26:289 reduce + 26:290 reduce + 26:291 reduce + 26:292 reduce + 26:293 reduce + 38:295,target 38 + 26:294 reduce + 26:295 reduce + 39:278,target 22 + 51:297,target 56 + 21:292,target 21 + 26:298 reduce + 6:293,target 6 + 15:291,target 15 + 29:0,target 29 + 30:0,target 30 + 35:0 reduce + 12:298,target 12 + 27:293,target 27 + 10:289,target 10 + 10:290,target 10 + 9:0 reduce + 0:266,target 10 + 52:297,target 56 + 22:292,target 22 + 7:293,target 7 + 32:295 reduce + 16:291,target 16 + 32:298 reduce + 13:298,target 13 + 28:293,target 28 + 49:0 reduce + 57:0,target 50 + 0:283,target 27 + 11:289,target 11 + 11:290,target 11 + 26:0,target 26 + 53:297,target 56 + 23:292,target 23 + 39:269,target 13 + 39:270,target 14 + 8:293,target 8 + 17:291,target 17 + 14:298,target 14 + 22:0 reduce + 29:293,target 29 + 30:293,target 30 + 0:299,target 39 + 12:289,target 12 + 12:290,target 12 + 42:295,target 48 + 37:295 reduce + 37:298 reduce + 24:292,target 24 + 39:286,target 30 + 0:257,target 1 + 9:293,target 9 + 54:0,target 41 + 48:296,target 39 + 18:291,target 18 + 23:0,target 23 + 15:298,target 15 + 31:293,target 31 + 36:0 reduce + 43:295,target 48 + 13:289,target 13 + 13:290,target 13 + 25:292,target 25 + 0:274,target 18 + 43:304 goto + 13:288 reduce + 43:295 shift + 13:289 reduce + 13:290 reduce + 13:291 reduce + 39:261,target 5 + 49:296,target 40 + 13:292 reduce + 19:291,target 19 + 20:291,target 20 + 43:298 shift + 13:293 reduce + 8:0,target 8 + 13:294 reduce + 13:295 reduce + 5:292,target 5 + 16:298,target 16 + 13:298 reduce + 51:0,target 48 + 14:289,target 14 + 14:290,target 14 + 19:0,target 19 + 20:0,target 20 + 51:0 reduce + 0:291,target 35 + 0:301,target 41 + 26:292,target 26 + 39:277,target 21 + 51:296,target 55 + 21:291,target 21 + 6:292,target 6 + 17:298,target 17 + 18:288 reduce + 48:295 reduce + 15:289,target 15 + 15:290,target 15 + 18:289 reduce + 18:290 reduce + 48:296 reduce + 18:291 reduce + 23:0 reduce + 48:297 reduce + 18:292 reduce + 18:293 reduce + 5:0,target 5 + 18:294 reduce + 7:288 reduce + 18:295 reduce + 27:292,target 27 + 7:290 reduce + 7:289 reduce + 7:291 reduce + 7:292 reduce + 18:298 reduce + 7:293 reduce + 47:0,target 53 + 7:294 reduce + 10:288,target 10 + 7:295 reduce + 0:265,target 9 + 7:298 reduce + 16:0,target 16 + 52:296,target 55 + 22:291,target 22 + 7:292,target 7 + 18:298,target 18 + 16:289,target 16 + 16:290,target 16 + 28:292,target 28 + 37:0 reduce + 0:282,target 26 + 11:288,target 11 + 24:288 reduce + 24:289 reduce + 24:290 reduce + 24:291 reduce + 24:292 reduce + 53:296,target 55 + 23:291,target 23 + 24:293 reduce + 2:0,target 2 + 24:294 reduce + 24:295 reduce + 39:268,target 12 + 8:292,target 8 + 19:298,target 19 + 20:298,target 20 + 24:298 reduce + 44:0,target 0 + 17:289,target 17 + 17:290,target 17 + 13:0,target 13 + 10:0 reduce + 29:292,target 29 + 30:292,target 30 + 52:0 reduce + 42:294,target 38 + 12:288,target 12 + 42:304,target 51 + 24:291,target 24 + 39:285,target 29 + 9:292,target 9 + 21:298,target 21 + 29:288 reduce + 30:288 reduce + 29:289 reduce + 29:290 reduce + 30:289 reduce + 30:290 reduce + 48:295,target 39 + 18:289,target 18 + 18:290,target 18 + 29:291 reduce + 30:291 reduce + 29:292 reduce + 30:292 reduce + 29:293 reduce + 30:293 reduce + 29:294 reduce + 30:294 reduce + 29:295 reduce + 30:295 reduce + 31:292,target 31 + 24:0 reduce + 29:298 reduce + 30:298 reduce + 41:0,target 45 + 43:304,target 52 + 13:288,target 13 + 10:0,target 10 + 25:291,target 25 + 0:273,target 17 + 22:298,target 22 + 39:259,target 3 + 39:260,target 4 + 50:295,target 48 + 49:295,target 40 + 19:289,target 19 + 19:290,target 19 + 20:289,target 20 + 20:290,target 20 + 5:291,target 5 + 14:288,target 14 + 38:0 reduce + 0:290,target 34 + 0:289,target 33 + 0:300,target 40 + 26:291,target 26 + 35:295 reduce + 23:298,target 23 + 35:298 reduce + 37:0,target 37 + 39:276,target 20 + 51:295,target 54 + 51:305,target 57 + 21:289,target 21 + 21:290,target 21 + 6:291,target 6 + 0:257 shift + 0:258 shift + 0:259 shift + 0:260 shift + 0:261 shift + 0:262 shift + 11:0 reduce + 0:263 shift + 15:288,target 15 + 0:264 shift + 0:265 shift + 0:266 shift + 0:267 shift + 0:268 shift + 27:291,target 27 + 0:269 shift + 0:270 shift + 0:271 shift + 0:272 shift + 0:273 shift + 24:298,target 24 + 0:274 shift + 0:275 shift + 0:276 shift + 0:264,target 8 + 0:277 shift + 0:278 shift + 52:295,target 54 + 52:305,target 58 + 0:280 shift + 0:279 shift + 22:289,target 22 + 22:290,target 22 + 0:281 shift + 0:282 shift + 11:288 reduce + 0:283 shift + 11:289 reduce + 11:290 reduce + 7:291,target 7 + 0:284 shift + 11:291 reduce + 0:285 shift + 11:292 reduce + 0:286 shift + 11:293 reduce + 0:287 shift + 11:294 reduce + 0:288 shift + 11:295 reduce + 34:0,target 34 + 0:290 shift + 0:289 shift + 0:300 shift + 0:291 shift + 0:301 goto + 16:288,target 16 + 0:292 shift + 0:302 goto + 11:298 reduce + 0:293 shift + 0:303 goto + 0:294 shift + 25:0 reduce + 0:306 goto + 28:291,target 28 + 0:299 shift + 25:298,target 25 + 0:281,target 25 + 0:0 reduce + 53:295,target 54 + 53:305,target 59 + 23:289,target 23 + 23:290,target 23 + 39:267,target 11 + 8:291,target 8 + 5:298,target 5 + 17:288,target 17 + 16:288 reduce + 16:289 reduce + 16:290 reduce + 29:291,target 29 + 30:291,target 30 + 16:291 reduce + 16:292 reduce + 39:0 reduce + 40:0 reduce + 16:293 reduce + 16:294 reduce + 26:298,target 26 + 42:293,target 37 + 5:288 reduce + 16:295 reduce + 31:0,target 31 + 42:303,target 50 + 5:290 reduce + 5:289 reduce + 5:291 reduce + 5:292 reduce + 16:298 reduce + 5:293 reduce + 5:294 reduce + 24:289,target 24 + 24:290,target 24 + 5:295 reduce + 39:284,target 28 + 9:291,target 9 + 5:298 reduce + 6:298,target 6 + 18:288,target 18 + 12:0 reduce + 31:291,target 31 + 27:298,target 27 + 54:0 reduce + 10:295,target 10 + 25:289,target 25 + 25:290,target 25 + 0:272,target 16 + 22:288 reduce + 52:295 shift + 52:305 goto + 22:289 reduce + 22:290 reduce + 58:0,target 51 + 52:296 shift + 22:291 reduce + 52:297 shift + 22:292 reduce + 22:293 reduce + 22:294 reduce + 22:295 reduce + 27:0,target 27 + 7:298,target 7 + 39:258,target 2 + 50:304,target 53 + 19:288,target 19 + 20:288,target 20 + 22:298 reduce + 5:290,target 5 + 5:289,target 5 + 26:0 reduce + 28:298,target 28 + 0:288,target 32 + 11:295,target 11 + 26:289,target 26 + 26:290,target 26 + 1:0 reduce + 39:275,target 19 + 8:298,target 8 + 21:288,target 21 + 27:288 reduce + 6:290,target 6 + 6:289,target 6 + 27:289 reduce + 27:290 reduce + 55:0,target 42 + 27:291 reduce + 27:292 reduce + 27:293 reduce + 27:294 reduce + 24:0,target 24 + 27:295 reduce + 29:298,target 29 + 30:298,target 30 + 27:298 reduce + 41:0 reduce + 12:295,target 12 + 27:289,target 27 + 27:290,target 27 + 39:302,target 46 + 0:263,target 7 + 9:298,target 9 + 22:288,target 22 + 7:290,target 7 + 7:289,target 7 + 31:298,target 31 + 9:0,target 9 + 13:0 reduce + 13:295,target 13 + 28:289,target 28 + 28:290,target 28 + 55:0 reduce + 52:0,target 49 + 0:280,target 24 + 0:279,target 23 + 21:0,target 21 + 33:295 reduce + 33:298 reduce + 23:288,target 23 + 39:266,target 10 + 8:290,target 8 + 8:289,target 8 + 32:298,target 32 + 14:295,target 14 + 27:0 reduce + 29:289,target 29 + 29:290,target 29 + 30:289,target 30 + 30:290,target 30 + 0:306,target 44 + 42:292,target 36 + 6:0,target 6 + 2:0 reduce + 24:288,target 24 + 39:283,target 27 + 48:0,target 39 + 9:290,target 9 + 9:289,target 9 + 17:0,target 17 + 38:295 reduce + 33:298,target 33 + 38:298 reduce + 15:295,target 15 + 31:289,target 31 + 31:290,target 31 + 42:0 reduce + 10:294,target 10 + 25:288,target 25 + 0:271,target 15 + 34:298,target 34 + 39:257,target 1 + 3:0,target 3 + 5:288,target 5 + 16:295,target 16 + 45:0,target 56 + 14:0 reduce + 14:288 reduce + 14:0,target 14 + 14:289 reduce + 14:290 reduce + 14:291 reduce + 14:292 reduce + 56:0 reduce + 14:293 reduce + 0:287,target 31 + 11:294,target 11 + 14:294 reduce + 14:295 reduce + 26:288,target 26 + 14:298 reduce + 39:274,target 18 + 35:298,target 35 + 6:288,target 6 + 17:295,target 17 + 28:0 reduce + 0:0,target 44 + 12:294,target 12 + 27:288,target 27 + 42:0,target 46 + 3:0 reduce + 39:301,target 45 + 50:304 goto + 19:288 reduce + 20:288 reduce + 50:295 shift + 49:295 reduce + 0:262,target 6 + 11:0,target 11 + 19:289 reduce + 19:290 reduce + 20:289 reduce + 20:290 reduce + 49:296 reduce + 19:291 reduce + 20:291 reduce + 49:297 reduce + 19:292 reduce + 20:292 reduce + 36:298,target 36 + 50:298 shift + 19:293 reduce + 20:293 reduce + 19:294 reduce + 20:294 reduce + 8:288 reduce + 19:295 reduce + 20:295 reduce + 8:290 reduce + 8:289 reduce + 8:291 reduce + 7:288,target 7 + 18:295,target 18 + 8:292 reduce + 19:298 reduce + 20:298 reduce + 8:293 reduce + 8:294 reduce + 8:295 reduce + 8:298 reduce + 13:294,target 13 + 43:0 reduce + 28:288,target 28 + 0:278,target 22 + 37:298,target 37 + 39:265,target 9 + 8:288,target 8 + 19:295,target 19 + 20:295,target 20 + 38:0,target 38 + 25:288 reduce + 25:289 reduce + 25:290 reduce + 25:291 reduce + 25:292 reduce + 25:293 reduce + 15:0 reduce + 25:294 reduce + 14:294,target 14 + 25:295 reduce + 29:288,target 29 + 30:288,target 30 + 25:298 reduce + 57:0 reduce + 42:291,target 35 + 38:298,target 38 + 39:282,target 26 + 9:288,target 9 + 21:295,target 21 + 15:294,target 15 + 31:288,target 31 + 29:0 reduce + 30:0 reduce + 35:0,target 35 + 31:288 reduce + 31:289 reduce + 31:290 reduce + 31:291 reduce + 31:292 reduce + 10:293,target 10 + 31:293 reduce + 31:294 reduce + 4:0 reduce + 0:269,target 13 + 0:270,target 14 + 31:295 reduce + 22:295,target 22 + 31:298 reduce + 16:294,target 16 + 44:0 accept + 0:286,target 30 + 11:293,target 11 + 23:295,target 23 + 32:0,target 32 + 39:273,target 17 + 36:295 reduce + 17:294,target 17 + 36:298 reduce + 16:0 reduce + 12:293,target 12 + 42:298,target 49 + 58:0 reduce + 24:295,target 24 + 0:261,target 5 + 59:0,target 52 + 18:294,target 18 + 28:0,target 28 + 42:288 shift + 42:290 shift + 42:289 shift + 42:291 shift + 42:292 shift + 42:293 shift + 31:0 reduce + 42:303 goto + 43:298,target 49 + 42:294 shift + 12:288 reduce + 13:293,target 13 + 42:304 goto + 12:289 reduce + 12:290 reduce + 42:295 shift + 12:291 reduce + 12:292 reduce + 12:293 reduce + 42:298 shift + 12:294 reduce + 25:295,target 25 + 0:277,target 21 + 12:295 reduce + 5:0 reduce + 12:298 reduce + 39:264,target 8 + 19:294,target 19 + 20:294,target 20 + 5:295,target 5 + 56:0,target 43 + 14:293,target 14 + 45:0 reduce + 0:294,target 38 + 25:0,target 25 + 26:295,target 26 + 42:290,target 34 + 42:289,target 33 + 17:288 reduce + 39:281,target 25 + 17:289 reduce + 17:290 reduce + 17:291 reduce + 17:292 reduce + 21:294,target 21 + 17:293 reduce + 17:294 reduce + 6:288 reduce + 17:295 reduce + 6:295,target 6 + 6:290 reduce + 6:289 reduce + 6:291 reduce + 6:292 reduce + 17:298 reduce + 6:293 reduce + 6:294 reduce + 6:295 reduce + 15:293,target 15 + 17:0 reduce + 6:298 reduce + 27:295,target 27 + 59:0 reduce + 10:292,target 10 + 39:307,target 47 + 0:268,target 12 + 22:294,target 22 + 22:0,target 22 + 7:295,target 7 + 23:288 reduce + 53:295 shift + 53:305 goto + 16:293,target 16 + 23:289 reduce + 23:290 reduce + 53:296 shift + 23:291 reduce + 53:297 shift + 23:292 reduce + 23:293 reduce + 23:294 reduce + 23:295 reduce + 28:295,target 28 + 32:0 reduce + 23:298 reduce + 0:285,target 29 + 11:292,target 11 + 6:0 reduce + 23:294,target 23 + 7:0,target 7 + 39:272,target 16 + 8:295,target 8 + 49:0,target 40 + 17:293,target 17 + 18:0,target 18 + 29:295,target 29 + 30:295,target 30 + 46:0 reduce + 12:292,target 12 + 28:288 reduce + 28:289 reduce + 28:290 reduce + 28:291 reduce + 28:292 reduce + 24:294,target 24 + 28:293 reduce + 28:294 reduce + 28:295 reduce + 0:259,target 3 + 0:260,target 4 + 9:295,target 9 + 28:298 reduce + 18:293,target 18 + 4:0,target 4 + 31:295,target 31 + 18:0 reduce + 13:292,target 13 + 46:0,target 57 + 15:0,target 15 + 25:294,target 25 + 0:276,target 20 + 39:263,target 7 + 50:298,target 49 + 19:293,target 19 + 20:293,target 20 + 5:294,target 5 + 34:295 reduce + 32:295,target 32 + 34:298 reduce + 39:257 shift + 39:258 shift + 39:259 shift + 39:260 shift + 14:292,target 14 + 39:261 shift + 33:0 reduce + 39:262 shift + 39:263 shift + 39:264 shift + 0:293,target 37 + 0:303,target 43 + 39:265 shift + 26:294,target 26 + 39:266 shift + 39:267 shift + 42:288,target 32 + 1:0,target 1 + 39:268 shift + 39:269 shift + 39:270 shift + 39:271 shift + 7:0 reduce + 39:272 shift + 39:273 shift + 39:274 shift + 39:279,target 23 + 39:280,target 24 + 43:0,target 47 + 39:275 shift + 39:276 shift + 21:293,target 21 + 39:277 shift + 39:278 shift + 12:0,target 12 + 39:279 shift + 39:280 shift + 39:281 shift + 6:294,target 6 + 39:282 shift + 33:295,target 33 + 39:283 shift + 39:284 shift + 39:285 shift + 39:286 shift + 39:287 shift + 15:292,target 15 + 39:301 goto + 39:302 goto + 47:0 reduce + 10:288 reduce + 27:294,target 27 + 10:289 reduce + 10:290 reduce + 10:291 reduce + 10:292 reduce + 39:307 goto + 10:293 reduce + 10:291,target 10 + 10:294 reduce + 10:295 reduce + 0:267,target 11 + 10:298 reduce + 22:293,target 22 + 7:294,target 7 + 34:295,target 34 + 16:292,target 16 + 39:0,target 55 + 40:0,target 54 + 19:0 reduce + 20:0 reduce + 28:294,target 28 + 0:284,target 28 + 11:291,target 11 + 23:293,target 23 + 15:288 reduce + 15:289 reduce + 15:290 reduce + 39:271,target 15 + 8:294,target 8 + 15:291 reduce + 15:292 reduce + 35:295,target 35 + 15:293 reduce + 15:294 reduce + 15:295 reduce + 17:292,target 17 + 15:298 reduce + 29:294,target 29 + 30:294,target 30 + 34:0 reduce + 12:291,target 12 + 36:0,target 36 + 24:293,target 24 + 8:0 reduce + 39:287,target 31 + 0:258,target 2 + 9:294,target 9 + 36:295,target 36 + 48:297,target 39 + 18:292,target 18 + 21:288 reduce +} + +array set cropsend::rules { + 9,l 302 + 11,l 302 + 32,l 303 + 53,l 306 + 6,l 302 + 28,l 302 + 50,l 306 + 49,l 306 + 3,l 301 + 25,l 302 + 46,l 306 + 0,l 308 + 22,l 302 + 43,l 305 + 18,l 302 + 40,l 304 + 39,l 304 + 15,l 302 + 36,l 303 + 57,l 307 + 12,l 302 + 33,l 303 + 54,l 306 + 7,l 302 + 29,l 302 + 30,l 302 + 51,l 306 + 4,l 301 + 26,l 302 + 47,l 306 + 1,l 301 + 23,l 302 + 44,l 306 + 19,l 302 + 20,l 302 + 41,l 305 + 16,l 302 + 37,l 303 + 13,l 302 + 34,l 303 + 55,l 307 + 8,l 302 + 10,l 302 + 31,l 302 + 52,l 306 + 5,l 302 + 27,l 302 + 48,l 306 + 2,l 301 + 24,l 302 + 45,l 306 + 21,l 302 + 42,l 305 + 17,l 302 + 38,l 303 + 14,l 302 + 35,l 303 + 56,l 307 +} + +array set cropsend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 0 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 2 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 4 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 0 + 22,dc 1 + 36,dc 1 + 51,dc 3 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 57,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 3 + 49,dc 2 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 2 +} + +array set cropsend::rules { + 41,line 156 + 7,line 118 + 37,line 149 + 4,line 114 + 34,line 146 + 1,line 111 + 31,line 142 + 27,line 138 + 24,line 135 + 21,line 132 + 17,line 128 + 14,line 125 + 11,line 122 + 56,line 185 + 53,line 180 + 50,line 173 + 49,line 171 + 46,line 164 + 43,line 158 + 9,line 120 + 40,line 153 + 39,line 152 + 6,line 117 + 36,line 148 + 3,line 113 + 33,line 145 + 29,line 140 + 30,line 141 + 26,line 137 + 23,line 134 + 19,line 130 + 20,line 131 + 16,line 127 + 13,line 124 + 10,line 121 + 55,line 184 + 52,line 179 + 48,line 168 + 45,line 163 + 42,line 157 + 8,line 119 + 38,line 150 + 5,line 116 + 35,line 147 + 2,line 112 + 32,line 144 + 28,line 139 + 25,line 136 + 22,line 133 + 18,line 129 + 15,line 126 + 12,line 123 + 57,line 186 + 54,line 181 + 51,line 176 + 47,line 166 + 44,line 161 +} + +array set cropsend::lr1_table { + 35 {{35 {0 295 298} 1}} + 66,trans {} + 36 {{36 {0 295 298} 1}} + 85,trans {{295 90} {296 91} {297 92} {305 93}} + 37 {{37 {0 295 298} 1}} + 38 {{38 {0 295 298} 1}} + 40 {{54 0 1}} + 39 {{53 0 1} {55 0 0} {56 0 0} {57 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0}} + 41 {{45 0 1}} + 42 {{46 0 1} {48 0 1} {50 0 1} {52 0 1} {39 {0 295 296 297} 0} {40 {0 295 296 297} 0} {32 {295 298} 0} {33 {295 298} 0} {34 {295 298} 0} {35 {295 298} 0} {36 {295 298} 0} {37 {295 298} 0} {38 {295 298} 0}} + 43 {{47 0 1} {49 0 1} {51 0 1} {39 {0 295 296 297} 0} {40 {0 295 296 297} 0}} + 44 {{0 0 1}} + 45 {{5 0 1}} + 46 {{6 0 1}} + 47 {{7 0 1}} + 48 {{8 0 1}} + 27,trans {} + 49 {{9 0 1}} + 50 {{10 0 1}} + 51 {{11 0 1}} + 46,trans {} + 52 {{12 0 1}} + 65,trans {} + 53 {{13 0 1}} + 84,trans {{295 87} {298 88} {304 89}} + 54 {{14 0 1}} + 55 {{15 0 1}} + 56 {{16 0 1}} + 57 {{17 0 1}} + 58 {{18 0 1}} + 59 {{19 0 1}} + 60 {{20 0 1}} + 61 {{21 0 1}} + 62 {{22 0 1}} + 63 {{23 0 1}} + 64 {{24 0 1}} + 65 {{25 0 1}} + 26,trans {} + 66 {{26 0 1}} + 67 {{27 0 1}} + 45,trans {} + 68 {{28 0 1}} + 64,trans {} + 69 {{29 0 1}} + 70 {{30 0 1}} + 83,trans {} + 71 {{31 0 1}} + 72 {{56 0 1}} + 73 {{57 0 1}} + 74 {{53 0 2}} + 75 {{32 {295 298} 1}} + 76 {{33 {295 298} 1}} + 77 {{34 {295 298} 1}} + 78 {{35 {295 298} 1}} + 79 {{36 {295 298} 1}} + 80 {{37 {295 298} 1}} + 81 {{38 {295 298} 1}} + 82 {{39 {0 295 296 297} 1}} + 25,trans {} + 83 {{40 {0 295 296 297} 1}} + 84 {{52 0 2} {39 {295 296 297} 0} {40 {295 296 297} 0}} + 44,trans {} + 85 {{48 0 2} {50 0 2} {41 0 0} {42 0 0} {43 0 0}} + 63,trans {} + 86 {{49 0 2} {51 0 2} {41 0 0} {42 0 0} {43 0 0}} + 82,trans {} + 87 {{39 {295 296 297} 1}} + 0 {{0 0 0} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 {0 288 289 290 291 292 293 294 295 298} 0} {6 {0 288 289 290 291 292 293 294 295 298} 0} {7 {0 288 289 290 291 292 293 294 295 298} 0} {8 {0 288 289 290 291 292 293 294 295 298} 0} {9 {0 288 289 290 291 292 293 294 295 298} 0} {10 {0 288 289 290 291 292 293 294 295 298} 0} {11 {0 288 289 290 291 292 293 294 295 298} 0} {12 {0 288 289 290 291 292 293 294 295 298} 0} {13 {0 288 289 290 291 292 293 294 295 298} 0} {14 {0 288 289 290 291 292 293 294 295 298} 0} {15 {0 288 289 290 291 292 293 294 295 298} 0} {16 {0 288 289 290 291 292 293 294 295 298} 0} {17 {0 288 289 290 291 292 293 294 295 298} 0} {18 {0 288 289 290 291 292 293 294 295 298} 0} {19 {0 288 289 290 291 292 293 294 295 298} 0} {20 {0 288 289 290 291 292 293 294 295 298} 0} {21 {0 288 289 290 291 292 293 294 295 298} 0} {22 {0 288 289 290 291 292 293 294 295 298} 0} {23 {0 288 289 290 291 292 293 294 295 298} 0} {24 {0 288 289 290 291 292 293 294 295 298} 0} {25 {0 288 289 290 291 292 293 294 295 298} 0} {26 {0 288 289 290 291 292 293 294 295 298} 0} {27 {0 288 289 290 291 292 293 294 295 298} 0} {28 {0 288 289 290 291 292 293 294 295 298} 0} {29 {0 288 289 290 291 292 293 294 295 298} 0} {30 {0 288 289 290 291 292 293 294 295 298} 0} {31 {0 288 289 290 291 292 293 294 295 298} 0} {32 {0 295 298} 0} {33 {0 295 298} 0} {34 {0 295 298} 0} {35 {0 295 298} 0} {36 {0 295 298} 0} {37 {0 295 298} 0} {38 {0 295 298} 0}} + 88 {{40 {295 296 297} 1}} + 1 {{1 0 1}} + 89 {{52 0 3} {41 0 0} {42 0 0} {43 0 0}} + 90 {{41 0 1}} + 2 {{2 0 1}} + 91 {{42 0 1}} + 3 {{3 0 1}} + 92 {{43 0 1}} + 4 {{4 0 1}} + 93 {{50 0 3}} + 5 {{5 {0 288 289 290 291 292 293 294 295 298} 1}} + 94 {{51 0 3}} + 6 {{6 {0 288 289 290 291 292 293 294 295 298} 1}} + 95 {{52 0 4}} + 7 {{7 {0 288 289 290 291 292 293 294 295 298} 1}} + 8 {{8 {0 288 289 290 291 292 293 294 295 298} 1}} + 9 {{9 {0 288 289 290 291 292 293 294 295 298} 1}} + 24,trans {} + 43,trans {{295 82} {298 83} {304 86}} + 62,trans {} + 81,trans {} + 23,trans {} + 42,trans {{288 75} {289 76} {290 77} {291 78} {292 79} {293 80} {294 81} {295 82} {298 83} {303 84} {304 85}} + 61,trans {} + 79,trans {} + 80,trans {} + 9,trans {} + 22,trans {} + 41,trans {} + 59,trans {} + 60,trans {} + 78,trans {} + 8,trans {} + 21,trans {} + 39,trans {{257 1} {258 2} {259 3} {260 4} {261 45} {262 46} {263 47} {264 48} {265 49} {266 50} {267 51} {268 52} {269 53} {270 54} {271 55} {272 56} {273 57} {274 58} {275 59} {276 60} {277 61} {278 62} {279 63} {280 64} {281 65} {282 66} {283 67} {284 68} {285 69} {286 70} {287 71} {301 72} {302 73} {307 74}} + 40,trans {} + 58,trans {} + 77,trans {} + 7,trans {} + 19,trans {} + 20,trans {} + 38,trans {} + 57,trans {} + 76,trans {} + 6,trans {} + 95,trans {} + 18,trans {} + 37,trans {} + 56,trans {} + 75,trans {} + 5,trans {} + 94,trans {} + 17,trans {} + 36,trans {} + 55,trans {} + 74,trans {} + 4,trans {} + 93,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 73,trans {} + 3,trans {} + 92,trans {} + 15,trans {} + 34,trans {} + 53,trans {} + 72,trans {} + 2,trans {} + 91,trans {} + 14,trans {} + 33,trans {} + 52,trans {} + 71,trans {} + 1,trans {} + 89,trans {{295 90} {296 91} {297 92} {305 95}} + 90,trans {} + 13,trans {} + 32,trans {} + 51,trans {} + 69,trans {} + 70,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {299 39} {300 40} {301 41} {302 42} {303 43} {306 44}} + 88,trans {} + 12,trans {} + 31,trans {} + 49,trans {} + 50,trans {} + 68,trans {} + 87,trans {} + 10 {{10 {0 288 289 290 291 292 293 294 295 298} 1}} + 11 {{11 {0 288 289 290 291 292 293 294 295 298} 1}} + 12 {{12 {0 288 289 290 291 292 293 294 295 298} 1}} + 13 {{13 {0 288 289 290 291 292 293 294 295 298} 1}} + 14 {{14 {0 288 289 290 291 292 293 294 295 298} 1}} + 15 {{15 {0 288 289 290 291 292 293 294 295 298} 1}} + 11,trans {} + 16 {{16 {0 288 289 290 291 292 293 294 295 298} 1}} + 29,trans {} + 30,trans {} + 17 {{17 {0 288 289 290 291 292 293 294 295 298} 1}} + 48,trans {} + 18 {{18 {0 288 289 290 291 292 293 294 295 298} 1}} + 67,trans {} + 20 {{20 {0 288 289 290 291 292 293 294 295 298} 1}} + 19 {{19 {0 288 289 290 291 292 293 294 295 298} 1}} + 86,trans {{295 90} {296 91} {297 92} {305 94}} + 21 {{21 {0 288 289 290 291 292 293 294 295 298} 1}} + 22 {{22 {0 288 289 290 291 292 293 294 295 298} 1}} + 23 {{23 {0 288 289 290 291 292 293 294 295 298} 1}} + 24 {{24 {0 288 289 290 291 292 293 294 295 298} 1}} + 25 {{25 {0 288 289 290 291 292 293 294 295 298} 1}} + 26 {{26 {0 288 289 290 291 292 293 294 295 298} 1}} + 27 {{27 {0 288 289 290 291 292 293 294 295 298} 1}} + 28 {{28 {0 288 289 290 291 292 293 294 295 298} 1}} + 30 {{30 {0 288 289 290 291 292 293 294 295 298} 1}} + 29 {{29 {0 288 289 290 291 292 293 294 295 298} 1}} + 31 {{31 {0 288 289 290 291 292 293 294 295 298} 1}} + 32 {{32 {0 295 298} 1}} + 10,trans {} + 33 {{33 {0 295 298} 1}} + 28,trans {} + 34 {{34 {0 295 298} 1}} + 47,trans {} +} + +array set cropsend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 115 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 LOCK_ + 284,title WCSW + 291 J2000_ + 301 coordsys + 292 ICRS_ + 302 wcssys + 288,line 40 + 293 GALACTIC_ + 303 skyframe + 304 skyformat + 294 ECLIPTIC_ + 305 rformat + 295 DEGREES_ + 306 cropsend + 296 ARCMIN_ + 307 3d + 262,t 0 + 297 ARCSEC_ + 308 start' + 285,line 36 + 298 SEXAGESIMAL_ + 299 3D_ + 283,t 0 + 282,line 33 + 264,title WCSC + 283,title WCSV + 278,line 29 + error,line 109 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 272,line 23 + 263,title WCSB + 282,title WCSU + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + 299,title 3D + error,t 0 + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title SEXAGESIMAL + 291,t 0 + 301,t 1 + 307,line 183 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 50 + 278,title WCSQ + 307,title {} + 297,title ARCSEC + 287,t 0 + 304,line 151 + 294,line 46 + 291,line 43 + error,title {} + 301,line 110 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title ARCMIN + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 305,title {} + 295,title DEGREES + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 304,title {} + 294,title ECLIPTIC + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 1 + 273,title WCSL + 292,title ICRS + 302,title {} + 267,t 0 + 299,line 56 + 288,t 0 + 306,line 160 + 296,line 49 + 272,title WCSK + 303,line 143 + 291,title J2000 + 293,line 45 + 301,title {} + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 57 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title LOCK + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 303,t 1 + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 187 + 276 WCSO_ + 298,line 52 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 155 + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc cropsend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ degrees } + 40 { set _ sexagesimal } + 41 { set _ degrees } + 42 { set _ arcmin } + 43 { set _ arcsec } + 44 { ProcessSendCmdCurrent "get crop center physical fk5 degrees physical degrees" } + 45 { ProcessSendCmdCurrent "get crop center $1 fk5 degrees $1 degrees" } + 46 { ProcessSendCmdCurrent "get crop center $1 fk5 degrees $1 degrees" } + 47 { ProcessSendCmdCurrent "get crop center wcs $1 degrees wcs degrees" } + 48 { ProcessSendCmdCurrent "get crop center $1 fk5 $2 $1 degrees" } + 49 { ProcessSendCmdCurrent "get crop center wcs $1 $2 wcs degrees" } + 50 { ProcessSendCmdCurrent "get crop center $1 fk5 $2 $1 $3" } + 51 { ProcessSendCmdCurrent "get crop center wcs $1 $2 wcs $3" } + 52 { ProcessSendCmdCurrent "get crop center $1 $2 $3 $1 $4" } + 54 { ProcessSendCmdGet crop lock } + 55 { ProcessSendCmdCurrent "get crop 3d image" } + 56 { ProcessSendCmdCurrent "get crop 3d $1" } + 57 { ProcessSendCmdCurrent "get crop 3d $1" } + } + 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 cropsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/crosshairlex.tcl b/ds9/parsers/crosshairlex.tcl new file mode 100644 index 0000000..2b90e9a --- /dev/null +++ b/ds9/parsers/crosshairlex.tcl @@ -0,0 +1,786 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval crosshair { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc crosshair::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc crosshair::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc crosshair::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc crosshair::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc crosshair::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc crosshair::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc crosshair::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc crosshair::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc crosshair::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set INT_ 295 +set REAL_ 296 +set SEXSTR_ 297 +set STRING_ 298 +set LOCK_ 299 +set MATCH_ 300 +set NONE_ 301 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $LOCK_ + } + 1 { +return $MATCH_ + } + 2 { +return $NONE_ + } + 3 { +return $IMAGE_ + } + 4 { +return $PHYSICAL_ + } + 5 { +return $AMPLIFIER_ + } + 6 { +return $DETECTOR_ + } + 7 { +return $WCS_ + } + 8 { +return $WCSA_ + } + 9 { +return $WCSB_ + } + 10 { +return $WCSC_ + } + 11 { +return $WCSD_ + } + 12 { +return $WCSE_ + } + 13 { +return $WCSF_ + } + 14 { +return $WCSG_ + } + 15 { +return $WCSH_ + } + 16 { +return $WCSI_ + } + 17 { +return $WCSJ_ + } + 18 { +return $WCSK_ + } + 19 { +return $WCSL_ + } + 20 { +return $WCSM_ + } + 21 { +return $WCSN_ + } + 22 { +return $WCSO_ + } + 23 { +return $WCSP_ + } + 24 { +return $WCSQ_ + } + 25 { +return $WCSR_ + } + 26 { +return $WCSS_ + } + 27 { +return $WCST_ + } + 28 { +return $WCSU_ + } + 29 { +return $WCSV_ + } + 30 { +return $WCSW_ + } + 31 { +return $WCSX_ + } + 32 { +return $WCSY_ + } + 33 { +return $WCSZ_ + } + 34 { +return $FK4_ + } + 35 { +return $FK4_ + } + 36 { +return $FK5_ + } + 37 { +return $FK5_ + } + 38 { +return $ICRS_ + } + 39 { +return $GALACTIC_ + } + 40 { +return $ECLIPTIC_ + } + 41 { +set yylval $yytext; return $INT_ + } + 42 - + 43 { +set yylval $yytext; return $REAL_ + } + 44 - + 45 { +set yylval $yytext; return $SEXSTR_ + } + 46 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 47 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 48 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 49 { +set yylval $yytext; return $STRING_ + } + 50 { +# ignore whitespace + } + 51 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/crosshairparser.tab.tcl b/ds9/parsers/crosshairparser.tab.tcl new file mode 100644 index 0000000..2e12b9a --- /dev/null +++ b/ds9/parsers/crosshairparser.tab.tcl @@ -0,0 +1,45 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set INT_ 295 +set REAL_ 296 +set SEXSTR_ 297 +set STRING_ 298 +set LOCK_ 299 +set MATCH_ 300 +set NONE_ 301 diff --git a/ds9/parsers/crosshairparser.tcl b/ds9/parsers/crosshairparser.tcl new file mode 100644 index 0000000..a3951a1 --- /dev/null +++ b/ds9/parsers/crosshairparser.tcl @@ -0,0 +1,1983 @@ +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 crosshair { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc crosshair::YYABORT {} { + return -code return 1 +} + +proc crosshair::YYACCEPT {} { + return -code return 0 +} + +proc crosshair::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc crosshair::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc crosshair::yyerror {s} { + puts stderr $s +} + +proc crosshair::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 crosshair::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set crosshair::table { + 9:283 shift + 21:289 reduce + 21:290 reduce + 31:294,target 22 + 5:276,target 29 + 9:284 shift + 21:291 reduce + 9:285 shift + 21:292 reduce + 51:298 reduce + 9:286 shift + 21:293 reduce + 9:287 shift + 21:294 reduce + 2:284,target 40 + 9:288 shift + 48:0 reduce + 9:289 shift + 9:290 shift + 9:291 shift + 9:292 shift + 21:298 reduce + 9:303 goto + 9:293 shift + 10:298,target 1 + 55:298,target 37 + 9:304 goto + 9:294 shift + 25:293,target 16 + 1:258,target 39 + 9:298 reduce + 64:0,target 50 + 33:0,target 24 + 19:292,target 10 + 20:292,target 11 + 9:268,target 21 + 5:303,target 46 + 32:294,target 23 + 48:272,target 25 + 21:0 reduce + 14:291,target 5 + 60:291,target 53 + 4:267,target 20 + 11:298,target 2 + 63:0 reduce + 56:298,target 38 + 26:293,target 17 + 1:275,target 39 + 26:288 reduce + 26:289 reduce + 26:290 reduce + 2:258,target 40 + 26:291 reduce + 26:292 reduce + 56:298 reduce + 26:293 reduce + 26:294 reduce + 9:285,target 38 + 21:292,target 12 + 26:298 reduce + 33:294,target 24 + 48:288,target 50 + 61:0,target 49 + 4:284,target 37 + 15:291,target 6 + 29:0,target 20 + 30:0,target 21 + 5:267,target 20 + 35:0 reduce + 1:292,target 39 + 12:298,target 3 + 57:298,target 52 + 27:293,target 18 + 2:275,target 40 + 9:0 reduce + 22:292,target 13 + 32:288 reduce + 32:289 reduce + 32:290 reduce + 34:294,target 25 + 32:291 reduce + 32:292 reduce + 32:293 reduce + 32:294 reduce + 5:284,target 37 + 16:291,target 7 + 32:298 reduce + 48:263,target 16 + 2:292,target 40 + 13:298,target 4 + 58:298,target 53 + 28:293,target 19 + 50:0 reduce + 4:258,target 11 + 57:0,target 52 + 1:266,target 39 + 26:0,target 17 + 23:292,target 14 + 35:294,target 26 + 9:276,target 29 + 17:291,target 8 + 48:280,target 33 + 48:279,target 32 + 14:298,target 5 + 60:298,target 48 + 59:298,target 47 + 37:288 reduce + 22:0 reduce + 29:293,target 20 + 30:293,target 21 + 37:290 reduce + 37:289 reduce + 4:275,target 28 + 37:291 reduce + 37:292 reduce + 0:299,target 4 + 5:258,target 11 + 37:293 reduce + 37:294 reduce + 1:283,target 39 + 64:0 reduce + 57:290,target 52 + 57:289,target 51 + 2:266,target 40 + 37:298 reduce + 24:292,target 15 + 9:303,target 57 + 9:293,target 55 + 36:294,target 27 + 54:0,target 36 + 2:257 reduce + 18:291,target 9 + 23:0,target 14 + 2:258 reduce + 2:260 reduce + 2:259 reduce + 2:261 reduce + 4:302,target 42 + 2:262 reduce + 15:298,target 6 + 61:298,target 49 + 2:263 reduce + 31:293,target 22 + 2:264 reduce + 5:275,target 28 + 2:265 reduce + 2:266 reduce + 36:0 reduce + 2:267 reduce + 2:283,target 40 + 2:268 reduce + 2:270 reduce + 2:269 reduce + 2:271 reduce + 2:272 reduce + 2:273 reduce + 2:274 reduce + 25:292,target 16 + 2:275 reduce + 2:276 reduce + 2:277 reduce + 1:257,target 39 + 2:278 reduce + 37:294,target 28 + 2:280 reduce + 2:279 reduce + 2:281 reduce + 2:282 reduce + 2:283 reduce + 2:284 reduce + 2:285 reduce + 19:291,target 10 + 20:291,target 11 + 48:257 shift + 43:298 reduce + 2:286 reduce + 48:258 shift + 2:287 reduce + 8:0,target 41 + 9:267,target 20 + 48:260 shift + 48:259 shift + 2:288 reduce + 48:261 shift + 2:290 reduce + 2:289 reduce + 5:302,target 45 + 16:298,target 7 + 48:262 shift + 32:293,target 23 + 2:291 reduce + 48:263 shift + 2:292 reduce + 13:298 reduce + 48:264 shift + 2:293 reduce + 51:0,target 33 + 48:271,target 24 + 48:265 shift + 2:294 reduce + 48:266 shift + 2:295 reduce + 48:267 shift + 2:296 reduce + 14:289,target 5 + 14:290,target 5 + 60:290,target 52 + 60:289,target 51 + 48:268 shift + 48:270 shift + 48:269 shift + 2:298 reduce + 4:266,target 19 + 19:0,target 10 + 20:0,target 11 + 51:0 reduce + 48:271 shift + 48:272 shift + 48:273 shift + 26:292,target 17 + 48:274 shift + 1:274,target 39 + 48:275 shift + 48:276 shift + 2:257,target 40 + 48:277 shift + 48:278 shift + 38:294,target 29 + 48:280 shift + 48:279 shift + 48:281 shift + 48:282 shift + 48:283 shift + 48:284 shift + 9:284,target 37 + 21:291,target 12 + 48:285 shift + 48:286 shift + 48:287 shift + 48:288 shift + 17:298,target 8 + 63:298,target 54 + 48:290 shift + 48:289 shift + 33:293,target 24 + 48:291 shift + 48:287,target 40 + 48:292 shift + 48:302 goto + 48:293 shift + 48:303 goto + 48:294 shift + 48:304 goto + 18:288 reduce + 4:283,target 36 + 15:289,target 6 + 15:290,target 6 + 18:289 reduce + 18:290 reduce + 18:291 reduce + 23:0 reduce + 5:266,target 19 + 18:292 reduce + 48:298 reduce + 18:293 reduce + 1:291,target 39 + 18:294 reduce + 27:292,target 18 + 2:274,target 40 + 18:298 reduce + 47:0,target 44 + 40:294,target 31 + 39:294,target 30 + 16:0,target 7 + 22:291,target 13 + 18:298,target 9 + 64:298,target 50 + 34:293,target 25 + 4:309,target 44 + 5:283,target 36 + 16:289,target 7 + 16:290,target 7 + 48:262,target 15 + 2:291,target 40 + 37:0 reduce + 28:292,target 19 + 4:257,target 10 + 24:288 reduce + 1:265,target 39 + 24:289 reduce + 24:290 reduce + 24:291 reduce + 24:292 reduce + 54:298 reduce + 23:291,target 14 + 24:293 reduce + 2:0,target 40 + 24:294 reduce + 19:298,target 10 + 20:298,target 11 + 35:293,target 26 + 24:298 reduce + 9:275,target 28 + 44:0,target 45 + 5:310,target 47 + 17:289,target 8 + 17:290,target 8 + 13:0,target 4 + 48:278,target 31 + 10:0 reduce + 29:292,target 20 + 30:292,target 21 + 4:274,target 27 + 0:308,target 8 + 5:257,target 10 + 52:0 reduce + 1:282,target 39 + 57:288,target 50 + 2:265,target 40 + 24:291,target 15 + 60:288 shift + 60:290 shift + 60:289 shift + 9:292,target 54 + 21:298,target 12 + 60:291 shift + 36:293,target 27 + 60:292 shift + 60:293 shift + 60:294 shift + 60:304 goto + 29:288 reduce + 30:288 reduce + 29:289 reduce + 29:290 reduce + 30:289 reduce + 30:290 reduce + 18:289,target 9 + 18:290,target 9 + 29:291 reduce + 30:291 reduce + 29:292 reduce + 30:292 reduce + 60:298 reduce + 59:298 reduce + 29:293 reduce + 30:293 reduce + 29:294 reduce + 30:294 reduce + 4:301,target 41 + 31:292,target 22 + 5:274,target 27 + 24:0 reduce + 29:298 reduce + 30:298 reduce + 1:298,target 39 + 41:0,target 57 + 2:282,target 40 + 10:0,target 1 + 25:291,target 16 + 22:298,target 13 + 37:293,target 28 + 19:289,target 10 + 19:290,target 10 + 20:289,target 11 + 20:290,target 11 + 9:266,target 19 + 32:292,target 23 + 48:270,target 23 + 48:269,target 22 + 2:298,target 40 + 35:288 reduce + 14:288,target 5 + 60:288,target 50 + 38:0 reduce + 35:290 reduce + 35:289 reduce + 35:291 reduce + 4:265,target 18 + 35:292 reduce + 35:293 reduce + 0:300,target 5 + 35:294 reduce + 26:291,target 17 + 1:273,target 39 + 35:298 reduce + 23:298,target 14 + 38:293,target 29 + 37:0,target 28 + 9:283,target 36 + 21:289,target 12 + 21:290,target 12 + 33:292,target 24 + 48:286,target 39 + 11:0 reduce + 4:282,target 35 + 15:288,target 6 + 5:265,target 18 + 1:290,target 39 + 1:289,target 39 + 53:0 reduce + 27:291,target 18 + 2:273,target 40 + 24:298,target 15 + 40:293,target 31 + 39:293,target 30 + 22:289,target 13 + 22:290,target 13 + 34:292,target 25 + 41:298 reduce + 34:0,target 25 + 0:300 shift + 5:282,target 35 + 16:288,target 7 + 11:298 reduce + 25:0 reduce + 48:261,target 14 + 2:290,target 40 + 2:289,target 40 + 0:305 goto + 0:295 shift + 0:306 goto + 0:296 shift + 28:291,target 19 + 0:297 shift + 0:308 goto + 5:257 shift + 0:299 shift + 5:258 shift + 5:259 shift + 5:260 shift + 25:298,target 16 + 5:261 shift + 5:262 shift + 1:264,target 39 + 5:263 shift + 5:264 shift + 5:265 shift + 5:266 shift + 23:289,target 14 + 23:290,target 14 + 5:267 shift + 5:268 shift + 5:269 shift + 5:270 shift + 5:271 shift + 35:292,target 26 + 5:272 shift + 5:273 shift + 9:274,target 27 + 5:274 shift + 5:275 shift + 5:276 shift + 5:277 shift + 17:288,target 8 + 5:278 shift + 48:277,target 30 + 5:279 shift + 5:280 shift + 5:281 shift + 5:282 shift + 16:288 reduce + 5:283 shift + 16:289 reduce + 16:290 reduce + 29:291,target 20 + 30:291,target 21 + 62:0,target 43 + 4:273,target 26 + 5:284 shift + 16:291 reduce + 40:0 reduce + 39:0 reduce + 5:285 shift + 16:292 reduce + 46:298 reduce + 0:297,target 3 + 5:286 shift + 16:293 reduce + 5:287 shift + 16:294 reduce + 26:298,target 17 + 1:281,target 39 + 31:0,target 22 + 2:264,target 40 + 5:302 goto + 16:298 reduce + 5:303 goto + 24:289,target 15 + 24:290,target 15 + 9:291,target 53 + 36:292,target 27 + 5:310 goto + 48:294,target 56 + 48:304,target 61 + 18:288,target 9 + 12:0 reduce + 31:291,target 22 + 5:273,target 26 + 27:298,target 18 + 2:281,target 40 + 54:0 reduce + 25:289,target 16 + 25:290,target 16 + 22:288 reduce + 22:289 reduce + 22:290 reduce + 58:0,target 53 + 22:291 reduce + 22:292 reduce + 52:298 reduce + 37:292,target 28 + 22:293 reduce + 22:294 reduce + 27:0,target 18 + 19:288,target 10 + 20:288,target 11 + 22:298 reduce + 9:265,target 18 + 32:291,target 23 + 48:268,target 21 + 26:0 reduce + 28:298,target 19 + 4:264,target 17 + 26:289,target 17 + 26:290,target 17 + 1:272,target 39 + 1:0 reduce + 38:292,target 29 + 57:288 shift + 8:298,target 42 + 57:290 shift + 57:289 shift + 57:291 shift + 9:282,target 35 + 21:288,target 12 + 57:292 shift + 57:293 shift + 57:294 shift + 57:304 goto + 27:288 reduce + 27:289 reduce + 27:290 reduce + 55:0,target 37 + 33:291,target 24 + 27:291 reduce + 48:285,target 38 + 27:292 reduce + 57:298 reduce + 27:293 reduce + 3:297,target 9 + 27:294 reduce + 24:0,target 15 + 29:298,target 20 + 30:298,target 21 + 4:281,target 34 + 5:264,target 17 + 27:298 reduce + 41:0 reduce + 1:288,target 39 + 27:289,target 18 + 27:290,target 18 + 2:272,target 40 + 40:292,target 31 + 39:292,target 30 + 9:298,target 51 + 22:288,target 13 + 34:291,target 25 + 31:298,target 22 + 5:281,target 34 + 9:0,target 51 + 13:0 reduce + 48:260,target 13 + 48:259,target 12 + 2:288,target 40 + 33:288 reduce + 28:289,target 19 + 28:290,target 19 + 33:290 reduce + 33:289 reduce + 55:0 reduce + 52:0,target 34 + 33:291 reduce + 33:292 reduce + 63:298 reduce + 33:293 reduce + 33:294 reduce + 21:0,target 12 + 1:263,target 39 + 33:298 reduce + 23:288,target 14 + 35:291,target 26 + 9:273,target 26 + 32:298,target 23 + 48:276,target 29 + 27:0 reduce + 29:289,target 20 + 29:290,target 20 + 30:289,target 21 + 30:290,target 21 + 4:272,target 25 + 0:306,target 7 + 0:296,target 2 + 1:280,target 39 + 1:279,target 39 + 2:263,target 40 + 2:0 reduce + 24:288,target 15 + 38:288 reduce + 38:290 reduce + 38:289 reduce + 48:0,target 46 + 38:291 reduce + 9:289,target 51 + 9:290,target 52 + 38:292 reduce + 36:291,target 27 + 38:293 reduce + 38:294 reduce + 17:0,target 8 + 33:298,target 24 + 48:293,target 55 + 48:303,target 60 + 38:298 reduce + 31:289,target 22 + 31:290,target 22 + 5:272,target 25 + 1:296,target 39 + 42:0 reduce + 2:280,target 40 + 2:279,target 40 + 25:288,target 16 + 37:291,target 28 + 34:298,target 25 + 9:264,target 17 + 32:289,target 23 + 32:290,target 23 + 45:0,target 58 + 14:0 reduce + 48:267,target 20 + 2:296,target 40 + 14:288 reduce + 14:0,target 5 + 14:289 reduce + 14:290 reduce + 14:291 reduce + 4:263,target 16 + 14:292 reduce + 56:0 reduce + 44:298 reduce + 14:293 reduce + 14:294 reduce + 26:288,target 17 + 1:271,target 39 + 14:298 reduce + 38:291,target 29 + 3:297 shift + 8:307,target 49 + 35:298,target 26 + 9:281,target 34 + 33:290,target 24 + 33:289,target 24 + 48:284,target 37 + 4:279,target 32 + 4:280,target 33 + 28:0 reduce + 5:263,target 16 + 1:287,target 39 + 57:294,target 56 + 57:304,target 63 + 27:288,target 18 + 2:271,target 40 + 42:0,target 55 + 40:291,target 31 + 39:291,target 30 + 19:288 reduce + 20:288 reduce + 11:0,target 2 + 19:289 reduce + 19:290 reduce + 20:289 reduce + 20:290 reduce + 19:291 reduce + 20:291 reduce + 36:298,target 27 + 19:292 reduce + 20:292 reduce + 50:298 reduce + 49:298 shift + 19:293 reduce + 20:293 reduce + 19:294 reduce + 20:294 reduce + 34:290,target 25 + 34:289,target 25 + 19:298 reduce + 20:298 reduce + 5:279,target 32 + 5:280,target 33 + 8:307 goto + 8:298 reduce + 48:258,target 11 + 2:287,target 40 + 43:0 reduce + 28:288,target 19 + 1:262,target 39 + 37:298,target 28 + 38:0,target 29 + 35:290,target 26 + 35:289,target 26 + 9:272,target 25 + 25:288 reduce + 25:289 reduce + 25:290 reduce + 25:291 reduce + 25:292 reduce + 55:298 reduce + 48:275,target 28 + 25:293 reduce + 15:0 reduce + 25:294 reduce + 14:294,target 5 + 60:294,target 56 + 60:304,target 64 + 29:288,target 20 + 30:288,target 21 + 4:271,target 24 + 25:298 reduce + 0:305,target 6 + 0:295,target 1 + 57:0 reduce + 1:278,target 39 + 2:262,target 40 + 38:298,target 29 + 9:288,target 50 + 36:290,target 27 + 36:289,target 27 + 6:296,target 2 + 48:292,target 54 + 48:302,target 59 + 4:287,target 40 + 15:294,target 6 + 31:288,target 22 + 5:271,target 24 + 35:0,target 26 + 29:0 reduce + 30:0 reduce + 1:295,target 39 + 2:278,target 40 + 31:288 reduce + 31:289 reduce + 31:290 reduce + 31:291 reduce + 31:292 reduce + 61:298 reduce + 40:298,target 31 + 39:298,target 30 + 31:293 reduce + 31:294 reduce + 31:298 reduce + 37:290,target 28 + 37:289,target 28 + 9:263,target 16 + 5:287,target 40 + 16:294,target 7 + 32:288,target 23 + 48:266,target 19 + 2:295,target 40 + 44:0 reduce + 4:262,target 15 + 41:298,target 57 + 63:0,target 54 + 1:269,target 39 + 1:270,target 39 + 32:0,target 23 + 38:290,target 29 + 38:289,target 29 + 36:288 reduce + 36:290 reduce + 36:289 reduce + 36:291 reduce + 36:292 reduce + 9:279,target 32 + 9:280,target 33 + 36:293 reduce + 36:294 reduce + 17:294,target 8 + 33:288,target 24 + 48:283,target 36 + 36:298 reduce + 16:0 reduce + 4:278,target 31 + 5:262,target 15 + 42:298,target 55 + 1:286,target 39 + 58:0 reduce + 57:293,target 55 + 2:270,target 40 + 2:269,target 40 + 1:257 reduce + 1:258 reduce + 1:259 reduce + 1:260 reduce + 40:290,target 31 + 40:289,target 31 + 39:290,target 30 + 39:289,target 30 + 1:261 reduce + 1:262 reduce + 1:263 reduce + 1:264 reduce + 1:265 reduce + 1:266 reduce + 1:267 reduce + 60:0,target 48 + 59:0,target 47 + 1:268 reduce + 1:269 reduce + 1:270 reduce + 1:271 reduce + 18:294,target 9 + 34:288,target 25 + 1:272 reduce + 1:273 reduce + 28:0,target 19 + 1:274 reduce + 1:275 reduce + 1:276 reduce + 1:277 reduce + 5:278,target 31 + 1:278 reduce + 1:280 reduce + 1:279 reduce + 1:281 reduce + 31:0 reduce + 48:257,target 10 + 43:298,target 56 + 2:286,target 40 + 1:282 reduce + 1:283 reduce + 1:284 reduce + 1:285 reduce + 42:298 reduce + 1:286 reduce + 1:287 reduce + 1:288 reduce + 1:290 reduce + 1:289 reduce + 1:291 reduce + 1:261,target 39 + 1:292 reduce + 12:298 reduce + 1:293 reduce + 1:294 reduce + 1:295 reduce + 1:296 reduce + 1:298 reduce + 19:294,target 10 + 20:294,target 11 + 35:288,target 26 + 9:271,target 24 + 48:274,target 27 + 56:0,target 38 + 44:298,target 45 + 14:293,target 5 + 60:293,target 55 + 4:269,target 22 + 4:270,target 23 + 45:0 reduce + 25:0,target 16 + 1:277,target 39 + 2:261,target 40 + 17:288 reduce + 17:289 reduce + 17:290 reduce + 17:291 reduce + 9:287,target 40 + 17:292 reduce + 21:294,target 12 + 47:298 reduce + 36:288,target 27 + 17:293 reduce + 17:294 reduce + 6:305,target 48 + 6:295,target 1 + 48:291,target 53 + 17:298 reduce + 6:305 goto + 6:295 shift + 45:298,target 58 + 4:286,target 39 + 6:296 shift + 15:293,target 6 + 17:0 reduce + 5:269,target 22 + 5:270,target 23 + 1:294,target 39 + 2:277,target 40 + 60:0 reduce + 59:0 reduce + 53:0,target 35 + 22:294,target 13 + 37:288,target 28 + 22:0,target 13 + 9:262,target 15 + 23:288 reduce + 46:298,target 59 + 5:286,target 39 + 16:293,target 7 + 23:289 reduce + 23:290 reduce + 23:291 reduce + 23:292 reduce + 53:298 reduce + 23:293 reduce + 48:265,target 18 + 2:294,target 40 + 23:294 reduce + 32:0 reduce + 4:261,target 14 + 23:298 reduce + 1:268,target 39 + 23:294,target 14 + 38:288,target 29 + 7:0,target 0 + 9:278,target 31 + 50:0,target 32 + 47:298,target 44 + 17:293,target 8 + 48:282,target 35 + 18:0,target 9 + 4:277,target 30 + 5:261,target 14 + 46:0 reduce + 1:285,target 39 + 57:292,target 54 + 28:288 reduce + 2:268,target 40 + 28:289 reduce + 28:290 reduce + 28:291 reduce + 28:292 reduce + 58:298 reduce + 24:294,target 15 + 28:293 reduce + 40:288,target 31 + 39:288,target 30 + 28:294 reduce + 28:298 reduce + 48:298,target 46 + 18:293,target 9 + 5:277,target 30 + 18:0 reduce + 2:285,target 40 + 46:0,target 59 + 61:0 reduce + 15:0,target 6 + 25:294,target 16 + 1:259,target 39 + 1:260,target 39 + 34:288 reduce + 34:290 reduce + 34:289 reduce + 50:298,target 32 + 49:298,target 62 + 34:291 reduce + 19:293,target 10 + 20:293,target 11 + 34:292 reduce + 64:298 reduce + 34:293 reduce + 9:269,target 22 + 9:270,target 23 + 34:294 reduce + 34:298 reduce + 48:273,target 26 + 14:292,target 5 + 60:292,target 54 + 33:0 reduce + 4:268,target 21 + 26:294,target 17 + 1:276,target 39 + 1:0,target 39 + 2:260,target 40 + 2:259,target 40 + 7:0 accept + 43:0,target 56 + 51:298,target 33 + 9:286,target 39 + 21:293,target 12 + 12:0,target 3 + 48:290,target 52 + 48:289,target 51 + 40:288 reduce + 39:288 reduce + 4:285,target 38 + 15:292,target 6 + 40:290 reduce + 40:289 reduce + 39:290 reduce + 39:289 reduce + 40:291 reduce + 39:291 reduce + 5:268,target 21 + 40:292 reduce + 39:292 reduce + 40:293 reduce + 39:293 reduce + 1:293,target 39 + 47:0 reduce + 40:294 reduce + 39:294 reduce + 27:294,target 18 + 2:276,target 40 + 40:298 reduce + 39:298 reduce + 10:298 reduce + 52:298,target 34 + 22:293,target 13 + 4:257 shift + 4:258 shift + 4:259 shift + 4:260 shift + 4:261 shift + 9:261,target 14 + 4:262 shift + 40:0,target 31 + 39:0,target 30 + 4:263 shift + 5:285,target 38 + 16:292,target 7 + 4:264 shift + 4:265 shift + 4:266 shift + 19:0 reduce + 20:0 reduce + 48:264,target 17 + 2:293,target 40 + 4:267 shift + 4:268 shift + 28:294,target 19 + 4:269 shift + 4:270 shift + 4:271 shift + 4:259,target 12 + 4:260,target 13 + 4:272 shift + 62:0 reduce + 4:273 shift + 4:274 shift + 4:275 shift + 1:267,target 39 + 4:276 shift + 4:277 shift + 4:278 shift + 53:298,target 35 + 4:279 shift + 4:280 shift + 23:293,target 14 + 4:281 shift + 4:282 shift + 15:288 reduce + 4:283 shift + 15:289 reduce + 15:290 reduce + 4:284 shift + 15:291 reduce + 4:285 shift + 15:292 reduce + 45:298 reduce + 4:286 shift + 9:277,target 30 + 15:293 reduce + 4:287 shift + 15:294 reduce + 4:301 shift + 17:292,target 8 + 4:302 goto + 15:298 reduce + 48:281,target 34 + 4:303 goto + 29:294,target 20 + 30:294,target 21 + 4:276,target 29 + 34:0 reduce + 4:309 goto + 5:259,target 12 + 5:260,target 13 + 1:284,target 39 + 9:261 shift + 57:291,target 53 + 9:262 shift + 36:0,target 27 + 2:267,target 40 + 9:263 shift + 9:264 shift + 9:265 shift + 54:298,target 36 + 9:266 shift + 24:293,target 15 + 8:0 reduce + 9:267 shift + 9:268 shift + 9:269 shift + 9:270 shift + 9:304,target 58 + 9:271 shift + 9:294,target 56 + 9:272 shift + 9:273 shift + 9:274 shift + 9:275 shift + 9:276 shift + 9:277 shift + 18:292,target 9 + 9:278 shift + 9:279 shift + 9:280 shift + 9:281 shift + 4:303,target 43 + 9:282 shift + 21:288 reduce +} + +array set crosshair::rules { + 9,l 303 + 11,l 303 + 32,l 304 + 53,l 308 + 6,l 303 + 28,l 303 + 50,l 308 + 49,l 308 + 3,l 302 + 25,l 303 + 46,l 308 + 0,l 311 + 22,l 303 + 43,l 306 + 18,l 303 + 40,l 305 + 39,l 305 + 15,l 303 + 36,l 304 + 57,l 309 + 12,l 303 + 33,l 304 + 54,l 308 + 7,l 303 + 29,l 303 + 30,l 303 + 51,l 308 + 4,l 302 + 26,l 303 + 47,l 308 + 1,l 302 + 23,l 303 + 44,l 308 + 19,l 303 + 20,l 303 + 41,l 306 + 16,l 303 + 37,l 304 + 58,l 310 + 13,l 303 + 34,l 304 + 55,l 309 + 8,l 303 + 10,l 303 + 31,l 303 + 52,l 308 + 5,l 303 + 27,l 303 + 48,l 308 + 2,l 302 + 24,l 303 + 45,l 308 + 21,l 303 + 42,l 307 + 17,l 303 + 38,l 304 + 59,l 310 + 14,l 303 + 35,l 304 + 56,l 309 +} + +array set crosshair::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 3 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 4 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 3 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 59,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 3 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 3 + 57,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 4 + 49,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 0 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 3 +} + +array set crosshair::rules { + 41,line 153 + 7,line 115 + 37,line 146 + 4,line 111 + 34,line 143 + 1,line 108 + 31,line 139 + 27,line 135 + 24,line 132 + 21,line 129 + 17,line 125 + 14,line 122 + 11,line 119 + 59,line 176 + 56,line 171 + 53,line 166 + 50,line 163 + 49,line 162 + 46,line 159 + 43,line 154 + 9,line 117 + 40,line 150 + 39,line 149 + 6,line 114 + 36,line 145 + 3,line 110 + 33,line 142 + 29,line 137 + 30,line 138 + 26,line 134 + 23,line 131 + 19,line 127 + 20,line 128 + 16,line 124 + 13,line 121 + 10,line 118 + 58,line 175 + 55,line 170 + 52,line 165 + 48,line 161 + 45,line 158 + 42,line 153 + 8,line 116 + 38,line 147 + 5,line 113 + 35,line 144 + 2,line 109 + 32,line 141 + 28,line 136 + 25,line 133 + 22,line 130 + 18,line 126 + 15,line 123 + 42,e 1 + 12,line 120 + 57,line 172 + 54,line 167 + 51,line 164 + 47,line 160 + 44,line 157 +} + +array set crosshair::lr1_table { + 66,trans {} + 35 {{26 {0 298} 1}} + 85,trans {} + 14,trans {} + 36 {{27 {0 298} 1}} + 33,trans {} + 37 {{28 {0 298} 1}} + 52,trans {} + 38 {{29 {0 298} 1}} + 71,trans {} + 39 {{30 {0 298} 1}} + 40 {{31 {0 298} 1}} + 90,trans {} + 89,trans {{288 79} {289 80} {290 81} {291 82} {292 83} {293 84} {294 85} {304 93}} + 18,trans {} + 1,trans {} + 41 {{57 {0 298} 1}} + 37,trans {} + 42 {{55 {0 298} 1}} + 56,trans {} + 43 {{56 {0 298} 1}} + 75,trans {} + 44 {{45 {0 298} 2}} + 23,trans {} + 5,trans {{257 10} {258 11} {259 12} {260 13} {261 14} {262 15} {263 16} {264 17} {265 18} {266 19} {267 20} {268 21} {269 22} {270 23} {271 24} {272 25} {273 26} {274 27} {275 28} {276 29} {277 30} {278 31} {279 32} {280 33} {281 34} {282 35} {283 36} {284 37} {285 38} {286 39} {287 40} {302 45} {303 46} {310 47}} + 45 {{58 {0 298} 1}} + 42,trans {} + 46 {{59 {0 298} 1}} + 61,trans {} + 47 {{44 {0 298} 2}} + 80,trans {} + 79,trans {} + 48 {{39 {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 285 286 287 288 289 290 291 292 293 294 298} 1}} + 27,trans {} + 9,trans {{261 52} {262 53} {263 54} {264 55} {265 56} {266 57} {267 58} {268 59} {269 60} {270 61} {271 62} {272 63} {273 64} {274 65} {275 66} {276 67} {277 68} {278 69} {279 70} {280 71} {281 72} {282 73} {283 74} {284 75} {285 76} {286 77} {287 78} {288 79} {289 80} {290 81} {291 82} {292 83} {293 84} {294 85} {303 86} {304 87}} + 50 {{46 {0 298} 2} {47 {0 298} 2} {48 {0 298} 2} {49 {0 298} 2} {50 {0 298} 2} {1 {0 298} 0} {2 {0 298} 0} {3 {0 298} 0} {4 {0 298} 0} {5 {0 288 289 290 291 292 293 294 298} 0} {6 {0 288 289 290 291 292 293 294 298} 0} {7 {0 288 289 290 291 292 293 294 298} 0} {8 {0 288 289 290 291 292 293 294 298} 0} {9 {0 288 289 290 291 292 293 294 298} 0} {10 {0 288 289 290 291 292 293 294 298} 0} {11 {0 288 289 290 291 292 293 294 298} 0} {12 {0 288 289 290 291 292 293 294 298} 0} {13 {0 288 289 290 291 292 293 294 298} 0} {14 {0 288 289 290 291 292 293 294 298} 0} {15 {0 288 289 290 291 292 293 294 298} 0} {16 {0 288 289 290 291 292 293 294 298} 0} {17 {0 288 289 290 291 292 293 294 298} 0} {18 {0 288 289 290 291 292 293 294 298} 0} {19 {0 288 289 290 291 292 293 294 298} 0} {20 {0 288 289 290 291 292 293 294 298} 0} {21 {0 288 289 290 291 292 293 294 298} 0} {22 {0 288 289 290 291 292 293 294 298} 0} {23 {0 288 289 290 291 292 293 294 298} 0} {24 {0 288 289 290 291 292 293 294 298} 0} {25 {0 288 289 290 291 292 293 294 298} 0} {26 {0 288 289 290 291 292 293 294 298} 0} {27 {0 288 289 290 291 292 293 294 298} 0} {28 {0 288 289 290 291 292 293 294 298} 0} {29 {0 288 289 290 291 292 293 294 298} 0} {30 {0 288 289 290 291 292 293 294 298} 0} {31 {0 288 289 290 291 292 293 294 298} 0} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0} {35 {0 298} 0} {36 {0 298} 0} {37 {0 298} 0} {38 {0 298} 0}} + 49 {{40 {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 285 286 287 288 289 290 291 292 293 294 298} 1}} + 46,trans {} + 51 {{43 0 2}} + 65,trans {} + 52 {{5 {0 288 289 290 291 292 293 294 298} 1}} + 84,trans {} + 13,trans {} + 53 {{6 {0 288 289 290 291 292 293 294 298} 1}} + 32,trans {} + 54 {{7 {0 288 289 290 291 292 293 294 298} 1}} + 51,trans {{298 91}} + 55 {{8 {0 288 289 290 291 292 293 294 298} 1}} + 70,trans {} + 69,trans {} + 56 {{9 {0 288 289 290 291 292 293 294 298} 1}} + 88,trans {} + 17,trans {} + 57 {{10 {0 288 289 290 291 292 293 294 298} 1}} + 0,trans {{295 1} {296 2} {297 3} {299 4} {300 5} {305 6} {306 7} {308 8}} + 36,trans {} + 58 {{11 {0 288 289 290 291 292 293 294 298} 1}} + 55,trans {} + 60 {{13 {0 288 289 290 291 292 293 294 298} 1}} + 59 {{12 {0 288 289 290 291 292 293 294 298} 1}} + 74,trans {} + 61 {{14 {0 288 289 290 291 292 293 294 298} 1}} + 93,trans {} + 22,trans {} + 62 {{15 {0 288 289 290 291 292 293 294 298} 1}} + 4,trans {{257 10} {258 11} {259 12} {260 13} {261 14} {262 15} {263 16} {264 17} {265 18} {266 19} {267 20} {268 21} {269 22} {270 23} {271 24} {272 25} {273 26} {274 27} {275 28} {276 29} {277 30} {278 31} {279 32} {280 33} {281 34} {282 35} {283 36} {284 37} {285 38} {286 39} {287 40} {301 41} {302 42} {303 43} {309 44}} + 41,trans {} + 63 {{16 {0 288 289 290 291 292 293 294 298} 1}} + 60,trans {} + 59,trans {} + 64 {{17 {0 288 289 290 291 292 293 294 298} 1}} + 78,trans {} + 65 {{18 {0 288 289 290 291 292 293 294 298} 1}} + 26,trans {} + 66 {{19 {0 288 289 290 291 292 293 294 298} 1}} + 8,trans {{307 51}} + 45,trans {} + 67 {{20 {0 288 289 290 291 292 293 294 298} 1}} + 64,trans {} + 68 {{21 {0 288 289 290 291 292 293 294 298} 1}} + 83,trans {} + 12,trans {} + 70 {{23 {0 288 289 290 291 292 293 294 298} 1}} + 69 {{22 {0 288 289 290 291 292 293 294 298} 1}} + 31,trans {} + 71 {{24 {0 288 289 290 291 292 293 294 298} 1}} + 50,trans {{257 10} {258 11} {259 12} {260 13} {261 52} {262 53} {263 54} {264 55} {265 56} {266 57} {267 58} {268 59} {269 60} {270 61} {271 62} {272 63} {273 64} {274 65} {275 66} {276 67} {277 68} {278 69} {279 70} {280 71} {281 72} {282 73} {283 74} {284 75} {285 76} {286 77} {287 78} {288 79} {289 80} {290 81} {291 82} {292 83} {293 84} {294 85} {302 88} {303 89} {304 90}} + 49,trans {} + 72 {{25 {0 288 289 290 291 292 293 294 298} 1}} + 68,trans {} + 73 {{26 {0 288 289 290 291 292 293 294 298} 1}} + 87,trans {} + 16,trans {} + 74 {{27 {0 288 289 290 291 292 293 294 298} 1}} + 35,trans {} + 75 {{28 {0 288 289 290 291 292 293 294 298} 1}} + 54,trans {} + 76 {{29 {0 288 289 290 291 292 293 294 298} 1}} + 73,trans {} + 77 {{30 {0 288 289 290 291 292 293 294 298} 1}} + 92,trans {} + 21,trans {} + 78 {{31 {0 288 289 290 291 292 293 294 298} 1}} + 3,trans {{297 9}} + 40,trans {} + 39,trans {} + 80 {{33 {0 298} 1}} + 79 {{32 {0 298} 1}} + 58,trans {} + 81 {{34 {0 298} 1}} + 10 {{1 {0 298} 1}} + 77,trans {} + 82 {{35 {0 298} 1}} + 11 {{2 {0 298} 1}} + 25,trans {} + 83 {{36 {0 298} 1}} + 7,trans {} + 12 {{3 {0 298} 1}} + 44,trans {} + 84 {{37 {0 298} 1}} + 13 {{4 {0 298} 1}} + 63,trans {} + 85 {{38 {0 298} 1}} + 14 {{5 {0 298} 1}} + 82,trans {} + 11,trans {} + 86 {{52 {0 298} 3} {54 {0 298} 3} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0} {35 {0 298} 0} {36 {0 298} 0} {37 {0 298} 0} {38 {0 298} 0}} + 15 {{6 {0 298} 1}} + 30,trans {} + 29,trans {} + 87 {{53 {0 298} 3}} + 16 {{7 {0 298} 1}} + 88 {{47 {0 298} 3}} + 48,trans {} + 0 {{0 0 0} {41 0 0} {43 0 0} {44 {0 298} 0} {45 {0 298} 0} {46 {0 298} 0} {47 {0 298} 0} {48 {0 298} 0} {49 {0 298} 0} {50 {0 298} 0} {51 {0 298} 0} {52 {0 298} 0} {53 {0 298} 0} {54 {0 298} 0} {39 {295 296} 0} {40 {295 296} 0}} + 17 {{8 {0 298} 1}} + 67,trans {} + 90 {{49 {0 298} 3}} + 89 {{48 {0 298} 3} {50 {0 298} 3} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0} {35 {0 298} 0} {36 {0 298} 0} {37 {0 298} 0} {38 {0 298} 0}} + 1 {{39 {295 296} 1}} + 18 {{9 {0 298} 1}} + 86,trans {{288 79} {289 80} {290 81} {291 82} {292 83} {293 84} {294 85} {304 92}} + 91 {{43 0 3}} + 15,trans {} + 2 {{40 {295 296} 1}} + 19 {{10 {0 298} 1}} + 20 {{11 {0 298} 1}} + 92 {{54 {0 298} 4}} + 34,trans {} + 3 {{51 {0 298} 1} {52 {0 298} 1} {53 {0 298} 1} {54 {0 298} 1}} + 21 {{12 {0 298} 1}} + 93 {{50 {0 298} 4}} + 53,trans {} + 4 {{45 {0 298} 1} {55 {0 298} 0} {56 {0 298} 0} {57 {0 298} 0} {1 {0 298} 0} {2 {0 298} 0} {3 {0 298} 0} {4 {0 298} 0} {5 {0 298} 0} {6 {0 298} 0} {7 {0 298} 0} {8 {0 298} 0} {9 {0 298} 0} {10 {0 298} 0} {11 {0 298} 0} {12 {0 298} 0} {13 {0 298} 0} {14 {0 298} 0} {15 {0 298} 0} {16 {0 298} 0} {17 {0 298} 0} {18 {0 298} 0} {19 {0 298} 0} {20 {0 298} 0} {21 {0 298} 0} {22 {0 298} 0} {23 {0 298} 0} {24 {0 298} 0} {25 {0 298} 0} {26 {0 298} 0} {27 {0 298} 0} {28 {0 298} 0} {29 {0 298} 0} {30 {0 298} 0} {31 {0 298} 0}} + 22 {{13 {0 298} 1}} + 72,trans {} + 5 {{44 {0 298} 1} {58 {0 298} 0} {59 {0 298} 0} {1 {0 298} 0} {2 {0 298} 0} {3 {0 298} 0} {4 {0 298} 0} {5 {0 298} 0} {6 {0 298} 0} {7 {0 298} 0} {8 {0 298} 0} {9 {0 298} 0} {10 {0 298} 0} {11 {0 298} 0} {12 {0 298} 0} {13 {0 298} 0} {14 {0 298} 0} {15 {0 298} 0} {16 {0 298} 0} {17 {0 298} 0} {18 {0 298} 0} {19 {0 298} 0} {20 {0 298} 0} {21 {0 298} 0} {22 {0 298} 0} {23 {0 298} 0} {24 {0 298} 0} {25 {0 298} 0} {26 {0 298} 0} {27 {0 298} 0} {28 {0 298} 0} {29 {0 298} 0} {30 {0 298} 0} {31 {0 298} 0}} + 23 {{14 {0 298} 1}} + 91,trans {} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{46 {0 298} 1} {47 {0 298} 1} {48 {0 298} 1} {49 {0 298} 1} {50 {0 298} 1} {39 {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 285 286 287 288 289 290 291 292 293 294 298} 0} {40 {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 285 286 287 288 289 290 291 292 293 294 298} 0}} + 24 {{15 {0 298} 1}} + 38,trans {} + 7 {{0 0 1}} + 25 {{16 {0 298} 1}} + 57,trans {} + 8 {{41 0 1} {43 0 1} {42 298 0}} + 26 {{17 {0 298} 1}} + 76,trans {} + 9 {{51 {0 298} 2} {52 {0 298} 2} {53 {0 298} 2} {54 {0 298} 2} {5 {0 288 289 290 291 292 293 294 298} 0} {6 {0 288 289 290 291 292 293 294 298} 0} {7 {0 288 289 290 291 292 293 294 298} 0} {8 {0 288 289 290 291 292 293 294 298} 0} {9 {0 288 289 290 291 292 293 294 298} 0} {10 {0 288 289 290 291 292 293 294 298} 0} {11 {0 288 289 290 291 292 293 294 298} 0} {12 {0 288 289 290 291 292 293 294 298} 0} {13 {0 288 289 290 291 292 293 294 298} 0} {14 {0 288 289 290 291 292 293 294 298} 0} {15 {0 288 289 290 291 292 293 294 298} 0} {16 {0 288 289 290 291 292 293 294 298} 0} {17 {0 288 289 290 291 292 293 294 298} 0} {18 {0 288 289 290 291 292 293 294 298} 0} {19 {0 288 289 290 291 292 293 294 298} 0} {20 {0 288 289 290 291 292 293 294 298} 0} {21 {0 288 289 290 291 292 293 294 298} 0} {22 {0 288 289 290 291 292 293 294 298} 0} {23 {0 288 289 290 291 292 293 294 298} 0} {24 {0 288 289 290 291 292 293 294 298} 0} {25 {0 288 289 290 291 292 293 294 298} 0} {26 {0 288 289 290 291 292 293 294 298} 0} {27 {0 288 289 290 291 292 293 294 298} 0} {28 {0 288 289 290 291 292 293 294 298} 0} {29 {0 288 289 290 291 292 293 294 298} 0} {30 {0 288 289 290 291 292 293 294 298} 0} {31 {0 288 289 290 291 292 293 294 298} 0} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0} {35 {0 298} 0} {36 {0 298} 0} {37 {0 298} 0} {38 {0 298} 0}} + 27 {{18 {0 298} 1}} + 24,trans {} + 6,trans {{295 48} {296 49} {305 50}} + 28 {{19 {0 298} 1}} + 43,trans {} + 29 {{20 {0 298} 1}} + 30 {{21 {0 298} 1}} + 62,trans {} + 31 {{22 {0 298} 1}} + 81,trans {} + 10,trans {} + 32 {{23 {0 298} 1}} + 28,trans {} + 33 {{24 {0 298} 1}} + 47,trans {} + 34 {{25 {0 298} 1}} +} + +array set crosshair::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 107 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 MATCH_ + 284,title WCSW + 291 J2000_ + 301 NONE_ + 292 ICRS_ + 302 coordsys + 288,line 40 + 293 GALACTIC_ + 303 wcssys + 304 skyframe + 294 ECLIPTIC_ + 305 numeric + 295 INT_ + 306 command + 296 REAL_ + 307 @PSEUDO1 + 262,t 0 + 297 SEXSTR_ + 308 crosshair + 285,line 36 + 298 STRING_ + 310 match + 309 lock + 299 LOCK_ + 311 start' + 283,t 0 + 282,line 33 + 264,title WCSC + 283,title WCSV + 278,line 29 + error,line 106 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + 310,title {} + 309,title {} + 299,title LOCK + error,t 0 + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title string + 291,t 0 + 301,t 0 + 311,line 177 + 307,line 153 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 51 + 278,title WCSQ + 307,title {} + 297,title sexagesimal + 287,t 0 + 304,line 140 + 294,line 46 + 291,line 43 + 301,line 59 + error,title {} + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title float + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 305,title {} + 295,title integer + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 304,title {} + 294,title ECLIPTIC + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 1 + 273,title WCSL + 292,title ICRS + 302,title {} + 267,t 0 + 310,line 174 + 309,line 169 + 299,line 57 + 288,t 0 + 306,line 152 + 296,line 49 + 272,title WCSK + 303,line 112 + 291,title J2000 + 293,line 45 + 301,title NONE + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 58 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title MATCH + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 303,t 1 + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 156 + 276 WCSO_ + 298,line 53 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 148 + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc crosshair::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ $1 } + 40 { set _ $1 } + 42 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 44 { MatchCrosshairCurrent $2 } + 45 { ProcessCmdSet crosshair lock $2 LockCrosshairCurrent } + 46 { CrosshairTo $1 $2 physical fk5 } + 47 { CrosshairTo $1 $2 $3 fk5 } + 48 { CrosshairTo $1 $2 $3 fk5 } + 49 { CrosshairTo $1 $2 wcs $3 } + 50 { CrosshairTo $1 $2 $3 $4 } + 51 { CrosshairTo $1 $2 wcs fk5 } + 52 { CrosshairTo $1 $2 $3 fk5 } + 53 { CrosshairTo $1 $2 wcs $3 } + 54 { CrosshairTo $1 $2 $3 $4 } + 55 { set _ $1 } + 56 { set _ $1 } + 57 { set _ none } + 58 { set _ $1 } + 59 { set _ $1 } + } + 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 crosshair::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/crosshairsendlex.tcl b/ds9/parsers/crosshairsendlex.tcl new file mode 100644 index 0000000..186d8b3 --- /dev/null +++ b/ds9/parsers/crosshairsendlex.tcl @@ -0,0 +1,697 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval crosshairsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc crosshairsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc crosshairsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc crosshairsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc crosshairsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc crosshairsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc crosshairsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc crosshairsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc crosshairsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc crosshairsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 +set LOCK_ 297 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $LOCK_ + } + 1 { +return $IMAGE_ + } + 2 { +return $PHYSICAL_ + } + 3 { +return $AMPLIFIER_ + } + 4 { +return $DETECTOR_ + } + 5 { +return $WCS_ + } + 6 { +return $WCSA_ + } + 7 { +return $WCSB_ + } + 8 { +return $WCSC_ + } + 9 { +return $WCSD_ + } + 10 { +return $WCSE_ + } + 11 { +return $WCSF_ + } + 12 { +return $WCSG_ + } + 13 { +return $WCSH_ + } + 14 { +return $WCSI_ + } + 15 { +return $WCSJ_ + } + 16 { +return $WCSK_ + } + 17 { +return $WCSL_ + } + 18 { +return $WCSM_ + } + 19 { +return $WCSN_ + } + 20 { +return $WCSO_ + } + 21 { +return $WCSP_ + } + 22 { +return $WCSQ_ + } + 23 { +return $WCSR_ + } + 24 { +return $WCSS_ + } + 25 { +return $WCST_ + } + 26 { +return $WCSU_ + } + 27 { +return $WCSV_ + } + 28 { +return $WCSW_ + } + 29 { +return $WCSX_ + } + 30 { +return $WCSY_ + } + 31 { +return $WCSZ_ + } + 32 { +return $FK4_ + } + 33 { +return $FK4_ + } + 34 { +return $FK5_ + } + 35 { +return $FK5_ + } + 36 { +return $ICRS_ + } + 37 { +return $GALACTIC_ + } + 38 { +return $ECLIPTIC_ + } + 39 { +return $DEGREES_ + } + 40 { +return $SEXAGESIMAL_ + } + 41 { +# ignore whitespace + } + 42 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + + diff --git a/ds9/parsers/crosshairsendparser.tab.tcl b/ds9/parsers/crosshairsendparser.tab.tcl new file mode 100644 index 0000000..dbf074e --- /dev/null +++ b/ds9/parsers/crosshairsendparser.tab.tcl @@ -0,0 +1,41 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 +set LOCK_ 297 diff --git a/ds9/parsers/crosshairsendparser.tcl b/ds9/parsers/crosshairsendparser.tcl new file mode 100644 index 0000000..6dde82c --- /dev/null +++ b/ds9/parsers/crosshairsendparser.tcl @@ -0,0 +1,1436 @@ +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 crosshairsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc crosshairsend::YYABORT {} { + return -code return 1 +} + +proc crosshairsend::YYACCEPT {} { + return -code return 0 +} + +proc crosshairsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc crosshairsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc crosshairsend::yyerror {s} { + puts stderr $s +} + +proc crosshairsend::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 crosshairsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set crosshairsend::table { + 31:294,target 31 + 21:290 reduce + 21:289 reduce + 21:291 reduce + 21:292 reduce + 14:295,target 14 + 30:290,target 30 + 30:289,target 30 + 29:290,target 29 + 29:289,target 29 + 27:0 reduce + 21:293 reduce + 9:292,target 9 + 21:294 reduce + 21:295 reduce + 13:291,target 13 + 9:288 reduce + 48:0 reduce + 21:296 reduce + 20:294,target 20 + 19:294,target 19 + 9:289 reduce + 9:290 reduce + 30:288 reduce + 29:288 reduce + 9:291 reduce + 30:290 reduce + 30:289 reduce + 29:290 reduce + 29:289 reduce + 9:292 reduce + 30:291 reduce + 29:291 reduce + 18:290,target 18 + 18:289,target 18 + 9:293 reduce + 30:292 reduce + 29:292 reduce + 25:293,target 25 + 5:295,target 5 + 9:294 reduce + 32:296,target 32 + 30:293 reduce + 29:293 reduce + 9:295 reduce + 0:275,target 19 + 6:0,target 6 + 30:294 reduce + 29:294 reduce + 9:296 reduce + 2:0 reduce + 30:295 reduce + 29:295 reduce + 24:288,target 24 + 31:292,target 31 + 30:296 reduce + 29:296 reduce + 37:295,target 37 + 24:0 reduce + 14:293,target 14 + 48:0,target 47 + 21:296,target 21 + 9:289,target 9 + 9:290,target 9 + 41:0,target 43 + 45:0 reduce + 33:0,target 33 + 13:288,target 13 + 25:0,target 25 + 20:292,target 20 + 19:292,target 19 + 0:294,target 38 + 38:295 reduce + 26:295,target 26 + 17:0,target 17 + 38:296 reduce + 10:0,target 10 + 10:296,target 10 + 25:291,target 25 + 5:293,target 5 + 0:273,target 17 + 15:295,target 15 + 31:290,target 31 + 31:289,target 31 + 17:288 reduce + 21:0 reduce + 17:290 reduce + 17:289 reduce + 17:291 reduce + 14:291,target 14 + 21:294,target 21 + 17:292 reduce + 42:0 reduce + 17:293 reduce + 17:294 reduce + 20:290,target 20 + 20:289,target 20 + 19:290,target 19 + 19:289,target 19 + 17:295 reduce + 0:302,target 43 + 0:292,target 36 + 6:288 reduce + 26:293,target 26 + 17:296 reduce + 6:289 reduce + 6:290 reduce + 6:295,target 6 + 33:296,target 33 + 26:288 reduce + 6:291 reduce + 26:290 reduce + 26:289 reduce + 10:294,target 10 + 6:292 reduce + 26:291 reduce + 25:288,target 25 + 5:291,target 5 + 6:293 reduce + 26:292 reduce + 0:271,target 15 + 6:294 reduce + 38:295,target 38 + 26:293 reduce + 6:295 reduce + 26:294 reduce + 15:293,target 15 + 6:296 reduce + 26:295 reduce + 22:296,target 22 + 17:0 reduce + 26:296 reduce + 14:288,target 14 + 38:0 reduce + 21:292,target 21 + 27:295,target 27 + 11:296,target 11 + 0:300,target 42 + 0:289,target 33 + 0:290,target 34 + 3:0,target 3 + 26:291,target 26 + 6:293,target 6 + 35:295 reduce + 35:296 reduce + 10:292,target 10 + 16:295,target 16 + 5:288,target 5 + 0:268,target 12 + 45:0,target 40 + 37:0,target 37 + 15:291,target 15 + 14:0 reduce + 30:0,target 30 + 29:0,target 29 + 22:294,target 22 + 22:0,target 22 + 14:288 reduce + 35:0 reduce + 14:290 reduce + 14:289 reduce + 14:0,target 14 + 21:290,target 21 + 21:289,target 21 + 14:291 reduce + 27:293,target 27 + 14:292 reduce + 7:295,target 7 + 34:296,target 34 + 14:293 reduce + 14:294 reduce + 11:294,target 11 + 0:287,target 31 + 26:288,target 26 + 14:295 reduce + 6:291,target 6 + 14:296 reduce + 0:257 shift + 23:288 reduce + 10:290,target 10 + 10:289,target 10 + 0:258 shift + 23:290 reduce + 23:289 reduce + 16:293,target 16 + 0:260 shift + 0:259 shift + 23:296,target 23 + 23:291 reduce + 0:266,target 10 + 0:261 shift + 9:0 reduce + 23:292 reduce + 11:0 reduce + 0:262 shift + 23:293 reduce + 15:288,target 15 + 0:263 shift + 23:294 reduce + 22:292,target 22 + 0:264 shift + 32:0 reduce + 28:295,target 28 + 23:295 reduce + 0:265 shift + 23:296 reduce + 0:266 shift + 12:296,target 12 + 0:267 shift + 27:291,target 27 + 0:268 shift + 7:293,target 7 + 0:270 shift + 0:269 shift + 11:292,target 11 + 0:271 shift + 0:285,target 29 + 17:295,target 17 + 0:272 shift + 6:288,target 6 + 0:273 shift + 32:295 reduce + 0:274 shift + 46:296,target 45 + 32:296 reduce + 16:291,target 16 + 0:275 shift + 6:0 reduce + 41:288 shift + 23:294,target 23 + 0:264,target 8 + 0:276 shift + 41:290 shift + 41:289 shift + 41:300 goto + 0:277 shift + 41:291 shift + 41:301 goto + 0:278 shift + 41:292 shift + 28:0 reduce + 22:290,target 22 + 22:289,target 22 + 0:279 shift + 0:280 shift + 7:0,target 7 + 41:293 shift + 28:293,target 28 + 0:0,target 41 + 0:281 shift + 8:295,target 8 + 41:294 shift + 35:296,target 35 + 11:288 reduce + 0:282 shift + 49:0 reduce + 41:295 shift + 12:294,target 12 + 11:290 reduce + 11:289 reduce + 0:283 shift + 41:296 shift + 27:288,target 27 + 11:291 reduce + 0:284 shift + 7:291,target 7 + 11:292 reduce + 0:285 shift + 49:0,target 48 + 41:295,target 44 + 11:293 reduce + 11:290,target 11 + 11:289,target 11 + 0:283,target 27 + 0:286 shift + 42:0,target 44 + 17:293,target 17 + 11:294 reduce + 0:287 shift + 34:0,target 34 + 24:296,target 24 + 11:295 reduce + 0:288 shift + 26:0,target 26 + 11:296 reduce + 0:300 goto + 0:289 shift + 0:290 shift + 3:0 reduce + 20:288 reduce + 19:288 reduce + 18:0,target 18 + 16:288,target 16 + 0:291 shift + 23:292,target 23 + 20:290 reduce + 20:289 reduce + 19:290 reduce + 19:289 reduce + 11:0,target 11 + 0:262,target 6 + 0:302 goto + 0:292 shift + 30:295,target 30 + 29:295,target 29 + 20:291 reduce + 19:291 reduce + 0:293 shift + 25:0 reduce + 20:292 reduce + 19:292 reduce + 0:294 shift + 20:293 reduce + 19:293 reduce + 13:296,target 13 + 28:291,target 28 + 20:294 reduce + 19:294 reduce + 8:293,target 8 + 46:0 reduce + 20:295 reduce + 19:295 reduce + 0:297 shift + 8:288 reduce + 20:296 reduce + 19:296 reduce + 12:292,target 12 + 0:298 goto + 8:289 reduce + 8:290 reduce + 28:288 reduce + 18:295,target 18 + 0:299 goto + 7:288,target 7 + 8:291 reduce + 28:290 reduce + 28:289 reduce + 8:292 reduce + 41:293,target 37 + 28:291 reduce + 0:281,target 25 + 8:293 reduce + 28:292 reduce + 17:291,target 17 + 8:294 reduce + 28:293 reduce + 24:294,target 24 + 0:0 reduce + 8:295 reduce + 28:294 reduce + 8:296 reduce + 28:295 reduce + 28:296 reduce + 23:290,target 23 + 23:289,target 23 + 0:260,target 4 + 0:259,target 3 + 30:293,target 30 + 29:293,target 29 + 22:0 reduce + 9:295,target 9 + 36:296,target 36 + 13:294,target 13 + 43:0 accept + 28:288,target 28 + 0:299,target 41 + 8:291,target 8 + 42:295,target 44 + 12:290,target 12 + 12:289,target 12 + 37:295 reduce + 18:293,target 18 + 37:296 reduce + 25:296,target 25 + 41:291,target 35 + 41:301,target 47 + 0:278,target 22 + 17:288,target 17 + 46:301 goto + 24:292,target 24 + 31:295,target 31 + 4:0,target 4 + 18:0 reduce + 16:288 reduce + 14:296,target 14 + 0:257,target 1 + 46:295 shift + 30:291,target 30 + 29:291,target 29 + 16:290 reduce + 16:289 reduce + 9:293,target 9 + 46:296 shift + 16:291 reduce + 40:0 reduce + 39:0 reduce + 16:292 reduce + 13:292,target 13 + 46:0,target 45 + 20:295,target 20 + 19:295,target 19 + 16:293 reduce + 0:297,target 39 + 8:288,target 8 + 38:0,target 38 + 16:294 reduce + 31:0,target 31 + 16:295 reduce + 5:288 reduce + 23:0,target 23 + 18:291,target 18 + 16:296 reduce + 5:289 reduce + 5:290 reduce + 25:294,target 25 + 25:288 reduce + 15:0,target 15 + 5:291 reduce + 5:296,target 5 + 41:288,target 32 + 25:290 reduce + 25:289 reduce + 0:276,target 20 + 5:292 reduce + 25:291 reduce + 5:293 reduce + 25:292 reduce + 24:290,target 24 + 24:289,target 24 + 5:294 reduce + 31:293,target 31 + 25:293 reduce + 5:295 reduce + 37:296,target 37 + 25:294 reduce + 15:0 reduce + 5:296 reduce + 25:295 reduce + 14:294,target 14 + 30:288,target 30 + 29:288,target 29 + 25:296 reduce + 9:291,target 9 + 36:0 reduce + 13:290,target 13 + 13:289,target 13 + 20:293,target 20 + 19:293,target 19 + 26:296,target 26 + 42:301,target 48 + 18:288,target 18 + 34:295 reduce + 25:292,target 25 + 5:294,target 5 + 34:296 reduce + 32:295,target 32 + 0:274,target 18 + 15:296,target 15 + 31:291,target 31 + 12:0 reduce + 14:292,target 14 + 33:0 reduce + 21:295,target 21 + 13:288 reduce + 9:288,target 9 + 13:290 reduce + 13:289 reduce + 13:291 reduce + 20:291,target 20 + 19:291,target 19 + 13:292 reduce + 0:293,target 37 + 26:294,target 26 + 13:293 reduce + 6:296,target 6 + 13:294 reduce + 8:0,target 8 + 13:295 reduce + 10:295,target 10 + 1:0,target 1 + 25:290,target 25 + 25:289,target 25 + 13:296 reduce + 5:292,target 5 + 22:288 reduce + 0:272,target 16 + 38:296,target 38 + 22:290 reduce + 22:289 reduce + 7:0 reduce + 22:291 reduce + 15:294,target 15 + 31:288,target 31 + 22:292 reduce + 43:0,target 0 + 22:293 reduce + 35:0,target 35 + 30:0 reduce + 29:0 reduce + 22:294 reduce + 14:290,target 14 + 14:289,target 14 + 27:0,target 27 + 22:295 reduce + 21:293,target 21 + 27:296,target 27 + 22:296 reduce + 20:0,target 20 + 19:0,target 19 + 31:288 reduce + 12:0,target 12 + 31:290 reduce + 31:289 reduce + 20:288,target 20 + 19:288,target 19 + 0:291,target 35 + 31:291 reduce + 26:292,target 26 + 6:294,target 6 + 33:295,target 33 + 31:292 reduce + 31:293 reduce + 10:293,target 10 + 31:294 reduce + 16:296,target 16 + 5:289,target 5 + 5:290,target 5 + 31:295 reduce + 0:270,target 14 + 0:269,target 13 + 4:0 reduce + 31:296 reduce + 15:292,target 15 + 22:295,target 22 + 26:0 reduce + 21:291,target 21 + 47:0 reduce + 27:294,target 27 + 10:288 reduce + 7:296,target 7 + 10:290 reduce + 10:289 reduce + 11:295,target 11 + 10:291 reduce + 0:288,target 32 + 26:290,target 26 + 26:289,target 26 + 10:292 reduce + 6:292,target 6 + 10:293 reduce + 10:294 reduce + 10:291,target 10 + 16:294,target 16 + 10:295 reduce + 1:0 reduce + 10:296 reduce + 0:267,target 11 + 18:288 reduce + 18:290 reduce + 18:289 reduce + 15:290,target 15 + 15:289,target 15 + 23:0 reduce + 22:293,target 22 + 18:291 reduce + 28:296,target 28 + 18:292 reduce + 18:293 reduce + 44:0 reduce + 21:288,target 21 + 18:294 reduce + 5:0,target 5 + 27:292,target 27 + 18:295 reduce + 7:288 reduce + 7:294,target 7 + 34:295,target 34 + 18:296 reduce + 7:289 reduce + 7:290 reduce + 27:288 reduce + 11:293,target 11 + 0:286,target 30 + 7:291 reduce + 27:290 reduce + 27:289 reduce + 17:296,target 17 + 6:289,target 6 + 6:290,target 6 + 7:292 reduce + 27:291 reduce + 7:293 reduce + 47:0,target 46 + 27:292 reduce + 10:288,target 10 + 7:294 reduce + 40:0,target 42 + 39:0,target 49 + 27:293 reduce + 16:292,target 16 + 7:295 reduce + 32:0,target 32 + 27:294 reduce + 23:295,target 23 + 0:265,target 9 + 7:296 reduce + 27:295 reduce + 24:0,target 24 + 27:296 reduce + 20:0 reduce + 19:0 reduce + 16:0,target 16 + 22:291,target 22 + 28:294,target 28 + 8:296,target 8 + 41:0 reduce + 12:295,target 12 + 27:290,target 27 + 27:289,target 27 + 7:292,target 7 + 41:296,target 45 + 36:295 reduce + 11:291,target 11 + 0:284,target 28 + 36:296 reduce + 17:294,target 17 + 46:295,target 44 + 16:290,target 16 + 16:289,target 16 + 23:293,target 23 + 0:263,target 7 + 30:296,target 30 + 29:296,target 29 + 16:0 reduce + 15:288 reduce + 22:288,target 22 + 15:290 reduce + 15:289 reduce + 37:0 reduce + 28:292,target 28 + 15:291 reduce + 8:294,target 8 + 35:295,target 35 + 15:292 reduce + 15:293 reduce + 12:293,target 12 + 18:296,target 18 + 15:294 reduce + 7:289,target 7 + 7:290,target 7 + 15:295 reduce + 41:294,target 38 + 15:296 reduce + 11:288,target 11 + 0:282,target 26 + 24:288 reduce + 17:292,target 17 + 24:295,target 24 + 24:290 reduce + 24:289 reduce + 24:291 reduce + 24:292 reduce + 24:293 reduce + 23:291,target 23 + 13:0 reduce + 0:261,target 5 + 9:0,target 9 + 30:294,target 30 + 29:294,target 29 + 24:294 reduce + 9:296,target 9 + 2:0,target 2 + 24:295 reduce + 34:0 reduce + 24:296 reduce + 13:295,target 13 + 28:290,target 28 + 28:289,target 28 + 8:292,target 8 + 42:296,target 45 + 12:291,target 12 + 44:0,target 39 + 18:294,target 18 + 36:0,target 36 + 41:292,target 36 + 28:0,target 28 + 0:279,target 23 + 0:280,target 24 + 33:295 reduce + 21:0,target 21 + 17:290,target 17 + 17:289,target 17 + 33:296 reduce + 24:293,target 24 + 13:0,target 13 + 31:296,target 31 + 8:0 reduce + 46:301,target 49 + 10:0 reduce + 42:301 goto + 23:288,target 23 + 0:258,target 2 + 30:292,target 30 + 29:292,target 29 + 9:294,target 9 + 36:295,target 36 + 31:0 reduce + 13:293,target 13 + 12:288 reduce + 42:295 shift + 20:296,target 20 + 19:296,target 19 + 12:290 reduce + 12:289 reduce + 0:298,target 40 + 8:289,target 8 + 8:290,target 8 + 42:296 shift + 12:291 reduce + 12:292 reduce + 12:288,target 12 + 18:292,target 18 + 12:293 reduce + 25:295,target 25 + 12:294 reduce + 41:290,target 34 + 41:289,target 33 + 41:300,target 46 + 12:295 reduce + 0:277,target 21 + 12:296 reduce + 24:291,target 24 + 21:288 reduce + 5:0 reduce +} + +array set crosshairsend::rules { + 9,l 299 + 11,l 299 + 32,l 300 + 6,l 299 + 28,l 299 + 49,l 302 + 3,l 298 + 25,l 299 + 46,l 302 + 0,l 303 + 22,l 299 + 43,l 302 + 18,l 299 + 40,l 301 + 39,l 301 + 15,l 299 + 36,l 300 + 12,l 299 + 33,l 300 + 7,l 299 + 29,l 299 + 30,l 299 + 4,l 298 + 26,l 299 + 47,l 302 + 1,l 298 + 23,l 299 + 44,l 302 + 19,l 299 + 20,l 299 + 41,l 302 + 16,l 299 + 37,l 300 + 13,l 299 + 34,l 300 + 8,l 299 + 10,l 299 + 31,l 299 + 5,l 299 + 27,l 299 + 48,l 302 + 2,l 298 + 24,l 299 + 45,l 302 + 21,l 299 + 42,l 302 + 17,l 299 + 38,l 300 + 14,l 299 + 35,l 300 +} + +array set crosshairsend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 0 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 1 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 3 +} + +array set crosshairsend::rules { + 41,line 149 + 7,line 110 + 37,line 141 + 4,line 106 + 34,line 138 + 1,line 103 + 31,line 134 + 27,line 130 + 24,line 127 + 21,line 124 + 17,line 120 + 14,line 117 + 11,line 114 + 49,line 157 + 46,line 154 + 43,line 151 + 9,line 112 + 40,line 145 + 39,line 144 + 6,line 109 + 36,line 140 + 3,line 105 + 33,line 137 + 29,line 132 + 30,line 133 + 26,line 129 + 23,line 126 + 19,line 122 + 20,line 123 + 16,line 119 + 13,line 116 + 10,line 113 + 48,line 156 + 45,line 153 + 42,line 150 + 8,line 111 + 38,line 142 + 5,line 108 + 35,line 139 + 2,line 104 + 32,line 136 + 28,line 131 + 25,line 128 + 22,line 125 + 18,line 121 + 15,line 118 + 12,line 115 + 47,line 155 + 44,line 152 +} + +array set crosshairsend::lr1_table { + 35 {{35 {0 295 296} 1}} + 14,trans {} + 36 {{36 {0 295 296} 1}} + 33,trans {} + 37 {{37 {0 295 296} 1}} + 38 {{38 {0 295 296} 1}} + 39 {{49 0 1}} + 40 {{42 0 1}} + 18,trans {} + 41 {{43 0 1} {45 0 1} {46 0 1} {48 0 1} {32 {0 295 296} 0} {33 {0 295 296} 0} {34 {0 295 296} 0} {35 {0 295 296} 0} {36 {0 295 296} 0} {37 {0 295 296} 0} {38 {0 295 296} 0} {39 0 0} {40 0 0}} + 1,trans {} + 37,trans {} + 42 {{44 0 1} {47 0 1} {39 0 0} {40 0 0}} + 43 {{0 0 1}} + 44 {{39 0 1}} + 45 {{40 0 1}} + 23,trans {} + 5,trans {} + 42,trans {{295 44} {296 45} {301 48}} + 46 {{45 0 2} {48 0 2} {39 0 0} {40 0 0}} + 47 {{46 0 2}} + 48 {{47 0 2}} + 49 {{48 0 3}} + 27,trans {} + 9,trans {} + 46,trans {{295 44} {296 45} {301 49}} + 13,trans {} + 32,trans {} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {297 39} {298 40} {299 41} {300 42} {302 43}} + 36,trans {} + 22,trans {} + 4,trans {} + 41,trans {{288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {295 44} {296 45} {300 46} {301 47}} + 26,trans {} + 8,trans {} + 45,trans {} + 12,trans {} + 31,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 10 {{10 {0 288 289 290 291 292 293 294 295 296} 1}} + 11 {{11 {0 288 289 290 291 292 293 294 295 296} 1}} + 25,trans {} + 7,trans {} + 12 {{12 {0 288 289 290 291 292 293 294 295 296} 1}} + 44,trans {} + 13 {{13 {0 288 289 290 291 292 293 294 295 296} 1}} + 14 {{14 {0 288 289 290 291 292 293 294 295 296} 1}} + 11,trans {} + 15 {{15 {0 288 289 290 291 292 293 294 295 296} 1}} + 30,trans {} + 29,trans {} + 16 {{16 {0 288 289 290 291 292 293 294 295 296} 1}} + 48,trans {} + 0 {{0 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 {0 288 289 290 291 292 293 294 295 296} 0} {6 {0 288 289 290 291 292 293 294 295 296} 0} {7 {0 288 289 290 291 292 293 294 295 296} 0} {8 {0 288 289 290 291 292 293 294 295 296} 0} {9 {0 288 289 290 291 292 293 294 295 296} 0} {10 {0 288 289 290 291 292 293 294 295 296} 0} {11 {0 288 289 290 291 292 293 294 295 296} 0} {12 {0 288 289 290 291 292 293 294 295 296} 0} {13 {0 288 289 290 291 292 293 294 295 296} 0} {14 {0 288 289 290 291 292 293 294 295 296} 0} {15 {0 288 289 290 291 292 293 294 295 296} 0} {16 {0 288 289 290 291 292 293 294 295 296} 0} {17 {0 288 289 290 291 292 293 294 295 296} 0} {18 {0 288 289 290 291 292 293 294 295 296} 0} {19 {0 288 289 290 291 292 293 294 295 296} 0} {20 {0 288 289 290 291 292 293 294 295 296} 0} {21 {0 288 289 290 291 292 293 294 295 296} 0} {22 {0 288 289 290 291 292 293 294 295 296} 0} {23 {0 288 289 290 291 292 293 294 295 296} 0} {24 {0 288 289 290 291 292 293 294 295 296} 0} {25 {0 288 289 290 291 292 293 294 295 296} 0} {26 {0 288 289 290 291 292 293 294 295 296} 0} {27 {0 288 289 290 291 292 293 294 295 296} 0} {28 {0 288 289 290 291 292 293 294 295 296} 0} {29 {0 288 289 290 291 292 293 294 295 296} 0} {30 {0 288 289 290 291 292 293 294 295 296} 0} {31 {0 288 289 290 291 292 293 294 295 296} 0} {32 {0 295 296} 0} {33 {0 295 296} 0} {34 {0 295 296} 0} {35 {0 295 296} 0} {36 {0 295 296} 0} {37 {0 295 296} 0} {38 {0 295 296} 0}} + 17 {{17 {0 288 289 290 291 292 293 294 295 296} 1}} + 1 {{1 0 1}} + 18 {{18 {0 288 289 290 291 292 293 294 295 296} 1}} + 15,trans {} + 2 {{2 0 1}} + 19 {{19 {0 288 289 290 291 292 293 294 295 296} 1}} + 20 {{20 {0 288 289 290 291 292 293 294 295 296} 1}} + 34,trans {} + 3 {{3 0 1}} + 21 {{21 {0 288 289 290 291 292 293 294 295 296} 1}} + 4 {{4 0 1}} + 22 {{22 {0 288 289 290 291 292 293 294 295 296} 1}} + 5 {{5 {0 288 289 290 291 292 293 294 295 296} 1}} + 23 {{23 {0 288 289 290 291 292 293 294 295 296} 1}} + 20,trans {} + 19,trans {} + 6 {{6 {0 288 289 290 291 292 293 294 295 296} 1}} + 24 {{24 {0 288 289 290 291 292 293 294 295 296} 1}} + 2,trans {} + 38,trans {} + 7 {{7 {0 288 289 290 291 292 293 294 295 296} 1}} + 25 {{25 {0 288 289 290 291 292 293 294 295 296} 1}} + 8 {{8 {0 288 289 290 291 292 293 294 295 296} 1}} + 26 {{26 {0 288 289 290 291 292 293 294 295 296} 1}} + 9 {{9 {0 288 289 290 291 292 293 294 295 296} 1}} + 27 {{27 {0 288 289 290 291 292 293 294 295 296} 1}} + 24,trans {} + 6,trans {} + 28 {{28 {0 288 289 290 291 292 293 294 295 296} 1}} + 43,trans {} + 29 {{29 {0 288 289 290 291 292 293 294 295 296} 1}} + 30 {{30 {0 288 289 290 291 292 293 294 295 296} 1}} + 31 {{31 {0 288 289 290 291 292 293 294 295 296} 1}} + 10,trans {} + 32 {{32 {0 295 296} 1}} + 28,trans {} + 33 {{33 {0 295 296} 1}} + 47,trans {} + 34 {{34 {0 295 296} 1}} +} + +array set crosshairsend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 148 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 skyframe + 284,title WCSW + 291 J2000_ + 301 skyformat + 292 ICRS_ + 302 crosshairsend + 288,line 40 + 293 GALACTIC_ + 303 start' + 294 ECLIPTIC_ + 295 DEGREES_ + 296 SEXAGESIMAL_ + 262,t 0 + 297 LOCK_ + 285,line 36 + 298 coordsys + 299 wcssys + 283,t 0 + 282,line 33 + 264,title WCSC + 283,title WCSV + 278,line 29 + error,line 101 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 272,line 23 + 263,title WCSB + 282,title WCSU + 268,line 19 + 276,t 0 + 265,line 16 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + error,t 0 + 299,title {} + 258,line 8 + 273,t 0 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 269,t 0 + 270,t 0 + 298,title {} + 291,t 0 + 301,t 1 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 53 + 278,title WCSQ + 297,title LOCK + 287,t 0 + 294,line 46 + 291,line 43 + error,title {} + 301,line 143 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 296,title SEXAGESIMAL + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 295,title DEGREES + 274,line 25 + 271,line 22 + 277,t 0 + 267,line 18 + 298,t 1 + 275,title WCSN + 294,title ECLIPTIC + 264,line 15 + 261,line 12 + 274,t 0 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 1 + 273,title WCSL + 292,title ICRS + 302,title {} + 267,t 0 + 299,line 107 + 288,t 0 + 296,line 49 + 272,title WCSK + 303,line 158 + 291,title J2000 + 293,line 45 + 301,title {} + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 135 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title {} + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 299,t 1 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 303,t 1 + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 1 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 276 WCSO_ + 298,line 102 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc crosshairsend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ degrees } + 40 { set _ sexagesimal } + 41 { ProcessSendCmdCurrent "get crosshair physical fk5 degrees" } + 42 { ProcessSendCmdCurrent "get crosshair $1 fk5 degrees" } + 43 { ProcessSendCmdCurrent "get crosshair $1 fk5 degrees" } + 44 { ProcessSendCmdCurrent "get crosshair wcs $1 degrees" } + 45 { ProcessSendCmdCurrent "get crosshair $1 $2 degrees" } + 46 { ProcessSendCmdCurrent "get crosshair $1 fk5 $2" } + 47 { ProcessSendCmdCurrent "get crosshair wcs $1 $2" } + 48 { ProcessSendCmdCurrent "get crosshair $1 $2 $3" } + 49 { ProcessSendCmdGet crosshair lock } + } + 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 crosshairsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/cubelex.tcl b/ds9/parsers/cubelex.tcl new file mode 100644 index 0000000..86b5e76 --- /dev/null +++ b/ds9/parsers/cubelex.tcl @@ -0,0 +1,998 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cube { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cube::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cube::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cube::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cube::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cube::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cube::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cube::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cube::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cube::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set FK4_ 284 +set B1950_ 285 +set FK5_ 286 +set J2000_ 287 +set ICRS_ 288 +set GALACTIC_ 289 +set ECLIPTIC_ 290 +set YES_ 291 +set NO_ 292 +set ON_ 293 +set OFF_ 294 +set TRUE_ 295 +set FALSE_ 296 +set INT_ 297 +set REAL_ 298 +set STRING_ 299 +set AXIS_ 300 +set AXES_ 301 +set CLOSE_ 302 +set FIRST_ 303 +set INTERVAL_ 304 +set IMAGE_ 305 +set LAST_ 306 +set LOCK_ 307 +set MATCH_ 308 +set NEXT_ 309 +set NONE_ 310 +set OPEN_ 311 +set ORDER_ 312 +set PLAY_ 313 +set PREV_ 314 +set STOP_ 315 +set 123_ 316 +set 132_ 317 +set 213_ 318 +set 231_ 319 +set 312_ 320 +set 321_ 321 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: axis + if {[regexp -start $index_ -indices -line -nocase -- {\A(axis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: first + if {[regexp -start $index_ -indices -line -nocase -- {\A(first)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: interval + if {[regexp -start $index_ -indices -line -nocase -- {\A(interval)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: last + if {[regexp -start $index_ -indices -line -nocase -- {\A(last)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: next + if {[regexp -start $index_ -indices -line -nocase -- {\A(next)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: order + if {[regexp -start $index_ -indices -line -nocase -- {\A(order)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: play + if {[regexp -start $index_ -indices -line -nocase -- {\A(play)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: prev + if {[regexp -start $index_ -indices -line -nocase -- {\A(prev)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: stop + if {[regexp -start $index_ -indices -line -nocase -- {\A(stop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: 123 + if {[regexp -start $index_ -indices -line -nocase -- {\A(123)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: 132 + if {[regexp -start $index_ -indices -line -nocase -- {\A(132)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: 213 + if {[regexp -start $index_ -indices -line -nocase -- {\A(213)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: 231 + if {[regexp -start $index_ -indices -line -nocase -- {\A(231)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: 312 + if {[regexp -start $index_ -indices -line -nocase -- {\A(312)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: 321 + if {[regexp -start $index_ -indices -line -nocase -- {\A(321)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AXIS_ + } + 1 { +return $AXES_ + } + 2 { +return $CLOSE_ + } + 3 { +return $FIRST_ + } + 4 { +return $IMAGE_ + } + 5 { +return $INTERVAL_ + } + 6 { +return $LAST_ + } + 7 { +return $LOCK_ + } + 8 { +return $MATCH_ + } + 9 { +return $NEXT_ + } + 10 { +return $NONE_ + } + 11 { +return $OPEN_ + } + 12 { +return $ORDER_ + } + 13 { +return $PLAY_ + } + 14 { +return $PREV_ + } + 15 { +return $STOP_ + } + 16 { +return $123_ + } + 17 { +return $132_ + } + 18 { +return $213_ + } + 19 { +return $231_ + } + 20 { +return $312_ + } + 21 { +return $321_ + } + 22 { +return $WCS_ + } + 23 { +return $WCSA_ + } + 24 { +return $WCSB_ + } + 25 { +return $WCSC_ + } + 26 { +return $WCSD_ + } + 27 { +return $WCSE_ + } + 28 { +return $WCSF_ + } + 29 { +return $WCSG_ + } + 30 { +return $WCSH_ + } + 31 { +return $WCSI_ + } + 32 { +return $WCSJ_ + } + 33 { +return $WCSK_ + } + 34 { +return $WCSL_ + } + 35 { +return $WCSM_ + } + 36 { +return $WCSN_ + } + 37 { +return $WCSO_ + } + 38 { +return $WCSP_ + } + 39 { +return $WCSQ_ + } + 40 { +return $WCSR_ + } + 41 { +return $WCSS_ + } + 42 { +return $WCST_ + } + 43 { +return $WCSU_ + } + 44 { +return $WCSV_ + } + 45 { +return $WCSW_ + } + 46 { +return $WCSX_ + } + 47 { +return $WCSY_ + } + 48 { +return $WCSZ_ + } + 49 { +return $FK4_ + } + 50 { +return $FK4_ + } + 51 { +return $FK5_ + } + 52 { +return $FK5_ + } + 53 { +return $ICRS_ + } + 54 { +return $GALACTIC_ + } + 55 { +return $ECLIPTIC_ + } + 56 { +return $YES_ + } + 57 { +return $NO_ + } + 58 { +return $ON_ + } + 59 { +return $OFF_ + } + 60 { +return $TRUE_ + } + 61 { +return $FALSE_ + } + 62 { +set yylval $yytext; return $INT_ + } + 63 - + 64 { +set yylval $yytext; return $REAL_ + } + 65 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 66 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 67 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 68 { +set yylval $yytext; return $STRING_ + } + 69 { +# ignore whitespace + } + 70 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/cubeparser.tab.tcl b/ds9/parsers/cubeparser.tab.tcl new file mode 100644 index 0000000..e7ae2ab --- /dev/null +++ b/ds9/parsers/cubeparser.tab.tcl @@ -0,0 +1,65 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set FK4_ 284 +set B1950_ 285 +set FK5_ 286 +set J2000_ 287 +set ICRS_ 288 +set GALACTIC_ 289 +set ECLIPTIC_ 290 +set YES_ 291 +set NO_ 292 +set ON_ 293 +set OFF_ 294 +set TRUE_ 295 +set FALSE_ 296 +set INT_ 297 +set REAL_ 298 +set STRING_ 299 +set AXIS_ 300 +set AXES_ 301 +set CLOSE_ 302 +set FIRST_ 303 +set INTERVAL_ 304 +set IMAGE_ 305 +set LAST_ 306 +set LOCK_ 307 +set MATCH_ 308 +set NEXT_ 309 +set NONE_ 310 +set OPEN_ 311 +set ORDER_ 312 +set PLAY_ 313 +set PREV_ 314 +set STOP_ 315 +set 123_ 316 +set 132_ 317 +set 213_ 318 +set 231_ 319 +set 312_ 320 +set 321_ 321 diff --git a/ds9/parsers/cubeparser.tcl b/ds9/parsers/cubeparser.tcl new file mode 100644 index 0000000..7f74327 --- /dev/null +++ b/ds9/parsers/cubeparser.tcl @@ -0,0 +1,2151 @@ +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 cube { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cube::YYABORT {} { + return -code return 1 +} + +proc cube::YYACCEPT {} { + return -code return 0 +} + +proc cube::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cube::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cube::yyerror {s} { + puts stderr $s +} + +proc cube::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 cube::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cube::table { + 61:299,target 76 + 9:283 shift + 46:288,target 14 + 17:266,target 42 + 51:299 reduce + 48:0 reduce + 21:299 reduce + 9:305 shift + 41:287,target 9 + 1:258,target 42 + 64:0,target 77 + 9:299 reduce + 9:310 shift + 53:290,target 21 + 53:289,target 21 + 68:284,target 77 + 33:0,target 1 + 35:286,target 3 + 4:320,target 27 + 4:319,target 26 + 9:268,target 44 + 16:299,target 52 + 62:299,target 75 + 9:322 goto + 17:283,target 59 + 47:288,target 15 + 56:284 reduce + 56:285 reduce + 13:317,target 24 + 56:286 reduce + 21:0 reduce + 56:287 reduce + 56:288 reduce + 56:290 reduce + 56:289 reduce + 0:302,target 5 + 9:331 goto + 63:0 reduce + 1:275,target 42 + 42:287,target 10 + 2:258,target 43 + 56:299 reduce + 54:290,target 22 + 54:289,target 22 + 10:273,target 49 + 26:299 reduce + 36:286,target 4 + 63:299,target 50 + 48:288,target 16 + 61:0,target 76 + 29:0,target 58 + 30:0,target 66 + 35:0 reduce + 17:257,target 33 + 2:275,target 43 + 43:287,target 11 + 77:0 reduce + 55:290,target 23 + 55:289,target 23 + 9:0 reduce + 22:292,target 71 + 37:286,target 5 + 64:299,target 77 + 50:288,target 18 + 49:288,target 17 + 62:299 reduce + 9:259,target 35 + 9:260,target 36 + 17:274,target 50 + 32:299 reduce + 44:287,target 12 + 50:0 reduce + 49:0 reduce + 57:0,target 25 + 56:290,target 24 + 56:289,target 24 + 1:266,target 42 + 26:0,target 70 + 38:286,target 6 + 10:264,target 40 + 19:299,target 45 + 20:299,target 61 + 65:299,target 78 + 51:288,target 19 + 9:276,target 52 + 33:285,target 1 + 37:284 reduce + 37:285 reduce + 37:286 reduce + 37:287 reduce + 22:0 reduce + 37:288 reduce + 37:289 reduce + 37:290 reduce + 45:287,target 13 + 0:309,target 11 + 67:299 reduce + 1:283,target 42 + 64:0 reduce + 57:290,target 25 + 57:289,target 25 + 2:266,target 43 + 37:299 reduce + 10:281,target 57 + 39:286,target 7 + 40:286,target 8 + 85:0,target 46 + 21:299,target 64 + 66:299,target 49 + 54:0,target 22 + 52:288,target 20 + 2:257 reduce + 23:0,target 67 + 2:258 reduce + 34:285,target 2 + 2:260 reduce + 2:259 reduce + 2:261 reduce + 2:262 reduce + 2:263 reduce + 2:264 reduce + 0:326,target 18 + 46:287,target 14 + 2:265 reduce + 2:266 reduce + 1:299,target 60 + 17:265,target 41 + 2:267 reduce + 36:0 reduce + 2:283,target 43 + 2:268 reduce + 58:290,target 26 + 58:289,target 26 + 2:270 reduce + 2:269 reduce + 2:271 reduce + 2:272 reduce + 43:284 reduce + 2:273 reduce + 43:285 reduce + 78:0 reduce + 2:274 reduce + 43:286 reduce + 2:275 reduce + 41:286,target 9 + 43:287 reduce + 2:276 reduce + 43:288 reduce + 2:277 reduce + 1:257,target 42 + 43:289 reduce + 43:290 reduce + 2:278 reduce + 22:299,target 35 + 67:299,target 59 + 2:280 reduce + 2:279 reduce + 53:288,target 21 + 2:281 reduce + 73:299 reduce + 2:282 reduce + 2:283 reduce + 35:285,target 3 + 4:318,target 25 + 8:0,target 56 + 9:267,target 43 + 43:299 reduce + 82:0,target 33 + 13:307 shift + 17:282,target 58 + 47:287,target 15 + 51:0,target 19 + 2:299,target 43 + 13:316,target 23 + 59:290,target 27 + 59:289,target 27 + 19:0,target 44 + 20:0,target 61 + 51:0 reduce + 2:299 reduce + 13:316 shift + 0:301,target 4 + 13:317 shift + 13:318 shift + 1:274,target 42 + 13:319 shift + 13:320 shift + 42:286,target 10 + 13:321 shift + 2:257,target 43 + 23:299,target 67 + 68:299,target 62 + 54:288,target 22 + 10:272,target 48 + 13:329 goto + 13:330 goto + 48:284 reduce + 36:285,target 4 + 48:285 reduce + 48:286 reduce + 48:287 reduce + 48:288 reduce + 48:290 reduce + 48:289 reduce + 48:287,target 16 + 78:299 reduce + 23:0 reduce + 48:299 reduce + 5:0,target 48 + 78:0,target 29 + 2:274,target 43 + 43:286,target 11 + 65:0 reduce + 24:299,target 68 + 70:299,target 36 + 69:299,target 85 + 47:0,target 15 + 55:288,target 23 + 7:297 shift + 7:298 shift + 16:0,target 52 + 22:291,target 70 + 37:285,target 5 + 50:287,target 18 + 49:287,target 17 + 9:258,target 34 + 54:284 reduce + 17:273,target 49 + 54:285 reduce + 54:286 reduce + 7:325 goto + 13:307,target 22 + 54:287 reduce + 37:0 reduce + 54:288 reduce + 44:286,target 12 + 54:290 reduce + 54:289 reduce + 25:299,target 69 + 71:299,target 39 + 84:299 reduce + 80:0 reduce + 79:0 reduce + 56:288,target 24 + 1:265,target 42 + 54:299 reduce + 2:0,target 43 + 38:285,target 6 + 75:0,target 41 + 10:263,target 39 + 51:287,target 19 + 9:275,target 51 + 24:299 reduce + 44:0,target 12 + 5:299,target 48 + 33:284,target 1 + 10:332,target 66 + 45:286,target 13 + 0:308,target 10 + 0:298,target 2 + 52:0 reduce + 26:299,target 70 + 72:299,target 37 + 1:282,target 42 + 57:288,target 25 + 2:265,target 43 + 59:284 reduce + 59:285 reduce + 59:286 reduce + 10:279,target 55 + 10:280,target 56 + 39:285,target 7 + 40:285,target 8 + 59:287 reduce + 59:288 reduce + 59:290 reduce + 59:289 reduce + 52:287,target 20 + 6:299,target 55 + 34:284,target 2 + 60:299 reduce + 59:299 reduce + 72:0,target 37 + 0:325,target 17 + 46:286,target 14 + 24:0 reduce + 17:264,target 40 + 29:299 reduce + 30:299 reduce + 27:299,target 71 + 41:0,target 9 + 73:299,target 40 + 2:282,target 43 + 58:288,target 26 + 66:0 reduce + 41:285,target 9 + 53:287,target 21 + 35:284,target 3 + 4:317,target 24 + 9:266,target 42 + 17:281,target 57 + 35:284 reduce + 47:286,target 15 + 35:285 reduce + 35:286 reduce + 28:299,target 72 + 35:287 reduce + 74:299,target 38 + 35:288 reduce + 59:288,target 27 + 35:289 reduce + 35:290 reduce + 38:0 reduce + 0:300,target 3 + 65:299 reduce + 1:273,target 42 + 42:285,target 10 + 81:0 reduce + 68:0,target 62 + 35:299 reduce + 54:287,target 22 + 37:0,target 5 + 10:271,target 47 + 8:299,target 56 + 9:283,target 59 + 36:284,target 4 + 48:286,target 16 + 11:0 reduce + 29:299,target 58 + 30:299,target 66 + 75:299,target 41 + 53:0 reduce + 2:273,target 43 + 43:285,target 11 + 41:284 reduce + 41:285 reduce + 41:286 reduce + 55:287,target 23 + 41:287 reduce + 41:288 reduce + 9:299,target 73 + 9:310,target 61 + 41:289 reduce + 41:290 reduce + 37:284,target 5 + 71:299 reduce + 65:0,target 78 + 50:286,target 18 + 49:286,target 17 + 41:299 reduce + 9:257,target 33 + 34:0,target 2 + 0:300 shift + 31:299,target 42 + 76:299,target 65 + 0:301 shift + 0:302 shift + 0:303 shift + 11:299 reduce + 17:272,target 48 + 0:304 shift + 25:0 reduce + 0:306 shift + 0:307 shift + 0:297 shift + 44:285,target 12 + 0:308 shift + 0:298 shift + 0:309 shift + 67:0 reduce + 0:311 shift + 0:312 shift + 56:287,target 24 + 0:313 shift + 1:264,target 42 + 0:314 shift + 0:315 shift + 68:290,target 83 + 68:289,target 82 + 38:284,target 6 + 10:262,target 38 + 46:284 reduce + 51:286,target 19 + 9:274,target 50 + 46:285 reduce + 0:325 goto + 46:286 reduce + 0:326 goto + 46:287 reduce + 32:299,target 57 + 46:288 reduce + 77:299,target 28 + 0:328 goto + 46:289 reduce + 46:290 reduce + 76:299 reduce + 62:0,target 75 + 45:285,target 13 + 39:0 reduce + 40:0 reduce + 0:307,target 9 + 0:297,target 1 + 46:299 reduce + 1:281,target 42 + 31:0,target 42 + 57:287,target 25 + 2:264,target 43 + 82:0 reduce + 16:299 reduce + 10:278,target 54 + 39:284,target 7 + 40:284,target 8 + 5:299 reduce + 52:286,target 20 + 33:299,target 1 + 78:299,target 29 + 12:0 reduce + 46:285,target 14 + 52:284 reduce + 52:285 reduce + 17:263,target 39 + 52:286 reduce + 52:287 reduce + 2:281,target 43 + 58:287,target 26 + 54:0 reduce + 52:288 reduce + 52:290 reduce + 52:289 reduce + 10:305,target 64 + 82:299 reduce + 41:284,target 9 + 58:0,target 26 + 22:291 shift + 22:292 shift + 22:293 shift + 53:286,target 21 + 52:299 reduce + 22:294 shift + 22:295 shift + 27:0,target 71 + 7:298,target 2 + 22:296 shift + 34:299,target 2 + 80:299,target 31 + 79:299,target 30 + 22:299 reduce + 4:316,target 23 + 9:265,target 41 + 17:279,target 55 + 17:280,target 56 + 47:285,target 15 + 26:0 reduce + 59:287,target 27 + 10:322,target 65 + 22:324 goto + 68:0 reduce + 1:272,target 42 + 42:284,target 10 + 22:324,target 76 + 1:0 reduce + 57:284 reduce + 57:285 reduce + 57:286 reduce + 54:286,target 22 + 7:325,target 32 + 57:287 reduce + 10:269,target 45 + 10:270,target 46 + 57:288 reduce + 57:290 reduce + 57:289 reduce + 35:299,target 3 + 81:299,target 32 + 9:282,target 58 + 55:0,target 23 + 48:285,target 16 + 57:299 reduce + 3:297,target 21 + 24:0,target 68 + 0:315,target 16 + 27:299 reduce + 41:0 reduce + 2:272,target 43 + 43:284,target 11 + 83:0 reduce + 55:286,target 23 + 36:299,target 4 + 82:299,target 33 + 50:285,target 18 + 49:285,target 17 + 4:307,target 22 + 9:0,target 73 + 33:284 reduce + 17:271,target 47 + 33:285 reduce + 83:0,target 34 + 33:286 reduce + 33:287 reduce + 33:288 reduce + 33:289 reduce + 33:290 reduce + 44:284,target 12 + 55:0 reduce + 52:0,target 20 + 63:299 reduce + 56:286,target 24 + 21:0,target 64 + 1:263,target 42 + 37:299,target 5 + 83:299,target 34 + 33:299 reduce + 68:288,target 81 + 10:261,target 37 + 51:285,target 19 + 9:273,target 49 + 27:0 reduce + 45:284,target 13 + 68:284 shift + 0:306,target 8 + 68:285 shift + 68:286 shift + 1:280,target 42 + 1:279,target 42 + 70:0 reduce + 68:287 shift + 57:286,target 25 + 68:288 shift + 2:263,target 43 + 68:290 shift + 68:289 shift + 6:0,target 55 + 38:284 reduce + 2:0 reduce + 38:285 reduce + 38:299,target 6 + 84:299,target 63 + 80:0,target 31 + 79:0,target 30 + 38:286 reduce + 10:277,target 53 + 38:287 reduce + 38:288 reduce + 38:289 reduce + 38:290 reduce + 48:0,target 16 + 52:285,target 20 + 68:299 reduce + 38:299 reduce + 46:284,target 14 + 17:262,target 38 + 68:323 goto + 42:0 reduce + 2:280,target 43 + 2:279,target 43 + 58:286,target 26 + 39:299,target 7 + 40:299,target 8 + 84:0 reduce + 22:296,target 75 + 53:285,target 21 + 7:297,target 31 + 44:284 reduce + 44:285 reduce + 76:0,target 65 + 9:264,target 40 + 44:286 reduce + 44:287 reduce + 44:288 reduce + 44:289 reduce + 44:290 reduce + 17:278,target 54 + 45:0,target 13 + 47:284,target 15 + 14:0 reduce + 74:299 reduce + 14:0,target 51 + 59:286,target 27 + 56:0 reduce + 41:299,target 9 + 44:299 reduce + 1:271,target 42 + 14:299 reduce + 54:285,target 22 + 10:268,target 44 + 3:297 shift + 9:281,target 57 + 33:289,target 1 + 33:290,target 1 + 13:329,target 67 + 13:330,target 30 + 48:284,target 16 + 28:0 reduce + 50:284 reduce + 49:284 reduce + 0:314,target 15 + 50:285 reduce + 49:285 reduce + 73:0,target 40 + 50:286 reduce + 49:286 reduce + 42:299,target 10 + 50:287 reduce + 49:287 reduce + 50:288 reduce + 49:288 reduce + 2:271,target 43 + 71:0 reduce + 50:290 reduce + 50:289 reduce + 49:290 reduce + 49:289 reduce + 68:323,target 84 + 42:0,target 10 + 80:299 reduce + 79:299 reduce + 55:285,target 23 + 11:0,target 53 + 50:299 reduce + 49:299 reduce + 17:322,target 68 + 34:289,target 2 + 34:290,target 2 + 50:284,target 18 + 49:284,target 17 + 19:299 reduce + 20:299 reduce + 8:299 reduce + 17:269,target 45 + 17:270,target 46 + 43:299,target 11 + 43:0 reduce + 85:0 reduce + 56:285,target 24 + 1:262,target 42 + 19:327 goto + 55:284 reduce + 55:285 reduce + 70:0,target 36 + 68:287,target 80 + 55:286 reduce + 55:287 reduce + 55:288 reduce + 10:259,target 35 + 10:260,target 36 + 55:290 reduce + 55:289 reduce + 35:289,target 3 + 35:290,target 3 + 38:0,target 6 + 51:284,target 19 + 9:272,target 48 + 13:321,target 28 + 55:299 reduce + 15:0 reduce + 44:299,target 12 + 25:299 reduce + 57:0 reduce + 1:278,target 42 + 57:285,target 25 + 2:262,target 43 + 10:276,target 52 + 36:289,target 4 + 36:290,target 4 + 52:284,target 20 + 66:0,target 49 + 45:299,target 13 + 29:0 reduce + 30:0 reduce + 35:0,target 3 + 1:305,target 20 + 17:261,target 37 + 2:278,target 43 + 58:285,target 26 + 72:0 reduce + 61:299 reduce + 22:295,target 74 + 31:299 reduce + 37:289,target 5 + 37:290,target 5 + 53:284,target 21 + 9:263,target 39 + 46:299,target 14 + 17:277,target 53 + 59:285,target 27 + 44:0 reduce + 63:0,target 50 + 1:270,target 42 + 1:269,target 42 + 36:284 reduce + 32:0,target 57 + 36:285 reduce + 36:286 reduce + 38:289,target 6 + 38:290,target 6 + 54:284,target 22 + 36:287 reduce + 10:267,target 43 + 36:288 reduce + 36:289 reduce + 36:290 reduce + 9:279,target 55 + 9:280,target 56 + 66:299 reduce + 47:299,target 15 + 33:288,target 1 + 36:299 reduce + 16:0 reduce + 0:313,target 14 + 58:0 reduce + 2:270,target 43 + 2:269,target 43 + 1:257 reduce + 1:258 reduce + 1:260 reduce + 1:259 reduce + 1:261 reduce + 39:289,target 7 + 39:290,target 7 + 40:289,target 8 + 40:290,target 8 + 55:284,target 23 + 1:262 reduce + 1:263 reduce + 1:264 reduce + 1:265 reduce + 1:266 reduce + 1:267 reduce + 60:0,target 74 + 59:0,target 27 + 1:268 reduce + 1:270 reduce + 1:269 reduce + 48:299,target 16 + 1:271 reduce + 1:272 reduce + 34:288,target 2 + 42:284 reduce + 1:273 reduce + 28:0,target 72 + 42:285 reduce + 1:274 reduce + 42:286 reduce + 1:275 reduce + 42:287 reduce + 1:276 reduce + 42:288 reduce + 1:277 reduce + 42:289 reduce + 42:290 reduce + 1:278 reduce + 1:280 reduce + 1:279 reduce + 17:268,target 44 + 1:281 reduce + 31:0 reduce + 72:299 reduce + 1:282 reduce + 1:283 reduce + 73:0 reduce + 42:299 reduce + 41:289,target 9 + 41:290,target 9 + 56:284,target 24 + 5:0 reduce + 1:261,target 42 + 17:257 shift + 12:299 reduce + 17:258 shift + 17:259 shift + 17:260 shift + 68:286,target 79 + 1:305 shift + 17:261 shift + 17:262 shift + 10:258,target 34 + 17:263 shift + 50:299,target 18 + 49:299,target 17 + 17:264 shift + 1:299 reduce + 17:265 shift + 35:288,target 3 + 9:271,target 47 + 17:266 shift + 17:267 shift + 17:268 shift + 17:269 shift + 17:270 shift + 17:271 shift + 17:272 shift + 13:319,target 26 + 13:320,target 27 + 17:273 shift + 17:274 shift + 56:0,target 24 + 17:275 shift + 17:276 shift + 17:277 shift + 17:278 shift + 45:0 reduce + 47:284 reduce + 0:304,target 7 + 17:279 shift + 17:280 shift + 25:0,target 69 + 47:285 reduce + 17:281 shift + 47:286 reduce + 1:277,target 42 + 17:282 shift + 42:289,target 10 + 42:290,target 10 + 47:287 reduce + 57:284,target 25 + 17:283 shift + 47:288 reduce + 2:261,target 43 + 47:289 reduce + 47:290 reduce + 77:299 reduce + 10:275,target 51 + 51:299,target 19 + 36:288,target 4 + 47:299 reduce + 6:299 reduce + 17:259,target 35 + 17:260,target 36 + 2:277,target 43 + 43:289,target 11 + 43:290,target 11 + 60:0 reduce + 59:0 reduce + 58:284,target 26 + 84:0,target 63 + 17:322 goto + 53:0,target 21 + 53:284 reduce + 52:299,target 20 + 22:294,target 73 + 53:285 reduce + 22:0,target 35 + 37:288,target 5 + 53:286 reduce + 53:287 reduce + 53:288 reduce + 53:290 reduce + 53:289 reduce + 9:262,target 38 + 83:299 reduce + 17:276,target 52 + 53:299 reduce + 32:0 reduce + 44:289,target 12 + 44:290,target 12 + 59:284,target 27 + 23:299 reduce + 74:0 reduce + 9:331,target 63 + 1:268,target 42 + 6:0 reduce + 53:299,target 21 + 38:288,target 6 + 10:266,target 42 + 81:0,target 32 + 4:330,target 30 + 4:329,target 29 + 9:278,target 54 + 50:0,target 18 + 49:0,target 17 + 33:287,target 1 + 58:284 reduce + 58:285 reduce + 18:0,target 0 + 58:286 reduce + 58:287 reduce + 58:288 reduce + 45:289,target 13 + 45:290,target 13 + 58:290 reduce + 58:289 reduce + 0:312,target 13 + 46:0 reduce + 2:268,target 43 + 54:299,target 22 + 58:299 reduce + 10:283,target 59 + 39:288,target 7 + 40:288,target 8 + 9:305,target 60 + 28:299 reduce + 34:287,target 2 + 0:328,target 19 + 46:289,target 14 + 46:290,target 14 + 77:0,target 28 + 18:0 accept + 17:267,target 43 + 46:0,target 14 + 61:0 reduce + 55:299,target 23 + 15:0,target 54 + 41:288,target 9 + 9:322,target 62 + 1:260,target 42 + 1:259,target 42 + 34:284 reduce + 34:285 reduce + 34:286 reduce + 68:285,target 78 + 34:287 reduce + 34:288 reduce + 10:257,target 33 + 34:289 reduce + 34:290 reduce + 35:287,target 3 + 4:321,target 28 + 9:269,target 45 + 9:270,target 46 + 64:299 reduce + 47:289,target 15 + 47:290,target 15 + 13:318,target 25 + 34:299 reduce + 33:0 reduce + 10:257 shift + 10:258 shift + 0:303,target 6 + 10:259 shift + 10:260 shift + 11:299,target 53 + 56:299,target 24 + 10:261 shift + 1:276,target 42 + 10:262 shift + 42:288,target 10 + 75:0 reduce + 1:0,target 60 + 10:263 shift + 2:260,target 43 + 2:259,target 43 + 10:264 shift + 74:0,target 38 + 10:265 shift + 10:266 shift + 10:267 shift + 10:268 shift + 10:274,target 50 + 10:269 shift + 10:270 shift + 43:0,target 11 + 10:271 shift + 10:272 shift + 10:273 shift + 36:287,target 4 + 10:274 shift + 12:0,target 47 + 10:275 shift + 10:276 shift + 10:277 shift + 48:290,target 16 + 48:289,target 16 + 10:278 shift + 39:284 reduce + 40:284 reduce + 10:279 shift + 10:280 shift + 39:285 reduce + 40:285 reduce + 10:281 shift + 39:286 reduce + 40:286 reduce + 10:282 shift + 39:287 reduce + 40:287 reduce + 10:283 shift + 39:288 reduce + 40:288 reduce + 39:289 reduce + 39:290 reduce + 40:289 reduce + 40:290 reduce + 12:299,target 47 + 17:258,target 34 + 70:299 reduce + 69:299 shift + 57:299,target 25 + 47:0 reduce + 2:276,target 43 + 43:288,target 11 + 39:299 reduce + 40:299 reduce + 10:305 shift + 22:293,target 72 + 37:287,target 5 + 71:0,target 39 + 50:290,target 18 + 50:289,target 18 + 49:290,target 17 + 49:289,target 17 + 9:261,target 37 + 39:0,target 7 + 40:0,target 8 + 10:322 goto + 17:275,target 51 + 19:0 reduce + 20:0 reduce + 58:299,target 26 + 44:288,target 12 + 45:284 reduce + 62:0 reduce + 45:285 reduce + 10:332 goto + 45:286 reduce + 45:287 reduce + 1:267,target 42 + 45:288 reduce + 45:289 reduce + 45:290 reduce + 38:287,target 6 + 75:299 reduce + 10:265,target 41 + 51:290,target 19 + 51:289,target 19 + 9:277,target 53 + 45:299 reduce + 33:286,target 1 + 15:299 reduce + 14:299,target 51 + 60:299,target 74 + 59:299,target 27 + 4:307 shift + 45:288,target 13 + 9:257 shift + 34:0 reduce + 67:0,target 59 + 0:311,target 12 + 9:258 shift + 9:259 shift + 9:260 shift + 9:261 shift + 9:262 shift + 2:267,target 43 + 9:263 shift + 36:0,target 4 + 76:0 reduce + 9:264 shift + 4:316 shift + 9:265 shift + 4:317 shift + 9:266 shift + 8:0 reduce + 4:318 shift + 9:267 shift + 10:282,target 58 + 39:287,target 7 + 40:287,target 8 + 4:320 shift + 4:319 shift + 9:268 shift + 19:327,target 69 + 4:321 shift + 9:269 shift + 9:270 shift + 9:271 shift + 51:284 reduce + 9:272 shift + 52:290,target 20 + 52:289,target 20 + 51:285 reduce + 9:273 shift + 51:286 reduce + 9:274 shift + 51:287 reduce + 9:275 shift + 51:288 reduce + 9:276 shift + 51:290 reduce + 51:289 reduce + 9:277 shift + 4:330 goto + 4:329 goto + 9:278 shift + 34:286,target 2 + 9:279 shift + 9:280 shift + 9:281 shift + 81:299 reduce + 9:282 shift + 15:299,target 54 +} + +array set cube::rules { + 9,l 322 + 11,l 322 + 32,l 323 + 53,l 328 + 74,l 331 + 6,l 322 + 28,l 323 + 50,l 328 + 49,l 328 + 71,l 330 + 3,l 322 + 25,l 322 + 46,l 326 + 67,l 330 + 0,l 333 + 22,l 322 + 43,l 325 + 64,l 328 + 18,l 322 + 40,l 324 + 39,l 324 + 61,l 328 + 15,l 322 + 36,l 324 + 57,l 328 + 78,l 332 + 12,l 322 + 33,l 323 + 54,l 328 + 75,l 331 + 7,l 322 + 29,l 323 + 30,l 323 + 51,l 328 + 72,l 330 + 4,l 322 + 26,l 322 + 47,l 328 + 68,l 330 + 1,l 322 + 23,l 322 + 44,l 326 + 65,l 329 + 19,l 322 + 20,l 322 + 41,l 324 + 62,l 328 + 16,l 322 + 37,l 324 + 58,l 328 + 13,l 322 + 34,l 323 + 55,l 328 + 76,l 331 + 8,l 322 + 10,l 322 + 31,l 323 + 52,l 328 + 73,l 331 + 5,l 322 + 27,l 322 + 48,l 328 + 70,l 330 + 69,l 330 + 2,l 322 + 24,l 322 + 45,l 327 + 66,l 329 + 21,l 322 + 42,l 325 + 63,l 328 + 17,l 322 + 38,l 324 + 60,l 328 + 59,l 328 + 14,l 322 + 35,l 324 + 56,l 328 + 77,l 332 +} + +array set cube::rules { + 63,dc 3 + 12,dc 1 + 77,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 70,dc 1 + 69,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 2 + 11,dc 1 + 76,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 1 + 68,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 3 + 61,dc 2 + 10,dc 1 + 75,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 1 + 67,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 0 + 60,dc 1 + 59,dc 2 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 1 + 66,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 58,dc 2 + 73,dc 0 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 65,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 57,dc 2 + 72,dc 1 + 21,dc 1 + 35,dc 0 + 50,dc 2 + 49,dc 2 + 64,dc 2 + 13,dc 1 + 78,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 1 + 71,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set cube::rules { + 41,line 173 + 7,line 137 + 37,line 169 + 4,line 134 + 34,line 165 + 1,line 131 + 31,line 162 + 27,line 157 + 24,line 154 + 21,line 151 + 76,line 219 + 17,line 147 + 73,line 216 + 14,line 144 + 70,line 211 + 69,line 210 + 11,line 141 + 66,line 205 + 63,line 200 + 60,line 196 + 59,line 195 + 56,line 192 + 53,line 189 + 50,line 186 + 49,line 185 + 46,line 180 + 43,line 176 + 9,line 139 + 40,line 172 + 39,line 171 + 6,line 136 + 36,line 168 + 3,line 133 + 33,line 164 + 29,line 160 + 30,line 161 + 26,line 156 + 23,line 153 + 78,line 223 + 19,line 149 + 20,line 150 + 75,line 218 + 16,line 146 + 72,line 213 + 13,line 143 + 68,line 209 + 10,line 140 + 65,line 204 + 62,line 198 + 58,line 194 + 55,line 191 + 52,line 188 + 48,line 184 + 45,line 179 + 42,line 175 + 8,line 138 + 38,line 170 + 5,line 135 + 35,line 167 + 2,line 132 + 32,line 163 + 28,line 159 + 25,line 155 + 22,line 152 + 77,line 222 + 45,e 1 + 18,line 148 + 74,line 217 + 15,line 145 + 71,line 212 + 12,line 142 + 67,line 208 + 64,line 201 + 61,line 197 + 57,line 193 + 54,line 190 + 51,line 187 + 47,line 183 + 44,line 179 +} + +array set cube::lr1_table { + 35 {{2 {0 299} 1}} + 66,trans {} + 36 {{3 {0 299} 1}} + 85,trans {} + 37 {{4 {0 299} 1}} + 38 {{5 {0 299} 1}} + 39 {{6 {0 299} 1}} + 40 {{7 {0 299} 1}} + 41 {{8 {0 299} 1}} + 42 {{9 {0 299} 1}} + 43 {{10 {0 299} 1}} + 44 {{11 {0 299} 1}} + 45 {{12 {0 299} 1}} + 46 {{13 {0 299} 1}} + 47 {{14 {0 299} 1}} + 48 {{15 {0 299} 1}} + 49 {{16 {0 299} 1}} + 50 {{17 {0 299} 1}} + 27,trans {} + 51 {{18 {0 299} 1}} + 46,trans {} + 52 {{19 {0 299} 1}} + 65,trans {} + 53 {{20 {0 299} 1}} + 84,trans {} + 54 {{21 {0 299} 1}} + 55 {{22 {0 299} 1}} + 56 {{23 {0 299} 1}} + 57 {{24 {0 299} 1}} + 58 {{25 {0 299} 1}} + 59 {{26 {0 299} 1}} + 60 {{27 {0 299} 1}} + 61 {{74 {0 299} 1}} + 62 {{76 {0 299} 1}} + 63 {{75 {0 299} 1}} + 64 {{50 {0 299} 2}} + 65 {{77 {0 299} 1}} + 66 {{78 {0 299} 1}} + 26,trans {} + 67 {{49 {0 299} 2}} + 45,trans {} + 68 {{59 {0 299} 2}} + 64,trans {} + 69 {{1 {0 284 285 286 287 288 289 290 299} 1}} + 70 {{2 {0 284 285 286 287 288 289 290 299} 1}} + 83,trans {} + 71 {{3 {0 284 285 286 287 288 289 290 299} 1}} + 72 {{4 {0 284 285 286 287 288 289 290 299} 1}} + 73 {{5 {0 284 285 286 287 288 289 290 299} 1}} + 74 {{6 {0 284 285 286 287 288 289 290 299} 1}} + 75 {{7 {0 284 285 286 287 288 289 290 299} 1}} + 76 {{8 {0 284 285 286 287 288 289 290 299} 1}} + 77 {{9 {0 284 285 286 287 288 289 290 299} 1}} + 78 {{10 {0 284 285 286 287 288 289 290 299} 1}} + 79 {{11 {0 284 285 286 287 288 289 290 299} 1}} + 80 {{12 {0 284 285 286 287 288 289 290 299} 1}} + 81 {{13 {0 284 285 286 287 288 289 290 299} 1}} + 82 {{14 {0 284 285 286 287 288 289 290 299} 1}} + 83 {{15 {0 284 285 286 287 288 289 290 299} 1}} + 25,trans {} + 84 {{16 {0 284 285 286 287 288 289 290 299} 1}} + 44,trans {} + 85 {{17 {0 284 285 286 287 288 289 290 299} 1}} + 63,trans {} + 86 {{18 {0 284 285 286 287 288 289 290 299} 1}} + 82,trans {} + 87 {{19 {0 284 285 286 287 288 289 290 299} 1}} + 0 {{0 0 0} {44 0 0} {46 0 0} {47 {0 299} 0} {48 {0 299} 0} {49 {0 299} 0} {50 {0 299} 0} {51 {0 299} 0} {52 {0 299} 0} {53 {0 299} 0} {54 {0 299} 0} {55 {0 299} 0} {56 {0 299} 0} {57 {0 299} 0} {58 {0 299} 0} {59 {0 299} 0} {60 {0 299} 0} {61 {0 299} 0} {62 {0 299} 0} {63 {0 299} 0} {64 {0 299} 0} {42 {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} 0} {43 {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} 0}} + 88 {{20 {0 284 285 286 287 288 289 290 299} 1}} + 1 {{60 {0 299} 1} {61 {0 299} 1} {42 {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} 1}} + 89 {{21 {0 284 285 286 287 288 289 290 299} 1}} + 90 {{22 {0 284 285 286 287 288 289 290 299} 1}} + 2 {{43 {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} 1}} + 91 {{23 {0 284 285 286 287 288 289 290 299} 1}} + 3 {{64 {0 299} 1}} + 92 {{24 {0 284 285 286 287 288 289 290 299} 1}} + 4 {{58 {0 299} 1} {65 {0 299} 0} {66 {0 299} 0} {67 {0 299} 0} {68 {0 299} 0} {69 {0 299} 0} {70 {0 299} 0} {71 {0 299} 0} {72 {0 299} 0}} + 93 {{25 {0 284 285 286 287 288 289 290 299} 1}} + 5 {{48 {0 299} 1}} + 94 {{26 {0 284 285 286 287 288 289 290 299} 1}} + 6 {{55 {0 299} 1}} + 95 {{27 {0 284 285 286 287 288 289 290 299} 1}} + 7 {{57 {0 299} 1} {42 {0 299} 0} {43 {0 299} 0}} + 96 {{62 {0 299} 2} {63 {0 299} 2} {28 {0 299} 0} {29 {0 299} 0} {30 {0 299} 0} {31 {0 299} 0} {32 {0 299} 0} {33 {0 299} 0} {34 {0 299} 0}} + 8 {{56 {0 299} 1}} + 97 {{46 0 2}} + 9 {{50 {0 299} 1} {73 {0 299} 0} {74 {0 299} 0} {75 {0 299} 0} {76 {0 299} 0} {1 {0 299} 0} {2 {0 299} 0} {3 {0 299} 0} {4 {0 299} 0} {5 {0 299} 0} {6 {0 299} 0} {7 {0 299} 0} {8 {0 299} 0} {9 {0 299} 0} {10 {0 299} 0} {11 {0 299} 0} {12 {0 299} 0} {13 {0 299} 0} {14 {0 299} 0} {15 {0 299} 0} {16 {0 299} 0} {17 {0 299} 0} {18 {0 299} 0} {19 {0 299} 0} {20 {0 299} 0} {21 {0 299} 0} {22 {0 299} 0} {23 {0 299} 0} {24 {0 299} 0} {25 {0 299} 0} {26 {0 299} 0} {27 {0 299} 0}} + 98 {{36 {0 299} 1}} + 99 {{39 {0 299} 1}} + 24,trans {} + 43,trans {} + 62,trans {} + 81,trans {} + 99,trans {} + 113,trans {} + 23,trans {} + 42,trans {} + 61,trans {} + 79,trans {} + 80,trans {} + 98,trans {} + 9,trans {{257 34} {258 35} {259 36} {260 37} {261 38} {262 39} {263 40} {264 41} {265 42} {266 43} {267 44} {268 45} {269 46} {270 47} {271 48} {272 49} {273 50} {274 51} {275 52} {276 53} {277 54} {278 55} {279 56} {280 57} {281 58} {282 59} {283 60} {305 61} {310 62} {322 63} {331 64}} + 112,trans {} + 22,trans {{291 98} {292 99} {293 100} {294 101} {295 102} {296 103} {324 104}} + 41,trans {} + 59,trans {} + 60,trans {} + 78,trans {} + 97,trans {{299 113}} + 8,trans {} + 111,trans {} + 100 {{37 {0 299} 1}} + 101 {{40 {0 299} 1}} + 102 {{38 {0 299} 1}} + 103 {{41 {0 299} 1}} + 104 {{65 {0 299} 2}} + 105 {{28 {0 299} 1}} + 106 {{29 {0 299} 1}} + 21,trans {} + 107 {{30 {0 299} 1}} + 39,trans {} + 40,trans {} + 108 {{31 {0 299} 1}} + 58,trans {} + 110 {{33 {0 299} 1}} + 109 {{32 {0 299} 1}} + 77,trans {} + 96,trans {{284 105} {285 106} {286 107} {287 108} {288 109} {289 110} {290 111} {323 112}} + 111 {{34 {0 299} 1}} + 7,trans {{297 31} {298 32} {325 33}} + 112 {{63 {0 299} 3}} + 113 {{46 0 3}} + 110,trans {} + 109,trans {} + 19,trans {{327 97}} + 20,trans {} + 38,trans {} + 57,trans {} + 76,trans {} + 95,trans {} + 6,trans {} + 108,trans {} + 18,trans {} + 37,trans {} + 56,trans {} + 75,trans {} + 94,trans {} + 5,trans {} + 107,trans {} + 17,trans {{257 69} {258 70} {259 71} {260 72} {261 73} {262 74} {263 75} {264 76} {265 77} {266 78} {267 79} {268 80} {269 81} {270 82} {271 83} {272 84} {273 85} {274 86} {275 87} {276 88} {277 89} {278 90} {279 91} {280 92} {281 93} {282 94} {283 95} {322 96}} + 36,trans {} + 55,trans {} + 74,trans {} + 93,trans {} + 4,trans {{307 22} {316 23} {317 24} {318 25} {319 26} {320 27} {321 28} {329 29} {330 30}} + 106,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 73,trans {} + 92,trans {} + 3,trans {{297 21}} + 105,trans {} + 15,trans {} + 34,trans {} + 53,trans {} + 72,trans {} + 91,trans {} + 2,trans {} + 104,trans {} + 14,trans {} + 33,trans {} + 52,trans {} + 71,trans {} + 90,trans {} + 89,trans {} + 1,trans {{305 20}} + 103,trans {} + 13,trans {{307 22} {316 23} {317 24} {318 25} {319 26} {320 27} {321 28} {329 68} {330 30}} + 32,trans {} + 51,trans {} + 69,trans {} + 70,trans {} + 88,trans {} + 0,trans {{297 1} {298 2} {300 3} {301 4} {302 5} {303 6} {304 7} {306 8} {307 9} {308 10} {309 11} {311 12} {312 13} {313 14} {314 15} {315 16} {325 17} {326 18} {328 19}} + 102,trans {} + 12,trans {} + 31,trans {} + 49,trans {} + 50,trans {} + 68,trans {} + 87,trans {} + 101,trans {} + 10 {{49 {0 299} 1} {77 {0 299} 0} {78 {0 299} 0} {1 {0 299} 0} {2 {0 299} 0} {3 {0 299} 0} {4 {0 299} 0} {5 {0 299} 0} {6 {0 299} 0} {7 {0 299} 0} {8 {0 299} 0} {9 {0 299} 0} {10 {0 299} 0} {11 {0 299} 0} {12 {0 299} 0} {13 {0 299} 0} {14 {0 299} 0} {15 {0 299} 0} {16 {0 299} 0} {17 {0 299} 0} {18 {0 299} 0} {19 {0 299} 0} {20 {0 299} 0} {21 {0 299} 0} {22 {0 299} 0} {23 {0 299} 0} {24 {0 299} 0} {25 {0 299} 0} {26 {0 299} 0} {27 {0 299} 0}} + 11 {{53 {0 299} 1}} + 12 {{47 {0 299} 1}} + 13 {{59 {0 299} 1} {65 {0 299} 0} {66 {0 299} 0} {67 {0 299} 0} {68 {0 299} 0} {69 {0 299} 0} {70 {0 299} 0} {71 {0 299} 0} {72 {0 299} 0}} + 14 {{51 {0 299} 1}} + 15 {{54 {0 299} 1}} + 11,trans {} + 16 {{52 {0 299} 1}} + 29,trans {} + 30,trans {} + 17 {{62 {0 299} 1} {63 {0 299} 1} {1 {0 284 285 286 287 288 289 290 299} 0} {2 {0 284 285 286 287 288 289 290 299} 0} {3 {0 284 285 286 287 288 289 290 299} 0} {4 {0 284 285 286 287 288 289 290 299} 0} {5 {0 284 285 286 287 288 289 290 299} 0} {6 {0 284 285 286 287 288 289 290 299} 0} {7 {0 284 285 286 287 288 289 290 299} 0} {8 {0 284 285 286 287 288 289 290 299} 0} {9 {0 284 285 286 287 288 289 290 299} 0} {10 {0 284 285 286 287 288 289 290 299} 0} {11 {0 284 285 286 287 288 289 290 299} 0} {12 {0 284 285 286 287 288 289 290 299} 0} {13 {0 284 285 286 287 288 289 290 299} 0} {14 {0 284 285 286 287 288 289 290 299} 0} {15 {0 284 285 286 287 288 289 290 299} 0} {16 {0 284 285 286 287 288 289 290 299} 0} {17 {0 284 285 286 287 288 289 290 299} 0} {18 {0 284 285 286 287 288 289 290 299} 0} {19 {0 284 285 286 287 288 289 290 299} 0} {20 {0 284 285 286 287 288 289 290 299} 0} {21 {0 284 285 286 287 288 289 290 299} 0} {22 {0 284 285 286 287 288 289 290 299} 0} {23 {0 284 285 286 287 288 289 290 299} 0} {24 {0 284 285 286 287 288 289 290 299} 0} {25 {0 284 285 286 287 288 289 290 299} 0} {26 {0 284 285 286 287 288 289 290 299} 0} {27 {0 284 285 286 287 288 289 290 299} 0}} + 48,trans {} + 18 {{0 0 1}} + 67,trans {} + 20 {{61 {0 299} 2}} + 19 {{44 0 1} {46 0 1} {45 299 0}} + 86,trans {} + 21 {{64 {0 299} 2}} + 22 {{65 {0 299} 1} {35 {0 299} 0} {36 {0 299} 0} {37 {0 299} 0} {38 {0 299} 0} {39 {0 299} 0} {40 {0 299} 0} {41 {0 299} 0}} + 100,trans {} + 23 {{67 {0 299} 1}} + 24 {{68 {0 299} 1}} + 25 {{69 {0 299} 1}} + 26 {{70 {0 299} 1}} + 27 {{71 {0 299} 1}} + 28 {{72 {0 299} 1}} + 30 {{66 {0 299} 1}} + 29 {{58 {0 299} 2}} + 31 {{42 {0 299} 1}} + 32 {{43 {0 299} 1}} + 10,trans {{257 34} {258 35} {259 36} {260 37} {261 38} {262 39} {263 40} {264 41} {265 42} {266 43} {267 44} {268 45} {269 46} {270 47} {271 48} {272 49} {273 50} {274 51} {275 52} {276 53} {277 54} {278 55} {279 56} {280 57} {281 58} {282 59} {283 60} {305 65} {322 66} {332 67}} + 33 {{57 {0 299} 2}} + 28,trans {} + 34 {{1 {0 299} 1}} + 47,trans {} +} + +array set cube::token_id_table { + 286 FK5_ + 286,t 0 + 287 J2000_ + 292,line 44 + 302,line 59 + 288 ICRS_ + 317,t 0 + 265,title WCSH + 289 GALACTIC_ + 290 ECLIPTIC_ + 300 AXIS_ + 284,title FK4 + 291 YES_ + 301 AXES_ + 313,title PLAY + 292 NO_ + 302 CLOSE_ + 332,title {} + 288,line 39 + 293 ON_ + 303 FIRST_ + 294 OFF_ + 304 INTERVAL_ + 305 IMAGE_ + 295 TRUE_ + 306 LAST_ + 296 FALSE_ + 307 LOCK_ + 262,t 0 + 297 INT_ + 308 MATCH_ + 285,line 36 + 298 REAL_ + 310 NONE_ + 309 NEXT_ + 299 STRING_ + 311 OPEN_ + 283,t 0 + 312 ORDER_ + 313 PLAY_ + 314,t 0 + 314 PREV_ + 282,line 32 + 315 STOP_ + 316 123_ + 264,title WCSG + 317 132_ + 283,title WCSZ + 318 213_ + 312,title ORDER + 331,title {} + 320 312_ + 319 231_ + 278,line 28 + error,line 129 + 321 321_ + 322 wcssys + 258,t 0 + 323 skyframe + 324 yesno + 325 numeric + 275,line 25 + 279,t 0 + 280,t 0 + 326 command + 327 @PSEUDO1 + 328 cube + 311,t 0 + 330 orderAxes + 329 order + 331 lockslice + 272,line 22 + 332,t 1 + 332 matchslice + 333 start' + 263,title WCSF + 282,title WCSY + 311,title OPEN + 330,title {} + 329,title {} + 268,line 18 + 276,t 0 + 265,line 15 + 307,t 0 + 297,t 0 + 331,line 215 + 328,t 1 + 262,line 12 + 327,line 179 + 0,t 0 + 0 {$} + 262,title WCSE + 281,title WCSX + error,t 0 + 310,title NONE + 309,title NEXT + 299,title string + 328,title {} + 258,line 8 + 273,t 0 + 324,line 166 + 294,t 0 + 304,t 0 + 325,t 1 + 321,line 79 + 317,line 75 + 261,title WCSD + 279,title WCSV + 280,title WCSW + 308,title MATCH + 269,t 0 + 270,t 0 + 298,title float + 327,title {} + 314,line 71 + 291,t 0 + 301,t 0 + 322,t 1 + 311,line 68 + 307,line 64 + 266,t 0 + 260,title WCSC + 259,title WCSB + 297,line 50 + 278,title WCSU + 307,title LOCK + 297,title integer + 326,title {} + 287,t 0 + 294,line 46 + 304,line 61 + 318,t 0 + error,title {} + 291,line 43 + 301,line 58 + 263,t 0 + 258,title WCSA + 287,line 38 + 277,title WCST + 284,t 0 + 306,title LAST + 296,title FALSE + 325,title {} + 315,t 0 + 284,line 35 + 281,line 31 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title WCS + 277,line 27 + 276,title WCSS + 312,t 0 + 305,title IMAGE + 295,title TRUE + 324,title {} + 333,t 1 + 274,line 24 + 271,line 21 + 277,t 0 + 308,t 0 + 267,line 17 + 298,t 0 + 275,title WCSR + 333,line 224 + 294,title OFF + 304,title INTERVAL + 330,t 1 + 329,t 1 + 323,title {} + 264,line 14 + 330,line 207 + 329,line 203 + 261,line 11 + 274,t 0 + 326,line 178 + 305,t 0 + 295,t 0 + 257,line 7 + 326,t 1 + 274,title WCSQ + 323,line 158 + 293,title ON + 303,title FIRST + 322,title {} + 320,line 78 + 319,line 77 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 74 + 323,t 1 + 273,title WCSP + 313,line 70 + 292,title NO + 302,title CLOSE + 321,title 321 + 267,t 0 + 310,line 67 + 309,line 66 + 299,line 53 + 288,t 0 + 320,t 0 + 319,t 0 + 306,line 63 + 296,line 48 + 272,title WCSO + 291,title YES + 293,line 45 + 301,title AXES + 303,line 60 + 320,title 312 + 319,title 231 + 264,t 0 + 285,t 0 + 289,line 40 + 290,line 41 + 300,line 57 + 316,t 0 + 286,line 37 + 271,title WCSN + 261,t 0 + 283,line 33 + 289,title GALACTIC + 290,title ECLIPTIC + 300,title AXIS + 318,title 213 + 282,t 0 + 279,line 29 + 280,line 30 + 313,t 0 + 276,line 26 + 257,t 0 + 269,title WCSL + 270,title WCSM + 273,line 23 + 288,title ICRS + 317,title 132 + 278,t 0 + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 19 + 270,line 20 + 331,t 1 + 266,line 16 + 332,line 221 + 268,title WCSK + 275,t 0 + 263,line 13 + 287,title J2000 + 316,title 123 + 328,line 182 + 306,t 0 + 296,t 0 + 327,t 1 + 260,line 10 + 259,line 9 + 325,line 174 + 322,line 130 + 272,t 0 + 267,title WCSJ + 257 WCS_ + 286,title FK5 + 293,t 0 + 303,t 0 + 315,title STOP + 258 WCSA_ + 318,line 76 + 260 WCSC_ + 259 WCSB_ + 324,t 1 + 261 WCSD_ + 262 WCSE_ + 263 WCSF_ + 264 WCSG_ + 315,line 72 + 265 WCSH_ + 266 WCSI_ + 267 WCSJ_ + 268,t 0 + 268 WCSK_ + 269 WCSL_ + 270 WCSM_ + 312,line 69 + 271 WCSN_ + 272 WCSO_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSI + 273 WCSP_ + 274 WCSQ_ + 285,title B1950 + 321,t 0 + 314,title PREV + 275 WCSR_ + 333,title {} + 308,line 65 + 276 WCSS_ + 298,line 51 + 277 WCST_ + 278 WCSU_ + 279 WCSV_ + 280 WCSW_ + 281 WCSX_ + 305,line 62 + 282 WCSY_ + 295,line 47 + 265,t 0 + 283 WCSZ_ + 284 FK4_ + 285 B1950_ +} + +proc cube::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 } + 28 { set _ fk4 } + 29 { set _ fk4 } + 30 { set _ fk5 } + 31 { set _ fk5 } + 32 { set _ icrs } + 33 { set _ galactic } + 34 { set _ ecliptic } + 35 { set _ 1 } + 36 { set _ 1 } + 37 { set _ 1 } + 38 { set _ 1 } + 39 { set _ 0 } + 40 { set _ 0 } + 41 { set _ 0 } + 42 { set _ $1 } + 43 { set _ $1 } + 45 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 48 { CubeDestroyDialog } + 49 { MatchCubeCurrent $2 } + 50 { ProcessCmdSet cube lock $2 LockCubeCurrent } + 51 { CubePlay } + 52 { CubeStop } + 53 { CubeNext } + 54 { CubePrev } + 55 { CubeFirst } + 56 { CubeLast } + 57 { ProcessCmdSet cube interval [expr int($2*1000)] } + 60 { CubeCmd $1 } + 61 { CubeCmd $1 } + 62 { CubeCmdCoord $1 $2 fk5 } + 63 { CubeCmdCoord $1 $2 $3 } + 65 { ProcessCmdSet cube lock,axes $2 LockAxesCurrent } + 66 { ProcessCmdSet cube axes $1 } + 67 { set _ 123 } + 68 { set _ 132 } + 69 { set _ 213 } + 70 { set _ 231 } + 71 { set _ 312 } + 72 { set _ 321 } + 73 { set _ image } + 74 { set _ image } + 75 { set _ $1 } + 76 { set _ none } + 77 { set _ image } + 78 { set _ $1 } + } + 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 cube::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/cubesendlex.tcl b/ds9/parsers/cubesendlex.tcl new file mode 100644 index 0000000..c3fb312 --- /dev/null +++ b/ds9/parsers/cubesendlex.tcl @@ -0,0 +1,300 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cubesend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cubesend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cubesend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cubesend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cubesend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cubesend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cubesend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cubesend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cubesend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cubesend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set AXIS_ 257 +set AXES_ 258 +set INTERVAL_ 259 +set LOCK_ 260 +set ORDER_ 261 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: axis + if {[regexp -start $index_ -indices -line -nocase -- {\A(axis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: interval + if {[regexp -start $index_ -indices -line -nocase -- {\A(interval)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: order + if {[regexp -start $index_ -indices -line -nocase -- {\A(order)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AXIS_ + } + 1 { +return $AXES_ + } + 2 { +return $INTERVAL_ + } + 3 { +return $LOCK_ + } + 4 { +return $ORDER_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/cubesendparser.tab.tcl b/ds9/parsers/cubesendparser.tab.tcl new file mode 100644 index 0000000..9d57c1a --- /dev/null +++ b/ds9/parsers/cubesendparser.tab.tcl @@ -0,0 +1,5 @@ +set AXIS_ 257 +set AXES_ 258 +set INTERVAL_ 259 +set LOCK_ 260 +set ORDER_ 261 diff --git a/ds9/parsers/cubesendparser.tcl b/ds9/parsers/cubesendparser.tcl new file mode 100644 index 0000000..384b214 --- /dev/null +++ b/ds9/parsers/cubesendparser.tcl @@ -0,0 +1,340 @@ +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 cubesend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cubesend::YYABORT {} { + return -code return 1 +} + +proc cubesend::YYACCEPT {} { + return -code return 0 +} + +proc cubesend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cubesend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cubesend::yyerror {s} { + puts stderr $s +} + +proc cubesend::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 cubesend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cubesend::table { + 6:0 accept + 3:0,target 3 + 0:257 shift + 7:0 reduce + 0:258 shift + 8:0 reduce + 5:0,target 7 + 0:260 shift + 0:259 shift + 9:0 reduce + 0:261 shift + 7:0,target 8 + 2:260 shift + 0:262 goto + 0:258,target 2 + 5:263,target 9 + 0:0,target 1 + 9:0,target 5 + 0:261,target 5 + 5:260 shift + 2:0,target 7 + 2:263 goto + 4:0,target 2 + 5:260,target 7 + 5:263 goto + 2:263,target 8 + 0:0 reduce + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 8:0,target 4 + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 reduce + 1:0,target 6 + 5:0 reduce + 2:260,target 7 + 0:262,target 6 +} + +array set cubesend::rules { + 2,l 262 + 6,l 262 + 3,l 262 + 7,l 263 + 0,l 264 + 4,l 262 + 8,l 263 + 1,l 262 + 5,l 262 +} + +array set cubesend::rules { + 5,dc 2 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 6,dc 1 + 1,dc 0 + 4,dc 2 + 7,dc 0 + 2,dc 1 +} + +array set cubesend::rules { + 7,line 26 + 4,line 20 + 1,line 17 + 6,line 23 + 3,line 19 + 8,line 27 + 5,line 22 + 2,line 18 +} + +array set cubesend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0}} + 1 {{6 0 1}} + 2 {{4 0 1} {7 0 0} {8 0 0}} + 3 {{3 0 1}} + 4 {{2 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6}} + 5 {{5 0 1} {7 0 0} {8 0 0}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {{260 7} {263 8}} + 3,trans {} + 7 {{8 0 1}} + 4,trans {} + 8 {{4 0 2}} + 5,trans {{260 7} {263 9}} + 9 {{5 0 2}} + 6,trans {} + 7,trans {} + 8,trans {} + 9,trans {} +} + +array set cubesend::token_id_table { + 264,line 28 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 9 + 261,line 12 + error,line 15 + 257 AXIS_ + 257,t 0 + 263,line 25 + 258 AXES_ + 258,t 0 + error,title {} + 260,t 0 + 260 LOCK_ + 259 INTERVAL_ + 259,t 0 + 261,t 0 + 261 ORDER_ + 262,t 1 + 262 cubesend + 257,line 8 + 263,t 1 + 263 order + 264,t 1 + 264 start' + 260,line 11 + 257,title AXIS + 259,line 10 + 258,title AXES + 262,line 16 + 260,title LOCK + 259,title INTERVAL + 261,title ORDER +} + +proc cubesend::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 { ProcessSendCmdCurrent "get fits slice" } + 2 { ProcessSendCmdGet cube lock } + 3 { BlinkSendCmdInterval } + 6 { ProcessSendCmdTxt "2" } + 7 { ProcessSendCmdGet cube axes } + 8 { ProcessSendCmdYesNo cube lock,axes } + } + 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 cubesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/cursorlex.tcl b/ds9/parsers/cursorlex.tcl new file mode 100644 index 0000000..c5d2770 --- /dev/null +++ b/ds9/parsers/cursorlex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval cursor { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc cursor::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc cursor::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc cursor::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc cursor::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc cursor::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc cursor::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc cursor::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc cursor::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc cursor::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval $yytext; return $INT_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/cursorparser.tab.tcl b/ds9/parsers/cursorparser.tab.tcl new file mode 100644 index 0000000..e736960 --- /dev/null +++ b/ds9/parsers/cursorparser.tab.tcl @@ -0,0 +1,2 @@ +set INT_ 257 +set STRING_ 258 diff --git a/ds9/parsers/cursorparser.tcl b/ds9/parsers/cursorparser.tcl new file mode 100644 index 0000000..b287162 --- /dev/null +++ b/ds9/parsers/cursorparser.tcl @@ -0,0 +1,295 @@ +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 cursor { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc cursor::YYABORT {} { + return -code return 1 +} + +proc cursor::YYACCEPT {} { + return -code return 0 +} + +proc cursor::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc cursor::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc cursor::yyerror {s} { + puts stderr $s +} + +proc cursor::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 cursor::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set cursor::table { + 6:0 reduce + 3:0,target 1 + 0:257 shift + 5:258,target 6 + 1:257 shift + 0:259 goto + 0:261 goto + 3:258 reduce + 1:257,target 4 + 4:258 reduce + 3:260 goto + 5:258 shift + 0:261,target 3 + 2:0,target 0 + 4:258,target 4 + 3:260,target 5 + 4:0,target 4 + 6:0,target 3 + 0:257,target 1 + 2:0 accept + 0:259,target 2 + 3:0 reduce + 4:0 reduce + 3:258,target 2 +} + +array set cursor::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 259 + 4,l 261 +} + +array set cursor::rules { + 0,dc 1 + 2,dc 0 + 4,dc 2 + 1,dc 1 + 3,dc 3 +} + +array set cursor::rules { + 2,e 1 + 2,line 16 + 4,line 20 + 1,line 16 + 3,line 17 +} + +array set cursor::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0}} + 1 {{4 {0 258} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{257 1} {259 2} {261 3}} + 4 {{4 {0 258} 2}} + 1,trans {{257 4}} + 5 {{3 0 2}} + 2,trans {} + 6 {{3 0 3}} + 3,trans {{260 5}} + 4,trans {} + 5,trans {{258 6}} + 6,trans {} +} + +array set cursor::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 9 + 261,line 19 + error,line 14 + 257 INT_ + 257,t 0 + 258 STRING_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 cursor + 262,t 1 + 262 start' + 257,line 7 + 260,line 16 + 259,line 15 + 257,title integer + 258,title string + 262,line 21 + 260,title {} + 259,title {} + 261,title {} +} + +proc cursor::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { CursorCmd $1 $2 } + } + 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 cursor::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/datasendlex.tcl b/ds9/parsers/datasendlex.tcl new file mode 100644 index 0000000..2aab089 --- /dev/null +++ b/ds9/parsers/datasendlex.tcl @@ -0,0 +1,778 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval datasend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc datasend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc datasend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc datasend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc datasend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc datasend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc datasend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc datasend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc datasend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc datasend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set YES_ 295 +set NO_ 296 +set ON_ 297 +set OFF_ 298 +set TRUE_ 299 +set FALSE_ 300 +set INT_ 301 +set REAL_ 302 +set SEXSTR_ 303 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $IMAGE_ + } + 1 { +return $PHYSICAL_ + } + 2 { +return $AMPLIFIER_ + } + 3 { +return $DETECTOR_ + } + 4 { +return $WCS_ + } + 5 { +return $WCSA_ + } + 6 { +return $WCSB_ + } + 7 { +return $WCSC_ + } + 8 { +return $WCSD_ + } + 9 { +return $WCSE_ + } + 10 { +return $WCSF_ + } + 11 { +return $WCSG_ + } + 12 { +return $WCSH_ + } + 13 { +return $WCSI_ + } + 14 { +return $WCSJ_ + } + 15 { +return $WCSK_ + } + 16 { +return $WCSL_ + } + 17 { +return $WCSM_ + } + 18 { +return $WCSN_ + } + 19 { +return $WCSO_ + } + 20 { +return $WCSP_ + } + 21 { +return $WCSQ_ + } + 22 { +return $WCSR_ + } + 23 { +return $WCSS_ + } + 24 { +return $WCST_ + } + 25 { +return $WCSU_ + } + 26 { +return $WCSV_ + } + 27 { +return $WCSW_ + } + 28 { +return $WCSX_ + } + 29 { +return $WCSY_ + } + 30 { +return $WCSZ_ + } + 31 { +return $FK4_ + } + 32 { +return $FK4_ + } + 33 { +return $FK5_ + } + 34 { +return $FK5_ + } + 35 { +return $ICRS_ + } + 36 { +return $GALACTIC_ + } + 37 { +return $ECLIPTIC_ + } + 38 { +return $YES_ + } + 39 { +return $NO_ + } + 40 { +return $ON_ + } + 41 { +return $OFF_ + } + 42 { +return $TRUE_ + } + 43 { +return $FALSE_ + } + 44 { +set yylval $yytext; return $INT_ + } + 45 - + 46 { +set yylval $yytext; return $REAL_ + } + 47 - + 48 { +set yylval $yytext; return $SEXSTR_ + } + 49 { +# ignore whitespace + } + 50 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/datasendparser.tab.tcl b/ds9/parsers/datasendparser.tab.tcl new file mode 100644 index 0000000..ae14bb2 --- /dev/null +++ b/ds9/parsers/datasendparser.tab.tcl @@ -0,0 +1,47 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set YES_ 295 +set NO_ 296 +set ON_ 297 +set OFF_ 298 +set TRUE_ 299 +set FALSE_ 300 +set INT_ 301 +set REAL_ 302 +set SEXSTR_ 303 diff --git a/ds9/parsers/datasendparser.tcl b/ds9/parsers/datasendparser.tcl new file mode 100644 index 0000000..b94334d --- /dev/null +++ b/ds9/parsers/datasendparser.tcl @@ -0,0 +1,1842 @@ +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 datasend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc datasend::YYABORT {} { + return -code return 1 +} + +proc datasend::YYACCEPT {} { + return -code return 0 +} + +proc datasend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc datasend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc datasend::yyerror {s} { + puts stderr $s +} + +proc datasend::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 datasend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set datasend::table { + 21:289 reduce + 21:290 reduce + 31:294,target 31 + 21:291 reduce + 21:301 reduce + 21:292 reduce + 21:302 reduce + 21:293 reduce + 21:303 reduce + 21:294 reduce + 9:288 reduce + 13:291,target 13 + 13:301,target 13 + 43:296,target 46 + 58:301,target 65 + 9:290 reduce + 9:289 reduce + 9:291 reduce + 9:301 reduce + 9:292 reduce + 9:302 reduce + 9:293 reduce + 9:303 reduce + 55:308,target 62 + 9:294 reduce + 25:293,target 25 + 25:303,target 25 + 0:275,target 19 + 19:292,target 19 + 19:302,target 19 + 20:292,target 20 + 20:302,target 20 + 5:303,target 5 + 5:293,target 5 + 14:291,target 14 + 14:301,target 14 + 44:296,target 47 + 60:301,target 43 + 59:301,target 43 + 56:301 shift + 56:302 shift + 0:292,target 36 + 56:308,target 63 + 26:293,target 26 + 26:303,target 26 + 26:288 reduce + 26:289 reduce + 26:290 reduce + 26:291 reduce + 26:301 reduce + 26:292 reduce + 26:302 reduce + 56:308 goto + 26:293 reduce + 26:303 reduce + 26:294 reduce + 21:292,target 21 + 21:302,target 21 + 6:303,target 6 + 6:293,target 6 + 15:291,target 15 + 15:301,target 15 + 61:301,target 43 + 1:302,target 1 + 57:308,target 64 + 27:293,target 27 + 27:303,target 27 + 77:0 reduce + 10:289,target 10 + 10:290,target 10 + 0:266,target 10 + 62:301 shift + 22:292,target 22 + 22:302,target 22 + 67:302,target 44 + 62:302 shift + 7:303,target 7 + 7:293,target 7 + 32:301 reduce + 32:302 reduce + 62:308 goto + 32:303 reduce + 16:291,target 16 + 16:301,target 16 + 62:301,target 43 + 2:302,target 2 + 28:293,target 28 + 28:303,target 28 + 0:283,target 27 + 11:289,target 11 + 11:290,target 11 + 23:292,target 23 + 23:302,target 23 + 68:302,target 44 + 8:303,target 8 + 8:293,target 8 + 65:299,target 76 + 17:291,target 17 + 17:301,target 17 + 63:301,target 43 + 67:301 shift + 67:302 shift + 3:302,target 3 + 60:308,target 67 + 59:308,target 66 + 29:293,target 29 + 29:303,target 29 + 30:293,target 30 + 30:303,target 30 + 37:301 reduce + 0:309,target 42 + 37:302 reduce + 67:308 goto + 37:303 reduce + 12:289,target 12 + 12:290,target 12 + 24:292,target 24 + 24:302,target 24 + 85:0,target 54 + 0:257,target 1 + 9:293,target 9 + 9:303,target 9 + 66:299,target 76 + 18:291,target 18 + 18:301,target 18 + 64:301,target 43 + 4:302,target 4 + 61:308,target 68 + 31:293,target 31 + 31:303,target 31 + 13:289,target 13 + 13:290,target 13 + 43:295,target 46 + 78:0 reduce + 25:292,target 25 + 25:302,target 25 + 0:274,target 18 + 43:300 reduce + 43:301 reduce + 43:302 reduce + 13:288 reduce + 13:289 reduce + 13:290 reduce + 43:295 reduce + 13:291 reduce + 13:301 reduce + 43:296 reduce + 13:292 reduce + 13:302 reduce + 19:291,target 19 + 19:301,target 19 + 20:291,target 20 + 20:301,target 20 + 43:297 reduce + 13:293 reduce + 13:303 reduce + 43:298 reduce + 13:294 reduce + 43:299 reduce + 82:0,target 49 + 5:302,target 5 + 5:292,target 5 + 62:308,target 69 + 2:301 reduce + 32:303,target 32 + 2:302 reduce + 14:289,target 14 + 14:290,target 14 + 44:295,target 47 + 0:291,target 35 + 26:292,target 26 + 26:302,target 26 + 21:291,target 21 + 21:301,target 21 + 6:302,target 6 + 6:292,target 6 + 63:308,target 70 + 33:303,target 33 + 48:301 shift + 48:302 shift + 18:288 reduce + 15:289,target 15 + 15:290,target 15 + 18:289 reduce + 18:290 reduce + 18:291 reduce + 18:301 reduce + 18:292 reduce + 18:302 reduce + 48:308 goto + 18:293 reduce + 18:303 reduce + 1:301,target 1 + 18:294 reduce + 7:288 reduce + 27:292,target 27 + 27:302,target 27 + 78:0,target 48 + 7:290 reduce + 7:289 reduce + 65:0 reduce + 7:301 reduce + 7:291 reduce + 7:302 reduce + 7:292 reduce + 7:303 reduce + 7:293 reduce + 70:299,target 76 + 69:299,target 76 + 7:294 reduce + 10:288,target 10 + 40:294,target 38 + 0:265,target 9 + 22:291,target 22 + 22:301,target 22 + 67:301,target 43 + 7:302,target 7 + 7:292,target 7 + 64:308,target 71 + 34:303,target 34 + 16:289,target 16 + 16:290,target 16 + 2:301,target 2 + 28:292,target 28 + 28:302,target 28 + 54:301 shift + 54:302 shift + 71:299,target 76 + 0:282,target 26 + 11:288,target 11 + 80:0 reduce + 79:0 reduce + 24:288 reduce + 24:289 reduce + 24:290 reduce + 24:291 reduce + 24:301 reduce + 24:292 reduce + 24:302 reduce + 54:308 goto + 23:291,target 23 + 23:301,target 23 + 24:293 reduce + 24:303 reduce + 68:301,target 43 + 24:294 reduce + 75:0,target 44 + 8:302,target 8 + 8:292,target 8 + 65:298,target 75 + 35:303,target 35 + 44:0,target 47 + 17:289,target 17 + 17:290,target 17 + 3:301,target 3 + 29:292,target 29 + 29:302,target 29 + 30:292,target 30 + 30:302,target 30 + 12:288,target 12 + 24:291,target 24 + 24:301,target 24 + 9:292,target 9 + 9:302,target 9 + 66:298,target 75 + 60:301 shift + 59:301 shift + 36:303,target 36 + 60:302 shift + 59:302 shift + 29:288 reduce + 30:288 reduce + 29:289 reduce + 29:290 reduce + 30:289 reduce + 30:290 reduce + 18:289,target 18 + 18:290,target 18 + 29:291 reduce + 29:301 reduce + 30:291 reduce + 30:301 reduce + 29:292 reduce + 29:302 reduce + 30:292 reduce + 30:302 reduce + 60:308 goto + 59:308 goto + 29:293 reduce + 29:303 reduce + 30:293 reduce + 30:303 reduce + 29:294 reduce + 30:294 reduce + 4:301,target 4 + 72:0,target 40 + 31:292,target 31 + 31:302,target 31 + 13:288,target 13 + 66:0 reduce + 25:291,target 25 + 25:301,target 25 + 0:273,target 17 + 67:308,target 80 + 37:303,target 37 + 19:289,target 19 + 19:290,target 19 + 20:289,target 20 + 20:290,target 20 + 65:300,target 77 + 5:301,target 5 + 5:291,target 5 + 32:302,target 32 + 65:300 shift + 14:288,target 14 + 65:295 shift + 65:296 shift + 35:301 reduce + 65:297 shift + 65:307 goto + 35:302 reduce + 65:298 shift + 0:290,target 34 + 0:289,target 33 + 35:303 reduce + 65:299 shift + 26:291,target 26 + 26:301,target 26 + 81:0 reduce + 68:308,target 81 + 38:303,target 38 + 21:289,target 21 + 21:290,target 21 + 66:300,target 77 + 6:301,target 6 + 6:291,target 6 + 0:257 shift + 33:302,target 33 + 0:258 shift + 0:259 shift + 0:260 shift + 0:261 shift + 0:262 shift + 0:263 shift + 15:288,target 15 + 0:264 shift + 0:265 shift + 0:266 shift + 0:267 shift + 0:268 shift + 27:291,target 27 + 27:301,target 27 + 0:269 shift + 0:270 shift + 0:271 shift + 71:300 shift + 0:272 shift + 0:273 shift + 70:298,target 75 + 69:298,target 75 + 0:274 shift + 40:303,target 46 + 40:293,target 37 + 0:275 shift + 0:264,target 8 + 0:276 shift + 71:295 shift + 0:277 shift + 71:296 shift + 0:278 shift + 41:301 shift + 71:297 shift + 71:307 goto + 0:280 shift + 0:279 shift + 22:289,target 22 + 22:290,target 22 + 41:302 shift + 71:298 shift + 0:281 shift + 41:303 shift + 71:299 shift + 0:282 shift + 11:288 reduce + 0:283 shift + 11:289 reduce + 11:290 reduce + 65:0,target 39 + 7:301,target 7 + 7:291,target 7 + 0:284 shift + 11:291 reduce + 11:301 reduce + 0:285 shift + 11:292 reduce + 11:302 reduce + 34:302,target 34 + 0:286 shift + 11:293 reduce + 11:303 reduce + 41:308 goto + 0:287 shift + 11:294 reduce + 0:288 shift + 0:290 shift + 0:289 shift + 0:291 shift + 16:288,target 16 + 0:292 shift + 0:293 shift + 0:294 shift + 0:304 goto + 0:305 goto + 0:306 goto + 28:291,target 28 + 28:301,target 28 + 0:309 goto + 71:298,target 75 + 0:281,target 25 + 41:303,target 49 + 23:289,target 23 + 23:290,target 23 + 8:301,target 8 + 8:291,target 8 + 65:297,target 74 + 65:307,target 78 + 35:302,target 35 + 17:288,target 17 + 46:303 shift + 16:288 reduce + 16:289 reduce + 16:290 reduce + 29:291,target 29 + 29:301,target 29 + 30:291,target 30 + 30:301,target 30 + 16:291 reduce + 16:301 reduce + 16:292 reduce + 16:302 reduce + 16:293 reduce + 16:303 reduce + 16:294 reduce + 5:288 reduce + 5:290 reduce + 5:289 reduce + 5:301 reduce + 5:291 reduce + 82:0 reduce + 5:302 reduce + 5:292 reduce + 5:303 reduce + 5:293 reduce + 5:294 reduce + 24:289,target 24 + 24:290,target 24 + 70:300,target 77 + 69:300,target 77 + 9:291,target 9 + 9:301,target 9 + 66:297,target 74 + 66:307,target 79 + 36:302,target 36 + 18:288,target 18 + 31:291,target 31 + 31:301,target 31 + 52:301 shift + 52:302 shift + 25:289,target 25 + 25:290,target 25 + 71:300,target 77 + 0:272,target 16 + 22:288 reduce + 22:289 reduce + 22:290 reduce + 22:291 reduce + 22:301 reduce + 22:292 reduce + 22:302 reduce + 52:308 goto + 22:293 reduce + 22:303 reduce + 37:302,target 37 + 22:294 reduce + 80:299,target 76 + 19:288,target 19 + 20:288,target 20 + 5:290,target 5 + 5:289,target 5 + 32:301,target 32 + 0:288,target 32 + 26:289,target 26 + 26:290,target 26 + 38:302,target 38 + 81:299,target 76 + 57:301 shift + 21:288,target 21 + 86:0,target 51 + 57:302 shift + 27:288 reduce + 6:290,target 6 + 6:289,target 6 + 27:289 reduce + 27:290 reduce + 27:291 reduce + 27:301 reduce + 33:301,target 33 + 27:292 reduce + 27:302 reduce + 57:308 goto + 27:293 reduce + 27:303 reduce + 27:294 reduce + 27:289,target 27 + 27:290,target 27 + 83:0 reduce + 70:297,target 74 + 70:307,target 83 + 69:297,target 74 + 69:307,target 82 + 39:302,target 44 + 40:302,target 44 + 40:292,target 36 + 0:263,target 7 + 22:288,target 22 + 7:290,target 7 + 7:289,target 7 + 34:301,target 34 + 46:303,target 52 + 63:301 shift + 83:0,target 53 + 63:302 shift + 28:289,target 28 + 28:290,target 28 + 33:301 reduce + 33:302 reduce + 63:308 goto + 33:303 reduce + 71:297,target 74 + 71:307,target 84 + 0:280,target 24 + 0:279,target 23 + 41:302,target 44 + 23:288,target 23 + 8:290,target 8 + 8:289,target 8 + 65:296,target 73 + 35:301,target 35 + 47:303,target 53 + 29:289,target 29 + 29:290,target 29 + 30:289,target 30 + 30:290,target 30 + 0:306,target 41 + 70:0 reduce + 69:0 reduce + 68:301 shift + 80:0,target 39 + 79:0,target 52 + 68:302 shift + 24:288,target 24 + 9:290,target 9 + 9:289,target 9 + 38:301 reduce + 66:296,target 73 + 36:301,target 36 + 38:302 reduce + 68:308 goto + 38:303 reduce + 31:289,target 31 + 31:290,target 31 + 42:0 accept + 43:302,target 46 + 10:294,target 10 + 84:0 reduce + 25:288,target 25 + 0:271,target 15 + 37:301,target 37 + 80:298,target 75 + 49:303,target 56 + 76:0,target 42 + 5:288,target 5 + 44:300 reduce + 44:301 reduce + 44:302 reduce + 14:288 reduce + 14:289 reduce + 14:290 reduce + 44:295 reduce + 44:302,target 47 + 14:291 reduce + 14:301 reduce + 44:296 reduce + 14:292 reduce + 14:302 reduce + 44:297 reduce + 14:293 reduce + 14:303 reduce + 44:298 reduce + 0:287,target 31 + 11:294,target 11 + 14:294 reduce + 44:299 reduce + 26:288,target 26 + 3:301 reduce + 3:302 reduce + 38:301,target 38 + 81:298,target 75 + 6:288,target 6 + 45:302,target 44 + 80:300 shift + 73:0,target 43 + 12:294,target 12 + 27:288,target 27 + 80:295 shift + 71:0 reduce + 80:296 shift + 50:301 shift + 42:0,target 0 + 80:297 shift + 80:307 goto + 50:302 shift + 80:298 shift + 70:296,target 73 + 69:296,target 73 + 49:303 shift + 39:301,target 43 + 40:301,target 43 + 40:291,target 35 + 80:299 shift + 19:288 reduce + 20:288 reduce + 0:262,target 6 + 19:289 reduce + 19:290 reduce + 20:289 reduce + 20:290 reduce + 19:291 reduce + 19:301 reduce + 20:291 reduce + 20:301 reduce + 19:292 reduce + 19:302 reduce + 20:292 reduce + 20:302 reduce + 50:308 goto + 19:293 reduce + 19:303 reduce + 20:293 reduce + 20:303 reduce + 19:294 reduce + 20:294 reduce + 8:288 reduce + 8:290 reduce + 8:289 reduce + 8:301 reduce + 8:291 reduce + 7:288,target 7 + 8:302 reduce + 8:292 reduce + 80:300,target 77 + 8:303 reduce + 8:293 reduce + 8:294 reduce + 13:294,target 13 + 43:299,target 46 + 28:288,target 28 + 43:0 reduce + 71:296,target 73 + 0:278,target 22 + 41:301,target 43 + 85:0 reduce + 53:303,target 60 + 70:0,target 39 + 69:0,target 39 + 8:288,target 8 + 65:295,target 72 + 55:301 shift + 81:300,target 77 + 55:302 shift + 25:288 reduce + 25:289 reduce + 25:290 reduce + 47:302,target 44 + 25:291 reduce + 25:301 reduce + 25:292 reduce + 25:302 reduce + 55:308 goto + 25:293 reduce + 25:303 reduce + 25:294 reduce + 14:294,target 14 + 44:299,target 47 + 29:288,target 29 + 30:288,target 30 + 0:305,target 40 + 9:288,target 9 + 66:295,target 72 + 48:302,target 44 + 66:0,target 39 + 15:294,target 15 + 31:288,target 31 + 61:301 shift + 61:302 shift + 31:288 reduce + 43:301,target 46 + 31:289 reduce + 31:290 reduce + 31:291 reduce + 31:301 reduce + 72:0 reduce + 31:292 reduce + 31:302 reduce + 61:308 goto + 10:293,target 10 + 10:303,target 10 + 31:293 reduce + 31:303 reduce + 39:308,target 45 + 40:308,target 48 + 31:294 reduce + 0:269,target 13 + 0:270,target 14 + 80:297,target 74 + 80:307,target 85 + 50:302,target 44 + 16:294,target 16 + 44:301,target 47 + 44:0 reduce + 0:286,target 30 + 11:293,target 11 + 11:303,target 11 + 41:308,target 50 + 86:0 reduce + 66:300 shift + 66:295 shift + 66:296 shift + 36:301 reduce + 81:297,target 74 + 81:307,target 86 + 66:297 shift + 66:307 goto + 36:302 reduce + 66:298 shift + 36:303 reduce + 66:299 shift + 17:294,target 17 + 45:301,target 43 + 12:293,target 12 + 12:303,target 12 + 70:295,target 72 + 69:295,target 72 + 40:289,target 33 + 40:290,target 34 + 0:261,target 5 + 52:302,target 44 + 18:294,target 18 + 12:288 reduce + 13:293,target 13 + 13:303,target 13 + 43:298,target 46 + 12:289 reduce + 12:290 reduce + 12:291 reduce + 12:301 reduce + 12:292 reduce + 12:302 reduce + 12:293 reduce + 12:303 reduce + 73:0 reduce + 12:294 reduce + 71:295,target 72 + 0:277,target 21 + 1:301 reduce + 1:302 reduce + 19:294,target 19 + 20:294,target 20 + 47:301,target 43 + 14:293,target 14 + 14:303,target 14 + 44:298,target 47 + 0:294,target 38 + 0:304,target 39 + 47:301 shift + 47:302 shift + 54:302,target 44 + 47:303 shift + 17:288 reduce + 17:289 reduce + 17:290 reduce + 17:291 reduce + 17:301 reduce + 17:292 reduce + 17:302 reduce + 21:294,target 21 + 17:293 reduce + 17:303 reduce + 47:308 goto + 17:294 reduce + 6:288 reduce + 6:290 reduce + 6:289 reduce + 6:301 reduce + 6:291 reduce + 48:301,target 43 + 6:302 reduce + 6:292 reduce + 6:303 reduce + 6:293 reduce + 6:294 reduce + 15:293,target 15 + 15:303,target 15 + 45:308,target 51 + 43:300,target 46 + 84:0,target 50 + 10:292,target 10 + 10:302,target 10 + 55:302,target 44 + 0:268,target 12 + 22:294,target 22 + 80:296,target 73 + 50:301,target 43 + 53:303 shift + 23:288 reduce + 16:293,target 16 + 16:303,target 16 + 23:289 reduce + 23:290 reduce + 23:291 reduce + 23:301 reduce + 23:292 reduce + 23:302 reduce + 23:293 reduce + 23:303 reduce + 23:294 reduce + 44:300,target 47 + 0:285,target 29 + 11:292,target 11 + 11:302,target 11 + 74:0 reduce + 56:302,target 44 + 23:294,target 23 + 81:0,target 39 + 81:296,target 73 + 51:301,target 58 + 47:308,target 54 + 17:293,target 17 + 17:303,target 17 + 58:301 shift + 12:292,target 12 + 12:302,target 12 + 57:302,target 44 + 28:288 reduce + 28:289 reduce + 28:290 reduce + 28:291 reduce + 28:301 reduce + 28:292 reduce + 28:302 reduce + 24:294,target 24 + 28:293 reduce + 28:303 reduce + 28:294 reduce + 40:288,target 32 + 0:259,target 3 + 0:260,target 4 + 52:301,target 43 + 48:308,target 55 + 18:293,target 18 + 18:303,target 18 + 77:0,target 45 + 13:292,target 13 + 13:302,target 13 + 43:297,target 46 + 25:294,target 25 + 0:276,target 20 + 64:301 shift + 64:302 shift + 50:308,target 57 + 19:293,target 19 + 19:303,target 19 + 20:293,target 20 + 20:303,target 20 + 34:301 reduce + 34:302 reduce + 64:308 goto + 34:303 reduce + 5:294,target 5 + 14:292,target 14 + 14:302,target 14 + 44:297,target 47 + 60:302,target 44 + 59:302,target 44 + 0:293,target 37 + 26:294,target 26 + 75:0 reduce + 74:0,target 41 + 54:301,target 43 + 43:0,target 46 + 21:293,target 21 + 21:303,target 21 + 6:294,target 6 + 70:300 shift + 69:300 shift + 15:292,target 15 + 15:302,target 15 + 40:288 shift + 70:295 shift + 69:295 shift + 61:302,target 44 + 40:289 shift + 40:290 shift + 70:296 shift + 69:296 shift + 39:301 shift + 40:301 shift + 40:291 shift + 70:297 shift + 70:307 goto + 69:297 shift + 69:307 goto + 39:302 shift + 40:302 shift + 40:292 shift + 70:298 shift + 69:298 shift + 40:303 shift + 40:293 shift + 70:299 shift + 69:299 shift + 10:288 reduce + 27:294,target 27 + 40:294 shift + 10:289 reduce + 10:290 reduce + 10:291 reduce + 10:301 reduce + 40:306 goto + 10:292 reduce + 10:302 reduce + 10:293 reduce + 10:303 reduce + 39:308 goto + 40:308 goto + 10:291,target 10 + 10:294 reduce + 10:301,target 10 + 40:306,target 47 + 55:301,target 43 + 0:267,target 11 + 52:308,target 59 + 22:293,target 22 + 22:303,target 22 + 7:294,target 7 + 80:295,target 72 + 71:0,target 39 + 16:292,target 16 + 16:302,target 16 + 62:302,target 44 + 28:294,target 28 + 0:284,target 28 + 11:291,target 11 + 11:301,target 11 + 56:301,target 43 + 45:301 shift + 23:293,target 23 + 23:303,target 23 + 45:302 shift + 15:288 reduce + 15:289 reduce + 15:290 reduce + 8:294,target 8 + 15:291 reduce + 15:301 reduce + 15:292 reduce + 15:302 reduce + 81:295,target 72 + 15:293 reduce + 15:303 reduce + 45:308 goto + 15:294 reduce + 4:301 reduce + 17:292,target 17 + 17:302,target 17 + 63:302,target 44 + 4:302 reduce + 29:294,target 29 + 30:294,target 30 + 12:291,target 12 + 12:301,target 12 + 57:301,target 43 + 76:0 reduce + 54:308,target 61 + 24:293,target 24 + 24:303,target 24 + 0:258,target 2 + 9:294,target 9 + 81:300 shift + 81:295 shift + 18:292,target 18 + 18:302,target 18 + 81:296 shift + 64:302,target 44 + 51:301 shift + 81:297 shift + 81:307 goto + 81:298 shift + 81:299 shift + 21:288 reduce +} + +array set datasend::rules { + 9,l 305 + 11,l 305 + 32,l 306 + 53,l 309 + 6,l 305 + 28,l 305 + 50,l 309 + 49,l 309 + 3,l 304 + 25,l 305 + 46,l 308 + 0,l 310 + 22,l 305 + 43,l 307 + 18,l 305 + 40,l 307 + 39,l 307 + 15,l 305 + 36,l 306 + 12,l 305 + 33,l 306 + 54,l 309 + 7,l 305 + 29,l 305 + 30,l 305 + 51,l 309 + 4,l 304 + 26,l 305 + 47,l 308 + 1,l 304 + 23,l 305 + 44,l 307 + 19,l 305 + 20,l 305 + 41,l 307 + 16,l 305 + 37,l 306 + 13,l 305 + 34,l 306 + 8,l 305 + 10,l 305 + 31,l 305 + 52,l 309 + 5,l 305 + 27,l 305 + 48,l 309 + 2,l 304 + 24,l 305 + 45,l 307 + 21,l 305 + 42,l 307 + 17,l 305 + 38,l 306 + 14,l 305 + 35,l 306 +} + +array set datasend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 0 + 54,dc 7 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 6 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 6 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 7 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 6 + 49,dc 6 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 6 +} + +array set datasend::rules { + 41,line 160 + 7,line 124 + 37,line 155 + 4,line 120 + 34,line 152 + 1,line 117 + 31,line 148 + 27,line 144 + 24,line 141 + 21,line 138 + 17,line 134 + 14,line 131 + 11,line 128 + 53,line 182 + 50,line 175 + 49,line 173 + 46,line 166 + 43,line 162 + 9,line 126 + 40,line 159 + 39,line 158 + 6,line 123 + 36,line 154 + 3,line 119 + 33,line 151 + 29,line 146 + 30,line 147 + 26,line 143 + 23,line 140 + 19,line 136 + 20,line 137 + 16,line 133 + 13,line 130 + 10,line 127 + 52,line 180 + 48,line 171 + 45,line 164 + 42,line 161 + 8,line 125 + 38,line 156 + 5,line 122 + 35,line 153 + 2,line 118 + 32,line 150 + 28,line 145 + 25,line 142 + 22,line 139 + 18,line 135 + 15,line 132 + 12,line 129 + 54,line 184 + 51,line 178 + 47,line 167 + 44,line 163 +} + +array set datasend::lr1_table { + 66,trans {{301 68} {302 69} {308 75}} + 35 {{35 {301 302 303} 1}} + 85,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 90}} + 14,trans {} + 36 {{36 {301 302 303} 1}} + 33,trans {} + 37 {{37 {301 302 303} 1}} + 52,trans {} + 38 {{38 {301 302 303} 1}} + 71,trans {{301 68} {302 69} {308 84}} + 39 {{48 0 1} {46 {301 302} 0} {47 {301 302} 0}} + 40 {{49 0 1} {51 0 1} {52 0 1} {54 0 1} {46 {301 302} 0} {47 {301 302} 0} {32 {301 302 303} 0} {33 {301 302 303} 0} {34 {301 302 303} 0} {35 {301 302 303} 0} {36 {301 302 303} 0} {37 {301 302 303} 0} {38 {301 302 303} 0}} + 90,trans {} + 89,trans {} + 18,trans {} + 41 {{50 0 1} {53 0 1} {46 {301 302} 0} {47 {301 302} 0}} + 1,trans {} + 37,trans {} + 42 {{0 0 1}} + 56,trans {{301 43} {302 44} {308 63}} + 43 {{46 {301 302} 1}} + 75,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 88}} + 44 {{47 {301 302} 1}} + 45 {{48 0 2} {46 301 0} {47 301 0}} + 23,trans {} + 5,trans {} + 42,trans {} + 46 {{52 0 2}} + 61,trans {{301 68} {302 69} {308 70}} + 47 {{51 0 2} {54 0 2} {46 {301 302} 0} {47 {301 302} 0}} + 80,trans {} + 79,trans {} + 48 {{49 0 2} {46 {301 302} 0} {47 {301 302} 0}} + 50 {{50 0 2} {46 {301 302} 0} {47 {301 302} 0}} + 49 {{53 0 2}} + 27,trans {} + 9,trans {} + 46,trans {{303 54}} + 51 {{46 301 1}} + 65,trans {{301 68} {302 69} {308 74}} + 52 {{47 301 1}} + 84,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 89}} + 53 {{48 0 3}} + 13,trans {} + 54 {{52 0 3} {46 {301 302} 0} {47 {301 302} 0}} + 32,trans {} + 51,trans {} + 55 {{54 0 3}} + 70,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 83}} + 69,trans {} + 56 {{51 0 3} {46 {301 302} 0} {47 {301 302} 0}} + 88,trans {} + 57 {{49 0 3} {46 {301 302} 0} {47 {301 302} 0}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {304 39} {305 40} {306 41} {309 42}} + 58 {{53 0 3} {46 {301 302} 0} {47 {301 302} 0}} + 36,trans {} + 55,trans {{303 62}} + 60 {{48 0 4}} + 59 {{50 0 3} {46 {301 302} 0} {47 {301 302} 0}} + 74,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 87}} + 61 {{52 0 4} {46 {0 295 296 297 298 299 300} 0} {47 {0 295 296 297 298 299 300} 0}} + 62 {{54 0 4} {46 {301 302} 0} {47 {301 302} 0}} + 22,trans {} + 4,trans {} + 63 {{51 0 4} {46 {301 302} 0} {47 {301 302} 0}} + 41,trans {{301 43} {302 44} {303 49} {308 50}} + 60,trans {{301 67}} + 59,trans {{301 43} {302 44} {308 66}} + 64 {{49 0 4} {46 {0 295 296 297 298 299 300} 0} {47 {0 295 296 297 298 299 300} 0}} + 78,trans {} + 65 {{53 0 4} {46 {0 295 296 297 298 299 300} 0} {47 {0 295 296 297 298 299 300} 0}} + 66 {{50 0 4} {46 {0 295 296 297 298 299 300} 0} {47 {0 295 296 297 298 299 300} 0}} + 26,trans {} + 8,trans {} + 67 {{48 0 5} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 45,trans {{301 51} {302 52} {308 53}} + 64,trans {{301 68} {302 69} {308 73}} + 68 {{46 {0 295 296 297 298 299 300} 1}} + 83,trans {} + 70 {{52 0 5} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 69 {{47 {0 295 296 297 298 299 300} 1}} + 12,trans {} + 71 {{54 0 5} {46 {0 295 296 297 298 299 300} 0} {47 {0 295 296 297 298 299 300} 0}} + 31,trans {} + 72 {{51 0 5} {46 {0 295 296 297 298 299 300} 0} {47 {0 295 296 297 298 299 300} 0}} + 50,trans {{301 43} {302 44} {308 59}} + 49,trans {{303 58}} + 68,trans {} + 73 {{49 0 5} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 87,trans {} + 74 {{53 0 5} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 16,trans {} + 75 {{50 0 5} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 35,trans {} + 76 {{40 0 1}} + 54,trans {{301 43} {302 44} {308 61}} + 73,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 86}} + 77 {{43 0 1}} + 78 {{41 0 1}} + 21,trans {} + 3,trans {} + 80 {{42 0 1}} + 79 {{44 0 1}} + 40,trans {{288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {301 43} {302 44} {303 46} {306 47} {308 48}} + 39,trans {{301 43} {302 44} {308 45}} + 81 {{45 0 1}} + 58,trans {{301 43} {302 44} {308 65}} + 10 {{10 {288 289 290 291 292 293 294 301 302 303} 1}} + 77,trans {} + 82 {{48 0 6}} + 11 {{11 {288 289 290 291 292 293 294 301 302 303} 1}} + 83 {{52 0 6}} + 25,trans {} + 7,trans {} + 12 {{12 {288 289 290 291 292 293 294 301 302 303} 1}} + 84 {{54 0 6} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 44,trans {} + 13 {{13 {288 289 290 291 292 293 294 301 302 303} 1}} + 85 {{51 0 6} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0}} + 63,trans {{301 43} {302 44} {308 72}} + 14 {{14 {288 289 290 291 292 293 294 301 302 303} 1}} + 82,trans {} + 86 {{49 0 6}} + 11,trans {} + 15 {{15 {288 289 290 291 292 293 294 301 302 303} 1}} + 87 {{53 0 6}} + 30,trans {} + 29,trans {} + 16 {{16 {288 289 290 291 292 293 294 301 302 303} 1}} + 88 {{50 0 6}} + 48,trans {{301 43} {302 44} {308 57}} + 0 {{0 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 0 0} {1 {301 302} 0} {2 {301 302} 0} {3 {301 302} 0} {4 {301 302} 0} {5 {288 289 290 291 292 293 294 301 302 303} 0} {6 {288 289 290 291 292 293 294 301 302 303} 0} {7 {288 289 290 291 292 293 294 301 302 303} 0} {8 {288 289 290 291 292 293 294 301 302 303} 0} {9 {288 289 290 291 292 293 294 301 302 303} 0} {10 {288 289 290 291 292 293 294 301 302 303} 0} {11 {288 289 290 291 292 293 294 301 302 303} 0} {12 {288 289 290 291 292 293 294 301 302 303} 0} {13 {288 289 290 291 292 293 294 301 302 303} 0} {14 {288 289 290 291 292 293 294 301 302 303} 0} {15 {288 289 290 291 292 293 294 301 302 303} 0} {16 {288 289 290 291 292 293 294 301 302 303} 0} {17 {288 289 290 291 292 293 294 301 302 303} 0} {18 {288 289 290 291 292 293 294 301 302 303} 0} {19 {288 289 290 291 292 293 294 301 302 303} 0} {20 {288 289 290 291 292 293 294 301 302 303} 0} {21 {288 289 290 291 292 293 294 301 302 303} 0} {22 {288 289 290 291 292 293 294 301 302 303} 0} {23 {288 289 290 291 292 293 294 301 302 303} 0} {24 {288 289 290 291 292 293 294 301 302 303} 0} {25 {288 289 290 291 292 293 294 301 302 303} 0} {26 {288 289 290 291 292 293 294 301 302 303} 0} {27 {288 289 290 291 292 293 294 301 302 303} 0} {28 {288 289 290 291 292 293 294 301 302 303} 0} {29 {288 289 290 291 292 293 294 301 302 303} 0} {30 {288 289 290 291 292 293 294 301 302 303} 0} {31 {288 289 290 291 292 293 294 301 302 303} 0} {32 {301 302 303} 0} {33 {301 302 303} 0} {34 {301 302 303} 0} {35 {301 302 303} 0} {36 {301 302 303} 0} {37 {301 302 303} 0} {38 {301 302 303} 0}} + 17 {{17 {288 289 290 291 292 293 294 301 302 303} 1}} + 90 {{51 0 7}} + 89 {{54 0 7}} + 67,trans {{295 76} {296 77} {297 78} {298 79} {299 80} {300 81} {307 82}} + 1 {{1 {301 302} 1}} + 18 {{18 {288 289 290 291 292 293 294 301 302 303} 1}} + 86,trans {} + 15,trans {} + 2 {{2 {301 302} 1}} + 19 {{19 {288 289 290 291 292 293 294 301 302 303} 1}} + 20 {{20 {288 289 290 291 292 293 294 301 302 303} 1}} + 34,trans {} + 3 {{3 {301 302} 1}} + 21 {{21 {288 289 290 291 292 293 294 301 302 303} 1}} + 53,trans {{301 60}} + 4 {{4 {301 302} 1}} + 22 {{22 {288 289 290 291 292 293 294 301 302 303} 1}} + 72,trans {{301 68} {302 69} {308 85}} + 5 {{5 {288 289 290 291 292 293 294 301 302 303} 1}} + 23 {{23 {288 289 290 291 292 293 294 301 302 303} 1}} + 20,trans {} + 19,trans {} + 6 {{6 {288 289 290 291 292 293 294 301 302 303} 1}} + 24 {{24 {288 289 290 291 292 293 294 301 302 303} 1}} + 2,trans {} + 38,trans {} + 7 {{7 {288 289 290 291 292 293 294 301 302 303} 1}} + 25 {{25 {288 289 290 291 292 293 294 301 302 303} 1}} + 57,trans {{301 43} {302 44} {308 64}} + 8 {{8 {288 289 290 291 292 293 294 301 302 303} 1}} + 26 {{26 {288 289 290 291 292 293 294 301 302 303} 1}} + 76,trans {} + 9 {{9 {288 289 290 291 292 293 294 301 302 303} 1}} + 27 {{27 {288 289 290 291 292 293 294 301 302 303} 1}} + 24,trans {} + 6,trans {} + 28 {{28 {288 289 290 291 292 293 294 301 302 303} 1}} + 43,trans {} + 29 {{29 {288 289 290 291 292 293 294 301 302 303} 1}} + 30 {{30 {288 289 290 291 292 293 294 301 302 303} 1}} + 62,trans {{301 43} {302 44} {308 71}} + 31 {{31 {288 289 290 291 292 293 294 301 302 303} 1}} + 81,trans {} + 10,trans {} + 32 {{32 {301 302 303} 1}} + 28,trans {} + 33 {{33 {301 302 303} 1}} + 47,trans {{301 43} {302 44} {303 55} {308 56}} + 34 {{34 {301 302 303} 1}} +} + +array set datasend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 56 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 FALSE_ + 284,title WCSW + 291 J2000_ + 301 INT_ + 292 ICRS_ + 302 REAL_ + 288,line 40 + 293 GALACTIC_ + 303 SEXSTR_ + 304 coordsys + 294 ECLIPTIC_ + 305 wcssys + 295 YES_ + 306 skyframe + 296 NO_ + 307 yesno + 262,t 0 + 297 ON_ + 308 numeric + 285,line 36 + 298 OFF_ + 310 start' + 309 datasend + 299 TRUE_ + 283,t 0 + 282,line 33 + 264,title WCSC + 283,title WCSV + 278,line 29 + error,line 115 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 272,line 23 + 263,title WCSB + 282,title WCSU + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title TRUE + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title OFF + 291,t 0 + 301,t 0 + 307,line 157 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 50 + 278,title WCSQ + 307,title {} + 297,title ON + 287,t 0 + 304,line 116 + 294,line 46 + 291,line 43 + 301,line 55 + error,title {} + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title NO + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 305,title {} + 295,title YES + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 304,title {} + 294,title ECLIPTIC + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title sexagesimal + 271,t 0 + error error + 292,t 0 + 302,t 0 + 273,title WCSL + 292,title ICRS + 302,title float + 267,t 0 + 310,line 185 + 309,line 169 + 299,line 52 + 288,t 0 + 306,line 149 + 296,line 49 + 272,title WCSK + 291,title J2000 + 293,line 45 + 301,title integer + 303,line 58 + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 53 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title FALSE + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 165 + 276 WCSO_ + 298,line 51 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 121 + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc datasend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ 1 } + 40 { set _ 1 } + 41 { set _ 1 } + 42 { set _ 1 } + 43 { set _ 0 } + 44 { set _ 0 } + 45 { set _ 0 } + 46 { set _ $1 } + 47 { set _ $1 } + 48 { DataSendCmd $1 fk5 $2 $3 $4 $5 $6 } + 49 { DataSendCmd $1 fk5 $2 $3 $4 $5 $6 } + 50 { DataSendCmd wcs $1 $2 $3 $4 $5 $6 } + 51 { DataSendCmd $1 $2 $3 $4 $5 $6 $7 } + 52 { DataSendCmd $1 fk5 $2 $3 $4 $5 $6 } + 53 { DataSendCmd wcs $1 $2 $3 $4 $5 $6 } + 54 { DataSendCmd $1 $2 $3 $4 $5 $6 $7 } + } + 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 datasend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/dssesolex.tcl b/ds9/parsers/dssesolex.tcl new file mode 100644 index 0000000..3e38bcd --- /dev/null +++ b/ds9/parsers/dssesolex.tcl @@ -0,0 +1,632 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval dsseso { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc dsseso::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc dsseso::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc dsseso::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc dsseso::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc dsseso::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc dsseso::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc dsseso::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc dsseso::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc dsseso::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set DSS1_ 284 +set DSS2RED_ 285 +set DSS2BLUE_ 286 +set DSS2INFRARED_ 287 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: dss1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(dss1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: dss2-red + if {[regexp -start $index_ -indices -line -nocase -- {\A(dss2-red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: dss2-blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(dss2-blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: dss2-infrared + if {[regexp -start $index_ -indices -line -nocase -- {\A(dss2-infrared)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $DSS1_ + } + 1 { +return $DSS2RED_ + } + 2 { +return $DSS2BLUE_ + } + 3 { +return $DSS2INFRARED_ + } + 4 { +return $YES_ + } + 5 { +return $NO_ + } + 6 { +return $ON_ + } + 7 { +return $OFF_ + } + 8 { +return $TRUE_ + } + 9 { +return $FALSE_ + } + 10 { +return $CLEAR_ + } + 11 { +return $CLOSE_ + } + 12 { +return $COORD_ + } + 13 { +return $CROSSHAIR_ + } + 14 { +return $CURRENT_ + } + 15 { +return $FRAME_ + } + 16 { +return $NAME_ + } + 17 { +return $NEW_ + } + 18 { +return $OPEN_ + } + 19 { +return $SAVE_ + } + 20 { +return $SIZE_ + } + 21 { +return $SURVEY_ + } + 22 { +return $UPDATE_ + } + 23 { +return $DEGREES_ + } + 24 { +return $ARCMIN_ + } + 25 { +return $ARCSEC_ + } + 26 { +return $SEXAGESIMAL_ + } + 27 - + 28 { +set yylval $yytext; return $SEXSTR_ + } + 29 { +set yylval $yytext; return $INT_ + } + 30 - + 31 { +set yylval $yytext; return $REAL_ + } + 32 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 33 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 34 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 35 { +set yylval $yytext; return $STRING_ + } + 36 { +# ignore whitespace + } + 37 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/dssesoparser.tab.tcl b/ds9/parsers/dssesoparser.tab.tcl new file mode 100644 index 0000000..a51d1d5 --- /dev/null +++ b/ds9/parsers/dssesoparser.tab.tcl @@ -0,0 +1,31 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set DSS1_ 284 +set DSS2RED_ 285 +set DSS2BLUE_ 286 +set DSS2INFRARED_ 287 diff --git a/ds9/parsers/dssesoparser.tcl b/ds9/parsers/dssesoparser.tcl new file mode 100644 index 0000000..c4b6cb5 --- /dev/null +++ b/ds9/parsers/dssesoparser.tcl @@ -0,0 +1,1023 @@ +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 dsseso { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc dsseso::YYABORT {} { + return -code return 1 +} + +proc dsseso::YYACCEPT {} { + return -code return 0 +} + +proc dsseso::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc dsseso::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc dsseso::yyerror {s} { + puts stderr $s +} + +proc dsseso::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 dsseso::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set dsseso::table { + 10:280,target 40 + 9:284 shift + 16:283,target 22 + 30:283 reduce + 29:283 reduce + 9:285 shift + 9:286 shift + 27:0 reduce + 9:287 shift + 48:0 reduce + 3:267,target 19 + 51:283,target 38 + 7:283,target 1 + 38:283 reduce + 0:275,target 9 + 11:282,target 19 + 40:283,target 10 + 39:283,target 33 + 6:266 shift + 7:262,target 32 + 9:299 goto + 56:0,target 30 + 6:268 shift + 24:0 reduce + 48:0,target 9 + 47:283 reduce + 41:0,target 8 + 45:0 reduce + 33:0,target 31 + 2:282,target 12 + 28:283,target 5 + 0:294,target 14 + 17:280 shift + 25:0,target 39 + 34:282,target 12 + 0:273,target 7 + 56:283 reduce + 7:259,target 29 + 7:260,target 30 + 21:0 reduce + 9:287,target 38 + 26:283 reduce + 52:283,target 37 + 2:280,target 17 + 12:282,target 20 + 41:283,target 8 + 35:283 reduce + 0:271,target 5 + 11:277,target 19 + 44:276 shift + 7:257,target 27 + 6:298 goto + 3:267 shift + 38:0 reduce + 30:283,target 6 + 29:283,target 3 + 9:285,target 36 + 45:277,target 54 + 3:270 shift + 44:283 reduce + 43:290,target 51 + 8:281,target 11 + 14:281 shift + 14:282 shift + 53:0,target 16 + 44:289 goto + 0:268,target 3 + 45:0,target 12 + 53:283 reduce + 37:0,target 43 + 30:0,target 6 + 29:0,target 3 + 22:0,target 28 + 53:283,target 16 + 35:0 reduce + 4:263,target 22 + 23:283 reduce + 56:0 reduce + 14:294 goto + 42:283,target 50 + 12:277,target 20 + 18:281,target 11 + 3:292 goto + 32:283 reduce + 11:0 reduce + 41:276 shift + 31:283,target 4 + 2:294,target 18 + 0:264 shift + 32:0 reduce + 0:265 shift + 44:289,target 52 + 53:0 reduce + 0:268 shift + 34:294,target 45 + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 19:283,target 15 + 20:283,target 14 + 0:272 shift + 11:278 reduce + 0:273 shift + 0:274 shift + 11:281 reduce + 0:275 shift + 11:282 reduce + 41:276,target 48 + 0:264,target 1 + 41:289 goto + 9:299,target 39 + 54:283,target 17 + 49:283 reduce + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 0:282 shift + 14:282,target 12 + 50:0 reduce + 49:0 reduce + 0:283 shift + 57:0,target 13 + 43:283,target 10 + 19:283 reduce + 20:283 reduce + 50:0,target 23 + 49:0,target 35 + 0:283,target 13 + 8:281 shift + 26:0,target 34 + 8:282 shift + 32:283,target 7 + 11:0,target 19 + 0:294 goto + 25:0 reduce + 28:283 reduce + 0:295 goto + 46:0 reduce + 0:297 goto + 21:283,target 32 + 7:288,target 33 + 0:281,target 11 + 37:283 reduce + 8:294 goto + 0:0 reduce + 55:283,target 18 + 3:292,target 21 + 22:0 reduce + 46:283 reduce + 43:0 reduce + 44:283,target 8 + 1:283,target 26 + 16:283 reduce + 33:283,target 31 + 55:283 reduce + 5:283 reduce + 54:0,target 17 + 40:0 reduce + 39:0 reduce + 22:283,target 28 + 25:283 reduce + 46:0,target 11 + 0:297,target 16 + 38:0,target 44 + 31:0,target 4 + 16:296 goto + 23:0,target 29 + 15:0,target 0 + 34:281 shift + 56:283,target 30 + 34:282 shift + 15:0 accept + 14:294,target 41 + 45:283,target 12 + 43:279 shift + 36:0 reduce + 0:295,target 15 + 57:0 reduce + 43:283 reduce + 6:298,target 26 + 34:294 goto + 0:274,target 8 + 11:281,target 19 + 13:283 reduce + 43:290 goto + 7:261,target 31 + 12:0 reduce + 52:283 reduce + 2:280 shift + 2:281 shift + 23:283,target 29 + 33:0 reduce + 2:282 shift + 2:281,target 11 + 54:0 reduce + 22:283 reduce + 44:276,target 48 + 57:283,target 13 + 1:0,target 26 + 34:281,target 11 + 0:272,target 6 + 11:278,target 19 + 7:0 reduce + 51:0,target 38 + 40:279,target 46 + 31:283 reduce + 2:294 goto + 7:258,target 28 + 46:283,target 11 + 43:0,target 10 + 35:0,target 41 + 30:0 reduce + 29:0 reduce + 9:286,target 37 + 27:0,target 2 + 45:278,target 55 + 7:257 shift + 19:0,target 15 + 20:0,target 14 + 51:0 reduce + 40:279 shift + 7:258 shift + 12:0,target 20 + 7:259 shift + 7:260 shift + 8:282,target 12 + 35:283,target 41 + 7:261 shift + 40:283 reduce + 39:283 reduce + 7:262 shift + 12:281,target 20 + 10:280 shift + 16:296,target 42 + 0:269,target 4 + 11:276,target 19 + 17:280,target 43 + 24:283,target 40 + 40:290 goto + 26:0 reduce + 48:283 reduce + 9:284,target 35 + 47:0 reduce + 45:276,target 53 + 13:283,target 27 + 18:281 shift + 18:282 shift + 12:278,target 20 + 18:282,target 12 + 57:283 reduce + 1:0 reduce + 47:283,target 36 + 4:283,target 23 + 7:283 reduce + 23:0 reduce + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 18:294 goto + 36:283,target 42 + 7:288 goto + 55:0,target 18 + 12:276,target 20 + 47:0,target 36 + 36:283 reduce + 40:0,target 10 + 39:0,target 33 + 4:263 shift + 25:283,target 39 + 45:276 shift + 32:0,target 7 + 0:265,target 2 + 45:277 shift + 6:268,target 25 + 24:0,target 40 + 45:278 shift + 45:293,target 57 + 16:0,target 21 + 19:0 reduce + 20:0 reduce + 41:0 reduce + 45:283 reduce + 48:283,target 9 + 45:291 goto + 5:283,target 25 + 54:283 reduce + 45:293 goto + 6:266,target 24 + 16:0 reduce + 45:291,target 56 + 4:283 shift + 37:283,target 43 + 37:0 reduce + 8:294,target 34 + 14:281,target 11 + 24:283 reduce + 0:282,target 12 + 26:283,target 34 + 40:290,target 47 + 33:283 reduce + 13:0 reduce + 55:0 reduce + 52:0,target 37 + 12:276 reduce + 44:0,target 8 + 42:283 shift + 12:277 reduce + 18:294,target 44 + 43:279,target 46 + 36:0,target 42 + 12:278 reduce + 49:283,target 35 + 0:280,target 10 + 28:0,target 5 + 12:281 reduce + 21:0,target 32 + 12:282 reduce + 13:0,target 27 + 51:283 reduce + 38:283,target 44 + 31:0 reduce + 1:283 reduce + 52:0 reduce + 3:270,target 20 + 21:283 reduce + 27:283,target 2 + 41:289,target 49 + 5:0 reduce +} + +array set dsseso::rules { + 9,l 289 + 11,l 290 + 32,l 297 + 6,l 288 + 28,l 297 + 3,l 288 + 25,l 297 + 0,l 300 + 22,l 296 + 43,l 299 + 18,l 293 + 40,l 298 + 39,l 298 + 15,l 292 + 36,l 297 + 12,l 291 + 33,l 297 + 7,l 288 + 29,l 297 + 30,l 297 + 4,l 288 + 26,l 297 + 1,l 288 + 23,l 295 + 44,l 299 + 19,l 294 + 20,l 294 + 41,l 299 + 16,l 293 + 37,l 297 + 13,l 291 + 34,l 297 + 8,l 289 + 10,l 290 + 31,l 297 + 5,l 288 + 27,l 297 + 2,l 288 + 24,l 297 + 21,l 295 + 42,l 299 + 17,l 293 + 38,l 297 + 14,l 292 + 35,l 297 +} + +array set dsseso::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 4 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 44,dc 1 + 22,dc 0 + 36,dc 3 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 2 +} + +array set dsseso::rules { + 41,line 152 + 7,line 93 + 37,line 144 + 4,line 90 + 34,line 140 + 1,line 87 + 31,line 136 + 27,line 131 + 24,line 128 + 21,line 124 + 17,line 117 + 22,e 1 + 14,line 112 + 11,line 105 + 43,line 154 + 9,line 101 + 40,line 149 + 39,line 148 + 6,line 92 + 36,line 143 + 3,line 89 + 33,line 138 + 29,line 133 + 30,line 135 + 26,line 130 + 23,line 125 + 19,line 120 + 20,line 121 + 16,line 116 + 13,line 109 + 10,line 104 + 42,line 153 + 8,line 100 + 38,line 145 + 5,line 91 + 35,line 141 + 2,line 88 + 32,line 137 + 28,line 132 + 25,line 129 + 22,line 124 + 18,line 118 + 15,line 113 + 12,line 108 + 44,line 155 +} + +array set dsseso::lr1_table { + 35 {{41 {0 283} 1}} + 14,trans {{281 41} {282 42} {294 43}} + 36 {{42 {0 283} 1}} + 33,trans {} + 37 {{43 {0 283} 1}} + 52,trans {} + 38 {{44 {0 283} 1}} + 40 {{36 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} + 39 {{33 {0 283} 2}} + 18,trans {{281 41} {282 42} {294 46}} + 41 {{19 {0 276} 1}} + 1,trans {} + 37,trans {} + 42 {{20 {0 276} 1}} + 56,trans {} + 43 {{35 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 44 {{23 0 2}} + 23,trans {} + 45 {{38 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 5,trans {} + 42,trans {} + 46 {{37 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 61,trans {} + 47 {{19 {0 276 277 278} 1}} + 48 {{20 {0 276 277 278} 1}} + 50 {{11 {0 283} 1}} + 49 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 27,trans {} + 9,trans {{284 35} {285 36} {286 37} {287 38} {299 39}} + 46,trans {{276 52} {289 56}} + 51 {{36 {0 283} 3}} + 52 {{9 {0 283} 1}} + 53 {{35 {0 283} 3}} + 13,trans {} + 54 {{23 0 3}} + 32,trans {} + 51,trans {} + 55 {{38 {0 283} 4}} + 56 {{37 {0 283} 4}} + 57 {{16 {0 283} 1}} + 17,trans {{280 45}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {275 9} {280 10} {281 11} {282 12} {283 13} {294 14} {295 15} {297 16}} + 58 {{17 {0 283} 1}} + 36,trans {} + 55,trans {} + 60 {{30 {0 283} 4}} + 59 {{18 {0 283} 1}} + 61 {{13 {0 283} 1}} + 22,trans {} + 4,trans {{263 22} {283 23}} + 41,trans {} + 60,trans {} + 59,trans {} + 26,trans {} + 8,trans {{281 11} {282 12} {294 34}} + 45,trans {{279 50} {290 55}} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {{276 57} {277 58} {278 59} {291 60} {293 61}} + 16,trans {{296 44}} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {{267 19} {270 20} {292 21}} + 40,trans {{279 50} {290 51}} + 39,trans {} + 58,trans {} + 10 {{36 {0 283} 1}} + 11 {{19 {281 282} 1}} + 25,trans {} + 12 {{20 {281 282} 1}} + 7,trans {{257 27} {258 28} {259 29} {260 30} {261 31} {262 32} {288 33}} + 44,trans {{283 54}} + 13 {{27 {0 283} 1}} + 14 {{35 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 11,trans {} + 15 {{0 0 1}} + 30,trans {} + 29,trans {} + 16 {{21 0 1} {23 0 1} {22 283 0}} + 48,trans {} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {38 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{38 {0 283} 2}} + 1 {{26 {0 283} 1}} + 18 {{37 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 15,trans {} + 2 {{37 {0 283} 1} {38 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{15 {0 283} 1}} + 20 {{14 {0 283} 1}} + 34,trans {{281 47} {282 48} {294 49}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{32 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{28 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{29 {0 283} 2}} + 20,trans {} + 19,trans {} + 6 {{34 {0 283} 1} {39 {0 283} 0} {40 {0 283} 0}} + 2,trans {{280 17} {281 11} {282 12} {294 18}} + 24 {{40 {0 283} 1}} + 38,trans {} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{39 {0 283} 1}} + 57,trans {} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{34 {0 283} 2}} + 9 {{33 {0 283} 1} {41 {0 283} 0} {42 {0 283} 0} {43 {0 283} 0} {44 {0 283} 0}} + 27 {{2 {0 283} 1}} + 24,trans {} + 6,trans {{266 24} {268 25} {298 26}} + 28 {{5 {0 283} 1}} + 43,trans {{276 52} {289 53}} + 29 {{3 {0 283} 1}} + 30 {{6 {0 283} 1}} + 31 {{4 {0 283} 1}} + 10,trans {{280 40}} + 32 {{7 {0 283} 1}} + 28,trans {} + 33 {{31 {0 283} 2}} + 47,trans {} + 34 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} +} + +array set dsseso::token_id_table { + 286,t 0 + 286 DSS2BLUE_ + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 298,title {} + 292,line 111 + 287 DSS2INFRARED_ + 270,t 0 + 269,t 0 + 288 yesno + 300 start' + 290 sex + 289 deg + 276,line 28 + 265,title COORD + 291,t 1 + 291 sizeOpt + 284,title DSS1 + 292 frame + 274,t 0 + 261,line 11 + 293 rformat + 288,line 86 + 257,t 0 + 294 numeric + 270,title NEW + 269,title NAME + 295,t 1 + 295 command + 288,title {} + 273,line 24 + 296 @PSEUDO1 + 278,t 0 + 297 dsseso + 257,line 7 + 262,t 0 + 298 update + 285,line 44 + 274,title SIZE + 299,t 1 + 299 survey + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 297,line 127 + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 297,title {} + 282,line 37 + 287,t 0 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 119 + 283,title string + 292,t 1 + 278,line 30 + error,line 85 + 275,t 0 + 268,title FRAME + 287,title DSS2INFRARED + 258,t 0 + 263,line 14 + 291,line 107 + error,title {} + 296,t 1 + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 46 + 258,title NO + 284,t 0 + 277,title ARCMIN + 296,title {} + 272,line 23 + 267,t 0 + 299,line 151 + 263,title CLEAR + 288,t 1 + 284,line 43 + 282,title float + 272,t 0 + 268,line 19 + 296,line 124 + 267,title CURRENT + 293,t 1 + 286,title DSS2BLUE + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + 297,t 1 + 293,line 115 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 300,line 156 + 290,line 103 + 289,line 99 + 285,t 0 + 267 CURRENT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + 299,title {} + error,t 0 + 271 OPEN_ + 300,t 1 + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 45 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title DSS2RED + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 298,line 147 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 300,title {} + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 298,t 1 + 281 INT_ + 267,line 18 + 295,line 123 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 DSS1_ + 280,line 34 + 279,line 32 + 285 DSS2RED_ + 261,title TRUE +} + +proc dsseso::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply deso 1 } + 26 { ARDestroy deso } + 27 { ProcessCmdSet deso name $1 "IMGSVRApply deso 1" } + 28 { ProcessCmdSet deso name {} } + 29 { ProcessCmdSet deso name $2 "IMGSVRApply deso 1" } + 30 { ProcessCmdSet4 deso width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet deso save $2 } + 32 { ProcessCmdSet deso mode $2 } + 33 { ProcessCmdSet deso survey $2 } + 35 { ProcessCmdSet4 deso x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply deso 1" } + 36 { ProcessCmdSet4 deso x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply deso 1" } + 37 { ProcessCmdSet4 deso x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply deso 1" } + 38 { ProcessCmdSet4 deso x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply deso 1" } + 39 { IMGSVRUpdate deso; IMGSVRApply deso 1 } + 40 { IMGSVRCrosshair deso; IMGSVRApply deso 1 } + 41 { set _ DSS1 } + 42 { set _ DSS2-red } + 43 { set _ DSS2-blue } + 44 { set _ DSS2-infrared } + } + 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 dsseso::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/dssesosendlex.tcl b/ds9/parsers/dssesosendlex.tcl new file mode 100644 index 0000000..037daa9 --- /dev/null +++ b/ds9/parsers/dssesosendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval dssesosend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc dssesosend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc dssesosend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc dssesosend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc dssesosend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc dssesosend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc dssesosend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc dssesosend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc dssesosend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc dssesosend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/dssesosendparser.tab.tcl b/ds9/parsers/dssesosendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/dssesosendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/dssesosendparser.tcl b/ds9/parsers/dssesosendparser.tcl new file mode 100644 index 0000000..ed0e865 --- /dev/null +++ b/ds9/parsers/dssesosendparser.tcl @@ -0,0 +1,324 @@ +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 dssesosend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc dssesosend::YYABORT {} { + return -code return 1 +} + +proc dssesosend::YYACCEPT {} { + return -code return 0 +} + +proc dssesosend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc dssesosend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc dssesosend::yyerror {s} { + puts stderr $s +} + +proc dssesosend::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 dssesosend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set dssesosend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 accept + 0:258 shift + 5:0,target 6 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 0 + 0:258,target 2 + 0:262 shift + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 7 + 4:0,target 3 + 0:0 reduce + 6:0,target 5 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 7 + 5:0 reduce + 0:262,target 6 +} + +array set dssesosend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 + 7,l 263 +} + +array set dssesosend::rules { + 5,dc 1 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set dssesosend::rules { + 5,line 24 + 7,line 26 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set dssesosend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0}} + 1 {{7 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7}} + 5 {{6 0 1}} + 1,trans {} + 6 {{5 0 1}} + 2,trans {} + 7 {{0 0 1}} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} + 7,trans {} +} + +array set dssesosend::token_id_table { + 264,line 27 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 dssesosend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc dssesosend::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 { ProcessSendCmdGet deso name } + 2 { ProcessSendCmdGet deso name } + 3 { ProcessSendCmdYesNo deso save } + 4 { ProcessSendCmdGet deso mode } + 5 { ProcessSendCmdGet deso survey } + 6 { ProcessSendCmdGet3 deso width height rformat } + 7 { ProcessSendCmdGet3 deso x y skyformat } + } + 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 dssesosend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/dsssaolex.tcl b/ds9/parsers/dsssaolex.tcl new file mode 100644 index 0000000..2af123a --- /dev/null +++ b/ds9/parsers/dsssaolex.tcl @@ -0,0 +1,588 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval dsssao { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc dsssao::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc dsssao::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc dsssao::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc dsssao::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc dsssao::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc dsssao::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc dsssao::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc dsssao::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc dsssao::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $YES_ + } + 1 { +return $NO_ + } + 2 { +return $ON_ + } + 3 { +return $OFF_ + } + 4 { +return $TRUE_ + } + 5 { +return $FALSE_ + } + 6 { +return $CLEAR_ + } + 7 { +return $CLOSE_ + } + 8 { +return $COORD_ + } + 9 { +return $CROSSHAIR_ + } + 10 { +return $CURRENT_ + } + 11 { +return $FRAME_ + } + 12 { +return $NAME_ + } + 13 { +return $NEW_ + } + 14 { +return $OPEN_ + } + 15 { +return $SAVE_ + } + 16 { +return $SIZE_ + } + 17 { +return $SURVEY_ + } + 18 { +return $UPDATE_ + } + 19 { +return $DEGREES_ + } + 20 { +return $ARCMIN_ + } + 21 { +return $ARCSEC_ + } + 22 { +return $SEXAGESIMAL_ + } + 23 - + 24 { +set yylval $yytext; return $SEXSTR_ + } + 25 { +set yylval $yytext; return $INT_ + } + 26 - + 27 { +set yylval $yytext; return $REAL_ + } + 28 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval $yytext; return $STRING_ + } + 32 { +# ignore whitespace + } + 33 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/dsssaoparser.tab.tcl b/ds9/parsers/dsssaoparser.tab.tcl new file mode 100644 index 0000000..0eda1ee --- /dev/null +++ b/ds9/parsers/dsssaoparser.tab.tcl @@ -0,0 +1,27 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 diff --git a/ds9/parsers/dsssaoparser.tcl b/ds9/parsers/dsssaoparser.tcl new file mode 100644 index 0000000..061cc99 --- /dev/null +++ b/ds9/parsers/dsssaoparser.tcl @@ -0,0 +1,939 @@ +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 dsssao { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc dsssao::YYABORT {} { + return -code return 1 +} + +proc dsssao::YYACCEPT {} { + return -code return 0 +} + +proc dsssao::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc dsssao::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc dsssao::yyerror {s} { + puts stderr $s +} + +proc dsssao::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 dsssao::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set dsssao::table { + 3:288,target 20 + 29:283 reduce + 30:283 reduce + 27:0 reduce + 38:276 shift + 48:0 reduce + 3:267,target 18 + 51:283,target 13 + 7:283,target 1 + 38:283 reduce + 11:282,target 20 + 38:285 goto + 40:283,target 11 + 39:283,target 12 + 6:266 shift + 7:262,target 31 + 10:277,target 19 + 6:268 shift + 24:0 reduce + 48:0,target 17 + 47:283 reduce + 41:0,target 35 + 45:0 reduce + 2:282,target 11 + 25:0,target 33 + 28:283,target 3 + 17:281 shift + 10:0,target 19 + 17:282 shift + 0:273,target 7 + 7:259,target 28 + 7:260,target 29 + 17:290 goto + 21:0 reduce + 38:276,target 42 + 26:283 reduce + 42:0 reduce + 35:276 shift + 2:280,target 16 + 34:279,target 40 + 41:283,target 35 + 35:283 reduce + 0:271,target 5 + 6:294 goto + 11:277,target 20 + 17:281,target 10 + 35:285 goto + 39:278,target 49 + 7:257,target 26 + 3:267 shift + 38:0 reduce + 30:283,target 4 + 29:283,target 6 + 3:270 shift + 0:290,target 13 + 8:281,target 10 + 18:283,target 15 + 0:268,target 3 + 45:0,target 37 + 37:0,target 10 + 14:0 accept + 39:276,target 47 + 29:0,target 6 + 30:0,target 4 + 22:0,target 29 + 35:0 reduce + 14:0,target 0 + 4:263,target 21 + 23:283 reduce + 13:282,target 11 + 3:288 goto + 42:283,target 9 + 32:283 reduce + 11:0 reduce + 31:283,target 7 + 0:264 shift + 37:286,target 45 + 32:0 reduce + 0:265 shift + 0:268 shift + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 19:283,target 14 + 20:283,target 32 + 0:272 shift + 11:278 reduce + 33:290,target 39 + 0:273 shift + 0:274 shift + 11:281 reduce + 11:282 reduce + 0:264,target 1 + 50:283 reduce + 49:283 reduce + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 0:282 shift + 50:0 reduce + 49:0 reduce + 0:283 shift + 43:283,target 34 + 19:283 reduce + 20:283 reduce + 50:0,target 30 + 49:0,target 18 + 0:283,target 12 + 42:0,target 9 + 34:0,target 10 + 0:290 goto + 8:281 shift + 26:0,target 2 + 0:291 goto + 8:282 shift + 18:0,target 15 + 32:283,target 31 + 11:0,target 20 + 0:293 goto + 25:0 reduce + 28:283 reduce + 2:290,target 17 + 46:0 reduce + 8:290 goto + 21:283,target 28 + 37:279 shift + 0:281,target 10 + 37:283 reduce + 0:0 reduce + 37:286 goto + 22:0 reduce + 46:283 reduce + 43:0 reduce + 37:279,target 40 + 1:283,target 26 + 16:280 shift + 10:281,target 19 + 18:0 reduce + 5:283 reduce + 40:0 reduce + 39:0 reduce + 22:283,target 29 + 25:283 reduce + 46:0,target 36 + 38:0,target 8 + 31:0,target 7 + 7:284,target 32 + 23:0,target 39 + 34:279 shift + 15:0,target 21 + 34:283 reduce + 33:281,target 10 + 10:278,target 19 + 15:0 reduce + 34:286 goto + 45:283,target 37 + 13:290,target 35 + 43:283 reduce + 34:283,target 10 + 13:281 shift + 0:274,target 8 + 11:281,target 20 + 13:282 shift + 7:261,target 30 + 10:276,target 19 + 12:0 reduce + 2:280 shift + 16:280,target 37 + 2:281 shift + 23:283,target 39 + 2:282 shift + 13:290 goto + 2:281,target 10 + 0:293,target 15 + 22:283 reduce + 35:285,target 43 + 12:283,target 27 + 1:0,target 26 + 2:290 goto + 0:272,target 6 + 11:278,target 20 + 7:0 reduce + 17:282,target 11 + 51:0,target 13 + 31:283 reduce + 7:258,target 27 + 46:283,target 36 + 43:0,target 34 + 39:276 shift + 35:0,target 8 + 29:0 reduce + 30:0 reduce + 39:277 shift + 27:0,target 5 + 39:278 shift + 7:257 shift + 19:0,target 14 + 20:0,target 32 + 51:0 reduce + 7:258 shift + 12:0,target 27 + 0:291,target 14 + 7:259 shift + 7:260 shift + 8:282,target 11 + 35:283,target 8 + 6:294,target 25 + 7:261 shift + 10:276 reduce + 40:283 reduce + 39:283 reduce + 7:262 shift + 10:277 reduce + 10:278 reduce + 0:269,target 4 + 10:281 reduce + 11:276,target 20 + 39:287 goto + 10:282 reduce + 15:292,target 36 + 24:283,target 38 + 39:277,target 48 + 39:289 goto + 26:0 reduce + 48:283 reduce + 47:0 reduce + 18:283 reduce + 1:0 reduce + 47:283,target 16 + 4:283,target 22 + 7:283 reduce + 7:284 goto + 23:0 reduce + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 36:283,target 44 + 13:281,target 10 + 47:0,target 16 + 36:283 shift + 40:0,target 11 + 39:0,target 12 + 4:263 shift + 25:283,target 33 + 32:0,target 31 + 0:265,target 2 + 6:268,target 24 + 24:0,target 38 + 19:0 reduce + 20:0 reduce + 41:0 reduce + 45:283 reduce + 9:280,target 34 + 35:276,target 42 + 15:283 reduce + 48:283,target 17 + 5:283,target 25 + 6:266,target 23 + 4:283 shift + 37:283,target 10 + 37:0 reduce + 15:292 goto + 24:283 reduce + 0:282,target 11 + 26:283,target 2 + 33:281 shift + 39:289,target 51 + 33:282 shift + 38:285,target 46 + 15:283,target 22 + 34:0 reduce + 33:290 goto + 44:0,target 23 + 42:283 reduce + 50:283,target 30 + 49:283,target 18 + 0:280,target 9 + 28:0,target 3 + 17:290,target 38 + 21:0,target 28 + 39:287,target 50 + 10:282,target 19 + 12:283 reduce + 10:0 reduce + 51:283 reduce + 38:283,target 8 + 31:0 reduce + 1:283 reduce + 8:290,target 33 + 3:270,target 19 + 21:283 reduce + 27:283,target 5 + 34:286,target 41 + 9:280 shift + 33:282,target 11 + 5:0 reduce +} + +array set dsssao::rules { + 9,l 285 + 11,l 286 + 32,l 293 + 6,l 284 + 28,l 293 + 3,l 284 + 25,l 293 + 0,l 295 + 22,l 292 + 18,l 289 + 39,l 294 + 15,l 288 + 36,l 293 + 12,l 287 + 33,l 293 + 7,l 284 + 29,l 293 + 30,l 293 + 4,l 284 + 26,l 293 + 1,l 284 + 23,l 291 + 19,l 290 + 20,l 290 + 16,l 289 + 37,l 293 + 13,l 287 + 34,l 293 + 8,l 285 + 10,l 286 + 31,l 293 + 5,l 284 + 27,l 293 + 2,l 284 + 24,l 293 + 21,l 291 + 17,l 289 + 38,l 294 + 14,l 288 + 35,l 293 +} + +array set dsssao::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 1 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 22,dc 0 + 36,dc 4 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 21,dc 1 + 35,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 3 +} + +array set dsssao::rules { + 7,line 88 + 37,line 139 + 4,line 85 + 34,line 135 + 1,line 82 + 31,line 131 + 27,line 126 + 24,line 123 + 21,line 119 + 17,line 112 + 22,e 1 + 14,line 107 + 11,line 100 + 9,line 96 + 39,line 143 + 6,line 87 + 36,line 138 + 3,line 84 + 33,line 134 + 29,line 128 + 30,line 130 + 26,line 125 + 23,line 120 + 19,line 115 + 20,line 116 + 16,line 111 + 13,line 104 + 10,line 99 + 8,line 95 + 38,line 142 + 5,line 86 + 35,line 137 + 2,line 83 + 32,line 132 + 28,line 127 + 25,line 124 + 22,line 119 + 18,line 113 + 15,line 108 + 12,line 103 +} + +array set dsssao::lr1_table { + 35 {{19 {0 276} 1}} + 14,trans {} + 36 {{20 {0 276} 1}} + 33,trans {{281 41} {282 42} {290 43}} + 37 {{34 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 52,trans {} + 38 {{23 0 2}} + 40 {{36 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 39 {{37 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 41 {{19 {0 276 277 278} 1}} + 18,trans {} + 1,trans {} + 37,trans {{276 46} {285 47}} + 42 {{20 {0 276 277 278} 1}} + 43 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 44 {{11 {0 283} 1}} + 45 {{35 {0 283} 3}} + 23,trans {} + 5,trans {} + 42,trans {} + 46 {{9 {0 283} 1}} + 47 {{34 {0 283} 3}} + 48 {{23 0 3}} + 50 {{36 {0 283} 4}} + 49 {{37 {0 283} 4}} + 27,trans {} + 9,trans {{280 34}} + 46,trans {} + 51 {{16 {0 283} 1}} + 52 {{17 {0 283} 1}} + 53 {{18 {0 283} 1}} + 13,trans {{281 35} {282 36} {290 37}} + 54 {{30 {0 283} 4}} + 32,trans {} + 51,trans {} + 55 {{13 {0 283} 1}} + 17,trans {{281 35} {282 36} {290 40}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {280 9} {281 10} {282 11} {283 12} {290 13} {291 14} {293 15}} + 36,trans {} + 55,trans {} + 22,trans {} + 4,trans {{263 21} {283 22}} + 41,trans {} + 26,trans {} + 8,trans {{281 10} {282 11} {290 33}} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {{280 39}} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {{267 18} {270 19} {288 20}} + 40,trans {{276 46} {285 50}} + 39,trans {{279 44} {286 49}} + 10 {{19 {281 282} 1}} + 11 {{20 {281 282} 1}} + 25,trans {} + 12 {{27 {0 283} 1}} + 7,trans {{257 26} {258 27} {259 28} {260 29} {261 30} {262 31} {284 32}} + 44,trans {} + 13 {{34 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 14 {{0 0 1}} + 15 {{21 0 1} {23 0 1} {22 283 0}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{37 {0 283} 2}} + 48,trans {} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{36 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 1 {{26 {0 283} 1}} + 18 {{15 {0 283} 1}} + 15,trans {{292 38}} + 2 {{36 {0 283} 1} {37 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{14 {0 283} 1}} + 20 {{32 {0 283} 2}} + 34,trans {{279 44} {286 45}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{28 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{29 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{39 {0 283} 1}} + 20,trans {} + 19,trans {} + 6 {{33 {0 283} 1} {38 {0 283} 0} {39 {0 283} 0}} + 2,trans {{280 16} {281 10} {282 11} {290 17}} + 24 {{38 {0 283} 1}} + 38,trans {{283 48}} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{33 {0 283} 2}} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{2 {0 283} 1}} + 9 {{35 {0 283} 1}} + 27 {{5 {0 283} 1}} + 24,trans {} + 6,trans {{266 23} {268 24} {294 25}} + 28 {{3 {0 283} 1}} + 43,trans {{276 51} {277 52} {278 53} {287 54} {289 55}} + 29 {{6 {0 283} 1}} + 30 {{4 {0 283} 1}} + 31 {{7 {0 283} 1}} + 32 {{31 {0 283} 2}} + 10,trans {} + 28,trans {} + 33 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} + 47,trans {} + 34 {{35 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} +} + +array set dsssao::token_id_table { + 286,t 1 + 286 sex + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 292,line 119 + 287 sizeOpt + 270,t 0 + 269,t 0 + 288 frame + 290 numeric + 289 rformat + 276,line 28 + 265,title COORD + 291,t 1 + 291 command + 284,title {} + 292 @PSEUDO1 + 274,t 0 + 261,line 11 + 293 dsssao + 288,line 106 + 257,t 0 + 294 update + 270,title NEW + 269,title NAME + 295,t 1 + 295 start' + 288,title {} + 273,line 24 + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 94 + 274,title SIZE + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 141 + 283,title string + 292,t 1 + 278,line 30 + error,line 80 + 275,t 0 + 268,title FRAME + 287,title {} + 258,t 0 + 263,line 14 + 291,line 118 + error,title {} + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 102 + 258,title NO + 284,t 1 + 277,title ARCMIN + 272,line 23 + 267,t 0 + 263,title CLEAR + 288,t 1 + 284,line 81 + 282,title float + 272,t 0 + 268,line 19 + 267,title CURRENT + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + 293,line 122 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 290,line 114 + 289,line 110 + 285,t 1 + 267 CURRENT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + error,t 0 + 271 OPEN_ + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 98 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title {} + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 281 INT_ + 267,line 18 + 295,line 144 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 yesno + 280,line 34 + 279,line 32 + 285 deg + 261,title TRUE +} + +proc dsssao::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dsao 1 } + 26 { ARDestroy dsao } + 27 { ProcessCmdSet dsao name $1 "IMGSVRApply dsao 1" } + 28 { ProcessCmdSet dsao name {} } + 29 { ProcessCmdSet dsao name $2 "IMGSVRApply dsao 1" } + 30 { ProcessCmdSet4 dsao width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet dsao save $2 } + 32 { ProcessCmdSet dsao mode $2 } + 34 { ProcessCmdSet4 dsao x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dsao 1" } + 35 { ProcessCmdSet4 dsao x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dsao 1" } + 36 { ProcessCmdSet4 dsao x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dsao 1" } + 37 { ProcessCmdSet4 dsao x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dsao 1" } + 38 { IMGSVRUpdate dsao; IMGSVRApply dsao 1 } + 39 { IMGSVRCrosshair dsao; IMGSVRApply dsao 1 } + } + 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 dsssao::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/dsssaosendlex.tcl b/ds9/parsers/dsssaosendlex.tcl new file mode 100644 index 0000000..b99eeef --- /dev/null +++ b/ds9/parsers/dsssaosendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval dsssaosend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc dsssaosend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc dsssaosend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc dsssaosend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc dsssaosend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc dsssaosend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc dsssaosend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc dsssaosend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc dsssaosend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc dsssaosend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/dsssaosendparser.tab.tcl b/ds9/parsers/dsssaosendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/dsssaosendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/dsssaosendparser.tcl b/ds9/parsers/dsssaosendparser.tcl new file mode 100644 index 0000000..22a80e1 --- /dev/null +++ b/ds9/parsers/dsssaosendparser.tcl @@ -0,0 +1,314 @@ +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 dsssaosend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc dsssaosend::YYABORT {} { + return -code return 1 +} + +proc dsssaosend::YYACCEPT {} { + return -code return 0 +} + +proc dsssaosend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc dsssaosend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc dsssaosend::yyerror {s} { + puts stderr $s +} + +proc dsssaosend::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 dsssaosend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set dsssaosend::table { + 6:0 accept + 3:0,target 2 + 0:257 shift + 0:258 shift + 5:0,target 5 + 0:259 shift + 0:260 shift + 0:261 shift + 0:258,target 2 + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 6 + 4:0,target 3 + 0:0 reduce + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 6 + 5:0 reduce +} + +array set dsssaosend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 +} + +array set dsssaosend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set dsssaosend::rules { + 5,line 24 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set dsssaosend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0}} + 1 {{6 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {263 6}} + 5 {{5 0 1}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} +} + +array set dsssaosend::token_id_table { + 264,line 26 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 dsssaosend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc dsssaosend::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 { ProcessSendCmdGet dsao name } + 2 { ProcessSendCmdGet dsao name } + 3 { ProcessSendCmdYesNo dsao save } + 4 { ProcessSendCmdGet dsao mode } + 5 { ProcessSendCmdGet3 dsao width height rformat } + 6 { ProcessSendCmdGet3 dsao x y skyformat } + } + 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 dsssaosend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/dssstscilex.tcl b/ds9/parsers/dssstscilex.tcl new file mode 100644 index 0000000..e6c1478 --- /dev/null +++ b/ds9/parsers/dssstscilex.tcl @@ -0,0 +1,687 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval dssstsci { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc dssstsci::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc dssstsci::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc dssstsci::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc dssstsci::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc dssstsci::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc dssstsci::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc dssstsci::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc dssstsci::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc dssstsci::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set POSS2RED_ 284 +set POSS2INFRARED_ 285 +set POSS2BLUE_ 286 +set POSS1BLUE_ 287 +set POSS1RED_ 288 +set ALL_ 289 +set QUICKV_ 290 +set GSC2_ 291 +set GSC1_ 292 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: poss2ukstu_red + if {[regexp -start $index_ -indices -line -nocase -- {\A(poss2ukstu_red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: poss2ukstu_ir + if {[regexp -start $index_ -indices -line -nocase -- {\A(poss2ukstu_ir)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: poss2ukstu_blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(poss2ukstu_blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: poss1_blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(poss1_blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: poss1_red + if {[regexp -start $index_ -indices -line -nocase -- {\A(poss1_red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: all + if {[regexp -start $index_ -indices -line -nocase -- {\A(all)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: quickv + if {[regexp -start $index_ -indices -line -nocase -- {\A(quickv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: phase2_gsc2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(phase2_gsc2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: phase2_gsc1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(phase2_gsc1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $POSS2RED_ + } + 1 { +return $POSS2INFRARED_ + } + 2 { +return $POSS2BLUE_ + } + 3 { +return $POSS1BLUE_ + } + 4 { +return $POSS1RED_ + } + 5 { +return $ALL_ + } + 6 { +return $QUICKV_ + } + 7 { +return $GSC2_ + } + 8 { +return $GSC1_ + } + 9 { +return $YES_ + } + 10 { +return $NO_ + } + 11 { +return $ON_ + } + 12 { +return $OFF_ + } + 13 { +return $TRUE_ + } + 14 { +return $FALSE_ + } + 15 { +return $CLEAR_ + } + 16 { +return $CLOSE_ + } + 17 { +return $COORD_ + } + 18 { +return $CROSSHAIR_ + } + 19 { +return $CURRENT_ + } + 20 { +return $FRAME_ + } + 21 { +return $NAME_ + } + 22 { +return $NEW_ + } + 23 { +return $OPEN_ + } + 24 { +return $SAVE_ + } + 25 { +return $SIZE_ + } + 26 { +return $SURVEY_ + } + 27 { +return $UPDATE_ + } + 28 { +return $DEGREES_ + } + 29 { +return $ARCMIN_ + } + 30 { +return $ARCSEC_ + } + 31 { +return $SEXAGESIMAL_ + } + 32 - + 33 { +set yylval $yytext; return $SEXSTR_ + } + 34 { +set yylval $yytext; return $INT_ + } + 35 - + 36 { +set yylval $yytext; return $REAL_ + } + 37 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 38 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 39 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 40 { +set yylval $yytext; return $STRING_ + } + 41 { +# ignore whitespace + } + 42 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/dssstsciparser.tab.tcl b/ds9/parsers/dssstsciparser.tab.tcl new file mode 100644 index 0000000..289f307 --- /dev/null +++ b/ds9/parsers/dssstsciparser.tab.tcl @@ -0,0 +1,36 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set POSS2RED_ 284 +set POSS2INFRARED_ 285 +set POSS2BLUE_ 286 +set POSS1BLUE_ 287 +set POSS1RED_ 288 +set ALL_ 289 +set QUICKV_ 290 +set GSC2_ 291 +set GSC1_ 292 diff --git a/ds9/parsers/dssstsciparser.tcl b/ds9/parsers/dssstsciparser.tcl new file mode 100644 index 0000000..1c2b25c --- /dev/null +++ b/ds9/parsers/dssstsciparser.tcl @@ -0,0 +1,1103 @@ +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 dssstsci { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc dssstsci::YYABORT {} { + return -code return 1 +} + +proc dssstsci::YYACCEPT {} { + return -code return 0 +} + +proc dssstsci::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc dssstsci::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc dssstsci::yyerror {s} { + puts stderr $s +} + +proc dssstsci::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 dssstsci::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set dssstsci::table { + 10:280,target 45 + 9:284 shift + 16:283,target 22 + 62:283,target 13 + 30:283 reduce + 29:283 reduce + 9:285 shift + 27:0 reduce + 9:286 shift + 9:292,target 43 + 9:287 shift + 9:288 shift + 48:0 reduce + 9:289 shift + 9:290 shift + 3:267,target 19 + 9:291 shift + 51:283,target 11 + 9:292 shift + 48:295,target 56 + 7:283,target 1 + 38:283 reduce + 9:304 goto + 50:278,target 60 + 0:275,target 9 + 11:282,target 19 + 40:283,target 46 + 39:283,target 45 + 6:266 shift + 7:262,target 32 + 56:0,target 38 + 6:268 shift + 24:0 reduce + 48:0,target 10 + 9:289,target 40 + 9:290,target 41 + 47:283 shift + 41:0,target 47 + 45:0 reduce + 33:0,target 31 + 2:282,target 12 + 28:283,target 5 + 17:280 shift + 25:0,target 39 + 34:282,target 12 + 50:276,target 58 + 49:276,target 53 + 0:273,target 7 + 56:283 reduce + 7:259,target 29 + 7:260,target 30 + 21:0 reduce + 26:283 reduce + 9:287,target 38 + 45:279,target 51 + 42:0 reduce + 52:283,target 36 + 2:280,target 17 + 0:302,target 16 + 12:282,target 20 + 6:303 goto + 41:283,target 47 + 35:283 reduce + 0:271,target 5 + 11:277,target 19 + 7:257,target 27 + 3:267 shift + 38:0 reduce + 30:283,target 6 + 29:283,target 3 + 9:285,target 36 + 3:270 shift + 44:283 reduce + 60:0 reduce + 59:0 reduce + 0:300,target 15 + 8:281,target 11 + 6:303,target 26 + 14:281 shift + 14:282 shift + 61:0,target 30 + 53:0,target 9 + 0:268,target 3 + 45:0,target 10 + 53:283 reduce + 37:0,target 43 + 30:0,target 6 + 29:0,target 3 + 8:299,target 34 + 22:0,target 28 + 53:283,target 9 + 35:0 reduce + 4:263,target 22 + 23:283 reduce + 56:0 reduce + 62:283 reduce + 42:283,target 48 + 12:277,target 20 + 18:281,target 11 + 14:299 goto + 32:283 reduce + 11:0 reduce + 31:283,target 4 + 0:264 shift + 32:0 reduce + 3:297 goto + 0:265 shift + 53:0 reduce + 0:268 shift + 7:293,target 33 + 18:299,target 49 + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 19:283,target 15 + 20:283,target 14 + 0:272 shift + 11:278 reduce + 50:276 shift + 49:276 shift + 0:273 shift + 50:277 shift + 0:274 shift + 11:281 reduce + 50:278 shift + 0:275 shift + 11:282 reduce + 16:301,target 47 + 0:264,target 1 + 54:283,target 35 + 50:283 reduce + 49:283 reduce + 28:0 reduce + 0:280 shift + 7:0,target 1 + 0:281 shift + 0:0,target 24 + 0:282 shift + 14:282,target 12 + 50:0 reduce + 49:0 reduce + 0:283 shift + 57:0,target 37 + 43:283,target 49 + 19:283 reduce + 20:283 reduce + 50:0,target 12 + 49:0,target 8 + 0:283,target 13 + 42:0,target 48 + 58:283 reduce + 26:0,target 34 + 0:300 goto + 8:281 shift + 49:294 goto + 46:294,target 54 + 8:282 shift + 32:283,target 7 + 0:302 goto + 11:0,target 19 + 50:296 goto + 28:283 reduce + 25:0 reduce + 50:298 goto + 46:0 reduce + 21:283,target 32 + 0:299 goto + 0:281,target 11 + 37:283 reduce + 0:0 reduce + 48:279,target 51 + 46:276 shift + 8:299 goto + 22:0 reduce + 46:283 reduce + 43:0 reduce + 0:299,target 14 + 44:283,target 33 + 1:283,target 26 + 16:283 reduce + 33:283,target 31 + 46:294 goto + 5:283 reduce + 62:0,target 13 + 16:301 goto + 54:0,target 35 + 40:0 reduce + 39:0 reduce + 22:283,target 28 + 25:283 reduce + 46:0,target 8 + 38:0,target 44 + 61:0 reduce + 31:0,target 4 + 23:0,target 29 + 15:0,target 0 + 34:281 shift + 56:283,target 38 + 34:282 shift + 15:0 accept + 9:291,target 42 + 45:283,target 10 + 36:0 reduce + 50:298,target 62 + 57:0 reduce + 43:283 reduce + 50:277,target 59 + 0:274,target 8 + 11:281,target 19 + 13:283 reduce + 34:299 goto + 7:261,target 31 + 12:0 reduce + 52:283 reduce + 2:280 shift + 2:281 shift + 23:283,target 29 + 33:0 reduce + 2:282 shift + 9:288,target 39 + 2:281,target 11 + 54:0 reduce + 50:296,target 61 + 22:283 reduce + 61:283 reduce + 57:283,target 37 + 1:0,target 26 + 34:281,target 11 + 0:272,target 6 + 11:278,target 19 + 7:0 reduce + 58:0,target 16 + 51:0,target 11 + 31:283 reduce + 2:299,target 18 + 7:258,target 28 + 46:283,target 8 + 43:0,target 49 + 35:0,target 41 + 30:0 reduce + 29:0 reduce + 27:0,target 2 + 9:286,target 37 + 7:257 shift + 19:0,target 15 + 20:0,target 14 + 51:0 reduce + 34:299,target 50 + 2:299 goto + 7:258 shift + 12:0,target 20 + 49:294,target 57 + 7:259 shift + 7:260 shift + 8:282,target 12 + 35:283,target 41 + 7:261 shift + 40:283 reduce + 39:283 reduce + 7:262 shift + 12:281,target 20 + 10:280 shift + 0:269,target 4 + 11:276,target 19 + 17:280,target 48 + 48:279 shift + 24:283,target 40 + 26:0 reduce + 48:283 reduce + 9:284,target 35 + 13:283,target 27 + 18:281 shift + 58:283,target 16 + 18:282 shift + 12:278,target 20 + 18:282,target 12 + 57:283 reduce + 1:0 reduce + 47:283,target 55 + 48:295 goto + 45:295,target 52 + 4:283,target 23 + 7:283 reduce + 23:0 reduce + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 36:283,target 42 + 55:0,target 23 + 7:293 goto + 12:276,target 20 + 18:299 goto + 36:283 reduce + 40:0,target 46 + 39:0,target 45 + 4:263 shift + 25:283,target 39 + 32:0,target 7 + 0:265,target 2 + 3:297,target 21 + 6:268,target 25 + 24:0,target 40 + 16:0,target 21 + 19:0 reduce + 20:0 reduce + 45:279 shift + 46:276,target 53 + 41:0 reduce + 60:283,target 18 + 59:283,target 17 + 45:283 reduce + 62:0 reduce + 48:283,target 10 + 5:283,target 25 + 54:283 reduce + 6:266,target 24 + 16:0 reduce + 45:295 goto + 4:283 shift + 37:283,target 43 + 37:0 reduce + 14:281,target 11 + 24:283 reduce + 58:0 reduce + 0:282,target 12 + 26:283,target 34 + 33:283 reduce + 13:0 reduce + 14:299,target 46 + 61:283,target 30 + 60:0,target 18 + 59:0,target 17 + 55:0 reduce + 52:0,target 36 + 12:276 reduce + 44:0,target 33 + 42:283 reduce + 12:277 reduce + 36:0,target 42 + 12:278 reduce + 50:283,target 12 + 49:283,target 8 + 28:0,target 5 + 0:280,target 10 + 12:281 reduce + 21:0,target 32 + 12:282 reduce + 13:0,target 27 + 51:283 reduce + 38:283,target 44 + 9:304,target 44 + 31:0 reduce + 1:283 reduce + 52:0 reduce + 3:270,target 20 + 21:283 reduce + 27:283,target 2 + 60:283 reduce + 59:283 reduce + 5:0 reduce +} + +array set dssstsci::rules { + 9,l 294 + 11,l 295 + 32,l 302 + 6,l 293 + 28,l 302 + 49,l 304 + 3,l 293 + 25,l 302 + 46,l 304 + 0,l 305 + 22,l 301 + 43,l 304 + 18,l 298 + 40,l 303 + 39,l 303 + 15,l 297 + 36,l 302 + 12,l 296 + 33,l 302 + 7,l 293 + 29,l 302 + 30,l 302 + 4,l 293 + 26,l 302 + 47,l 304 + 1,l 293 + 23,l 300 + 44,l 304 + 19,l 299 + 20,l 299 + 41,l 304 + 16,l 298 + 37,l 302 + 13,l 296 + 34,l 302 + 8,l 294 + 10,l 295 + 31,l 302 + 5,l 293 + 27,l 302 + 48,l 304 + 2,l 293 + 24,l 302 + 45,l 304 + 21,l 300 + 42,l 304 + 17,l 298 + 38,l 302 + 14,l 297 + 35,l 302 +} + +array set dssstsci::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 46,dc 1 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 4 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 45,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 44,dc 1 + 22,dc 0 + 36,dc 3 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 3 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 2 + 48,dc 1 +} + +array set dssstsci::rules { + 41,line 157 + 7,line 98 + 37,line 149 + 4,line 95 + 34,line 145 + 1,line 92 + 31,line 141 + 27,line 136 + 24,line 133 + 21,line 129 + 17,line 122 + 22,e 1 + 14,line 117 + 11,line 110 + 49,line 165 + 46,line 162 + 43,line 159 + 9,line 106 + 40,line 154 + 39,line 153 + 6,line 97 + 36,line 148 + 3,line 94 + 33,line 143 + 29,line 138 + 30,line 140 + 26,line 135 + 23,line 130 + 19,line 125 + 20,line 126 + 16,line 121 + 13,line 114 + 10,line 109 + 48,line 164 + 45,line 161 + 42,line 158 + 8,line 105 + 38,line 150 + 5,line 96 + 35,line 146 + 2,line 93 + 32,line 142 + 28,line 137 + 25,line 134 + 22,line 129 + 18,line 123 + 15,line 118 + 12,line 113 + 47,line 163 + 44,line 160 +} + +array set dssstsci::lr1_table { + 66,trans {} + 35 {{41 {0 283} 1}} + 14,trans {{281 46} {282 47} {299 48}} + 36 {{42 {0 283} 1}} + 33,trans {} + 37 {{43 {0 283} 1}} + 52,trans {} + 38 {{44 {0 283} 1}} + 40 {{46 {0 283} 1}} + 39 {{45 {0 283} 1}} + 18,trans {{281 46} {282 47} {299 51}} + 41 {{47 {0 283} 1}} + 1,trans {} + 37,trans {} + 42 {{48 {0 283} 1}} + 56,trans {} + 43 {{49 {0 283} 1}} + 44 {{33 {0 283} 2}} + 23,trans {} + 45 {{36 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} + 5,trans {} + 42,trans {} + 46 {{19 {0 276} 1}} + 61,trans {} + 47 {{20 {0 276} 1}} + 48 {{35 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 27,trans {} + 50 {{38 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 49 {{23 0 2}} + 9,trans {{284 35} {285 36} {286 37} {287 38} {288 39} {289 40} {290 41} {291 42} {292 43} {304 44}} + 46,trans {} + 51 {{37 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 65,trans {} + 52 {{19 {0 276 277 278} 1}} + 53 {{20 {0 276 277 278} 1}} + 13,trans {} + 54 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 32,trans {} + 51,trans {{276 57} {294 61}} + 55 {{11 {0 283} 1}} + 56 {{36 {0 283} 3}} + 57 {{9 {0 283} 1}} + 17,trans {{280 50}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {275 9} {280 10} {281 11} {282 12} {283 13} {299 14} {300 15} {302 16}} + 58 {{35 {0 283} 3}} + 36,trans {} + 55,trans {} + 60 {{38 {0 283} 4}} + 59 {{23 0 3}} + 61 {{37 {0 283} 4}} + 62 {{16 {0 283} 1}} + 22,trans {} + 4,trans {{263 22} {283 23}} + 63 {{17 {0 283} 1}} + 41,trans {} + 60,trans {} + 59,trans {} + 64 {{18 {0 283} 1}} + 65 {{30 {0 283} 4}} + 66 {{13 {0 283} 1}} + 26,trans {} + 8,trans {{281 11} {282 12} {299 34}} + 45,trans {{279 55} {295 56}} + 64,trans {} + 12,trans {} + 31,trans {} + 50,trans {{279 55} {295 60}} + 49,trans {{283 59}} + 16,trans {{301 49}} + 35,trans {} + 54,trans {{276 62} {277 63} {278 64} {296 65} {298 66}} + 21,trans {} + 3,trans {{267 19} {270 20} {297 21}} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{36 {0 283} 1}} + 11 {{19 {281 282} 1}} + 25,trans {} + 12 {{20 {281 282} 1}} + 7,trans {{257 27} {258 28} {259 29} {260 30} {261 31} {262 32} {293 33}} + 44,trans {} + 13 {{27 {0 283} 1}} + 63,trans {} + 14 {{35 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 11,trans {} + 15 {{0 0 1}} + 30,trans {} + 29,trans {} + 16 {{21 0 1} {23 0 1} {22 283 0}} + 48,trans {{276 57} {294 58}} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {38 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{38 {0 283} 2}} + 1 {{26 {0 283} 1}} + 18 {{37 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 15,trans {} + 2 {{37 {0 283} 1} {38 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{15 {0 283} 1}} + 20 {{14 {0 283} 1}} + 34,trans {{281 52} {282 53} {299 54}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{32 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{28 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{29 {0 283} 2}} + 20,trans {} + 19,trans {} + 6 {{34 {0 283} 1} {39 {0 283} 0} {40 {0 283} 0}} + 2,trans {{280 17} {281 11} {282 12} {299 18}} + 24 {{40 {0 283} 1}} + 38,trans {} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{39 {0 283} 1}} + 57,trans {} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{34 {0 283} 2}} + 9 {{33 {0 283} 1} {41 {0 283} 0} {42 {0 283} 0} {43 {0 283} 0} {44 {0 283} 0} {45 {0 283} 0} {46 {0 283} 0} {47 {0 283} 0} {48 {0 283} 0} {49 {0 283} 0}} + 27 {{2 {0 283} 1}} + 24,trans {} + 6,trans {{266 24} {268 25} {303 26}} + 28 {{5 {0 283} 1}} + 43,trans {} + 29 {{3 {0 283} 1}} + 30 {{6 {0 283} 1}} + 62,trans {} + 31 {{4 {0 283} 1}} + 10,trans {{280 45}} + 32 {{7 {0 283} 1}} + 28,trans {} + 33 {{31 {0 283} 2}} + 47,trans {} + 34 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} +} + +array set dssstsci::token_id_table { + 286 POSS2BLUE_ + 286,t 0 + 287 POSS1BLUE_ + 292,line 51 + 302,line 132 + 288 POSS1RED_ + 265,title COORD + 289 ALL_ + 290 QUICKV_ + 300 command + 284,title POSS2RED + 291 GSC2_ + 301 @PSEUDO1 + 292 GSC1_ + 302 dssstsci + 288,line 47 + 293 yesno + 303 update + 304 survey + 294 deg + 305 start' + 295 sex + 296 sizeOpt + 262,t 0 + 297 frame + 285,line 44 + 298 rformat + 299 numeric + 283,t 0 + 282,line 37 + 264,title CLOSE + 283,title string + 278,line 30 + error,line 90 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 272,line 23 + 263,title CLEAR + 282,title float + 268,line 19 + 276,t 0 + 265,line 16 + 297,t 1 + 262,line 12 + 262,title FALSE + 0 {$} + 0,t 0 + 281,title integer + error,t 0 + 299,title {} + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 1 + 261,title TRUE + 279,title SEXAGESIMAL + 280,title SEXSTR + 269,t 0 + 270,t 0 + 298,title {} + 291,t 0 + 301,t 1 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 116 + 278,title ARCSEC + 297,title {} + 287,t 0 + 304,line 156 + 294,line 104 + 291,line 50 + error,title {} + 301,line 129 + 263,t 0 + 258,title NO + 287,line 46 + 277,title ARCMIN + 284,t 0 + 296,title {} + 284,line 43 + 281,line 36 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title YES + 277,line 29 + 276,title DEGREES + 305,title {} + 295,title {} + 274,line 25 + 271,line 22 + 277,t 0 + 267,line 18 + 298,t 1 + 275,title SURVEY + 304,title {} + 294,title {} + 264,line 15 + 261,line 11 + 274,t 0 + 305,t 1 + 295,t 1 + 257,line 7 + 274,title SIZE + 293,title {} + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 1 + 273,title SAVE + 292,title GSC1 + 302,title {} + 267,t 0 + 299,line 124 + 288,t 0 + 296,line 112 + 272,title UPDATE + 303,line 152 + 291,title GSC2 + 293,line 91 + 301,title {} + 264,t 0 + 285,t 0 + 289,line 48 + 290,line 49 + 300,line 128 + 286,line 45 + 271,title OPEN + 261,t 0 + 283,line 39 + 289,title ALL + 290,title QUICKV + 300,title {} + 282,t 0 + 279,line 32 + 280,line 34 + 276,line 28 + 257,t 0 + 269,title NAME + 270,title NEW + 273,line 24 + 288,title POSS1RED + 278,t 0 + 299,t 1 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title FRAME + 275,t 0 + 263,line 14 + 287,title POSS1BLUE + 296,t 1 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title CURRENT + 303,t 1 + 257 YES_ + 286,title POSS2BLUE + 293,t 1 + 258 NO_ + 260 OFF_ + 259 ON_ + 261 TRUE_ + 262 FALSE_ + 263 CLEAR_ + 264 CLOSE_ + 265 COORD_ + 266 CROSSHAIR_ + 267 CURRENT_ + 268,t 0 + 268 FRAME_ + 269 NAME_ + 270 NEW_ + 271 OPEN_ + 272 UPDATE_ + 289,t 0 + 290,t 0 + 300,t 1 + 266,title CROSSHAIR + 273 SAVE_ + 274 SIZE_ + 285,title POSS2INFRARED + 275 SURVEY_ + 276 DEGREES_ + 298,line 120 + 277 ARCMIN_ + 278 ARCSEC_ + 279 SEXAGESIMAL_ + 280 SEXSTR_ + 281 INT_ + 305,line 166 + 282 REAL_ + 295,line 108 + 265,t 0 + 283 STRING_ + 284 POSS2RED_ + 285 POSS2INFRARED_ +} + +proc dssstsci::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dstsci 1 } + 26 { ARDestroy dstsci } + 27 { ProcessCmdSet dstsci name $1 "IMGSVRApply dstsci 1" } + 28 { ProcessCmdSet dstsci name {} } + 29 { ProcessCmdSet dstsci name $2 "IMGSVRApply dstsci 1" } + 30 { ProcessCmdSet4 dstsci width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet dstsci save $2 } + 32 { ProcessCmdSet dstsci mode $2 } + 33 { ProcessCmdSet dstsci survey $2 } + 35 { ProcessCmdSet4 dstsci x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dstsci 1" } + 36 { ProcessCmdSet4 dstsci x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dstsci 1" } + 37 { ProcessCmdSet4 dstsci x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dstsci 1" } + 38 { ProcessCmdSet4 dstsci x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dstsci 1" } + 39 { IMGSVRUpdate dstsci; IMGSVRApply dstsci 1 } + 40 { IMGSVRCrosshair dstsci; IMGSVRApply dstsci 1 } + 41 { set _ poss2ukstu_red } + 42 { set _ poss2ukstu_ir } + 43 { set _ poss2ukstu_blue } + 44 { set _ poss1_blue } + 45 { set _ poss1_red } + 46 { set _ all } + 47 { set _ quickv } + 48 { set _ phase2_gsc2 } + 49 { set _ phase2_gsc1 } + } + 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 dssstsci::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/dssstscisendlex.tcl b/ds9/parsers/dssstscisendlex.tcl new file mode 100644 index 0000000..8eb6037 --- /dev/null +++ b/ds9/parsers/dssstscisendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval dssstscisend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc dssstscisend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc dssstscisend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc dssstscisend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc dssstscisend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc dssstscisend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc dssstscisend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc dssstscisend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc dssstscisend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc dssstscisend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/dssstscisendparser.tab.tcl b/ds9/parsers/dssstscisendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/dssstscisendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/dssstscisendparser.tcl b/ds9/parsers/dssstscisendparser.tcl new file mode 100644 index 0000000..e54b71a --- /dev/null +++ b/ds9/parsers/dssstscisendparser.tcl @@ -0,0 +1,324 @@ +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 dssstscisend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc dssstscisend::YYABORT {} { + return -code return 1 +} + +proc dssstscisend::YYACCEPT {} { + return -code return 0 +} + +proc dssstscisend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc dssstscisend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc dssstscisend::yyerror {s} { + puts stderr $s +} + +proc dssstscisend::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 dssstscisend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set dssstscisend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 accept + 0:258 shift + 5:0,target 6 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 0 + 0:258,target 2 + 0:262 shift + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 7 + 4:0,target 3 + 0:0 reduce + 6:0,target 5 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 7 + 5:0 reduce + 0:262,target 6 +} + +array set dssstscisend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 + 7,l 263 +} + +array set dssstscisend::rules { + 5,dc 1 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set dssstscisend::rules { + 5,line 24 + 7,line 26 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set dssstscisend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0}} + 1 {{7 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7}} + 5 {{6 0 1}} + 1,trans {} + 6 {{5 0 1}} + 2,trans {} + 7 {{0 0 1}} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} + 7,trans {} +} + +array set dssstscisend::token_id_table { + 264,line 27 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 dssstscisend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc dssstscisend::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 { ProcessSendCmdGet dstsci name } + 2 { ProcessSendCmdGet dstsci name } + 3 { ProcessSendCmdYesNo dstsci save } + 4 { ProcessSendCmdGet dstsci mode } + 5 { ProcessSendCmdGet dstsci survey } + 6 { ProcessSendCmdGet3 dstsci width height rformat } + 7 { ProcessSendCmdGet3 dstsci x y skyformat } + } + 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 dssstscisend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/envilex.tcl b/ds9/parsers/envilex.tcl new file mode 100644 index 0000000..eefd958 --- /dev/null +++ b/ds9/parsers/envilex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval envi { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc envi::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc envi::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc envi::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc envi::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc envi::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc envi::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc envi::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc envi::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc envi::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NEW_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/enviparser.tab.tcl b/ds9/parsers/enviparser.tab.tcl new file mode 100644 index 0000000..f492518 --- /dev/null +++ b/ds9/parsers/enviparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set NEW_ 258 diff --git a/ds9/parsers/enviparser.tcl b/ds9/parsers/enviparser.tcl new file mode 100644 index 0000000..8f2fc60 --- /dev/null +++ b/ds9/parsers/enviparser.tcl @@ -0,0 +1,324 @@ +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 envi { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc envi::YYABORT {} { + return -code return 1 +} + +proc envi::YYACCEPT {} { + return -code return 0 +} + +proc envi::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc envi::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc envi::yyerror {s} { + puts stderr $s +} + +proc envi::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 envi::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set envi::table { + 6:0 reduce + 3:0,target 1 + 0:257 reduce + 7:0 reduce + 6:257,target 8 + 0:258 shift + 1:257 reduce + 8:0 reduce + 0:259 goto + 8:257,target 5 + 3:257 reduce + 0:261 goto + 7:0,target 3 + 4:257 shift + 1:257,target 7 + 0:262 goto + 0:258,target 1 + 5:257 shift + 3:260 goto + 6:257 shift + 3:257,target 2 + 0:261,target 3 + 2:0,target 0 + 8:257 reduce + 5:257,target 7 + 3:260,target 5 + 6:0,target 4 + 0:257,target 6 + 2:0 accept + 8:0,target 5 + 3:0 reduce + 0:259,target 2 + 4:257,target 6 + 0:262,target 4 +} + +array set envi::rules { + 0,l 263 + 1,l 259 + 2,l 260 + 3,l 259 + 4,l 261 + 5,l 261 + 6,l 262 + 7,l 262 +} + +array set envi::rules { + 5,dc 3 + 7,dc 1 + 0,dc 1 + 2,dc 0 + 4,dc 2 + 6,dc 0 + 1,dc 1 + 3,dc 3 +} + +array set envi::rules { + 5,line 21 + 7,line 25 + 2,e 1 + 2,line 16 + 4,line 20 + 6,line 24 + 1,line 16 + 3,line 17 +} + +array set envi::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 257 0} {7 257 0}} + 1 {{7 257 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 257 0}} + 4 {{4 {0 257} 1} {5 {0 257} 1}} + 0,trans {{258 1} {259 2} {261 3} {262 4}} + 1,trans {} + 5 {{3 0 2}} + 2,trans {} + 6 {{4 {0 257} 2} {5 {0 257} 2}} + 7 {{3 0 3}} + 3,trans {{260 5}} + 8 {{5 {0 257} 3}} + 4,trans {{257 6}} + 5,trans {{257 7}} + 6,trans {{257 8}} + 7,trans {} + 8,trans {} +} + +array set envi::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 19 + error,line 14 + 257 STRING_ + 257,t 0 + 263,line 26 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 envi + 262,t 1 + 262 opts + 257,line 7 + 263,t 1 + 263 start' + 260,line 16 + 259,line 15 + 257,title string + 258,title NEW + 262,line 23 + 260,title {} + 259,title {} + 261,title {} +} + +proc envi::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ImportENVIFile $2 [FindENVIDataFile $2]; FinishLoad } + 5 { ImportENVIFile $2 $3; FinishLoad } + 7 { CreateFrame } + } + 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 envi::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/exportlex.tcl b/ds9/parsers/exportlex.tcl new file mode 100644 index 0000000..3496751 --- /dev/null +++ b/ds9/parsers/exportlex.tcl @@ -0,0 +1,470 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval export { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc export::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc export::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc export::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc export::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc export::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc export::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc export::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc export::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc export::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set ARRAY_ 260 +set RGBARRAY_ 261 +set NRRD_ 262 +set ENVI_ 263 +set GIF_ 264 +set TIFF_ 265 +set JPEG_ 266 +set PNG_ 267 +set BIG_ 268 +set LITTLE_ 269 +set NATIVE_ 270 +set NONE_ 271 +set PACKBITS_ 272 +set DEFLATE_ 273 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: array + if {[regexp -start $index_ -indices -line -nocase -- {\A(array)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: rgbarray + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgbarray)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: nrrd + if {[regexp -start $index_ -indices -line -nocase -- {\A(nrrd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: envi + if {[regexp -start $index_ -indices -line -nocase -- {\A(envi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: gif + if {[regexp -start $index_ -indices -line -nocase -- {\A(gif)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: tiff + if {[regexp -start $index_ -indices -line -nocase -- {\A(tiff)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: jpeg + if {[regexp -start $index_ -indices -line -nocase -- {\A(jpeg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: png + if {[regexp -start $index_ -indices -line -nocase -- {\A(png)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: big + if {[regexp -start $index_ -indices -line -nocase -- {\A(big)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: little + if {[regexp -start $index_ -indices -line -nocase -- {\A(little)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: native + if {[regexp -start $index_ -indices -line -nocase -- {\A(native)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: packbits + if {[regexp -start $index_ -indices -line -nocase -- {\A(packbits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: deflate + if {[regexp -start $index_ -indices -line -nocase -- {\A(deflate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ARRAY_ + } + 1 { +return $RGBARRAY_ + } + 2 { +return $NRRD_ + } + 3 { +return $ENVI_ + } + 4 { +return $GIF_ + } + 5 { +return $TIFF_ + } + 6 { +return $JPEG_ + } + 7 { +return $PNG_ + } + 8 { +return $BIG_ + } + 9 { +return $LITTLE_ + } + 10 { +return $NATIVE_ + } + 11 { +return $NONE_ + } + 12 { +return $PACKBITS_ + } + 13 { +return $DEFLATE_ + } + 14 { +set yylval $yytext; return $INT_ + } + 15 - + 16 { +set yylval $yytext; return $REAL_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 20 { +set yylval $yytext; return $STRING_ + } + 21 { +# ignore whitespace + } + 22 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/exportparser.tab.tcl b/ds9/parsers/exportparser.tab.tcl new file mode 100644 index 0000000..3fb54d8 --- /dev/null +++ b/ds9/parsers/exportparser.tab.tcl @@ -0,0 +1,17 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set ARRAY_ 260 +set RGBARRAY_ 261 +set NRRD_ 262 +set ENVI_ 263 +set GIF_ 264 +set TIFF_ 265 +set JPEG_ 266 +set PNG_ 267 +set BIG_ 268 +set LITTLE_ 269 +set NATIVE_ 270 +set NONE_ 271 +set PACKBITS_ 272 +set DEFLATE_ 273 diff --git a/ds9/parsers/exportparser.tcl b/ds9/parsers/exportparser.tcl new file mode 100644 index 0000000..0d5bf65 --- /dev/null +++ b/ds9/parsers/exportparser.tcl @@ -0,0 +1,703 @@ +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 export { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc export::YYABORT {} { + return -code return 1 +} + +proc export::YYACCEPT {} { + return -code return 0 +} + +proc export::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc export::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc export::yyerror {s} { + puts stderr $s +} + +proc export::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 export::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set export::table { + 29:281 goto + 30:281 goto + 17:259 reduce + 6:259,target 15 + 1:280,target 24 + 6:259 reduce + 29:268,target 17 + 30:268,target 17 + 26:259 shift + 0:275,target 10 + 1:258,target 15 + 27:259,target 31 + 24:0 reduce + 33:0,target 12 + 16:259,target 24 + 25:0,target 8 + 17:0,target 28 + 10:0,target 0 + 7:259,target 16 + 21:0 reduce + 14:259 reduce + 3:259 reduce + 23:259 reduce + 28:259,target 9 + 17:0 reduce + 17:259,target 28 + 32:259 reduce + 1:273,target 22 + 8:259,target 17 + 28:257,target 14 + 14:0 reduce + 29:0,target 11 + 30:0,target 13 + 22:0,target 26 + 14:0,target 1 + 29:281,target 33 + 30:281,target 34 + 11:259 reduce + 1:271,target 20 + 29:259,target 11 + 30:259,target 13 + 0:260 shift + 0:259 shift + 0:261 shift + 0:266,target 8 + 0:262 shift + 11:0 reduce + 19:259 reduce + 20:259 reduce + 0:263 shift + 0:264 shift + 18:259,target 29 + 0:265 shift + 32:0 reduce + 0:266 shift + 0:267 shift + 8:259 reduce + 28:257 shift + 11:276 goto + 28:258 shift + 28:259 reduce + 28:274,target 23 + 1:268,target 17 + 9:259,target 18 + 0:275 goto + 0:264,target 6 + 0:277 goto + 28:266 shift + 0:278 goto + 0:279 goto + 28:0 reduce + 28:271 shift + 28:272 shift + 28:273 shift + 28:274 goto + 28:272,target 21 + 1:266,target 16 + 34:0,target 14 + 18:0,target 29 + 28:280 goto + 0:262,target 4 + 11:0,target 3 + 19:259,target 30 + 20:259,target 23 + 16:259 reduce + 25:0 reduce + 5:259 shift + 25:259 reduce + 0:260,target 2 + 0:259,target 1 + 22:0 reduce + 34:259 reduce + 32:259,target 10 + 0:278,target 12 + 21:259,target 25 + 18:0 reduce + 13:259 shift + 1:281,target 25 + 29:269,target 18 + 29:270,target 19 + 30:269,target 18 + 30:270,target 19 + 31:0,target 5 + 23:0,target 27 + 15:0,target 2 + 2:259 reduce + 1:259,target 6 + 22:259 reduce + 15:0 reduce + 33:259,target 12 + 22:259,target 26 + 1:257,target 14 + 11:259,target 4 + 33:0 reduce + 1:0,target 6 + 2:259,target 19 + 18:259 reduce + 34:259,target 14 + 29:0 reduce + 30:0 reduce + 19:0,target 30 + 20:0,target 23 + 7:259 reduce + 28:280,target 32 + 23:259,target 27 + 1:274,target 23 + 27:259 shift + 11:276,target 27 + 28:258,target 15 + 12:259,target 28 + 3:259,target 20 + 1:272,target 21 + 1:0 reduce + 0:267,target 9 + 23:0 reduce + 15:259 reduce + 24:259,target 7 + 4:259 reduce + 1:269,target 18 + 1:270,target 19 + 24:259 reduce + 13:259,target 29 + 0:265,target 7 + 32:0,target 10 + 24:0,target 7 + 16:0,target 24 + 19:0 reduce + 20:0 reduce + 33:259 reduce + 4:259,target 21 + 28:273,target 22 + 0:263,target 5 + 16:0 reduce + 25:259,target 8 + 12:259 shift + 1:257 shift + 28:271,target 20 + 1:258 shift + 14:259,target 1 + 1:259 reduce + 21:259 reduce + 0:261,target 3 + 1:266 shift + 34:0 reduce + 5:259,target 26 + 1:268 shift + 9:259 reduce + 1:269 shift + 1:270 shift + 1:271 shift + 29:259 reduce + 30:259 reduce + 1:272 shift + 1:273 shift + 0:279,target 13 + 28:0,target 9 + 1:274 goto + 21:0,target 25 + 10:0 accept + 1:280 goto + 26:259,target 30 + 29:268 shift + 30:268 shift + 1:281 goto + 29:269 shift + 29:270 shift + 30:269 shift + 30:270 shift + 31:0 reduce + 15:259,target 2 + 0:277,target 11 + 28:266,target 16 +} + +array set export::rules { + 27,l 280 + 9,l 277 + 11,l 277 + 15,l 278 + 20,l 279 + 19,l 279 + 2,l 274 + 24,l 280 + 6,l 277 + 28,l 281 + 12,l 277 + 16,l 278 + 21,l 279 + 3,l 275 + 25,l 280 + 7,l 277 + 30,l 281 + 29,l 281 + 13,l 277 + 0,l 282 + 17,l 278 + 22,l 279 + 4,l 276 + 26,l 280 + 8,l 277 + 10,l 277 + 14,l 277 + 18,l 278 + 1,l 274 + 23,l 280 + 5,l 275 +} + +array set export::rules { + 23,dc 1 + 5,dc 3 + 0,dc 1 + 17,dc 1 + 12,dc 3 + 26,dc 1 + 8,dc 2 + 21,dc 1 + 3,dc 1 + 15,dc 1 + 10,dc 3 + 30,dc 1 + 29,dc 1 + 24,dc 1 + 6,dc 1 + 18,dc 1 + 1,dc 1 + 13,dc 3 + 27,dc 1 + 9,dc 2 + 22,dc 1 + 4,dc 0 + 16,dc 1 + 11,dc 2 + 25,dc 1 + 7,dc 2 + 20,dc 1 + 19,dc 1 + 2,dc 1 + 14,dc 4 + 28,dc 1 +} + +array set export::rules { + 13,line 55 + 25,line 73 + 7,line 47 + 10,line 52 + 22,line 68 + 4,line 42 + 18,line 62 + 1,line 38 + 15,line 59 + 27,line 75 + 9,line 50 + 12,line 54 + 24,line 72 + 6,line 46 + 21,line 67 + 3,line 42 + 17,line 61 + 4,e 1 + 30,line 80 + 29,line 79 + 14,line 56 + 26,line 74 + 8,line 49 + 11,line 53 + 23,line 71 + 5,line 43 + 20,line 66 + 19,line 65 + 2,line 39 + 16,line 60 + 28,line 78 +} + +array set export::lr1_table { + 14,trans {} + 33,trans {} + 18,trans {} + 1,trans {{257 14} {258 15} {266 16} {268 17} {269 18} {270 19} {271 20} {272 21} {273 22} {274 23} {280 24} {281 25}} + 23,trans {} + 5,trans {{259 26}} + 27,trans {{259 31}} + 9,trans {} + 13,trans {{259 29}} + 32,trans {} + 0,trans {{259 1} {260 2} {261 3} {262 4} {263 5} {264 6} {265 7} {266 8} {267 9} {275 10} {277 11} {278 12} {279 13}} + 17,trans {} + 22,trans {} + 4,trans {} + 26,trans {{259 30}} + 8,trans {} + 12,trans {{259 28}} + 31,trans {} + 16,trans {} + 21,trans {} + 3,trans {} + 10 {{0 0 1}} + 11 {{3 0 1} {5 0 1} {4 259 0}} + 25,trans {} + 12 {{9 {0 259} 1} {10 {0 259} 1}} + 7,trans {} + 13 {{11 {0 259} 1} {12 {0 259} 1}} + 14 {{1 {0 259} 1}} + 15 {{2 {0 259} 1}} + 11,trans {{276 27}} + 30,trans {{268 17} {269 18} {270 19} {281 34}} + 29,trans {{268 17} {269 18} {270 19} {281 33}} + 16 {{24 {0 259} 1}} + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {8 {0 259} 0} {9 {0 259} 0} {10 {0 259} 0} {11 {0 259} 0} {12 {0 259} 0} {13 {0 259} 0} {14 {0 259} 0} {15 259 0} {16 259 0} {17 259 0} {18 259 0} {19 259 0} {20 259 0} {21 259 0} {22 259 0}} + 17 {{28 {0 259} 1}} + 1 {{6 {0 259} 1} {7 {0 259} 1} {8 {0 259} 1} {23 {0 259} 0} {24 {0 259} 0} {25 {0 259} 0} {26 {0 259} 0} {27 {0 259} 0} {28 {0 259} 0} {29 {0 259} 0} {30 {0 259} 0} {1 {0 259} 0} {2 {0 259} 0}} + 18 {{29 {0 259} 1}} + 2 {{19 259 1}} + 19 {{30 {0 259} 1}} + 20 {{23 {0 259} 1}} + 15,trans {} + 34,trans {} + 3 {{20 259 1}} + 21 {{25 {0 259} 1}} + 4 {{21 259 1}} + 22 {{26 {0 259} 1}} + 5 {{13 {0 259} 1} {14 {0 259} 1} {22 259 1}} + 23 {{27 {0 259} 1}} + 20,trans {} + 19,trans {} + 6 {{15 259 1}} + 24 {{7 {0 259} 2}} + 2,trans {} + 7 {{16 259 1}} + 25 {{8 {0 259} 2}} + 8 {{17 259 1}} + 26 {{13 {0 259} 2} {14 {0 259} 2}} + 9 {{18 259 1}} + 27 {{5 0 2}} + 24,trans {} + 6,trans {} + 28 {{9 {0 259} 2} {10 {0 259} 2} {23 {0 259} 0} {24 {0 259} 0} {25 {0 259} 0} {26 {0 259} 0} {27 {0 259} 0} {1 {0 259} 0} {2 {0 259} 0}} + 30 {{13 {0 259} 3} {14 {0 259} 3} {28 {0 259} 0} {29 {0 259} 0} {30 {0 259} 0}} + 29 {{11 {0 259} 2} {12 {0 259} 2} {28 {0 259} 0} {29 {0 259} 0} {30 {0 259} 0}} + 31 {{5 0 3}} + 32 {{10 {0 259} 3}} + 10,trans {} + 33 {{12 {0 259} 3}} + 28,trans {{257 14} {258 15} {266 16} {271 20} {272 21} {273 22} {274 23} {280 32}} + 34 {{14 {0 259} 4}} +} + +array set export::token_id_table { + 280,title {} + 279,title {} + 264,line 19 + 270,t 0 + 269,t 0 + 276,line 42 + 265,title TIFF + 274,t 1 + 261,line 15 + 257,t 0 + 270,title NATIVE + 269,title LITTLE + 273,line 30 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 26 + 269,line 25 + 259,title string + 260,title ARRAY + 266,t 0 + 278,title {} + 282,line 81 + error error + 271,t 0 + 264,title GIF + 266,line 21 + 278,line 58 + 275,t 1 + error,line 36 + 268,title BIG + 258,t 0 + 263,line 17 + error,title {} + 280,t 1 + 279,t 1 + 275,line 41 + 273,title DEFLATE + 263,t 0 + 259,line 10 + 260,line 14 + 258,title float + 277,title {} + 272,line 29 + 267,t 0 + 263,title ENVI + 282,title {} + 272,t 0 + 268,line 24 + 267,title PNG + 257 INT_ + 281,line 77 + 276,t 1 + 258 REAL_ + 259,t 0 + 259 STRING_ + 260 ARRAY_ + 260,t 0 + 272,title PACKBITS + 261 RGBARRAY_ + 265,line 20 + 262 NRRD_ + 281,t 1 + 263 ENVI_ + 277,line 45 + 257,title integer + 264 GIF_ + 264,t 0 + 276,title {} + 265 TIFF_ + 262,line 16 + 266 JPEG_ + 267 PNG_ + 0,t 0 + 0 {$} + 262,title NRRD + 268 BIG_ + 268,t 0 + 281,title {} + 274,line 37 + 270 NATIVE_ + 269 LITTLE_ + error,t 0 + 271 NONE_ + 272 PACKBITS_ + 258,line 8 + 273,t 0 + 273 DEFLATE_ + 266,title JPEG + 274 numeric + 275 command + 271,line 28 + 276 @PSEUDO1 + 277,t 1 + 277 export + 271,title NONE + 278 ext + 261,t 0 + 280 opts + 279 ext2 + 281 endian + 267,line 22 + 282,t 1 + 282 start' + 275,title {} + 265,t 0 + 280,line 70 + 279,line 64 + 261,title RGBARRAY +} + +proc export::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { ExportCmdSave [ExtToFormat $1] $1 } + 7 { ExportCmdSave [ExtToFormat $1] $1 } + 8 { ExportCmdSave [ExtToFormat $1] $1 } + 9 { ExportCmdSave $1 $2 } + 10 { ExportCmdSave $1 $2 } + 11 { ExportCmdSave $1 $2 } + 12 { ExportCmdSave $1 $2 } + 13 { ExportCmdSave envi $2 $3 } + 14 { ExportCmdSave envi $2 $3 } + 15 { set _ gif } + 16 { set _ tiff } + 17 { set _ jpeg } + 18 { set _ png } + 19 { set _ array } + 20 { set _ rgbarray } + 21 { set _ nrrd } + 22 { set _ envi } + 23 { ProcessCmdSet export tiff,compress none } + 24 { ProcessCmdSet export tiff,compress jpeg } + 25 { ProcessCmdSet export tiff,compress packbits } + 26 { ProcessCmdSet export tiff,compress deflate } + 27 { ProcessCmdSet export jpeg,quality $1 } + 28 { ProcessCmdSet export endian big } + 29 { ProcessCmdSet export endian little } + 30 { ProcessCmdSet export endian native } + } + 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 export::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/fitslex.tcl b/ds9/parsers/fitslex.tcl new file mode 100644 index 0000000..7126931 --- /dev/null +++ b/ds9/parsers/fitslex.tcl @@ -0,0 +1,319 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval fits { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc fits::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc fits::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc fits::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc fits::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc fits::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc fits::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc fits::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc fits::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc fits::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set SLICE_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $SLICE_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/fitsparser.tab.tcl b/ds9/parsers/fitsparser.tab.tcl new file mode 100644 index 0000000..4d5b356 --- /dev/null +++ b/ds9/parsers/fitsparser.tab.tcl @@ -0,0 +1,4 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set SLICE_ 260 diff --git a/ds9/parsers/fitsparser.tcl b/ds9/parsers/fitsparser.tcl new file mode 100644 index 0000000..a3a5e76 --- /dev/null +++ b/ds9/parsers/fitsparser.tcl @@ -0,0 +1,382 @@ +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 fits { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc fits::YYABORT {} { + return -code return 1 +} + +proc fits::YYACCEPT {} { + return -code return 0 +} + +proc fits::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc fits::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc fits::yyerror {s} { + puts stderr $s +} + +proc fits::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 fits::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set fits::table { + 0:257 reduce + 0:258 reduce + 0:260 reduce + 0:259 shift + 5:0,target 7 + 9:0 reduce + 0:261 goto + 6:260,target 9 + 11:0 reduce + 0:262 goto + 4:257 shift + 4:258 shift + 0:264 goto + 1:260,target 9 + 4:260 shift + 6:257 shift + 7:263,target 11 + 6:260 shift + 4:263 goto + 6:263 goto + 6:0,target 6 + 2:0 accept + 1:258,target 9 + 6:0 reduce + 6:257,target 5 + 0:264,target 4 + 4:260,target 7 + 7:0,target 6 + 1:257,target 9 + 12:0 reduce + 0:0,target 8 + 10:0,target 3 + 4:258,target 6 + 9:257,target 5 + 8:0,target 2 + 3:0 reduce + 1:0,target 9 + 11:0,target 4 + 0:262,target 3 + 4:257,target 5 + 7:0 reduce + 1:257 reduce + 1:258 reduce + 1:260 reduce + 9:0,target 6 + 0:261,target 2 + 7:257 shift + 2:0,target 0 + 12:0,target 5 + 9:257 shift + 7:257,target 5 + 0:0 reduce + 7:263 goto + 0:260,target 8 + 0:259,target 1 + 9:263 goto + 4:0 reduce + 6:263,target 10 + 3:0,target 1 + 8:0 reduce + 10:0 reduce + 0:258,target 8 + 9:263,target 12 + 4:0,target 6 + 0:257,target 8 + 1:0 reduce + 4:263,target 8 + 5:0 reduce +} + +array set fits::rules { + 9,l 264 + 2,l 262 + 6,l 263 + 3,l 262 + 7,l 263 + 0,l 265 + 4,l 262 + 8,l 264 + 1,l 261 + 5,l 262 +} + +array set fits::rules { + 5,dc 4 + 0,dc 1 + 8,dc 0 + 3,dc 3 + 6,dc 0 + 1,dc 1 + 9,dc 1 + 4,dc 3 + 7,dc 1 + 2,dc 2 +} + +array set fits::rules { + 7,line 29 + 4,line 24 + 1,line 19 + 9,line 33 + 6,line 28 + 3,line 23 + 8,line 32 + 5,line 25 + 2,line 22 +} + +array set fits::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {8 {0 257 258 260} 0} {9 {0 257 258 260} 0}} + 1 {{9 {0 257 258 260} 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1} {4 0 1} {5 0 1} {6 0 0} {7 0 0}} + 0,trans {{259 1} {261 2} {262 3} {264 4}} + 1,trans {} + 5 {{7 0 1}} + 2,trans {} + 6 {{3 0 2} {5 0 2} {6 0 0} {7 0 0}} + 3,trans {} + 7 {{4 0 2} {6 0 0} {7 0 0}} + 4,trans {{257 5} {258 6} {260 7} {263 8}} + 8 {{2 0 2}} + 10 {{3 0 3}} + 9 {{5 0 3} {6 0 0} {7 0 0}} + 5,trans {} + 11 {{4 0 3}} + 6,trans {{257 5} {260 9} {263 10}} + 12 {{5 0 4}} + 7,trans {{257 5} {263 11}} + 8,trans {} + 10,trans {} + 9,trans {{257 5} {263 12}} + 11,trans {} + 12,trans {} +} + +array set fits::token_id_table { + 264,line 31 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 265,title {} + 258,line 11 + 261,line 18 + error,line 16 + 257 STRING_ + 257,t 0 + 263,line 27 + 258 MASK_ + 258,t 0 + error,title {} + 260,t 0 + 260 SLICE_ + 259 NEW_ + 259,t 0 + 265,line 34 + 261,t 1 + 261 command + 262,t 1 + 262 fits + 257,line 7 + 263,t 1 + 263 filename + 264,t 1 + 264 new + 260,line 13 + 257,title string + 259,line 12 + 265,t 1 + 265 start' + 258,title MASK + 262,line 21 + 260,title SLICE + 259,title NEW + 261,title {} +} + +proc fits::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 { + 2 { FitsCmdLoad $2 {} {} } + 3 { FitsCmdLoad $3 mask {} } + 4 { FitsCmdLoad $3 {} slice } + 5 { FitsCmdLoad $4 mask slice } + 6 { set _ {} } + 7 { set _ $1 } + 9 { CreateFrame } + } + 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 fits::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/fitssendlex.tcl b/ds9/parsers/fitssendlex.tcl new file mode 100644 index 0000000..0a95d6e --- /dev/null +++ b/ds9/parsers/fitssendlex.tcl @@ -0,0 +1,847 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval fitssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc fitssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc fitssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc fitssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc fitssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc fitssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc fitssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc fitssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc fitssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc fitssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set FK4_ 284 +set B1950_ 285 +set FK5_ 286 +set J2000_ 287 +set ICRS_ 288 +set GALACTIC_ 289 +set ECLIPTIC_ 290 +set DEGREES_ 291 +set ARCMIN_ 292 +set ARCSEC_ 293 +set INT_ 294 +set STRING_ 295 +set BITPIX_ 296 +set DEPTH_ 297 +set GZ_ 298 +set HEADER_ 299 +set HEIGHT_ 300 +set IMAGE_ 301 +set KEYWORD_ 302 +set RESAMPLE_ 303 +set SIZE_ 304 +set SLICE_ 305 +set TABLE_ 306 +set TYPE_ 307 +set WIDTH_ 308 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: bitpix + if {[regexp -start $index_ -indices -line -nocase -- {\A(bitpix)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: depth + if {[regexp -start $index_ -indices -line -nocase -- {\A(depth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: gz + if {[regexp -start $index_ -indices -line -nocase -- {\A(gz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: header + if {[regexp -start $index_ -indices -line -nocase -- {\A(header)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: height + if {[regexp -start $index_ -indices -line -nocase -- {\A(height)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: keyword + if {[regexp -start $index_ -indices -line -nocase -- {\A(keyword)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: resample + if {[regexp -start $index_ -indices -line -nocase -- {\A(resample)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: table + if {[regexp -start $index_ -indices -line -nocase -- {\A(table)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: type + if {[regexp -start $index_ -indices -line -nocase -- {\A(type)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BITPIX_ + } + 1 { +return $DEPTH_ + } + 2 { +return $GZ_ + } + 3 { +return $HEADER_ + } + 4 { +return $HEIGHT_ + } + 5 { +return $IMAGE_ + } + 6 { +return $KEYWORD_ + } + 7 { +return $RESAMPLE_ + } + 8 { +return $SIZE_ + } + 9 { +return $SLICE_ + } + 10 { +return $TABLE_ + } + 11 { +return $TYPE_ + } + 12 { +return $WIDTH_ + } + 13 { +return $WCS_ + } + 14 { +return $WCSA_ + } + 15 { +return $WCSB_ + } + 16 { +return $WCSC_ + } + 17 { +return $WCSD_ + } + 18 { +return $WCSE_ + } + 19 { +return $WCSF_ + } + 20 { +return $WCSG_ + } + 21 { +return $WCSH_ + } + 22 { +return $WCSI_ + } + 23 { +return $WCSJ_ + } + 24 { +return $WCSK_ + } + 25 { +return $WCSL_ + } + 26 { +return $WCSM_ + } + 27 { +return $WCSN_ + } + 28 { +return $WCSO_ + } + 29 { +return $WCSP_ + } + 30 { +return $WCSQ_ + } + 31 { +return $WCSR_ + } + 32 { +return $WCSS_ + } + 33 { +return $WCST_ + } + 34 { +return $WCSU_ + } + 35 { +return $WCSV_ + } + 36 { +return $WCSW_ + } + 37 { +return $WCSX_ + } + 38 { +return $WCSY_ + } + 39 { +return $WCSZ_ + } + 40 { +return $FK4_ + } + 41 { +return $FK4_ + } + 42 { +return $FK5_ + } + 43 { +return $FK5_ + } + 44 { +return $ICRS_ + } + 45 { +return $GALACTIC_ + } + 46 { +return $ECLIPTIC_ + } + 47 { +return $DEGREES_ + } + 48 { +return $ARCMIN_ + } + 49 { +return $ARCSEC_ + } + 50 { +set yylval $yytext; return $INT_ + } + 51 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 52 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 53 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 54 { +set yylval $yytext; return $STRING_ + } + 55 { +# ignore whitespace + } + 56 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/fitssendparser.tab.tcl b/ds9/parsers/fitssendparser.tab.tcl new file mode 100644 index 0000000..649aa46 --- /dev/null +++ b/ds9/parsers/fitssendparser.tab.tcl @@ -0,0 +1,52 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set FK4_ 284 +set B1950_ 285 +set FK5_ 286 +set J2000_ 287 +set ICRS_ 288 +set GALACTIC_ 289 +set ECLIPTIC_ 290 +set DEGREES_ 291 +set ARCMIN_ 292 +set ARCSEC_ 293 +set INT_ 294 +set STRING_ 295 +set BITPIX_ 296 +set DEPTH_ 297 +set GZ_ 298 +set HEADER_ 299 +set HEIGHT_ 300 +set IMAGE_ 301 +set KEYWORD_ 302 +set RESAMPLE_ 303 +set SIZE_ 304 +set SLICE_ 305 +set TABLE_ 306 +set TYPE_ 307 +set WIDTH_ 308 diff --git a/ds9/parsers/fitssendparser.tcl b/ds9/parsers/fitssendparser.tcl new file mode 100644 index 0000000..4d0c30b --- /dev/null +++ b/ds9/parsers/fitssendparser.tcl @@ -0,0 +1,1754 @@ +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 fitssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc fitssend::YYABORT {} { + return -code return 1 +} + +proc fitssend::YYACCEPT {} { + return -code return 0 +} + +proc fitssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc fitssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc fitssend::yyerror {s} { + puts stderr $s +} + +proc fitssend::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 fitssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set fitssend::table { + 21:289 reduce + 21:290 reduce + 21:291 reduce + 21:292 reduce + 21:293 reduce + 48:0 reduce + 28:285,target 12 + 25:293,target 9 + 41:287,target 25 + 9:298 reduce + 64:0,target 51 + 23:284,target 7 + 33:0,target 17 + 19:292,target 3 + 20:292,target 4 + 35:286,target 19 + 7:260,target 20 + 7:259,target 19 + 21:0 reduce + 29:285,target 13 + 30:285,target 14 + 26:284 reduce + 26:285 reduce + 26:286 reduce + 63:0 reduce + 26:287 reduce + 26:293,target 10 + 26:288 reduce + 42:287,target 26 + 26:289 reduce + 26:290 reduce + 26:291 reduce + 26:292 reduce + 26:293 reduce + 54:290,target 50 + 54:289,target 49 + 24:284,target 8 + 21:292,target 5 + 36:286,target 20 + 7:276,target 36 + 61:0,target 56 + 29:0,target 13 + 30:0,target 14 + 31:285,target 15 + 35:0 reduce + 27:293,target 11 + 43:287,target 27 + 25:284,target 9 + 9:0 reduce + 32:284 reduce + 22:292,target 6 + 32:285 reduce + 32:286 reduce + 37:286,target 21 + 32:287 reduce + 32:288 reduce + 7:293,target 53 + 32:289 reduce + 32:290 reduce + 32:291 reduce + 32:292 reduce + 32:293 reduce + 32:285,target 16 + 13:298,target 58 + 28:293,target 12 + 50:0 reduce + 49:0 reduce + 57:0,target 43 + 26:284,target 10 + 26:0,target 10 + 23:292,target 7 + 38:286,target 22 + 17:291,target 1 + 63:291,target 51 + 33:285,target 17 + 37:284 reduce + 7:267,target 27 + 37:285 reduce + 37:286 reduce + 3:302,target 15 + 37:287 reduce + 22:0 reduce + 29:293,target 13 + 30:293,target 14 + 37:288 reduce + 37:289 reduce + 37:290 reduce + 37:291 reduce + 0:299,target 3 + 37:292 reduce + 37:293 reduce + 64:0 reduce + 27:284,target 11 + 24:292,target 8 + 39:286,target 23 + 40:286,target 24 + 54:0,target 47 + 7:284,target 44 + 18:291,target 2 + 23:0,target 7 + 34:285,target 18 + 31:293,target 15 + 36:0 reduce + 28:284,target 12 + 43:284 reduce + 43:285 reduce + 25:292,target 9 + 43:286 reduce + 41:286,target 25 + 43:287 reduce + 43:288 reduce + 43:289 reduce + 43:290 reduce + 43:291 reduce + 43:292 reduce + 43:293 reduce + 7:311,target 56 + 19:291,target 3 + 20:291,target 4 + 35:285,target 19 + 8:0,target 63 + 32:293,target 16 + 13:298 shift + 51:0,target 35 + 13:316,target 59 + 7:258,target 18 + 29:284,target 13 + 30:284,target 14 + 7:257 shift + 19:0,target 3 + 20:0,target 4 + 51:0 reduce + 13:316 goto + 7:258 shift + 7:260 shift + 7:259 shift + 0:301,target 5 + 7:261 shift + 26:292,target 10 + 7:262 shift + 42:286,target 26 + 7:263 shift + 7:264 shift + 7:265 shift + 7:266 shift + 54:288,target 48 + 7:267 shift + 7:268 shift + 7:270 shift + 7:269 shift + 7:271 shift + 7:272 shift + 21:291,target 5 + 7:273 shift + 36:285,target 20 + 7:274 shift + 7:275 shift + 7:276 shift + 18:284 reduce + 7:277 shift + 33:293,target 17 + 48:291 reduce + 7:278 shift + 7:275,target 35 + 18:285 reduce + 48:292 reduce + 7:280 shift + 7:279 shift + 18:286 reduce + 48:293 reduce + 7:281 shift + 18:287 reduce + 7:282 shift + 18:288 reduce + 7:283 shift + 18:289 reduce + 18:290 reduce + 7:284 shift + 18:291 reduce + 23:0 reduce + 31:284,target 15 + 7:285 shift + 18:292 reduce + 7:286 shift + 18:293 reduce + 7:287 shift + 5:0,target 62 + 7:288 shift + 27:292,target 11 + 7:290 shift + 7:289 shift + 43:286,target 27 + 65:0 reduce + 7:291 shift + 7:292 shift + 7:293 shift + 47:0,target 31 + 16:0,target 44 + 7:310 goto + 7:309 goto + 22:291,target 6 + 7:311 goto + 37:285,target 21 + 7:313 goto + 7:292,target 52 + 34:293,target 18 + 32:284,target 16 + 54:284 shift + 54:285 shift + 54:286 shift + 54:287 shift + 28:292,target 12 + 37:0 reduce + 54:288 shift + 54:290 shift + 54:289 shift + 24:284 reduce + 54:291 shift + 24:285 reduce + 54:292 shift + 24:286 reduce + 54:293 shift + 24:287 reduce + 24:288 reduce + 24:289 reduce + 24:290 reduce + 24:291 reduce + 24:292 reduce + 23:291,target 7 + 24:293 reduce + 54:310 goto + 2:0,target 40 + 38:285,target 22 + 54:311 goto + 35:293,target 19 + 44:0,target 28 + 17:290,target 1 + 17:289,target 1 + 13:0,target 65 + 33:284,target 17 + 7:266,target 26 + 10:0 reduce + 29:292,target 13 + 30:292,target 14 + 0:308,target 11 + 0:298,target 60 + 52:0 reduce + 24:291,target 8 + 39:285,target 23 + 40:285,target 24 + 29:284 reduce + 30:284 reduce + 29:285 reduce + 30:285 reduce + 36:293,target 20 + 29:286 reduce + 30:286 reduce + 29:287 reduce + 30:287 reduce + 29:288 reduce + 30:288 reduce + 60:295 shift + 29:289 reduce + 29:290 reduce + 30:289 reduce + 30:290 reduce + 60:296 shift + 7:283,target 43 + 18:289,target 2 + 18:290,target 2 + 29:291 reduce + 30:291 reduce + 29:292 reduce + 30:292 reduce + 34:284,target 18 + 29:293 reduce + 30:293 reduce + 31:292,target 15 + 24:0 reduce + 41:0,target 25 + 66:0 reduce + 10:0,target 42 + 25:291,target 9 + 41:285,target 25 + 37:293,target 21 + 7:310,target 55 + 7:309,target 54 + 19:289,target 3 + 19:290,target 3 + 20:289,target 4 + 20:290,target 4 + 35:284,target 19 + 32:292,target 16 + 35:284 reduce + 35:285 reduce + 7:257,target 17 + 35:286 reduce + 35:287 reduce + 35:288 reduce + 35:289 reduce + 35:290 reduce + 38:0 reduce + 35:291 reduce + 35:292 reduce + 0:300,target 4 + 35:293 reduce + 26:291,target 10 + 42:285,target 26 + 68:0,target 53 + 38:293,target 22 + 54:287,target 47 + 37:0,target 21 + 21:289,target 5 + 21:290,target 5 + 36:284,target 20 + 33:292,target 17 + 7:274,target 34 + 11:0 reduce + 53:0 reduce + 27:291,target 11 + 43:285,target 27 + 41:284 reduce + 41:285 reduce + 39:293,target 23 + 40:293,target 24 + 41:286 reduce + 41:287 reduce + 41:288 reduce + 41:289 reduce + 41:290 reduce + 41:291 reduce + 22:289,target 6 + 22:290,target 6 + 41:292 reduce + 37:284,target 21 + 41:293 reduce + 65:0,target 52 + 7:291,target 51 + 34:292,target 18 + 34:0,target 18 + 0:300 shift + 0:301 shift + 0:303 shift + 0:304 shift + 25:0 reduce + 0:305 shift + 0:296 shift + 0:306 shift + 28:291,target 12 + 0:307 shift + 0:297 shift + 0:308 shift + 0:298 reduce + 0:299 shift + 67:0 reduce + 0:312 goto + 41:293,target 25 + 0:0 reduce + 0:315 goto + 23:289,target 7 + 23:290,target 7 + 38:284,target 22 + 35:292,target 19 + 5:298,target 62 + 17:288,target 1 + 46:291 reduce + 46:292 reduce + 7:265,target 25 + 46:293 reduce + 60:296,target 67 + 29:291,target 13 + 30:291,target 14 + 62:0,target 58 + 39:0 reduce + 40:0 reduce + 0:297,target 2 + 0:307,target 10 + 31:0,target 15 + 42:293,target 26 + 24:289,target 8 + 24:290,target 8 + 39:284,target 23 + 40:284,target 24 + 5:298 reduce + 36:292,target 20 + 6:298,target 64 + 7:282,target 42 + 18:288,target 2 + 15:296,target 62 + 12:0 accept + 31:291,target 15 + 43:293,target 27 + 54:0 reduce + 22:284 reduce + 22:285 reduce + 22:286 reduce + 22:287 reduce + 25:289,target 9 + 25:290,target 9 + 22:288 reduce + 41:284,target 25 + 22:289 reduce + 22:290 reduce + 58:0,target 66 + 22:291 reduce + 22:292 reduce + 22:293 reduce + 37:292,target 21 + 27:0,target 11 + 19:288,target 3 + 20:288,target 4 + 32:291,target 16 + 26:0 reduce + 44:293,target 28 + 68:0 reduce + 26:289,target 10 + 26:290,target 10 + 42:284,target 26 + 1:0 reduce + 38:292,target 22 + 54:286,target 46 + 8:298,target 63 + 27:284 reduce + 21:288,target 5 + 27:285 reduce + 27:286 reduce + 27:287 reduce + 27:288 reduce + 27:289 reduce + 27:290 reduce + 55:0,target 48 + 27:291 reduce + 33:291,target 17 + 7:273,target 33 + 27:292 reduce + 27:293 reduce + 24:0,target 8 + 45:293,target 29 + 0:315,target 13 + 41:0 reduce + 27:289,target 11 + 27:290,target 11 + 43:284,target 27 + 39:292,target 23 + 40:292,target 24 + 9:298,target 61 + 22:288,target 6 + 7:290,target 50 + 7:289,target 49 + 34:291,target 18 + 46:293,target 30 + 13:0 reduce + 9:0,target 61 + 33:284 reduce + 63:291 shift + 33:285 reduce + 63:292 shift + 33:286 reduce + 63:293 shift + 33:287 reduce + 28:289,target 12 + 28:290,target 12 + 33:288 reduce + 33:289 reduce + 33:290 reduce + 55:0 reduce + 52:0,target 36 + 33:291 reduce + 33:292 reduce + 33:293 reduce + 41:292,target 25 + 63:311 goto + 21:0,target 5 + 23:288,target 7 + 35:291,target 19 + 47:293,target 31 + 17:287,target 1 + 7:264,target 24 + 60:295,target 66 + 27:0 reduce + 29:289,target 13 + 29:290,target 13 + 30:289,target 14 + 30:290,target 14 + 0:296,target 1 + 0:306,target 9 + 42:292,target 26 + 6:0,target 64 + 38:284 reduce + 2:0 reduce + 38:285 reduce + 24:288,target 8 + 38:286 reduce + 38:287 reduce + 38:288 reduce + 38:289 reduce + 38:290 reduce + 48:0,target 32 + 38:291 reduce + 36:291,target 20 + 38:292 reduce + 38:293 reduce + 17:0,target 1 + 48:293,target 32 + 7:281,target 41 + 18:287,target 2 + 15:295,target 61 + 31:289,target 15 + 31:290,target 15 + 42:0 reduce + 43:292,target 27 + 25:288,target 9 + 37:291,target 21 + 50:293,target 34 + 49:293,target 33 + 3:0,target 54 + 19:287,target 3 + 20:287,target 4 + 32:289,target 16 + 32:290,target 16 + 45:0,target 29 + 44:291 reduce + 14:0 reduce + 44:292 reduce + 44:293 reduce + 14:0,target 55 + 44:292,target 28 + 14:302 shift + 56:0 reduce + 26:288,target 10 + 3:302 shift + 3:294 shift + 38:291,target 22 + 54:285,target 45 + 21:287,target 5 + 3:314 goto + 33:289,target 17 + 33:290,target 17 + 7:272,target 32 + 45:292,target 29 + 28:0 reduce + 0:0,target 60 + 27:288,target 11 + 19:284 reduce + 20:284 reduce + 50:291 reduce + 49:291 reduce + 19:285 reduce + 20:285 reduce + 42:0,target 26 + 50:292 reduce + 49:292 reduce + 19:286 reduce + 20:286 reduce + 50:293 reduce + 49:293 reduce + 3:0 reduce + 19:287 reduce + 20:287 reduce + 39:291,target 23 + 40:291,target 24 + 19:288 reduce + 20:288 reduce + 11:0,target 38 + 19:289 reduce + 19:290 reduce + 20:289 reduce + 20:290 reduce + 19:291 reduce + 20:291 reduce + 19:292 reduce + 20:292 reduce + 19:293 reduce + 20:293 reduce + 22:287,target 6 + 7:288,target 48 + 34:289,target 18 + 34:290,target 18 + 46:292,target 30 + 8:298 reduce + 28:288,target 12 + 43:0 reduce + 41:291,target 25 + 23:287,target 7 + 25:284 reduce + 55:291 shift + 25:285 reduce + 35:289,target 19 + 35:290,target 19 + 38:0,target 22 + 55:292 shift + 25:286 reduce + 55:293 shift + 25:287 reduce + 25:288 reduce + 25:289 reduce + 25:290 reduce + 47:292,target 31 + 17:286,target 1 + 25:291 reduce + 25:292 reduce + 7:263,target 23 + 25:293 reduce + 55:311 goto + 29:288,target 13 + 30:288,target 14 + 0:305,target 8 + 57:0 reduce + 42:291,target 26 + 54:293,target 53 + 24:287,target 8 + 36:289,target 20 + 36:290,target 20 + 48:292,target 32 + 7:280,target 40 + 7:279,target 39 + 18:286,target 2 + 3:314,target 16 + 66:0,target 57 + 31:288,target 15 + 31:284 reduce + 29:0 reduce + 30:0 reduce + 31:285 reduce + 35:0,target 19 + 31:286 reduce + 31:287 reduce + 31:288 reduce + 43:291,target 27 + 31:289 reduce + 31:290 reduce + 31:291 reduce + 31:292 reduce + 31:293 reduce + 55:293,target 53 + 25:287,target 9 + 4:0 reduce + 37:289,target 21 + 37:290,target 21 + 50:292,target 34 + 49:292,target 33 + 19:286,target 3 + 20:286,target 4 + 32:288,target 16 + 44:291,target 28 + 44:0 reduce + 63:0,target 50 + 26:287,target 10 + 36:284 reduce + 32:0,target 16 + 36:285 reduce + 36:286 reduce + 38:289,target 22 + 38:290,target 22 + 54:284,target 44 + 36:287 reduce + 36:288 reduce + 36:289 reduce + 36:290 reduce + 36:291 reduce + 21:286,target 5 + 36:292 reduce + 36:293 reduce + 33:288,target 17 + 7:271,target 31 + 16:0 reduce + 45:291,target 29 + 58:0 reduce + 27:287,target 11 + 54:311,target 64 + 39:289,target 23 + 39:290,target 23 + 40:289,target 24 + 40:290,target 24 + 22:286,target 6 + 59:0,target 45 + 7:287,target 47 + 34:288,target 18 + 42:284 reduce + 28:0,target 12 + 42:285 reduce + 42:286 reduce + 42:287 reduce + 42:288 reduce + 46:291,target 30 + 42:289 reduce + 42:290 reduce + 42:291 reduce + 42:292 reduce + 31:0 reduce + 42:293 reduce + 28:287,target 12 + 55:311,target 65 + 41:289,target 25 + 41:290,target 25 + 5:0 reduce + 23:286,target 7 + 35:288,target 19 + 47:291,target 31 + 17:285,target 1 + 7:262,target 22 + 56:0,target 49 + 29:287,target 13 + 30:287,target 14 + 45:0 reduce + 0:304,target 7 + 25:0,target 9 + 42:289,target 26 + 42:290,target 26 + 17:284 reduce + 47:291 reduce + 17:285 reduce + 47:292 reduce + 17:286 reduce + 54:292,target 52 + 47:293 reduce + 17:287 reduce + 24:286,target 8 + 17:288 reduce + 17:290 reduce + 17:289 reduce + 17:291 reduce + 17:292 reduce + 17:293 reduce + 36:288,target 20 + 48:291,target 32 + 7:278,target 38 + 18:285,target 2 + 17:0 reduce + 31:287,target 15 + 6:298 reduce + 43:289,target 27 + 43:290,target 27 + 59:0 reduce + 55:292,target 52 + 25:286,target 9 + 53:0,target 37 + 22:0,target 6 + 37:288,target 21 + 23:284 reduce + 50:291,target 34 + 49:291,target 33 + 19:285,target 3 + 20:285,target 4 + 23:285 reduce + 23:286 reduce + 23:287 reduce + 23:288 reduce + 23:289 reduce + 23:290 reduce + 23:291 reduce + 32:287,target 16 + 23:292 reduce + 23:293 reduce + 32:0 reduce + 26:286,target 10 + 6:0 reduce + 38:288,target 22 + 7:0,target 46 + 21:285,target 5 + 50:0,target 34 + 49:0,target 33 + 17:293,target 1 + 63:293,target 53 + 33:287,target 17 + 7:270,target 30 + 7:269,target 29 + 18:0,target 2 + 3:294,target 14 + 28:284 reduce + 0:312,target 12 + 28:285 reduce + 46:0 reduce + 28:286 reduce + 28:287 reduce + 27:286,target 11 + 28:288 reduce + 28:289 reduce + 28:290 reduce + 28:291 reduce + 28:292 reduce + 54:310,target 63 + 28:293 reduce + 39:288,target 23 + 40:288,target 24 + 22:285,target 6 + 7:286,target 46 + 18:293,target 2 + 34:287,target 18 + 4:0,target 39 + 18:0 reduce + 46:0,target 30 + 28:286,target 12 + 61:0 reduce + 41:288,target 25 + 34:284 reduce + 34:285 reduce + 23:285,target 7 + 34:286 reduce + 34:287 reduce + 7:313,target 57 + 34:288 reduce + 34:289 reduce + 34:290 reduce + 19:293,target 3 + 20:293,target 4 + 34:291 reduce + 34:292 reduce + 35:287,target 19 + 34:293 reduce + 17:284,target 1 + 7:261,target 21 + 14:302,target 60 + 29:286,target 13 + 30:286,target 14 + 33:0 reduce + 0:303,target 6 + 42:288,target 26 + 1:0,target 41 + 7:0 reduce + 54:291,target 51 + 24:285,target 8 + 43:0,target 27 + 21:293,target 5 + 36:287,target 20 + 12:0,target 0 + 63:311,target 68 + 7:277,target 37 + 18:284,target 2 + 39:284 reduce + 40:284 reduce + 39:285 reduce + 40:285 reduce + 39:286 reduce + 40:286 reduce + 39:287 reduce + 40:287 reduce + 39:288 reduce + 40:288 reduce + 31:286,target 15 + 39:289 reduce + 39:290 reduce + 40:289 reduce + 40:290 reduce + 39:291 reduce + 40:291 reduce + 39:292 reduce + 40:292 reduce + 39:293 reduce + 40:293 reduce + 47:0 reduce + 43:288,target 27 + 55:291,target 51 + 25:285,target 9 + 22:293,target 6 + 37:287,target 21 + 19:284,target 3 + 20:284,target 4 + 39:0,target 23 + 40:0,target 24 + 32:286,target 16 + 19:0 reduce + 20:0 reduce + 62:0 reduce + 26:285,target 10 + 45:291 reduce + 45:292 reduce + 23:293,target 7 + 45:293 reduce + 38:287,target 22 + 21:284,target 5 + 15:295 shift + 15:296 shift + 17:292,target 1 + 63:292,target 52 + 33:286,target 17 + 7:268,target 28 + 34:0 reduce + 67:0,target 59 + 27:285,target 11 + 36:0,target 20 + 24:293,target 8 + 8:0 reduce + 39:287,target 23 + 40:287,target 24 + 22:284,target 6 + 7:285,target 45 + 18:292,target 2 + 21:284 reduce + 21:285 reduce + 34:286,target 18 + 21:286 reduce + 21:287 reduce + 21:288 reduce +} + +array set fitssend::rules { + 9,l 309 + 11,l 309 + 32,l 310 + 53,l 313 + 6,l 309 + 28,l 310 + 50,l 313 + 49,l 313 + 3,l 309 + 25,l 309 + 46,l 313 + 0,l 317 + 22,l 309 + 43,l 312 + 64,l 315 + 18,l 309 + 40,l 312 + 39,l 312 + 61,l 315 + 15,l 309 + 36,l 311 + 57,l 314 + 12,l 309 + 33,l 310 + 54,l 314 + 7,l 309 + 29,l 310 + 30,l 310 + 51,l 313 + 4,l 309 + 26,l 309 + 47,l 313 + 1,l 309 + 23,l 309 + 44,l 312 + 65,l 316 + 19,l 309 + 20,l 309 + 41,l 312 + 62,l 315 + 16,l 309 + 37,l 311 + 58,l 314 + 13,l 309 + 34,l 310 + 55,l 314 + 8,l 309 + 10,l 309 + 31,l 310 + 52,l 313 + 5,l 309 + 27,l 309 + 48,l 313 + 2,l 309 + 24,l 309 + 45,l 312 + 66,l 316 + 21,l 309 + 42,l 312 + 63,l 315 + 17,l 309 + 38,l 312 + 60,l 315 + 59,l 314 + 14,l 309 + 35,l 311 + 56,l 314 +} + +array set fitssend::rules { + 63,dc 1 + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 0 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 0 + 61,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 3 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 60,dc 0 + 59,dc 3 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 2 + 66,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 2 + 22,dc 1 + 36,dc 1 + 51,dc 2 + 65,dc 0 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 2 + 57,dc 3 + 21,dc 1 + 35,dc 1 + 50,dc 2 + 49,dc 1 + 64,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 2 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set fitssend::rules { + 41,line 157 + 7,line 117 + 37,line 149 + 4,line 114 + 34,line 145 + 1,line 111 + 31,line 142 + 27,line 137 + 24,line 134 + 21,line 131 + 17,line 127 + 14,line 124 + 11,line 121 + 66,line 193 + 63,line 188 + 60,line 184 + 59,line 181 + 56,line 178 + 53,line 171 + 50,line 168 + 49,line 167 + 46,line 164 + 43,line 159 + 9,line 119 + 40,line 155 + 39,line 154 + 6,line 116 + 36,line 148 + 3,line 113 + 33,line 144 + 29,line 140 + 30,line 141 + 26,line 136 + 23,line 133 + 19,line 129 + 20,line 130 + 16,line 126 + 13,line 123 + 10,line 120 + 65,line 192 + 62,line 186 + 58,line 180 + 55,line 175 + 52,line 170 + 48,line 166 + 45,line 161 + 42,line 158 + 8,line 118 + 38,line 153 + 5,line 115 + 35,line 147 + 2,line 112 + 32,line 143 + 28,line 139 + 25,line 135 + 22,line 132 + 18,line 128 + 15,line 125 + 12,line 122 + 64,line 189 + 61,line 185 + 57,line 179 + 54,line 174 + 51,line 169 + 47,line 165 + 44,line 160 +} + +array set fitssend::lr1_table { + 66,trans {} + 35 {{19 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 14,trans {{302 60}} + 36 {{20 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 33,trans {} + 37 {{21 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 52,trans {} + 38 {{22 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 39 {{23 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 40 {{24 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 18,trans {} + 41 {{25 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 1,trans {} + 37,trans {} + 42 {{26 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 56,trans {} + 43 {{27 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 44 {{28 {0 291 292 293} 1}} + 23,trans {} + 45 {{29 {0 291 292 293} 1}} + 5,trans {} + 42,trans {} + 46 {{30 {0 291 292 293} 1}} + 61,trans {} + 47 {{31 {0 291 292 293} 1}} + 48 {{32 {0 291 292 293} 1}} + 27,trans {} + 9,trans {} + 50 {{34 {0 291 292 293} 1}} + 49 {{33 {0 291 292 293} 1}} + 46,trans {} + 51 {{35 0 1}} + 65,trans {} + 52 {{36 0 1}} + 13,trans {{298 58} {316 59}} + 53 {{37 0 1}} + 32,trans {} + 54 {{47 0 1} {50 0 1} {51 0 1} {53 0 1} {28 {0 291 292 293} 0} {29 {0 291 292 293} 0} {30 {0 291 292 293} 0} {31 {0 291 292 293} 0} {32 {0 291 292 293} 0} {33 {0 291 292 293} 0} {34 {0 291 292 293} 0} {35 0 0} {36 0 0} {37 0 0}} + 51,trans {} + 55 {{48 0 1} {52 0 1} {35 0 0} {36 0 0} {37 0 0}} + 56 {{49 0 1}} + 17,trans {} + 57 {{43 0 2}} + 0,trans {{296 1} {297 2} {299 3} {300 4} {301 5} {303 6} {304 7} {305 8} {306 9} {307 10} {308 11} {312 12} {315 13}} + 36,trans {} + 58 {{66 0 1}} + 55,trans {{291 51} {292 52} {293 53} {311 65}} + 60 {{57 0 2} {59 0 2}} + 59 {{45 0 2}} + 61 {{56 0 2}} + 22,trans {} + 62 {{58 0 2}} + 4,trans {} + 63 {{50 0 2} {53 0 2} {35 0 0} {36 0 0} {37 0 0}} + 41,trans {} + 60,trans {{295 66} {296 67}} + 59,trans {} + 64 {{51 0 2}} + 65 {{52 0 2}} + 66 {{57 0 3}} + 26,trans {} + 8,trans {} + 67 {{59 0 3}} + 45,trans {} + 64,trans {} + 68 {{53 0 3}} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 68,trans {} + 16,trans {} + 35,trans {} + 54,trans {{284 44} {285 45} {286 46} {287 47} {288 48} {289 49} {290 50} {291 51} {292 52} {293 53} {310 63} {311 64}} + 21,trans {} + 3,trans {{294 14} {302 15} {314 16}} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{42 0 1}} + 11 {{38 0 1}} + 25,trans {} + 7,trans {{257 17} {258 18} {259 19} {260 20} {261 21} {262 22} {263 23} {264 24} {265 25} {266 26} {267 27} {268 28} {269 29} {270 30} {271 31} {272 32} {273 33} {274 34} {275 35} {276 36} {277 37} {278 38} {279 39} {280 40} {281 41} {282 42} {283 43} {284 44} {285 45} {286 46} {287 47} {288 48} {289 49} {290 50} {291 51} {292 52} {293 53} {309 54} {310 55} {311 56} {313 57}} + 12 {{0 0 1}} + 44,trans {} + 13 {{45 0 1} {65 0 0} {66 0 0}} + 63,trans {{291 51} {292 52} {293 53} {311 68}} + 14 {{55 0 1} {57 0 1} {59 0 1}} + 11,trans {} + 15 {{56 0 1} {58 0 1}} + 30,trans {} + 29,trans {} + 16 {{44 0 2}} + 48,trans {} + 0 {{0 0 0} {38 0 0} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0} {60 {0 298} 0} {61 {0 298} 0} {62 {0 298} 0} {63 {0 298} 0} {64 {0 298} 0}} + 17 {{1 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 67,trans {} + 1 {{41 0 1}} + 18 {{2 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 15,trans {{295 61} {296 62}} + 2 {{40 0 1}} + 19 {{3 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 20 {{4 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 34,trans {} + 3 {{44 0 1} {54 0 0} {55 0 0} {56 0 0} {57 0 0} {58 0 0} {59 0 0}} + 21 {{5 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 53,trans {} + 4 {{39 0 1}} + 22 {{6 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 5 {{62 {0 298} 1}} + 23 {{7 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 20,trans {} + 19,trans {} + 6 {{64 {0 298} 1}} + 2,trans {} + 24 {{8 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 38,trans {} + 7 {{43 0 1} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {1 {0 284 285 286 287 288 289 290 291 292 293} 0} {2 {0 284 285 286 287 288 289 290 291 292 293} 0} {3 {0 284 285 286 287 288 289 290 291 292 293} 0} {4 {0 284 285 286 287 288 289 290 291 292 293} 0} {5 {0 284 285 286 287 288 289 290 291 292 293} 0} {6 {0 284 285 286 287 288 289 290 291 292 293} 0} {7 {0 284 285 286 287 288 289 290 291 292 293} 0} {8 {0 284 285 286 287 288 289 290 291 292 293} 0} {9 {0 284 285 286 287 288 289 290 291 292 293} 0} {10 {0 284 285 286 287 288 289 290 291 292 293} 0} {11 {0 284 285 286 287 288 289 290 291 292 293} 0} {12 {0 284 285 286 287 288 289 290 291 292 293} 0} {13 {0 284 285 286 287 288 289 290 291 292 293} 0} {14 {0 284 285 286 287 288 289 290 291 292 293} 0} {15 {0 284 285 286 287 288 289 290 291 292 293} 0} {16 {0 284 285 286 287 288 289 290 291 292 293} 0} {17 {0 284 285 286 287 288 289 290 291 292 293} 0} {18 {0 284 285 286 287 288 289 290 291 292 293} 0} {19 {0 284 285 286 287 288 289 290 291 292 293} 0} {20 {0 284 285 286 287 288 289 290 291 292 293} 0} {21 {0 284 285 286 287 288 289 290 291 292 293} 0} {22 {0 284 285 286 287 288 289 290 291 292 293} 0} {23 {0 284 285 286 287 288 289 290 291 292 293} 0} {24 {0 284 285 286 287 288 289 290 291 292 293} 0} {25 {0 284 285 286 287 288 289 290 291 292 293} 0} {26 {0 284 285 286 287 288 289 290 291 292 293} 0} {27 {0 284 285 286 287 288 289 290 291 292 293} 0} {28 {0 291 292 293} 0} {29 {0 291 292 293} 0} {30 {0 291 292 293} 0} {31 {0 291 292 293} 0} {32 {0 291 292 293} 0} {33 {0 291 292 293} 0} {34 {0 291 292 293} 0} {35 0 0} {36 0 0} {37 0 0}} + 25 {{9 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 57,trans {} + 8 {{63 {0 298} 1}} + 26 {{10 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 9 {{61 {0 298} 1}} + 27 {{11 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 24,trans {} + 6,trans {} + 28 {{12 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 43,trans {} + 29 {{13 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 30 {{14 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 62,trans {} + 31 {{15 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 10,trans {} + 32 {{16 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 28,trans {} + 33 {{17 {0 284 285 286 287 288 289 290 291 292 293} 1}} + 47,trans {} + 34 {{18 {0 284 285 286 287 288 289 290 291 292 293} 1}} +} + +array set fitssend::token_id_table { + 286 FK5_ + 286,t 0 + 287 J2000_ + 292,line 44 + 302,line 59 + 288 ICRS_ + 317,t 1 + 265,title WCSH + 289 GALACTIC_ + 290 ECLIPTIC_ + 300 HEIGHT_ + 284,title FK4 + 291 DEGREES_ + 301 IMAGE_ + 313,title {} + 292 ARCMIN_ + 302 KEYWORD_ + 288,line 39 + 293 ARCSEC_ + 303 RESAMPLE_ + 294 INT_ + 304 SIZE_ + 305 SLICE_ + 295 STRING_ + 306 TABLE_ + 296 BITPIX_ + 307 TYPE_ + 262,t 0 + 297 DEPTH_ + 308 WIDTH_ + 285,line 36 + 298 GZ_ + 310 skyframe + 309 wcssys + 299 HEADER_ + 311 rformat + 283,t 0 + 312 fitssend + 313 size + 314,t 1 + 314 header + 282,line 32 + 315 opt + 316 gz + 264,title WCSG + 317 start' + 283,title WCSZ + 312,title {} + 278,line 28 + error,line 109 + 258,t 0 + 275,line 25 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 22 + 263,title WCSF + 282,title WCSY + 311,title {} + 268,line 18 + 276,t 0 + 265,line 15 + 307,t 0 + 297,t 0 + 262,line 12 + 0,t 0 + 0 {$} + 262,title WCSE + 281,title WCSX + 310,title {} + 309,title {} + error,t 0 + 299,title HEADER + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 317,line 194 + 261,title WCSD + 279,title WCSV + 280,title WCSW + 308,title WIDTH + 269,t 0 + 270,t 0 + 298,title GZ + 314,line 173 + 291,t 0 + 301,t 0 + 311,line 146 + 307,line 64 + 266,t 0 + 260,title WCSC + 259,title WCSB + 297,line 54 + 278,title WCSU + 307,title TYPE + 297,title DEPTH + 287,t 0 + 294,line 47 + 304,line 61 + error,title {} + 291,line 43 + 301,line 58 + 263,t 0 + 258,title WCSA + 287,line 38 + 277,title WCST + 284,t 0 + 306,title TABLE + 296,title BITPIX + 315,t 1 + 284,line 35 + 281,line 31 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title WCS + 277,line 27 + 276,title WCSS + 312,t 1 + 305,title SLICE + 295,title string + 274,line 24 + 271,line 21 + 277,t 0 + 308,t 0 + 267,line 17 + 298,t 0 + 275,title WCSR + 294,title integer + 304,title SIZE + 264,line 14 + 261,line 11 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSQ + 293,title ARCSEC + 303,title RESAMPLE + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 191 + 273,title WCSP + 313,line 163 + 292,title ARCMIN + 302,title KEYWORD + 267,t 0 + 310,line 138 + 309,line 110 + 299,line 56 + 288,t 0 + 306,line 63 + 296,line 53 + 272,title WCSO + 291,title DEGREES + 293,line 45 + 301,title IMAGE + 303,line 60 + 264,t 0 + 285,t 0 + 289,line 40 + 290,line 41 + 300,line 57 + 316,t 1 + 286,line 37 + 271,title WCSN + 261,t 0 + 283,line 33 + 289,title GALACTIC + 290,title ECLIPTIC + 300,title HEIGHT + 282,t 0 + 279,line 29 + 280,line 30 + 313,t 1 + 276,line 26 + 257,t 0 + 269,title WCSL + 270,title WCSM + 273,line 23 + 288,title ICRS + 317,title {} + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 19 + 270,line 20 + 266,line 16 + 268,title WCSK + 275,t 0 + 263,line 13 + 287,title J2000 + 316,title {} + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSJ + 257 WCS_ + 286,title FK5 + 293,t 0 + 303,t 0 + 315,title {} + 258 WCSA_ + 260 WCSC_ + 259 WCSB_ + 261 WCSD_ + 262 WCSE_ + 263 WCSF_ + 264 WCSG_ + 315,line 183 + 265 WCSH_ + 266 WCSI_ + 267 WCSJ_ + 268,t 0 + 268 WCSK_ + 269 WCSL_ + 270 WCSM_ + 312,line 152 + 271 WCSN_ + 272 WCSO_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSI + 273 WCSP_ + 274 WCSQ_ + 285,title B1950 + 314,title {} + 275 WCSR_ + 308,line 65 + 276 WCSS_ + 298,line 55 + 277 WCST_ + 278 WCSU_ + 279 WCSV_ + 280 WCSW_ + 281 WCSX_ + 305,line 62 + 282 WCSY_ + 295,line 49 + 265,t 0 + 283 WCSZ_ + 284 FK4_ + 285 B1950_ +} + +proc fitssend::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 } + 28 { set _ fk4 } + 29 { set _ fk4 } + 30 { set _ fk5 } + 31 { set _ fk5 } + 32 { set _ icrs } + 33 { set _ galactic } + 34 { set _ ecliptic } + 35 { set _ degrees } + 36 { set _ arcmin } + 37 { set _ arcsec } + 38 { ProcessSendCmdCurrent "get fits width" } + 39 { ProcessSendCmdCurrent "get fits height" } + 40 { ProcessSendCmdCurrent "get fits depth" } + 41 { ProcessSendCmdCurrent "get fits bitpix" } + 42 { FitsSendCmdType } + 45 { FitsSendCmd $1 } + 46 { ProcessSendCmdCurrent "get fits size" } + 47 { ProcessSendCmdCurrent "get fits size $1 fk5 degrees" } + 48 { ProcessSendCmdCurrent "get fits size wcs $1 degrees" } + 49 { ProcessSendCmdCurrent "get fits size wcs fk5 $1" } + 50 { ProcessSendCmdCurrent "get fits size $1 $2 degrees" } + 51 { ProcessSendCmdCurrent "get fits size $1 fk5 $2" } + 52 { ProcessSendCmdCurrent "get fits size wcs $1 $2" } + 53 { ProcessSendCmdCurrent "get fits size $1 $2 $3" } + 54 { ProcessSendCmdSend {.txt} "get fits header 1" } + 55 { ProcessSendCmdSend {.txt} "get fits header $1" } + 56 { ProcessSendCmdCurrent "get fits header keyword \{$2\}" } + 57 { ProcessSendCmdCurrent "get fits header $1 keyword \{$3\}" } + 58 { ProcessSendCmdCurrent "get fits header keyword \{BITPIX\}" } + 59 { ProcessSendCmdCurrent "get fits header $1 keyword \{BITPIX\}" } + 60 { set _ image } + 61 { set _ table } + 62 { set _ image } + 63 { set _ slice } + 64 { set _ resample } + } + 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 fitssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/framelex.tcl b/ds9/parsers/framelex.tcl new file mode 100644 index 0000000..d3f6d09 --- /dev/null +++ b/ds9/parsers/framelex.tcl @@ -0,0 +1,890 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval frame { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc frame::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc frame::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc frame::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc frame::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc frame::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc frame::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc frame::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc frame::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc frame::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set INT_ 288 +set STRING_ 289 +set 3D_ 290 +set ALL_ 291 +set BACK_ 292 +set CENTER_ 293 +set CLEAR_ 294 +set DELETE_ 295 +set FIRST_ 296 +set FORWARD_ 297 +set FRAMENO_ 298 +set HIDE_ 299 +set LAST_ 300 +set LOCK_ 301 +set MATCH_ 302 +set MOVE_ 303 +set NEW_ 304 +set NEXT_ 305 +set NONE_ 306 +set PREV_ 307 +set REFRESH_ 308 +set RESET_ 309 +set RGB_ 310 +set SHOW_ 311 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: all + if {[regexp -start $index_ -indices -line -nocase -- {\A(all)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: back + if {[regexp -start $index_ -indices -line -nocase -- {\A(back)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: center + if {[regexp -start $index_ -indices -line -nocase -- {\A(center)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: delete + if {[regexp -start $index_ -indices -line -nocase -- {\A(delete)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: first + if {[regexp -start $index_ -indices -line -nocase -- {\A(first)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: forward + if {[regexp -start $index_ -indices -line -nocase -- {\A(forward)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: frameno + if {[regexp -start $index_ -indices -line -nocase -- {\A(frameno)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: hide + if {[regexp -start $index_ -indices -line -nocase -- {\A(hide)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: last + if {[regexp -start $index_ -indices -line -nocase -- {\A(last)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: move + if {[regexp -start $index_ -indices -line -nocase -- {\A(move)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: next + if {[regexp -start $index_ -indices -line -nocase -- {\A(next)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: prev + if {[regexp -start $index_ -indices -line -nocase -- {\A(prev)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: refresh + if {[regexp -start $index_ -indices -line -nocase -- {\A(refresh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: reset + if {[regexp -start $index_ -indices -line -nocase -- {\A(reset)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: rgb + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: show + if {[regexp -start $index_ -indices -line -nocase -- {\A(show)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $CLOSE_ + } + 2 { +return $ALL_ + } + 3 { +return $BACK_ + } + 4 { +return $CENTER_ + } + 5 { +return $CLEAR_ + } + 6 { +return $DELETE_ + } + 7 { +return $FIRST_ + } + 8 { +return $FORWARD_ + } + 9 { +return $FRAMENO_ + } + 10 { +return $HIDE_ + } + 11 { +return $LAST_ + } + 12 { +return $LOCK_ + } + 13 { +return $MATCH_ + } + 14 { +return $MOVE_ + } + 15 { +return $NEW_ + } + 16 { +return $NEXT_ + } + 17 { +return $NONE_ + } + 18 { +return $PREV_ + } + 19 { +return $REFRESH_ + } + 20 { +return $RESET_ + } + 21 { +return $RGB_ + } + 22 { +return $SHOW_ + } + 23 { +return $IMAGE_ + } + 24 { +return $PHYSICAL_ + } + 25 { +return $AMPLIFIER_ + } + 26 { +return $DETECTOR_ + } + 27 { +return $WCS_ + } + 28 { +return $WCSA_ + } + 29 { +return $WCSB_ + } + 30 { +return $WCSC_ + } + 31 { +return $WCSD_ + } + 32 { +return $WCSE_ + } + 33 { +return $WCSF_ + } + 34 { +return $WCSG_ + } + 35 { +return $WCSH_ + } + 36 { +return $WCSI_ + } + 37 { +return $WCSJ_ + } + 38 { +return $WCSK_ + } + 39 { +return $WCSL_ + } + 40 { +return $WCSM_ + } + 41 { +return $WCSN_ + } + 42 { +return $WCSO_ + } + 43 { +return $WCSP_ + } + 44 { +return $WCSQ_ + } + 45 { +return $WCSR_ + } + 46 { +return $WCSS_ + } + 47 { +return $WCST_ + } + 48 { +return $WCSU_ + } + 49 { +return $WCSV_ + } + 50 { +return $WCSW_ + } + 51 { +return $WCSX_ + } + 52 { +return $WCSY_ + } + 53 { +return $WCSZ_ + } + 54 { +set yylval $yytext; return $INT_ + } + 55 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 56 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 57 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 58 { +set yylval $yytext; return $STRING_ + } + 59 { +# ignore whitespace + } + 60 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/frameparser.tab.tcl b/ds9/parsers/frameparser.tab.tcl new file mode 100644 index 0000000..4f0858a --- /dev/null +++ b/ds9/parsers/frameparser.tab.tcl @@ -0,0 +1,55 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set INT_ 288 +set STRING_ 289 +set 3D_ 290 +set ALL_ 291 +set BACK_ 292 +set CENTER_ 293 +set CLEAR_ 294 +set DELETE_ 295 +set FIRST_ 296 +set FORWARD_ 297 +set FRAMENO_ 298 +set HIDE_ 299 +set LAST_ 300 +set LOCK_ 301 +set MATCH_ 302 +set MOVE_ 303 +set NEW_ 304 +set NEXT_ 305 +set NONE_ 306 +set PREV_ 307 +set REFRESH_ 308 +set RESET_ 309 +set RGB_ 310 +set SHOW_ 311 diff --git a/ds9/parsers/frameparser.tcl b/ds9/parsers/frameparser.tcl new file mode 100644 index 0000000..039670b --- /dev/null +++ b/ds9/parsers/frameparser.tcl @@ -0,0 +1,1583 @@ +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 frame { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc frame::YYABORT {} { + return -code return 1 +} + +proc frame::YYACCEPT {} { + return -code return 0 +} + +proc frame::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc frame::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc frame::yyerror {s} { + puts stderr $s +} + +proc frame::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 frame::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set frame::table { + 21:289 reduce + 10:280,target 56 + 10:279,target 55 + 9:283 shift + 12:310 shift + 9:284 shift + 3:288,target 23 + 9:285 shift + 60:289 reduce + 59:289 reduce + 30:289,target 71 + 29:289,target 51 + 27:0 reduce + 9:286 shift + 75:289,target 45 + 9:287 shift + 10:258,target 34 + 48:0 reduce + 0:296,target 5 + 30:289 reduce + 29:289 reduce + 9:271,target 47 + 70:0 reduce + 69:0 reduce + 64:289,target 82 + 12:320 goto + 68:289 reduce + 87:0,target 44 + 2:0 reduce + 9:306 shift + 80:0,target 69 + 79:0,target 68 + 4:291,target 27 + 72:0,target 76 + 10:277,target 53 + 64:0,target 82 + 56:0,target 24 + 53:289,target 21 + 38:289 reduce + 24:0 reduce + 48:0,target 16 + 9:312 goto + 41:0,target 9 + 9:313 goto + 10:327,target 70 + 77:289 reduce + 45:0 reduce + 33:0,target 1 + 25:0,target 38 + 0:304,target 12 + 0:294,target 3 + 17:0,target 73 + 66:0 reduce + 42:289,target 10 + 4:319,target 28 + 9:268,target 44 + 87:289,target 44 + 47:289 reduce + 87:0 reduce + 86:289 reduce + 4:288,target 26 + 31:289,target 72 + 17:288 shift + 10:275,target 51 + 76:289,target 63 + 21:0 reduce + 17:289 reduce + 17:291 shift + 9:326 goto + 9:287,target 63 + 56:289 reduce + 42:0 reduce + 20:289,target 53 + 19:289,target 33 + 0:302,target 10 + 6:288 shift + 65:289,target 80 + 63:0 reduce + 9:266,target 42 + 26:289 reduce + 84:0 reduce + 65:289 reduce + 54:289,target 22 + 17:0 reduce + 10:273,target 49 + 38:0 reduce + 35:289 reduce + 9:285,target 61 + 43:289,target 11 + 88:289,target 89 + 74:289 reduce + 60:0 reduce + 59:0 reduce + 11:296,target 72 + 0:300,target 8 + 3:0,target 55 + 84:0,target 41 + 76:0,target 63 + 15:322,target 81 + 9:264,target 40 + 81:0 reduce + 68:0,target 83 + 17:324 goto + 61:0,target 29 + 53:0,target 21 + 44:289 reduce + 32:289,target 43 + 77:289,target 62 + 45:0,target 13 + 37:0,target 5 + 15:291,target 80 + 14:0 reduce + 83:289 reduce + 30:0,target 71 + 29:0,target 51 + 10:271,target 47 + 22:0,target 37 + 11:325,target 75 + 35:0 reduce + 14:289 reduce + 14:0,target 48 + 21:289,target 54 + 9:283,target 59 + 66:289,target 81 + 56:0 reduce + 53:289 reduce + 3:288 shift + 77:0 reduce + 3:289 reduce + 9:262,target 38 + 3:291 shift + 55:289,target 23 + 23:289 reduce + 9:312,target 65 + 62:289 reduce + 15:288,target 79 + 10:268,target 44 + 32:0 reduce + 0:316,target 19 + 44:289,target 12 + 1:289,target 50 + 9:281,target 57 + 53:0 reduce + 32:289 reduce + 11:292,target 71 + 74:0 reduce + 71:289 reduce + 6:288,target 29 + 33:289,target 1 + 9:259,target 35 + 9:260,target 36 + 78:289,target 40 + 10:287,target 63 + 16:291,target 83 + 3:318 goto + 41:289 reduce + 28:0 reduce + 22:289,target 37 + 7:0,target 70 + 10:266,target 42 + 80:289 reduce + 79:289 reduce + 67:289,target 36 + 0:314,target 18 + 81:0,target 42 + 17:324,target 87 + 73:0,target 79 + 50:0 reduce + 49:0 reduce + 11:300 shift + 9:278,target 54 + 65:0,target 80 + 7:291,target 31 + 57:0,target 25 + 11:292 shift + 71:0 reduce + 50:289 reduce + 50:0,target 18 + 49:289 reduce + 49:0,target 17 + 11:300,target 74 + 56:289,target 24 + 42:0,target 10 + 34:0,target 2 + 0:288 shift + 9:257,target 33 + 88:289 shift + 26:0,target 59 + 11:296 shift + 10:285,target 61 + 0:300 shift + 3:0 reduce + 18:0,target 0 + 16:288,target 82 + 11:297 shift + 0:301 shift + 20:289 reduce + 19:289 reduce + 0:302 shift + 0:303 shift + 0:293 shift + 45:289,target 13 + 25:0 reduce + 0:304 shift + 0:294 shift + 58:289 reduce + 0:305 shift + 0:295 shift + 2:289,target 52 + 10:264,target 40 + 0:296 shift + 46:0 reduce + 0:307 shift + 0:298 shift + 0:308 shift + 8:289 reduce + 9:276,target 52 + 0:299 shift + 0:309 shift + 7:288,target 30 + 67:0 reduce + 34:289,target 2 + 28:289 reduce + 0:311 shift + 80:289,target 69 + 79:289,target 68 + 17:291,target 86 + 9:326,target 67 + 67:289 reduce + 0:314 goto + 10:283,target 59 + 0:316 goto + 23:289,target 56 + 19:315 goto + 68:289,target 83 + 22:0 reduce + 11:325 goto + 37:289 reduce + 10:262,target 38 + 43:0 reduce + 0:299,target 7 + 0:309,target 16 + 76:289 reduce + 12:290,target 76 + 12:289,target 61 + 9:274,target 50 + 64:0 reduce + 57:289,target 25 + 10:312,target 68 + 85:0 reduce + 46:289 reduce + 17:288,target 85 + 10:281,target 57 + 4:0,target 58 + 85:289 reduce + 85:0,target 74 + 46:289,target 14 + 77:0,target 62 + 18:0 accept + 16:288 shift + 3:289,target 55 + 70:0,target 35 + 69:0,target 84 + 16:289 reduce + 62:0,target 30 + 16:291 shift + 54:0,target 22 + 40:0 reduce + 39:0 reduce + 10:259,target 35 + 10:260,target 36 + 55:289 reduce + 46:0,target 14 + 0:307,target 14 + 38:0,target 6 + 35:289,target 3 + 81:289,target 42 + 61:0 reduce + 31:0,target 72 + 9:272,target 48 + 23:0,target 56 + 5:289 reduce + 15:0,target 67 + 82:0 reduce + 25:289 reduce + 3:318,target 25 + 24:289,target 57 + 70:289,target 35 + 69:289,target 84 + 64:289 reduce + 10:278,target 54 + 15:0 reduce + 36:0 reduce + 34:289 reduce + 13:289,target 49 + 10:257,target 33 + 58:289,target 26 + 0:305,target 13 + 0:295,target 4 + 57:0 reduce + 73:289 reduce + 16:321 goto + 9:269,target 45 + 9:270,target 46 + 78:0 reduce + 47:289,target 15 + 43:289 reduce + 4:289,target 58 + 12:0 reduce + 10:276,target 52 + 82:289 reduce + 33:0 reduce + 36:289,target 4 + 13:289 reduce + 10:257 shift + 82:289,target 65 + 10:258 shift + 54:0 reduce + 0:303,target 11 + 0:293,target 2 + 10:259 shift + 10:260 shift + 52:289 reduce + 10:261 shift + 8:0,target 47 + 9:267,target 43 + 10:262 shift + 89:0,target 34 + 75:0 reduce + 1:0,target 50 + 2:288 shift + 10:263 shift + 82:0,target 65 + 25:289,target 38 + 2:289 reduce + 10:264 shift + 74:0,target 77 + 71:289,target 78 + 2:291 shift + 10:265 shift + 66:0,target 81 + 22:289 reduce + 7:0 reduce + 10:266 shift + 58:0,target 26 + 10:267 shift + 51:0,target 19 + 10:274,target 50 + 10:268 shift + 61:289 reduce + 43:0,target 11 + 10:270 shift + 10:269 shift + 35:0,target 3 + 30:0 reduce + 29:0 reduce + 14:289,target 48 + 10:271 shift + 60:289,target 28 + 59:289,target 27 + 27:0,target 60 + 10:272 shift + 9:286,target 62 + 20:0,target 53 + 19:0,target 32 + 10:273 shift + 51:0 reduce + 12:0,target 61 + 10:274 shift + 31:289 reduce + 11:297,target 73 + 10:275 shift + 0:301,target 9 + 10:276 shift + 72:0 reduce + 10:277 shift + 9:265,target 41 + 70:289 reduce + 69:289 reduce + 48:289,target 16 + 10:278 shift + 10:280 shift + 10:279 shift + 5:289,target 46 + 10:281 shift + 4:0 reduce + 10:282 shift + 2:317 goto + 10:283 shift + 40:289 reduce + 39:289 reduce + 10:284 shift + 10:272,target 48 + 37:289,target 5 + 26:0 reduce + 10:285 shift + 83:289,target 66 + 10:286 shift + 78:289 reduce + 12:310,target 77 + 10:287 shift + 9:284,target 60 + 47:0 reduce + 0:288,target 1 + 68:0 reduce + 26:289,target 59 + 72:289,target 76 + 48:289 reduce + 9:263,target 39 + 89:0 reduce + 1:0 reduce + 87:289 reduce + 9:313,target 66 + 15:289,target 67 + 61:289,target 29 + 23:0 reduce + 10:270,target 46 + 10:269,target 45 + 19:315,target 88 + 57:289 reduce + 10:312 goto + 44:0 reduce + 5:0,target 46 + 9:282,target 58 + 10:313 goto + 86:0,target 75 + 7:288 shift + 78:0,target 40 + 7:289 reduce + 71:0,target 78 + 65:0 reduce + 50:289,target 18 + 49:289,target 17 + 7:291 shift + 63:0,target 31 + 27:289 reduce + 55:0,target 23 + 9:261,target 37 + 86:0 reduce + 47:0,target 15 + 66:289 reduce + 40:0,target 8 + 39:0,target 7 + 32:0,target 43 + 38:289,target 6 + 24:0,target 57 + 84:289,target 41 + 20:0 reduce + 19:0 reduce + 16:0,target 64 + 7:323,target 32 + 10:267,target 43 + 36:289 reduce + 41:0 reduce + 10:327 goto + 9:279,target 55 + 9:280,target 56 + 75:289 reduce + 27:289,target 60 + 73:289,target 79 + 62:0 reduce + 16:321,target 84 + 83:0 reduce + 9:258,target 34 + 45:289 reduce + 10:286,target 62 + 16:289,target 64 + 62:289,target 30 + 84:289 reduce + 16:0 reduce + 7:323 goto + 15:288 shift + 15:289 reduce + 2:291,target 21 + 10:265,target 41 + 37:0 reduce + 15:291 shift + 54:289 reduce + 51:289,target 19 + 9:277,target 53 + 58:0 reduce + 7:289,target 70 + 4:288 shift + 4:289 reduce + 80:0 reduce + 79:0 reduce + 4:291 shift + 24:289 reduce + 40:289,target 8 + 39:289,target 7 + 10:284,target 60 + 85:289,target 74 + 63:289 reduce + 13:0 reduce + 2:0,target 52 + 9:306,target 64 + 83:0,target 66 + 75:0,target 45 + 34:0 reduce + 2:288,target 20 + 9:257 shift + 10:263,target 39 + 67:0,target 36 + 28:289,target 39 + 0:311,target 17 + 9:258 shift + 74:289,target 77 + 60:0,target 28 + 59:0,target 27 + 33:289 reduce + 9:259 shift + 9:260 shift + 55:0 reduce + 52:0,target 20 + 9:261 shift + 9:275,target 51 + 44:0,target 12 + 9:262 shift + 10:313,target 69 + 72:289 reduce + 36:0,target 4 + 9:263 shift + 76:0 reduce + 28:0,target 39 + 15:322 goto + 9:264 shift + 21:0,target 54 + 17:289,target 73 + 9:265 shift + 63:289,target 31 + 13:0,target 49 + 9:266 shift + 10:282,target 58 + 2:317,target 22 + 8:0 reduce + 9:267 shift + 42:289 reduce + 4:319 goto + 9:268 shift + 3:291,target 24 + 9:269 shift + 9:270 shift + 12:320,target 78 + 9:271 shift + 81:289 reduce + 31:0 reduce + 9:272 shift + 52:289,target 20 + 9:273 shift + 10:261,target 37 + 12:290 shift + 12:289 reduce + 0:298,target 6 + 0:308,target 15 + 8:289,target 47 + 9:274 shift + 52:0 reduce + 9:275 shift + 9:273,target 49 + 9:276 shift + 51:289 reduce + 9:277 shift + 73:0 reduce + 9:278 shift + 41:289,target 9 + 9:279 shift + 9:280 shift + 86:289,target 75 + 1:289 reduce + 9:281 shift + 5:0 reduce + 9:282 shift +} + +array set frame::rules { + 9,l 313 + 11,l 313 + 32,l 314 + 53,l 317 + 74,l 324 + 6,l 313 + 28,l 313 + 50,l 316 + 49,l 316 + 71,l 323 + 3,l 312 + 25,l 313 + 46,l 316 + 67,l 322 + 0,l 328 + 22,l 313 + 43,l 316 + 64,l 321 + 18,l 313 + 40,l 316 + 39,l 316 + 61,l 320 + 82,l 326 + 15,l 313 + 36,l 316 + 57,l 318 + 78,l 325 + 12,l 313 + 33,l 315 + 54,l 317 + 75,l 324 + 7,l 313 + 29,l 313 + 30,l 313 + 51,l 316 + 72,l 323 + 4,l 312 + 26,l 313 + 47,l 316 + 68,l 322 + 1,l 312 + 23,l 313 + 44,l 316 + 65,l 321 + 19,l 313 + 20,l 313 + 41,l 316 + 62,l 320 + 83,l 327 + 16,l 313 + 37,l 316 + 58,l 319 + 80,l 326 + 79,l 325 + 13,l 313 + 34,l 314 + 55,l 318 + 76,l 325 + 8,l 313 + 10,l 313 + 31,l 313 + 52,l 317 + 73,l 324 + 5,l 313 + 27,l 313 + 48,l 316 + 70,l 323 + 69,l 322 + 2,l 312 + 24,l 313 + 45,l 316 + 66,l 321 + 21,l 313 + 42,l 316 + 63,l 320 + 84,l 327 + 17,l 313 + 38,l 316 + 60,l 319 + 59,l 319 + 81,l 326 + 14,l 313 + 35,l 316 + 56,l 318 + 77,l 325 +} + +array set frame::rules { + 63,dc 1 + 12,dc 1 + 77,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 2 + 55,dc 0 + 70,dc 0 + 69,dc 1 + 18,dc 1 + 84,dc 1 + 33,dc 0 + 9,dc 1 + 47,dc 1 + 62,dc 1 + 11,dc 1 + 76,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 2 + 39,dc 2 + 54,dc 1 + 68,dc 1 + 17,dc 1 + 83,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 61,dc 0 + 10,dc 1 + 75,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 2 + 53,dc 1 + 67,dc 0 + 16,dc 1 + 82,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 60,dc 1 + 59,dc 1 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 2 + 52,dc 0 + 66,dc 1 + 15,dc 1 + 81,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 0 + 73,dc 0 + 22,dc 1 + 36,dc 2 + 51,dc 2 + 65,dc 1 + 14,dc 1 + 80,dc 1 + 79,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 2 + 57,dc 1 + 72,dc 1 + 21,dc 1 + 35,dc 2 + 50,dc 1 + 49,dc 1 + 64,dc 0 + 13,dc 1 + 78,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 2 + 56,dc 1 + 71,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 3 + 48,dc 1 +} + +array set frame::rules { + 41,line 149 + 7,line 112 + 37,line 145 + 4,line 108 + 34,line 140 + 1,line 105 + 31,line 136 + 27,line 132 + 83,line 213 + 24,line 129 + 80,line 208 + 79,line 205 + 21,line 126 + 76,line 202 + 17,line 122 + 73,line 197 + 14,line 119 + 70,line 192 + 69,line 189 + 11,line 116 + 66,line 184 + 63,line 179 + 60,line 174 + 59,line 173 + 56,line 168 + 53,line 163 + 50,line 158 + 49,line 157 + 46,line 154 + 33,e 1 + 43,line 151 + 9,line 114 + 40,line 148 + 39,line 147 + 6,line 111 + 36,line 144 + 3,line 107 + 33,line 139 + 29,line 134 + 30,line 135 + 26,line 131 + 82,line 210 + 23,line 128 + 78,line 204 + 19,line 124 + 20,line 125 + 75,line 199 + 16,line 121 + 72,line 194 + 13,line 118 + 68,line 188 + 10,line 115 + 65,line 183 + 62,line 178 + 58,line 172 + 55,line 167 + 52,line 162 + 48,line 156 + 45,line 153 + 42,line 150 + 8,line 113 + 38,line 146 + 5,line 110 + 35,line 143 + 2,line 106 + 32,line 139 + 28,line 133 + 84,line 214 + 25,line 130 + 81,line 209 + 22,line 127 + 77,line 203 + 18,line 123 + 74,line 198 + 15,line 120 + 71,line 193 + 12,line 117 + 67,line 187 + 64,line 182 + 61,line 177 + 57,line 169 + 54,line 164 + 51,line 159 + 47,line 155 + 44,line 152 +} + +array set frame::lr1_table { + 66,trans {} + 35 {{3 {0 289} 1}} + 85,trans {} + 14,trans {} + 36 {{4 {0 289} 1}} + 33,trans {} + 37 {{5 {0 289} 1}} + 52,trans {} + 38 {{6 {0 289} 1}} + 71,trans {} + 40 {{8 {0 289} 1}} + 39 {{7 {0 289} 1}} + 89,trans {} + 18,trans {} + 41 {{9 {0 289} 1}} + 1,trans {} + 37,trans {} + 42 {{10 {0 289} 1}} + 56,trans {} + 43 {{11 {0 289} 1}} + 75,trans {} + 44 {{12 {0 289} 1}} + 23,trans {} + 45 {{13 {0 289} 1}} + 5,trans {} + 42,trans {} + 46 {{14 {0 289} 1}} + 61,trans {} + 47 {{15 {0 289} 1}} + 80,trans {} + 79,trans {} + 48 {{16 {0 289} 1}} + 27,trans {} + 9,trans {{257 33} {258 34} {259 35} {260 36} {261 37} {262 38} {263 39} {264 40} {265 41} {266 42} {267 43} {268 44} {269 45} {270 46} {271 47} {272 48} {273 49} {274 50} {275 51} {276 52} {277 53} {278 54} {279 55} {280 56} {281 57} {282 58} {283 59} {284 60} {285 61} {286 62} {287 63} {306 64} {312 65} {313 66} {326 67}} + 50 {{18 {0 289} 1}} + 49 {{17 {0 289} 1}} + 46,trans {} + 51 {{19 {0 289} 1}} + 65,trans {} + 52 {{20 {0 289} 1}} + 84,trans {} + 13,trans {} + 53 {{21 {0 289} 1}} + 32,trans {} + 54 {{22 {0 289} 1}} + 51,trans {} + 55 {{23 {0 289} 1}} + 70,trans {} + 69,trans {} + 56 {{24 {0 289} 1}} + 88,trans {{289 89}} + 17,trans {{288 85} {291 86} {324 87}} + 57 {{25 {0 289} 1}} + 0,trans {{288 1} {293 2} {294 3} {295 4} {296 5} {298 6} {299 7} {300 8} {301 9} {302 10} {303 11} {304 12} {305 13} {307 14} {308 15} {309 16} {311 17} {314 18} {316 19}} + 36,trans {} + 58 {{26 {0 289} 1}} + 55,trans {} + 60 {{28 {0 289} 1}} + 59 {{27 {0 289} 1}} + 74,trans {} + 61 {{29 {0 289} 1}} + 22,trans {} + 62 {{30 {0 289} 1}} + 4,trans {{288 26} {291 27} {319 28}} + 41,trans {} + 63 {{31 {0 289} 1}} + 60,trans {} + 59,trans {} + 64 {{82 {0 289} 1}} + 78,trans {} + 65 {{80 {0 289} 1}} + 26,trans {} + 66 {{81 {0 289} 1}} + 8,trans {} + 45,trans {} + 67 {{36 {0 289} 2}} + 64,trans {} + 68 {{83 {0 289} 1}} + 83,trans {} + 12,trans {{290 76} {310 77} {320 78}} + 70 {{35 {0 289} 2}} + 69 {{84 {0 289} 1}} + 31,trans {} + 71 {{78 {0 289} 1}} + 50,trans {} + 49,trans {} + 72 {{76 {0 289} 1}} + 68,trans {} + 73 {{79 {0 289} 1}} + 87,trans {} + 16,trans {{288 82} {291 83} {321 84}} + 74 {{77 {0 289} 1}} + 35,trans {} + 75 {{45 {0 289} 2}} + 54,trans {} + 76 {{63 {0 289} 1}} + 73,trans {} + 77 {{62 {0 289} 1}} + 21,trans {} + 78 {{40 {0 289} 2}} + 3,trans {{288 23} {291 24} {318 25}} + 40,trans {} + 39,trans {} + 80 {{69 {0 289} 1}} + 79 {{68 {0 289} 1}} + 58,trans {} + 81 {{42 {0 289} 2}} + 10 {{35 {0 289} 1} {83 {0 289} 0} {84 {0 289} 0} {1 {0 289} 0} {2 {0 289} 0} {3 {0 289} 0} {4 {0 289} 0} {5 {0 289} 0} {6 {0 289} 0} {7 {0 289} 0} {8 {0 289} 0} {9 {0 289} 0} {10 {0 289} 0} {11 {0 289} 0} {12 {0 289} 0} {13 {0 289} 0} {14 {0 289} 0} {15 {0 289} 0} {16 {0 289} 0} {17 {0 289} 0} {18 {0 289} 0} {19 {0 289} 0} {20 {0 289} 0} {21 {0 289} 0} {22 {0 289} 0} {23 {0 289} 0} {24 {0 289} 0} {25 {0 289} 0} {26 {0 289} 0} {27 {0 289} 0} {28 {0 289} 0} {29 {0 289} 0} {30 {0 289} 0} {31 {0 289} 0}} + 77,trans {} + 82 {{65 {0 289} 1}} + 11 {{45 {0 289} 1} {76 {0 289} 0} {77 {0 289} 0} {78 {0 289} 0} {79 {0 289} 0}} + 25,trans {} + 83 {{66 {0 289} 1}} + 12 {{40 {0 289} 1} {61 {0 289} 0} {62 {0 289} 0} {63 {0 289} 0}} + 7,trans {{288 30} {291 31} {323 32}} + 44,trans {} + 84 {{41 {0 289} 2}} + 13 {{49 {0 289} 1}} + 63,trans {} + 85 {{74 {0 289} 1}} + 14 {{48 {0 289} 1}} + 82,trans {} + 86 {{75 {0 289} 1}} + 11,trans {{292 71} {296 72} {297 73} {300 74} {325 75}} + 15 {{42 {0 289} 1} {67 {0 289} 0} {68 {0 289} 0} {69 {0 289} 0}} + 30,trans {} + 29,trans {} + 87 {{44 {0 289} 2}} + 16 {{41 {0 289} 1} {64 {0 289} 0} {65 {0 289} 0} {66 {0 289} 0}} + 48,trans {} + 88 {{34 0 2}} + 0 {{0 0 0} {32 0 0} {34 0 0} {35 {0 289} 0} {36 {0 289} 0} {37 {0 289} 0} {38 {0 289} 0} {39 {0 289} 0} {40 {0 289} 0} {41 {0 289} 0} {42 {0 289} 0} {43 {0 289} 0} {44 {0 289} 0} {45 {0 289} 0} {46 {0 289} 0} {47 {0 289} 0} {48 {0 289} 0} {49 {0 289} 0} {50 {0 289} 0} {51 {0 289} 0}} + 17 {{44 {0 289} 1} {73 {0 289} 0} {74 {0 289} 0} {75 {0 289} 0}} + 89 {{34 0 3}} + 67,trans {} + 1 {{50 {0 289} 1}} + 18 {{0 0 1}} + 86,trans {} + 15,trans {{288 79} {291 80} {322 81}} + 2 {{37 {0 289} 1} {52 {0 289} 0} {53 {0 289} 0} {54 {0 289} 0}} + 19 {{32 0 1} {34 0 1} {33 289 0}} + 20 {{53 {0 289} 1}} + 34,trans {} + 3 {{38 {0 289} 1} {55 {0 289} 0} {56 {0 289} 0} {57 {0 289} 0}} + 21 {{54 {0 289} 1}} + 53,trans {} + 4 {{39 {0 289} 1} {58 {0 289} 0} {59 {0 289} 0} {60 {0 289} 0}} + 22 {{37 {0 289} 2}} + 72,trans {} + 5 {{46 {0 289} 1}} + 23 {{56 {0 289} 1}} + 20,trans {} + 19,trans {{315 88}} + 6 {{51 {0 289} 1}} + 2,trans {{288 20} {291 21} {317 22}} + 24 {{57 {0 289} 1}} + 38,trans {} + 7 {{43 {0 289} 1} {70 {0 289} 0} {71 {0 289} 0} {72 {0 289} 0}} + 25 {{38 {0 289} 2}} + 57,trans {} + 8 {{47 {0 289} 1}} + 26 {{59 {0 289} 1}} + 76,trans {} + 9 {{36 {0 289} 1} {80 {0 289} 0} {81 {0 289} 0} {82 {0 289} 0} {1 {0 289} 0} {2 {0 289} 0} {3 {0 289} 0} {4 {0 289} 0} {5 {0 289} 0} {6 {0 289} 0} {7 {0 289} 0} {8 {0 289} 0} {9 {0 289} 0} {10 {0 289} 0} {11 {0 289} 0} {12 {0 289} 0} {13 {0 289} 0} {14 {0 289} 0} {15 {0 289} 0} {16 {0 289} 0} {17 {0 289} 0} {18 {0 289} 0} {19 {0 289} 0} {20 {0 289} 0} {21 {0 289} 0} {22 {0 289} 0} {23 {0 289} 0} {24 {0 289} 0} {25 {0 289} 0} {26 {0 289} 0} {27 {0 289} 0} {28 {0 289} 0} {29 {0 289} 0} {30 {0 289} 0} {31 {0 289} 0}} + 27 {{60 {0 289} 1}} + 24,trans {} + 28 {{39 {0 289} 2}} + 6,trans {{288 29}} + 43,trans {} + 29 {{51 {0 289} 2}} + 30 {{71 {0 289} 1}} + 62,trans {} + 31 {{72 {0 289} 1}} + 81,trans {} + 10,trans {{257 33} {258 34} {259 35} {260 36} {261 37} {262 38} {263 39} {264 40} {265 41} {266 42} {267 43} {268 44} {269 45} {270 46} {271 47} {272 48} {273 49} {274 50} {275 51} {276 52} {277 53} {278 54} {279 55} {280 56} {281 57} {282 58} {283 59} {284 60} {285 61} {286 62} {287 63} {312 68} {313 69} {327 70}} + 32 {{43 {0 289} 2}} + 28,trans {} + 33 {{1 {0 289} 1}} + 47,trans {} + 34 {{2 {0 289} 1}} +} + +array set frame::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 48 + 302,line 58 + 288 INT_ + 317,t 1 + 265,title WCSD + 289 STRING_ + 290 3D_ + 300 LAST_ + 284,title WCSW + 291 ALL_ + 301 LOCK_ + 313,title {} + 292 BACK_ + 302 MATCH_ + 288,line 40 + 293 CENTER_ + 303 MOVE_ + 294 CLEAR_ + 304 NEW_ + 305 NEXT_ + 295 DELETE_ + 306 NONE_ + 296 FIRST_ + 307 PREV_ + 262,t 0 + 297 FORWARD_ + 308 REFRESH_ + 285,line 36 + 298 FRAMENO_ + 310 RGB_ + 309 RESET_ + 299 HIDE_ + 311 SHOW_ + 283,t 0 + 312 coordsys + 313 wcssys + 314,t 1 + 314 command + 282,line 33 + 315 @PSEUDO1 + 316 frame + 264,title WCSC + 317 center + 283,title WCSV + 318 clear + 312,title {} + 320 new + 319 delete + 278,line 29 + 321 reset + error,line 103 + 322 refresh + 258,t 0 + 323 hide + 324 show + 325 move + 275,line 26 + 279,t 0 + 280,t 0 + 326 lock + 327 match + 328 start' + 311,t 0 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title SHOW + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 328,t 1 + 262,line 13 + 327,line 212 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + error,t 0 + 310,title RGB + 309,title RESET + 299,title HIDE + 328,title {} + 258,line 8 + 273,t 0 + 324,line 196 + 294,t 0 + 304,t 0 + 325,t 1 + 321,line 181 + 317,line 161 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title REFRESH + 269,t 0 + 270,t 0 + 298,title FRAMENO + 327,title {} + 314,line 138 + 291,t 0 + 301,t 0 + 322,t 1 + 311,line 67 + 307,line 63 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 53 + 278,title WCSQ + 307,title PREV + 297,title FORWARD + 326,title {} + 287,t 0 + 294,line 50 + 304,line 60 + 318,t 1 + error,title {} + 291,line 47 + 301,line 57 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title NONE + 296,title FIRST + 325,title {} + 315,t 1 + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title NEXT + 295,title DELETE + 324,title {} + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 0 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title CLEAR + 304,title NEW + 323,title {} + 264,line 15 + 261,line 12 + 274,t 0 + 326,line 207 + 305,t 0 + 295,t 0 + 257,line 7 + 326,t 1 + 274,title WCSM + 323,line 191 + 293,title CENTER + 303,title MOVE + 322,title {} + 320,line 176 + 319,line 171 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 142 + 323,t 1 + 273,title WCSL + 313,line 109 + 292,title BACK + 302,title MATCH + 321,title {} + 267,t 0 + 310,line 66 + 309,line 65 + 299,line 55 + 288,t 0 + 320,t 1 + 319,t 1 + 306,line 62 + 296,line 52 + 272,title WCSK + 291,title ALL + 293,line 49 + 301,title LOCK + 303,line 59 + 320,title {} + 319,title {} + 264,t 0 + 285,t 0 + 289,line 42 + 290,line 46 + 300,line 56 + 316,t 1 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title string + 290,title 3D + 300,title LAST + 318,title {} + 282,t 0 + 279,line 30 + 280,line 31 + 313,t 1 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title integer + 317,title {} + 278,t 0 + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 316,title {} + 328,line 215 + 306,t 0 + 296,t 0 + 327,t 1 + 260,line 10 + 259,line 9 + 325,line 201 + 322,line 186 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 315,title {} + 258 PHYSICAL_ + 318,line 166 + 260 DETECTOR_ + 259 AMPLIFIER_ + 324,t 1 + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 315,line 139 + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 104 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 321,t 1 + 314,title {} + 275 WCSN_ + 308,line 64 + 276 WCSO_ + 298,line 54 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 61 + 282 WCSU_ + 295,line 51 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc frame::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 33 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 35 { MatchFrameCurrent $2 } + 36 { ProcessCmdSet panzoom lock $2; LockFrameCurrent } + 46 { FirstFrame } + 47 { LastFrame } + 48 { PrevFrame } + 49 { NextFrame } + 50 { CreateGotoFrame $1 base } + 51 { CreateGotoFrame $2 base } + 52 { CenterCurrentFrame } + 53 { CenterFrame "Frame$1" } + 54 { CenterAllFrame } + 55 { ClearCurrentFrame } + 56 { ClearFrame "Frame$1" } + 57 { ClearAllFrame } + 58 { DeleteCurrentFrame } + 59 { DeleteSingleFrame "Frame$1" } + 60 { DeleteAllFrames } + 61 { CreateFrame } + 62 { CreateRGBFrame } + 63 { Create3DFrame } + 64 { ResetCurrentFrame } + 65 { ResetFrame "Frame$1" } + 66 { ResetAllFrame } + 67 { UpdateCurrentFrame } + 68 { UpdateFrame "Frame$1" } + 69 { UpdateAllFrame } + 70 { global current; ProcessCmdSet active $current(frame) 0 UpdateActiveFrames } + 71 { ProcessCmdSet active "Frame$1" 0 UpdateActiveFrames } + 72 { ActiveFrameNone } + 74 { ProcessCmdSet active "Frame$1" 1 UpdateActiveFrames } + 75 { ActiveFrameAll } + 76 { FirstFrame } + 77 { LastFrame } + 78 { PrevFrame } + 79 { NextFrame } + 80 { set _ $1 } + 81 { set _ $1 } + 82 { set _ none } + 83 { set _ $1 } + 84 { set _ $1 } + } + 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 frame::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/framesendlex.tcl b/ds9/parsers/framesendlex.tcl new file mode 100644 index 0000000..be87bca --- /dev/null +++ b/ds9/parsers/framesendlex.tcl @@ -0,0 +1,872 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval framesend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc framesend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc framesend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc framesend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc framesend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc framesend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc framesend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc framesend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc framesend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc framesend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set ACTIVE_ 288 +set ALL_ 289 +set AUX_ 290 +set BIN_ 291 +set CELESTIAL_ 292 +set CONTOUR_ 293 +set CUBE_ 294 +set DATAMIN_ 295 +set DATASEC_ 296 +set EQUATORIAL_ 297 +set FITS_ 298 +set FRAMENO_ 299 +set GRID_ 300 +set HAS_ 301 +set HIGHLITE_ 302 +set IIS_ 303 +set IRAFMIN_ 304 +set LINEAR_ 305 +set LOCK_ 306 +set MARKER_ 307 +set MOSAIC_ 308 +set PASTE_ 309 +set SELECT_ 310 +set SMOOTH_ 311 +set SYSTEM_ 312 +set UNDO_ 313 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: active + if {[regexp -start $index_ -indices -line -nocase -- {\A(active)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: all + if {[regexp -start $index_ -indices -line -nocase -- {\A(all)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: aux + if {[regexp -start $index_ -indices -line -nocase -- {\A(aux)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: bin + if {[regexp -start $index_ -indices -line -nocase -- {\A(bin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: celestial + if {[regexp -start $index_ -indices -line -nocase -- {\A(celestial)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: contour + if {[regexp -start $index_ -indices -line -nocase -- {\A(contour)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: cube + if {[regexp -start $index_ -indices -line -nocase -- {\A(cube)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: datamin + if {[regexp -start $index_ -indices -line -nocase -- {\A(datamin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: datasec + if {[regexp -start $index_ -indices -line -nocase -- {\A(datasec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: equatorial + if {[regexp -start $index_ -indices -line -nocase -- {\A(equatorial)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: fits + if {[regexp -start $index_ -indices -line -nocase -- {\A(fits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: frameno + if {[regexp -start $index_ -indices -line -nocase -- {\A(frameno)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: has + if {[regexp -start $index_ -indices -line -nocase -- {\A(has)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: highlite + if {[regexp -start $index_ -indices -line -nocase -- {\A(highlite)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: iis + if {[regexp -start $index_ -indices -line -nocase -- {\A(iis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: irafmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(irafmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: linear + if {[regexp -start $index_ -indices -line -nocase -- {\A(linear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: marker + if {[regexp -start $index_ -indices -line -nocase -- {\A(marker)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: mosaic + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: paste + if {[regexp -start $index_ -indices -line -nocase -- {\A(paste)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: select + if {[regexp -start $index_ -indices -line -nocase -- {\A(select)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: undo + if {[regexp -start $index_ -indices -line -nocase -- {\A(undo)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ACTIVE_ + } + 1 { +return $ALL_ + } + 2 { +return $AUX_ + } + 3 { +return $BIN_ + } + 4 { +return $CELESTIAL_ + } + 5 { +return $CONTOUR_ + } + 6 { +return $CUBE_ + } + 7 { +return $DATAMIN_ + } + 8 { +return $DATASEC_ + } + 9 { +return $EQUATORIAL_ + } + 10 { +return $FITS_ + } + 11 { +return $FRAMENO_ + } + 12 { +return $GRID_ + } + 13 { +return $HAS_ + } + 14 { +return $HIGHLITE_ + } + 15 { +return $IIS_ + } + 16 { +return $IRAFMIN_ + } + 17 { +return $LINEAR_ + } + 18 { +return $LOCK_ + } + 19 { +return $MARKER_ + } + 20 { +return $MOSAIC_ + } + 21 { +return $PASTE_ + } + 22 { +return $SELECT_ + } + 23 { +return $SMOOTH_ + } + 24 { +return $SYSTEM_ + } + 25 { +return $UNDO_ + } + 26 { +return $IMAGE_ + } + 27 { +return $PHYSICAL_ + } + 28 { +return $AMPLIFIER_ + } + 29 { +return $DETECTOR_ + } + 30 { +return $WCS_ + } + 31 { +return $WCSA_ + } + 32 { +return $WCSB_ + } + 33 { +return $WCSC_ + } + 34 { +return $WCSD_ + } + 35 { +return $WCSE_ + } + 36 { +return $WCSF_ + } + 37 { +return $WCSG_ + } + 38 { +return $WCSH_ + } + 39 { +return $WCSI_ + } + 40 { +return $WCSJ_ + } + 41 { +return $WCSK_ + } + 42 { +return $WCSL_ + } + 43 { +return $WCSM_ + } + 44 { +return $WCSN_ + } + 45 { +return $WCSO_ + } + 46 { +return $WCSP_ + } + 47 { +return $WCSQ_ + } + 48 { +return $WCSR_ + } + 49 { +return $WCSS_ + } + 50 { +return $WCST_ + } + 51 { +return $WCSU_ + } + 52 { +return $WCSV_ + } + 53 { +return $WCSW_ + } + 54 { +return $WCSX_ + } + 55 { +return $WCSY_ + } + 56 { +return $WCSZ_ + } + 57 { +# ignore whitespace + } + 58 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/framesendparser.tab.tcl b/ds9/parsers/framesendparser.tab.tcl new file mode 100644 index 0000000..e774ea8 --- /dev/null +++ b/ds9/parsers/framesendparser.tab.tcl @@ -0,0 +1,57 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set ACTIVE_ 288 +set ALL_ 289 +set AUX_ 290 +set BIN_ 291 +set CELESTIAL_ 292 +set CONTOUR_ 293 +set CUBE_ 294 +set DATAMIN_ 295 +set DATASEC_ 296 +set EQUATORIAL_ 297 +set FITS_ 298 +set FRAMENO_ 299 +set GRID_ 300 +set HAS_ 301 +set HIGHLITE_ 302 +set IIS_ 303 +set IRAFMIN_ 304 +set LINEAR_ 305 +set LOCK_ 306 +set MARKER_ 307 +set MOSAIC_ 308 +set PASTE_ 309 +set SELECT_ 310 +set SMOOTH_ 311 +set SYSTEM_ 312 +set UNDO_ 313 diff --git a/ds9/parsers/framesendparser.tcl b/ds9/parsers/framesendparser.tcl new file mode 100644 index 0000000..8cbf008 --- /dev/null +++ b/ds9/parsers/framesendparser.tcl @@ -0,0 +1,1533 @@ +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 framesend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc framesend::YYABORT {} { + return -code return 1 +} + +proc framesend::YYACCEPT {} { + return -code return 0 +} + +proc framesend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc framesend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc framesend::yyerror {s} { + puts stderr $s +} + +proc framesend::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 framesend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set framesend::table { + 47:263 shift + 55:280,target 68 + 55:279,target 68 + 47:264 shift + 47:265 shift + 11:263,target 13 + 47:272,target 22 + 47:266 shift + 27:0 reduce + 54:275,target 69 + 47:267 shift + 4:272,target 22 + 47:268 shift + 48:0 reduce + 47:270 shift + 47:269 shift + 0:306,target 5 + 53:271,target 67 + 47:271 shift + 47:322,target 72 + 47:272 shift + 70:0 reduce + 69:0 reduce + 47:273 shift + 47:274 shift + 58:270,target 20 + 58:269,target 19 + 47:275 shift + 6:0,target 0 + 11:282,target 32 + 47:276 shift + 2:0 reduce + 47:277 shift + 45:313,target 68 + 72:0,target 44 + 47:278 shift + 64:0,target 42 + 55:277,target 68 + 47:280 shift + 47:279 shift + 56:0,target 66 + 47:281 shift + 38:290 shift + 24:0 reduce + 11:261,target 52 + 48:0,target 38 + 47:282 shift + 47:270,target 20 + 47:269,target 19 + 54:273,target 69 + 47:283 shift + 41:0,target 54 + 4:269,target 19 + 4:270,target 20 + 47:284 shift + 33:0,target 27 + 47:285 shift + 25:0,target 19 + 53:268,target 67 + 47:286 shift + 17:0,target 11 + 66:0 reduce + 47:287 shift + 10:0,target 4 + 58:267,target 17 + 11:279,target 29 + 11:280,target 30 + 55:275,target 68 + 21:0 reduce + 53:287,target 67 + 47:267,target 17 + 54:271,target 69 + 42:0 reduce + 4:267,target 17 + 58:286,target 36 + 38:319 goto + 63:0 reduce + 53:266,target 67 + 53:261 reduce + 53:262 reduce + 4:317,target 50 + 53:263 reduce + 47:314 goto + 53:264 reduce + 47:315 goto + 58:265,target 15 + 53:265 reduce + 11:277,target 27 + 53:266 reduce + 47:286,target 36 + 53:267 reduce + 4:286,target 36 + 53:268 reduce + 17:0 reduce + 58:315,target 73 + 55:273,target 68 + 53:270 reduce + 53:269 reduce + 53:285,target 67 + 53:271 reduce + 47:322 goto + 53:272 reduce + 47:265,target 15 + 38:0 reduce + 54:268,target 69 + 53:273 reduce + 4:265,target 15 + 53:274 reduce + 60:0 reduce + 59:0 reduce + 58:284,target 34 + 53:275 reduce + 3:0,target 33 + 0:289,target 2 + 53:276 reduce + 53:264,target 67 + 47:315,target 71 + 53:277 reduce + 4:315,target 49 + 68:0,target 61 + 53:278 reduce + 61:0,target 55 + 53:280 reduce + 53:279 reduce + 58:263,target 13 + 53:281 reduce + 53:0,target 67 + 11:275,target 25 + 53:282 reduce + 47:284,target 34 + 54:287,target 69 + 53:283 reduce + 37:0,target 31 + 14:0 reduce + 4:284,target 34 + 53:284 reduce + 30:0,target 24 + 29:0,target 23 + 55:271,target 68 + 53:285 reduce + 22:0,target 16 + 53:286 reduce + 53:283,target 67 + 35:0 reduce + 14:0,target 8 + 53:287 reduce + 47:263,target 13 + 54:266,target 69 + 4:263,target 13 + 56:0 reduce + 11:261 shift + 58:282,target 32 + 11:262 shift + 53:262,target 67 + 11:263 shift + 11:264 shift + 11:265 shift + 11:266 shift + 58:261,target 52 + 9:0 reduce + 11:267 shift + 11:273,target 23 + 47:282,target 32 + 11:0 reduce + 11:268 shift + 54:285,target 69 + 4:282,target 32 + 11:269 shift + 11:270 shift + 11:271 shift + 55:268,target 68 + 32:0 reduce + 0:316,target 6 + 11:323,target 57 + 11:272 shift + 58:261 shift + 53:281,target 67 + 11:273 shift + 58:262 shift + 47:261,target 52 + 11:274 shift + 58:263 shift + 54:264,target 69 + 53:0 reduce + 4:261,target 11 + 11:275 shift + 58:264 shift + 11:276 shift + 58:280,target 30 + 58:279,target 29 + 58:265 shift + 11:292,target 53 + 11:277 shift + 58:266 shift + 38:319,target 60 + 11:278 shift + 58:267 shift + 4:311,target 46 + 11:279 shift + 11:280 shift + 58:268 shift + 11:281 shift + 58:270 shift + 58:269 shift + 55:287,target 68 + 6:0 accept + 11:282 shift + 58:271 shift + 11:271,target 21 + 11:283 shift + 58:272 shift + 47:280,target 30 + 47:279,target 29 + 11:284 shift + 58:273 shift + 54:283,target 69 + 45:302,target 65 + 41:291 shift + 4:279,target 29 + 4:280,target 30 + 11:285 shift + 58:274 shift + 28:0 reduce + 7:0,target 1 + 11:286 shift + 58:275 shift + 55:266,target 68 + 0:0,target 32 + 11:287 shift + 58:276 shift + 53:278,target 67 + 41:294 shift + 73:0,target 65 + 58:277 shift + 50:0 reduce + 49:0 reduce + 47:258,target 8 + 65:0,target 58 + 58:278 shift + 54:262,target 69 + 4:258,target 8 + 58:280 shift + 58:279 shift + 57:0,target 45 + 11:292 shift + 71:0 reduce + 58:281 shift + 58:277,target 27 + 50:0,target 37 + 49:0,target 39 + 41:308 shift + 58:282 shift + 42:0,target 50 + 58:283 shift + 45:321,target 69 + 34:0,target 28 + 4:298,target 41 + 0:288 shift + 11:305 shift + 58:284 shift + 26:0,target 20 + 3:0 reduce + 0:289 shift + 58:285 shift + 55:285,target 68 + 18:0,target 12 + 0:301 shift + 11:297 shift + 58:286 shift + 11:0,target 5 + 11:268,target 18 + 58:287 shift + 47:277,target 27 + 54:281,target 69 + 25:0 reduce + 4:277,target 27 + 55:264,target 68 + 0:306 shift + 53:276,target 67 + 46:0 reduce + 41:320 goto + 55:261 reduce + 11:315 goto + 55:262 reduce + 0:299 shift + 67:0 reduce + 55:263 reduce + 58:275,target 25 + 55:264 reduce + 11:287,target 37 + 55:265 reduce + 55:266 reduce + 0:0 reduce + 4:296,target 40 + 55:267 reduce + 55:283,target 68 + 55:268 reduce + 0:316 goto + 11:323 goto + 55:270 reduce + 55:269 reduce + 11:324 goto + 11:266,target 16 + 55:271 reduce + 47:275,target 25 + 22:0 reduce + 55:272 reduce + 54:278,target 69 + 4:275,target 25 + 58:315 goto + 55:273 reduce + 55:274 reduce + 55:262,target 68 + 43:0 reduce + 0:299,target 3 + 55:275 reduce + 53:274,target 67 + 55:276 reduce + 64:0 reduce + 55:277 reduce + 55:278 reduce + 58:273,target 23 + 55:280 reduce + 55:279 reduce + 41:291,target 61 + 11:285,target 35 + 55:281 reduce + 55:282 reduce + 4:304,target 44 + 55:283 reduce + 55:284 reduce + 55:281,target 68 + 55:285 reduce + 18:0 reduce + 11:264,target 14 + 70:0,target 62 + 69:0,target 43 + 55:286 reduce + 47:273,target 23 + 62:0,target 56 + 55:287 reduce + 54:276,target 69 + 4:273,target 23 + 54:0,target 69 + 40:0 reduce + 39:0 reduce + 46:0,target 51 + 41:320,target 64 + 53:272,target 67 + 38:0,target 52 + 61:0 reduce + 31:0,target 25 + 23:0,target 17 + 15:0,target 9 + 58:271,target 21 + 11:283,target 33 + 55:278,target 68 + 15:0 reduce + 11:262,target 12 + 47:271,target 21 + 54:274,target 69 + 36:0 reduce + 4:271,target 21 + 57:0 reduce + 53:270,target 67 + 53:269,target 67 + 58:268,target 18 + 11:281,target 31 + 4:300,target 42 + 12:0 reduce + 55:276,target 68 + 47:268,target 18 + 33:0 reduce + 54:272,target 69 + 4:268,target 18 + 58:287,target 37 + 54:0 reduce + 53:267,target 67 + 4:318,target 51 + 8:0,target 2 + 1:0,target 35 + 58:266,target 16 + 11:278,target 28 + 66:0,target 59 + 47:287,target 37 + 7:0 reduce + 58:0,target 64 + 45:310,target 67 + 45:309,target 66 + 4:287,target 37 + 51:0,target 40 + 55:274,target 68 + 43:0,target 46 + 53:286,target 67 + 35:0,target 29 + 30:0 reduce + 29:0 reduce + 47:266,target 16 + 27:0,target 21 + 54:270,target 69 + 54:269,target 69 + 20:0,target 14 + 19:0,target 13 + 4:266,target 16 + 51:0 reduce + 12:0,target 6 + 58:285,target 35 + 0:301,target 4 + 11:297,target 54 + 53:265,target 67 + 72:0 reduce + 58:264,target 14 + 11:276,target 26 + 47:285,target 35 + 4:285,target 35 + 55:272,target 68 + 26:0 reduce + 53:284,target 67 + 47:264,target 14 + 54:267,target 69 + 4:264,target 14 + 58:283,target 33 + 0:288,target 1 + 11:305,target 55 + 68:0 reduce + 53:263,target 67 + 47:314,target 70 + 4:314,target 48 + 1:0 reduce + 58:262,target 12 + 11:274,target 24 + 47:283,target 33 + 54:286,target 69 + 4:283,target 33 + 23:0 reduce + 55:270,target 68 + 55:269,target 68 + 11:324,target 58 + 53:282,target 67 + 47:262,target 12 + 44:0 reduce + 5:0,target 34 + 54:265,target 69 + 4:262,target 12 + 54:261 reduce + 4:257 shift + 71:0,target 63 + 65:0 reduce + 58:281,target 31 + 54:262 reduce + 41:308,target 63 + 4:258 shift + 63:0,target 57 + 54:263 reduce + 53:261,target 67 + 4:260 shift + 4:259 shift + 55:0,target 68 + 54:264 reduce + 4:261 shift + 4:312,target 47 + 54:265 reduce + 4:262 shift + 54:266 reduce + 40:0,target 49 + 39:0,target 47 + 4:263 shift + 54:267 reduce + 32:0,target 26 + 4:264 shift + 11:272,target 22 + 54:268 reduce + 47:281,target 31 + 38:290,target 59 + 24:0,target 18 + 4:265 shift + 54:284,target 69 + 54:270 reduce + 54:269 reduce + 20:0 reduce + 19:0 reduce + 16:0,target 10 + 4:266 shift + 4:281,target 31 + 54:271 reduce + 4:267 shift + 55:267,target 68 + 54:272 reduce + 4:268 shift + 54:273 reduce + 53:280,target 67 + 53:279,target 67 + 41:0 reduce + 4:269 shift + 4:270 shift + 54:274 reduce + 47:260,target 10 + 47:259,target 9 + 4:271 shift + 54:275 reduce + 54:263,target 69 + 4:260,target 10 + 4:259,target 9 + 4:272 shift + 62:0 reduce + 54:276 reduce + 4:273 shift + 58:278,target 28 + 54:277 reduce + 4:274 shift + 54:278 reduce + 4:275 shift + 54:280 reduce + 54:279 reduce + 4:276 shift + 54:281 reduce + 4:277 shift + 55:286,target 68 + 54:282 reduce + 4:278 shift + 54:283 reduce + 45:302 shift + 4:279 shift + 4:280 shift + 11:269,target 19 + 11:270,target 20 + 54:284 reduce + 47:278,target 28 + 16:0 reduce + 4:281 shift + 54:285 reduce + 54:282,target 69 + 4:278,target 28 + 4:282 shift + 54:286 reduce + 4:283 shift + 55:265,target 68 + 54:287 reduce + 37:0 reduce + 4:284 shift + 53:277,target 67 + 4:285 shift + 47:257,target 7 + 4:286 shift + 58:0 reduce + 54:261,target 69 + 45:310 shift + 45:309 shift + 4:257,target 7 + 4:287 shift + 58:276,target 26 + 41:294,target 62 + 4:300 shift + 45:313 shift + 4:307,target 45 + 4:293 shift + 4:303 shift + 55:284,target 68 + 4:304 shift + 13:0 reduce + 4:295 shift + 9:0,target 3 + 11:267,target 17 + 47:276,target 26 + 2:0,target 36 + 4:296 shift + 54:280,target 69 + 54:279,target 69 + 4:307 shift + 4:276,target 26 + 45:321 goto + 34:0 reduce + 4:298 shift + 67:0,target 60 + 55:263,target 68 + 60:0,target 41 + 59:0,target 53 + 53:275,target 67 + 4:311 shift + 55:0 reduce + 52:0,target 5 + 4:312 shift + 44:0,target 48 + 36:0,target 30 + 4:314 goto + 58:274,target 24 + 28:0,target 22 + 4:315 goto + 11:286,target 36 + 21:0,target 15 + 13:0,target 7 + 4:317 goto + 4:295,target 39 + 4:318 goto + 8:0 reduce + 55:282,target 68 + 10:0 reduce + 11:265,target 15 + 47:274,target 24 + 54:277,target 69 + 31:0 reduce + 4:274,target 24 + 55:261,target 68 + 11:315,target 56 + 53:273,target 67 + 52:0 reduce + 47:257 shift + 73:0 reduce + 47:258 shift + 58:272,target 22 + 47:260 shift + 47:259 shift + 11:284,target 34 + 47:261 shift + 47:262 shift + 4:293,target 38 + 4:303,target 43 + 5:0 reduce +} + +array set framesend::rules { + 9,l 315 + 11,l 315 + 32,l 316 + 53,l 319 + 6,l 315 + 28,l 315 + 50,l 318 + 49,l 318 + 3,l 314 + 25,l 315 + 46,l 318 + 67,l 324 + 0,l 325 + 22,l 315 + 43,l 317 + 64,l 323 + 18,l 315 + 40,l 317 + 39,l 317 + 61,l 321 + 15,l 315 + 36,l 316 + 57,l 320 + 12,l 315 + 33,l 316 + 54,l 320 + 7,l 315 + 29,l 315 + 30,l 315 + 51,l 318 + 4,l 314 + 26,l 315 + 47,l 318 + 68,l 324 + 1,l 314 + 23,l 315 + 44,l 317 + 65,l 323 + 19,l 315 + 20,l 315 + 41,l 317 + 62,l 322 + 16,l 315 + 37,l 316 + 58,l 321 + 13,l 315 + 34,l 316 + 55,l 320 + 8,l 315 + 10,l 315 + 31,l 315 + 52,l 319 + 5,l 315 + 27,l 315 + 48,l 318 + 69,l 324 + 2,l 314 + 24,l 315 + 45,l 317 + 66,l 323 + 21,l 315 + 42,l 317 + 63,l 322 + 17,l 315 + 38,l 317 + 60,l 321 + 59,l 321 + 14,l 315 + 35,l 316 + 56,l 320 +} + +array set framesend::rules { + 63,dc 1 + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 2 + 55,dc 1 + 69,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 0 + 68,dc 1 + 17,dc 1 + 32,dc 0 + 8,dc 1 + 46,dc 1 + 61,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 1 + 67,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 60,dc 1 + 59,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 2 + 52,dc 0 + 66,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 65,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 2 + 57,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 1 + 49,dc 1 + 64,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 2 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set framesend::rules { + 41,line 150 + 7,line 112 + 37,line 144 + 4,line 108 + 34,line 141 + 1,line 105 + 31,line 136 + 27,line 132 + 24,line 129 + 21,line 126 + 17,line 122 + 14,line 119 + 69,line 193 + 11,line 116 + 66,line 187 + 63,line 182 + 60,line 177 + 59,line 176 + 56,line 171 + 53,line 166 + 50,line 161 + 49,line 160 + 46,line 157 + 43,line 152 + 9,line 114 + 40,line 149 + 39,line 148 + 6,line 111 + 36,line 143 + 3,line 107 + 33,line 140 + 29,line 134 + 30,line 135 + 26,line 131 + 23,line 128 + 19,line 124 + 20,line 125 + 16,line 121 + 13,line 118 + 68,line 192 + 10,line 115 + 65,line 186 + 62,line 181 + 58,line 175 + 55,line 170 + 52,line 165 + 48,line 159 + 45,line 154 + 42,line 151 + 8,line 113 + 38,line 147 + 5,line 110 + 35,line 142 + 2,line 106 + 32,line 139 + 28,line 133 + 25,line 130 + 22,line 127 + 18,line 123 + 15,line 120 + 12,line 117 + 67,line 190 + 64,line 185 + 61,line 178 + 57,line 172 + 54,line 169 + 51,line 162 + 47,line 158 + 44,line 153 +} + +array set framesend::lr1_table { + 66,trans {} + 35 {{29 0 1}} + 14,trans {} + 36 {{30 0 1}} + 33,trans {} + 37 {{31 0 1}} + 52,trans {} + 38 {{41 0 1} {52 0 0} {53 0 0}} + 71,trans {} + 39 {{47 0 1}} + 40 {{49 0 1}} + 18,trans {} + 1,trans {} + 41 {{42 0 1} {54 0 0} {55 0 0} {56 0 0} {57 0 0}} + 37,trans {} + 42 {{50 0 1}} + 56,trans {} + 43 {{46 0 1}} + 44 {{48 0 1}} + 23,trans {} + 5,trans {} + 45 {{43 0 1} {58 0 0} {59 0 0} {60 0 0} {61 0 0}} + 42,trans {} + 46 {{51 0 1}} + 61,trans {} + 47 {{44 0 1} {62 0 0} {63 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0}} + 48 {{38 0 1}} + 27,trans {} + 9,trans {} + 50 {{37 0 2}} + 49 {{39 0 1}} + 46,trans {} + 51 {{40 0 1}} + 65,trans {} + 52 {{5 0 1}} + 13,trans {} + 53 {{67 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287} 1}} + 32,trans {} + 54 {{69 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287} 1}} + 51,trans {} + 55 {{68 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287} 1}} + 70,trans {} + 69,trans {} + 56 {{66 0 1}} + 17,trans {} + 57 {{45 0 2}} + 0,trans {{288 1} {289 2} {299 3} {301 4} {306 5} {316 6}} + 36,trans {} + 58 {{64 0 1} {65 0 1} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0}} + 55,trans {} + 60 {{41 0 2}} + 59 {{53 0 1}} + 61 {{55 0 1}} + 62 {{56 0 1}} + 22,trans {} + 4,trans {{257 7} {258 8} {259 9} {260 10} {261 11} {262 12} {263 13} {264 14} {265 15} {266 16} {267 17} {268 18} {269 19} {270 20} {271 21} {272 22} {273 23} {274 24} {275 25} {276 26} {277 27} {278 28} {279 29} {280 30} {281 31} {282 32} {283 33} {284 34} {285 35} {286 36} {287 37} {293 38} {295 39} {296 40} {298 41} {300 42} {303 43} {304 44} {307 45} {311 46} {312 47} {314 48} {315 49} {317 50} {318 51}} + 41,trans {{291 61} {294 62} {308 63} {320 64}} + 63 {{57 0 1}} + 60,trans {} + 59,trans {} + 64 {{42 0 2}} + 65 {{58 0 1}} + 66 {{59 0 1}} + 26,trans {} + 8,trans {} + 45,trans {{302 65} {309 66} {310 67} {313 68} {321 69}} + 67 {{60 0 1}} + 64,trans {} + 68 {{61 0 1}} + 70 {{62 0 1}} + 69 {{43 0 2}} + 12,trans {} + 71 {{63 0 1}} + 31,trans {} + 50,trans {} + 49,trans {} + 72 {{44 0 2}} + 68,trans {} + 73 {{65 0 2}} + 16,trans {} + 35,trans {} + 54,trans {} + 73,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 58,trans {{261 52} {262 12} {263 13} {264 14} {265 15} {266 16} {267 17} {268 18} {269 19} {270 20} {271 21} {272 22} {273 23} {274 24} {275 25} {276 26} {277 27} {278 28} {279 29} {280 30} {281 31} {282 32} {283 33} {284 34} {285 35} {286 36} {287 37} {315 73}} + 10 {{4 0 1}} + 11 {{45 0 1} {5 0 1} {64 0 0} {65 0 0} {66 0 0} {67 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287} 0} {68 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287} 0} {69 {0 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287} 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0}} + 25,trans {} + 7,trans {} + 12 {{6 0 1}} + 44,trans {} + 13 {{7 0 1}} + 63,trans {} + 14 {{8 0 1}} + 11,trans {{261 52} {262 12} {263 13} {264 14} {265 15} {266 16} {267 17} {268 18} {269 19} {270 20} {271 21} {272 22} {273 23} {274 24} {275 25} {276 26} {277 27} {278 28} {279 29} {280 30} {281 31} {282 32} {283 33} {284 34} {285 35} {286 36} {287 37} {292 53} {297 54} {305 55} {315 56} {323 57} {324 58}} + 15 {{9 0 1}} + 30,trans {} + 29,trans {} + 16 {{10 0 1}} + 48,trans {} + 0 {{0 0 0} {32 0 0} {33 0 0} {34 0 0} {35 0 0} {36 0 0} {37 0 0}} + 17 {{11 0 1}} + 67,trans {} + 1 {{35 0 1}} + 18 {{12 0 1}} + 15,trans {} + 2 {{36 0 1}} + 19 {{13 0 1}} + 20 {{14 0 1}} + 34,trans {} + 3 {{33 0 1}} + 21 {{15 0 1}} + 53,trans {} + 4 {{37 0 1} {38 0 0} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0}} + 22 {{16 0 1}} + 72,trans {} + 5 {{34 0 1}} + 23 {{17 0 1}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{0 0 1}} + 24 {{18 0 1}} + 38,trans {{290 59} {319 60}} + 7 {{1 0 1}} + 25 {{19 0 1}} + 57,trans {} + 8 {{2 0 1}} + 26 {{20 0 1}} + 9 {{3 0 1}} + 27 {{21 0 1}} + 24,trans {} + 6,trans {} + 28 {{22 0 1}} + 43,trans {} + 29 {{23 0 1}} + 30 {{24 0 1}} + 62,trans {} + 31 {{25 0 1}} + 10,trans {} + 32 {{26 0 1}} + 28,trans {} + 33 {{27 0 1}} + 47,trans {{257 7} {258 8} {259 9} {260 10} {261 52} {262 12} {263 13} {264 14} {265 15} {266 16} {267 17} {268 18} {269 19} {270 20} {271 21} {272 22} {273 23} {274 24} {275 25} {276 26} {277 27} {278 28} {279 29} {280 30} {281 31} {282 32} {283 33} {284 34} {285 35} {286 36} {287 37} {314 70} {315 71} {322 72}} + 34 {{28 0 1}} +} + +array set framesend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 46 + 302,line 56 + 288 ACTIVE_ + 317,t 1 + 265,title WCSD + 289 ALL_ + 290 AUX_ + 300 GRID_ + 284,title WCSW + 291 BIN_ + 301 HAS_ + 313,title UNDO + 292 CELESTIAL_ + 302 HIGHLITE_ + 288,line 42 + 293 CONTOUR_ + 303 IIS_ + 294 CUBE_ + 304 IRAFMIN_ + 305 LINEAR_ + 295 DATAMIN_ + 306 LOCK_ + 296 DATASEC_ + 307 MARKER_ + 262,t 0 + 297 EQUATORIAL_ + 308 MOSAIC_ + 285,line 36 + 298 FITS_ + 310 SELECT_ + 309 PASTE_ + 299 FRAMENO_ + 311 SMOOTH_ + 283,t 0 + 312 SYSTEM_ + 313 UNDO_ + 314,t 1 + 314 coordsys + 282,line 33 + 315 wcssys + 316 framesend + 264,title WCSC + 317 has + 283,title WCSV + 318 param + 312,title SYSTEM + 320 fits + 319 contour + 278,line 29 + 321 marker + error,line 103 + 322 system + 258,t 0 + 323 wcs + 324 wcstype + 325 start' + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 0 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title SMOOTH + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + error,t 0 + 310,title SELECT + 309,title PASTE + 299,title FRAMENO + 258,line 8 + 273,t 0 + 324,line 189 + 294,t 0 + 304,t 0 + 325,t 1 + 321,line 174 + 317,line 146 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title MOSAIC + 269,t 0 + 270,t 0 + 298,title FITS + 314,line 104 + 291,t 0 + 301,t 0 + 322,t 1 + 311,line 65 + 307,line 61 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 51 + 278,title WCSQ + 307,title MARKER + 297,title EQUATORIAL + 287,t 0 + 294,line 48 + 304,line 58 + 318,t 1 + error,title {} + 291,line 45 + 301,line 55 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title LOCK + 296,title DATASEC + 325,title {} + 315,t 1 + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 0 + 305,title LINEAR + 295,title DATAMIN + 324,title {} + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 0 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title CUBE + 304,title IRAFMIN + 323,title {} + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSM + 323,line 184 + 293,title CONTOUR + 303,title IIS + 322,title {} + 320,line 168 + 319,line 164 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 138 + 323,t 1 + 273,title WCSL + 313,line 67 + 292,title CELESTIAL + 302,title HIGHLITE + 321,title {} + 267,t 0 + 310,line 64 + 309,line 63 + 299,line 53 + 288,t 0 + 320,t 1 + 319,t 1 + 306,line 60 + 296,line 50 + 272,title WCSK + 291,title BIN + 293,line 47 + 301,title HAS + 303,line 57 + 320,title {} + 319,title {} + 264,t 0 + 285,t 0 + 289,line 43 + 290,line 44 + 300,line 54 + 316,t 1 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title ALL + 290,title AUX + 300,title GRID + 318,title {} + 282,t 0 + 279,line 30 + 280,line 31 + 313,t 0 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title ACTIVE + 317,title {} + 278,t 0 + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 316,title {} + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 325,line 194 + 322,line 180 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 315,title {} + 258 PHYSICAL_ + 318,line 156 + 260 DETECTOR_ + 259 AMPLIFIER_ + 324,t 1 + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 315,line 109 + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 66 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 321,t 1 + 314,title {} + 275 WCSN_ + 308,line 62 + 276 WCSO_ + 298,line 52 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 59 + 282 WCSU_ + 295,line 49 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc framesend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { FrameSendCmd } + 33 { FrameSendCmd } + 34 { ProcessSendCmdGet panzoom lock } + 35 { FrameSendCmdGet active } + 36 { FrameSendCmdGet frames } + 38 { ProcessSendCmdCurrentYesNo "has $1" } + 39 { ProcessSendCmdCurrentYesNo "has wcs $1" } + 40 { ProcessSendCmdCurrentYesNo "has $1" } + 41 { ProcessSendCmdCurrentYesNo "has contour $2" } + 42 { ProcessSendCmdCurrentYesNo "has fits $2" } + 43 { ProcessSendCmdCurrentYesNo "has marker $2" } + 46 { set _ iis } + 47 { set _ datamin } + 48 { set _ irafmin } + 49 { set _ datasec } + 50 { set _ grid } + 51 { set _ smooth } + 52 { set _ {} } + 53 { set _ aux } + 54 { set _ {} } + 55 { set _ bin } + 56 { set _ cube } + 57 { set _ mosaic } + 58 { set _ highlite } + 59 { set _ paste } + 60 { set _ select } + 61 { set _ undo } + 62 { ProcessSendCmdCurrentYesNo "has $1" } + 63 { ProcessSendCmdCurrentYesNo "has wcs $1" } + 64 { ProcessSendCmdCurrentYesNo "has wcs $1 wcs" } + 65 { ProcessSendCmdCurrentYesNo "has wcs $1 $2" } + 66 { ProcessSendCmdCurrentYesNo "has wcs $1" } + 67 { set _ celestial } + 68 { set _ linear } + 69 { set _ celestial } + } + 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 framesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/gridlex.tcl b/ds9/parsers/gridlex.tcl new file mode 100644 index 0000000..4c1718f --- /dev/null +++ b/ds9/parsers/gridlex.tcl @@ -0,0 +1,1552 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval grid { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc grid::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc grid::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc grid::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc grid::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc grid::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc grid::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc grid::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc grid::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc grid::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set IMAGE_ 275 +set PHYSICAL_ 276 +set AMPLIFIER_ 277 +set DETECTOR_ 278 +set WCS_ 279 +set WCSA_ 280 +set WCSB_ 281 +set WCSC_ 282 +set WCSD_ 283 +set WCSE_ 284 +set WCSF_ 285 +set WCSG_ 286 +set WCSH_ 287 +set WCSI_ 288 +set WCSJ_ 289 +set WCSK_ 290 +set WCSL_ 291 +set WCSM_ 292 +set WCSN_ 293 +set WCSO_ 294 +set WCSP_ 295 +set WCSQ_ 296 +set WCSR_ 297 +set WCSS_ 298 +set WCST_ 299 +set WCSU_ 300 +set WCSV_ 301 +set WCSW_ 302 +set WCSX_ 303 +set WCSY_ 304 +set WCSZ_ 305 +set FK4_ 306 +set B1950_ 307 +set FK5_ 308 +set J2000_ 309 +set ICRS_ 310 +set GALACTIC_ 311 +set ECLIPTIC_ 312 +set DEGREES_ 313 +set SEXAGESIMAL_ 314 +set INT_ 315 +set REAL_ 316 +set STRING_ 317 +set ANALYSIS_ 318 +set AXES_ 319 +set BORDER_ 320 +set COLOR_ 321 +set CLOSE_ 322 +set DASH_ 323 +set DEF_ 324 +set DEF1_ 325 +set DEF2_ 326 +set EXTERIOR_ 327 +set FORMAT1_ 328 +set FORMAT2_ 329 +set GAP_ 330 +set GAP1_ 331 +set GAP2_ 332 +set GAP3_ 333 +set GRID_ 334 +set INTERIOR_ 335 +set LABELS_ 336 +set LOAD_ 337 +set NUMBERS_ 338 +set NUMERICS_ 339 +set ORIGIN_ 340 +set OPEN_ 341 +set PUBLICATION_ 342 +set RESET_ 343 +set SAVE_ 344 +set SKYFRAME_ 345 +set SKYFORMAT_ 346 +set STYLE_ 347 +set SYSTEM_ 348 +set TEXT_ 349 +set TEXT1_ 350 +set TEXT2_ 351 +set TICKMARKS_ 352 +set TITLE_ 353 +set TYPE_ 354 +set VERTICAL_ 355 +set VIEW_ 356 +set WIDTH_ 357 +set LLL_ 358 +set LLU_ 359 +set LUL_ 360 +set LUU_ 361 +set ULL_ 362 +set ULU_ 363 +set UUL_ 364 +set UUU_ 365 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: analysis + if {[regexp -start $index_ -indices -line -nocase -- {\A(analysis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: border + if {[regexp -start $index_ -indices -line -nocase -- {\A(border)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: dash + if {[regexp -start $index_ -indices -line -nocase -- {\A(dash)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: def + if {[regexp -start $index_ -indices -line -nocase -- {\A(def)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: def1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(def1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: def2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(def2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: exterior + if {[regexp -start $index_ -indices -line -nocase -- {\A(exterior)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: format1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(format1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: format2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(format2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: gap + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: gap1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: gap2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: gap3 + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap3)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: interior + if {[regexp -start $index_ -indices -line -nocase -- {\A(interior)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: label + if {[regexp -start $index_ -indices -line -nocase -- {\A(label)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: labels + if {[regexp -start $index_ -indices -line -nocase -- {\A(labels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: textlab + if {[regexp -start $index_ -indices -line -nocase -- {\A(textlab)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: numlab + if {[regexp -start $index_ -indices -line -nocase -- {\A(numlab)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: numbers + if {[regexp -start $index_ -indices -line -nocase -- {\A(numbers)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: numeric + if {[regexp -start $index_ -indices -line -nocase -- {\A(numeric)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: numerics + if {[regexp -start $index_ -indices -line -nocase -- {\A(numerics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: origin + if {[regexp -start $index_ -indices -line -nocase -- {\A(origin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: publication + if {[regexp -start $index_ -indices -line -nocase -- {\A(publication)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: reset + if {[regexp -start $index_ -indices -line -nocase -- {\A(reset)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: skyframe + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyframe)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: style + if {[regexp -start $index_ -indices -line -nocase -- {\A(style)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: text + if {[regexp -start $index_ -indices -line -nocase -- {\A(text)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: text1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(text1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: text2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(text2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: tick + if {[regexp -start $index_ -indices -line -nocase -- {\A(tick)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: tickmark + if {[regexp -start $index_ -indices -line -nocase -- {\A(tickmark)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: tickmarks + if {[regexp -start $index_ -indices -line -nocase -- {\A(tickmarks)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: title + if {[regexp -start $index_ -indices -line -nocase -- {\A(title)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: type + if {[regexp -start $index_ -indices -line -nocase -- {\A(type)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: vertical + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: lll + if {[regexp -start $index_ -indices -line -nocase -- {\A(lll)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: llu + if {[regexp -start $index_ -indices -line -nocase -- {\A(llu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: lul + if {[regexp -start $index_ -indices -line -nocase -- {\A(lul)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: luu + if {[regexp -start $index_ -indices -line -nocase -- {\A(luu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: ull + if {[regexp -start $index_ -indices -line -nocase -- {\A(ull)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: ulu + if {[regexp -start $index_ -indices -line -nocase -- {\A(ulu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: uul + if {[regexp -start $index_ -indices -line -nocase -- {\A(uul)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: uuu + if {[regexp -start $index_ -indices -line -nocase -- {\A(uuu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: times + if {[regexp -start $index_ -indices -line -nocase -- {\A(times)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: helvetica + if {[regexp -start $index_ -indices -line -nocase -- {\A(helvetica)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: courier + if {[regexp -start $index_ -indices -line -nocase -- {\A(courier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: normal + if {[regexp -start $index_ -indices -line -nocase -- {\A(normal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: bold + if {[regexp -start $index_ -indices -line -nocase -- {\A(bold)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: roman + if {[regexp -start $index_ -indices -line -nocase -- {\A(roman)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: italic + if {[regexp -start $index_ -indices -line -nocase -- {\A(italic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + # rule 80: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 80 + } + # rule 81: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 81 + } + # rule 82: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 82 + } + # rule 83: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 83 + } + # rule 84: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 84 + } + # rule 85: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 85 + } + # rule 86: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 86 + } + # rule 87: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 87 + } + # rule 88: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 88 + } + # rule 89: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 89 + } + # rule 90: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 90 + } + # rule 91: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 91 + } + # rule 92: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 92 + } + # rule 93: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 93 + } + # rule 94: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 94 + } + # rule 95: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 95 + } + # rule 96: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 96 + } + # rule 97: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 97 + } + # rule 98: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 98 + } + # rule 99: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 99 + } + # rule 100: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 100 + } + # rule 101: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 101 + } + # rule 102: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 102 + } + # rule 103: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 103 + } + # rule 104: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 104 + } + # rule 105: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 105 + } + # rule 106: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 106 + } + # rule 107: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 107 + } + # rule 108: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 108 + } + # rule 109: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 109 + } + # rule 110: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 110 + } + # rule 111: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 111 + } + # rule 112: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 112 + } + # rule 113: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 113 + } + # rule 114: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 114 + } + # rule 115: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 115 + } + # rule 116: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 116 + } + # rule 117: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 117 + } + # rule 118: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 118 + } + # rule 119: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 119 + } + # rule 120: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 120 + } + # rule 121: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 121 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ANALYSIS_ + } + 1 { +return $AXES_ + } + 2 { +return $BORDER_ + } + 3 { +return $CLOSE_ + } + 4 { +return $COLOR_ + } + 5 { +return $DASH_ + } + 6 { +return $DEF_ + } + 7 { +return $DEF1_ + } + 8 { +return $DEF2_ + } + 9 { +return $EXTERIOR_ + } + 10 { +return $FORMAT1_ + } + 11 { +return $FORMAT2_ + } + 12 { +return $GAP_ + } + 13 { +return $GAP1_ + } + 14 { +return $GAP2_ + } + 15 { +return $GAP3_ + } + 16 { +return $GRID_ + } + 17 { +return $INTERIOR_ + } + 18 { +return $LABELS_ + } + 19 { +return $LABELS_ + } + 20 { +return $LOAD_ + } + 21 { +return $LABELS_ + } + 22 { +return $NUMERICS_ + } + 23 { +return $NUMBERS_ + } + 24 { +return $NUMERICS_ + } + 25 { +return $NUMERICS_ + } + 26 { +return $ORIGIN_ + } + 27 { +return $OPEN_ + } + 28 { +return $PUBLICATION_ + } + 29 { +return $RESET_ + } + 30 { +return $SAVE_ + } + 31 { +return $SKYFRAME_ + } + 32 { +return $SKYFRAME_ + } + 33 { +return $SKYFORMAT_ + } + 34 { +return $STYLE_ + } + 35 { +return $SYSTEM_ + } + 36 { +return $TEXT_ + } + 37 { +return $TEXT1_ + } + 38 { +return $TEXT2_ + } + 39 { +return $TICKMARKS_ + } + 40 { +return $TICKMARKS_ + } + 41 { +return $TICKMARKS_ + } + 42 { +return $TITLE_ + } + 43 { +return $TYPE_ + } + 44 { +return $VERTICAL_ + } + 45 { +return $VIEW_ + } + 46 { +return $WIDTH_ + } + 47 { +return $LLL_ + } + 48 { +return $LLU_ + } + 49 { +return $LUL_ + } + 50 { +return $LUU_ + } + 51 { +return $ULL_ + } + 52 { +return $ULU_ + } + 53 { +return $UUL_ + } + 54 { +return $UUU_ + } + 55 { +return $YES_ + } + 56 { +return $NO_ + } + 57 { +return $ON_ + } + 58 { +return $OFF_ + } + 59 { +return $TRUE_ + } + 60 { +return $FALSE_ + } + 61 { +return $FONT_ + } + 62 { +return $FONTSIZE_ + } + 63 { +return $FONTSLANT_ + } + 64 { +return $FONTSTYLE_ + } + 65 { +return $FONTWEIGHT_ + } + 66 { +return $TIMES_ + } + 67 { +return $HELVETICA_ + } + 68 { +return $COURIER_ + } + 69 { +return $NORMAL_ + } + 70 { +return $BOLD_ + } + 71 { +return $ROMAN_ + } + 72 { +return $ITALIC_ + } + 73 { +return $IMAGE_ + } + 74 { +return $PHYSICAL_ + } + 75 { +return $AMPLIFIER_ + } + 76 { +return $DETECTOR_ + } + 77 { +return $WCS_ + } + 78 { +return $WCSA_ + } + 79 { +return $WCSB_ + } + 80 { +return $WCSC_ + } + 81 { +return $WCSD_ + } + 82 { +return $WCSE_ + } + 83 { +return $WCSF_ + } + 84 { +return $WCSG_ + } + 85 { +return $WCSH_ + } + 86 { +return $WCSI_ + } + 87 { +return $WCSJ_ + } + 88 { +return $WCSK_ + } + 89 { +return $WCSL_ + } + 90 { +return $WCSM_ + } + 91 { +return $WCSN_ + } + 92 { +return $WCSO_ + } + 93 { +return $WCSP_ + } + 94 { +return $WCSQ_ + } + 95 { +return $WCSR_ + } + 96 { +return $WCSS_ + } + 97 { +return $WCST_ + } + 98 { +return $WCSU_ + } + 99 { +return $WCSV_ + } + 100 { +return $WCSW_ + } + 101 { +return $WCSX_ + } + 102 { +return $WCSY_ + } + 103 { +return $WCSZ_ + } + 104 { +return $FK4_ + } + 105 { +return $FK4_ + } + 106 { +return $FK5_ + } + 107 { +return $FK5_ + } + 108 { +return $ICRS_ + } + 109 { +return $GALACTIC_ + } + 110 { +return $ECLIPTIC_ + } + 111 { +return $DEGREES_ + } + 112 { +return $SEXAGESIMAL_ + } + 113 { +set yylval $yytext; return $INT_ + } + 114 - + 115 { +set yylval $yytext; return $REAL_ + } + 116 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 117 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 118 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 119 { +set yylval $yytext; return $STRING_ + } + 120 { +# ignore whitespace + } + 121 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/gridparser.tab.tcl b/ds9/parsers/gridparser.tab.tcl new file mode 100644 index 0000000..85e59a2 --- /dev/null +++ b/ds9/parsers/gridparser.tab.tcl @@ -0,0 +1,109 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set IMAGE_ 275 +set PHYSICAL_ 276 +set AMPLIFIER_ 277 +set DETECTOR_ 278 +set WCS_ 279 +set WCSA_ 280 +set WCSB_ 281 +set WCSC_ 282 +set WCSD_ 283 +set WCSE_ 284 +set WCSF_ 285 +set WCSG_ 286 +set WCSH_ 287 +set WCSI_ 288 +set WCSJ_ 289 +set WCSK_ 290 +set WCSL_ 291 +set WCSM_ 292 +set WCSN_ 293 +set WCSO_ 294 +set WCSP_ 295 +set WCSQ_ 296 +set WCSR_ 297 +set WCSS_ 298 +set WCST_ 299 +set WCSU_ 300 +set WCSV_ 301 +set WCSW_ 302 +set WCSX_ 303 +set WCSY_ 304 +set WCSZ_ 305 +set FK4_ 306 +set B1950_ 307 +set FK5_ 308 +set J2000_ 309 +set ICRS_ 310 +set GALACTIC_ 311 +set ECLIPTIC_ 312 +set DEGREES_ 313 +set SEXAGESIMAL_ 314 +set INT_ 315 +set REAL_ 316 +set STRING_ 317 +set ANALYSIS_ 318 +set AXES_ 319 +set BORDER_ 320 +set COLOR_ 321 +set CLOSE_ 322 +set DASH_ 323 +set DEF_ 324 +set DEF1_ 325 +set DEF2_ 326 +set EXTERIOR_ 327 +set FORMAT1_ 328 +set FORMAT2_ 329 +set GAP_ 330 +set GAP1_ 331 +set GAP2_ 332 +set GAP3_ 333 +set GRID_ 334 +set INTERIOR_ 335 +set LABELS_ 336 +set LOAD_ 337 +set NUMBERS_ 338 +set NUMERICS_ 339 +set ORIGIN_ 340 +set OPEN_ 341 +set PUBLICATION_ 342 +set RESET_ 343 +set SAVE_ 344 +set SKYFRAME_ 345 +set SKYFORMAT_ 346 +set STYLE_ 347 +set SYSTEM_ 348 +set TEXT_ 349 +set TEXT1_ 350 +set TEXT2_ 351 +set TICKMARKS_ 352 +set TITLE_ 353 +set TYPE_ 354 +set VERTICAL_ 355 +set VIEW_ 356 +set WIDTH_ 357 +set LLL_ 358 +set LLU_ 359 +set LUL_ 360 +set LUU_ 361 +set ULL_ 362 +set ULU_ 363 +set UUL_ 364 +set UUU_ 365 diff --git a/ds9/parsers/gridparser.tcl b/ds9/parsers/gridparser.tcl new file mode 100644 index 0000000..d2402e8 --- /dev/null +++ b/ds9/parsers/gridparser.tcl @@ -0,0 +1,3546 @@ +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 grid { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc grid::YYABORT {} { + return -code return 1 +} + +proc grid::YYACCEPT {} { + return -code return 0 +} + +proc grid::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc grid::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc grid::yyerror {s} { + puts stderr $s +} + +proc grid::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 grid::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set grid::table { + 116:317,target 40 + 21:289 shift + 21:290 shift + 21:300 shift + 162:317,target 109 + 21:291 shift + 21:301 shift + 217:317,target 134 + 122:0,target 46 + 21:292 shift + 21:302 shift + 12:317,target 1 + 21:293 shift + 21:303 shift + 106:317 reduce + 21:294 shift + 21:304 shift + 153:366,target 241 + 134:268,target 187 + 21:295 shift + 21:305 shift + 81:317 reduce + 21:296 shift + 21:297 shift + 7:354,target 33 + 21:298 shift + 24:319,target 146 + 15:257,target 1 + 21:299 shift + 51:315 shift + 61:257,target 1 + 95:0,target 19 + 91:0 reduce + 15:354 shift + 15:355 shift + 31:363,target 165 + 177:0 reduce + 56:273 shift + 56:274 shift + 242:317 reduce + 24:378,target 149 + 75:375 goto + 9:317 reduce + 21:275,target 94 + 230:0 reduce + 229:0 reduce + 15:366 goto + 0:344,target 18 + 22:258,target 2 + 117:317,target 41 + 212:317 reduce + 163:317,target 110 + 222:0,target 119 + 218:317,target 135 + 236:366 goto + 7:260,target 4 + 7:259,target 3 + 13:317,target 1 + 154:366,target 242 + 79:261,target 5 + 181:0,target 59 + 172:317 reduce + 25:319,target 151 + 25:320,target 152 + 107:0 reduce + 150:0,target 70 + 149:0,target 87 + 142:317 shift + 13:265,target 56 + 118:0,target 42 + 150:0 reduce + 149:0 reduce + 112:317 reduce + 86:317 reduce + 15:388 goto + 21:292,target 111 + 21:302,target 121 + 202:0 reduce + 192:0 reduce + 136:369 goto + 92:0,target 57 + 23:258,target 2 + 47:315,target 180 + 118:317,target 42 + 22:386,target 133 + 164:317,target 111 + 140:261,target 5 + 244:0 reduce + 220:317,target 116 + 219:317,target 136 + 61:0,target 1 + 8:260,target 4 + 8:259,target 3 + 14:317,target 68 + 26:317 reduce + 59:317,target 202 + 60:317,target 1 + 155:366,target 243 + 30:0,target 1 + 247:317 reduce + 35:0 reduce + 235:260,target 4 + 235:259,target 3 + 217:317 reduce + 122:0 reduce + 218:0,target 135 + 21:371 goto + 30:259,target 3 + 30:260,target 4 + 153:257 shift + 21:372 goto + 153:258 shift + 153:260 shift + 153:259 shift + 9:0 reduce + 177:317 reduce + 177:0,target 122 + 153:261 shift + 56:273,target 192 + 164:0 reduce + 153:262 shift + 13:351,target 65 + 21:382 goto + 48:315,target 180 + 216:0 reduce + 120:317,target 44 + 119:317,target 43 + 165:317,target 112 + 115:0,target 39 + 221:317,target 118 + 117:317 reduce + 15:317,target 1 + 8:387,target 42 + 25:353,target 154 + 61:317,target 1 + 92:317 reduce + 147:327 shift + 62:315 shift + 62:316 shift + 88:0,target 54 + 33:379,target 172 + 78:379,target 218 + 236:260,target 4 + 236:259,target 3 + 15:265,target 71 + 32:315 shift + 147:335 shift + 92:0 reduce + 26:0,target 67 + 56:369 goto + 129:258,target 2 + 246:0,target 166 + 178:0 reduce + 19:309,target 86 + 19:310,target 87 + 49:315,target 180 + 50:315,target 185 + 223:317 reduce + 121:317,target 45 + 215:0,target 132 + 166:317,target 113 + 21:283,target 102 + 222:317,target 119 + 0:352,target 22 + 16:317,target 68 + 71:369,target 211 + 231:0 reduce + 183:317 reduce + 174:0,target 121 + 13:325,target 60 + 143:0,target 137 + 153:317 reduce + 22:0 reduce + 237:260,target 4 + 237:259,target 3 + 112:0,target 36 + 123:317 reduce + 108:0 reduce + 97:317 reduce + 151:0 reduce + 85:0,target 51 + 67:317 reduce + 0:257,target 1 + 13:257 shift + 21:299,target 118 + 51:315,target 186 + 122:317,target 46 + 13:258 shift + 167:317,target 114 + 13:259 shift + 13:260 shift + 73:271 shift + 223:317,target 117 + 203:0 reduce + 193:0 reduce + 13:261 shift + 37:317 shift + 73:272 shift + 13:262 shift + 17:317,target 84 + 23:266,target 137 + 72:370,target 212 + 147:379 goto + 13:263 shift + 38:261,target 5 + 13:264 shift + 23:0,target 1 + 13:265 shift + 13:266 shift + 245:0 reduce + 13:267 shift + 243:0,target 164 + 228:317 reduce + 62:375 goto + 212:0,target 130 + 36:0 reduce + 188:317 reduce + 171:0,target 65 + 24:318,target 145 + 123:0 reduce + 140:0,target 1 + 158:317 reduce + 31:362,target 164 + 165:0 reduce + 123:317,target 47 + 108:0,target 32 + 168:317,target 106 + 224:317,target 141 + 128:317 shift + 18:317,target 82 + 153:366 goto + 134:268 shift + 64:317,target 207 + 134:270 shift + 134:269 shift + 217:0 reduce + 8:0,target 1 + 82:0,target 86 + 0:343,target 17 + 22:257,target 1 + 12:333,target 49 + 7:258,target 2 + 43:317 reduce + 79:260,target 4 + 79:259,target 3 + 151:262,target 6 + 7:257 shift + 7:258 shift + 7:260 shift + 7:259 shift + 13:317 reduce + 46:262,target 6 + 7:261 shift + 240:0,target 163 + 239:0,target 161 + 7:262 shift + 13:321 shift + 13:264,target 55 + 234:317 reduce + 93:0 reduce + 208:0,target 149 + 198:0,target 158 + 124:317,target 48 + 2:317 reduce + 170:317,target 66 + 169:317,target 104 + 13:325 shift + 225:317,target 142 + 13:326 shift + 204:317 reduce + 194:317 reduce + 180:0 reduce + 179:0 reduce + 167:0,target 114 + 65:317,target 208 + 21:291,target 110 + 21:301,target 120 + 140:257 shift + 13:331 shift + 140:258 shift + 13:332 shift + 140:260 shift + 140:259 shift + 164:317 reduce + 140:261 shift + 23:257,target 1 + 232:0 reduce + 140:262 shift + 140:260,target 4 + 140:259,target 3 + 105:0,target 29 + 8:258,target 2 + 152:262,target 6 + 23:0 reduce + 0:317,target 1 + 104:317 reduce + 5:0,target 4 + 110:0 reduce + 109:0 reduce + 235:258,target 2 + 13:350 shift + 13:351 shift + 30:258,target 2 + 48:315 shift + 125:317,target 90 + 48:316 shift + 171:317,target 65 + 226:317,target 144 + 152:0 reduce + 54:268 shift + 16:0,target 68 + 54:269 shift + 54:270 shift + 66:317,target 147 + 78:327 shift + 0:376,target 27 + 73:368 goto + 18:317 shift + 12:366,target 52 + 236:0,target 1 + 204:0 reduce + 194:0 reduce + 13:350,target 64 + 240:317 reduce + 239:317 reduce + 205:0,target 152 + 195:0,target 15 + 78:335 shift + 7:317 reduce + 13:366 goto + 246:0 reduce + 7:321 shift + 0:334,target 12 + 210:317 reduce + 209:317 reduce + 199:317 reduce + 164:0,target 111 + 153:262,target 6 + 7:323 shift + 1:317,target 2 + 133:0,target 78 + 170:317 reduce + 169:317 reduce + 236:258,target 2 + 15:264,target 70 + 102:0,target 26 + 55:315,target 191 + 126:317,target 91 + 124:0 reduce + 172:317,target 105 + 140:317 reduce + 139:317 shift + 80:0 reduce + 79:0 reduce + 227:317,target 145 + 22:317,target 1 + 57:272,target 196 + 67:317,target 82 + 12:383,target 53 + 60:257 shift + 166:0 reduce + 129:257,target 1 + 110:317 reduce + 109:317 reduce + 2:0,target 5 + 60:258 shift + 13:366,target 66 + 7:340 shift + 60:259 shift + 60:260 shift + 84:317 reduce + 60:261 shift + 134:367 goto + 13:390 goto + 19:308,target 85 + 60:262 shift + 30:257 shift + 15:333,target 77 + 21:282,target 101 + 30:258 shift + 218:0 reduce + 30:259 shift + 30:260 shift + 44:0,target 76 + 30:261 shift + 7:347 shift + 30:262 shift + 62:316,target 181 + 154:262,target 6 + 13:0,target 1 + 2:317,target 5 + 24:318 shift + 233:0,target 88 + 7:354 shift + 24:319 shift + 245:317 reduce + 237:258,target 2 + 7:357 shift + 202:0,target 159 + 192:0,target 13 + 136:369,target 226 + 52:0 reduce + 127:317,target 71 + 173:317,target 102 + 228:317,target 143 + 78:379 goto + 62:375,target 205 + 215:317 reduce + 161:0,target 108 + 23:317,target 1 + 48:375 goto + 58:272,target 200 + 68:317,target 85 + 151:257 shift + 94:0 reduce + 151:258 shift + 7:366 goto + 28:377,target 157 + 151:260 shift + 151:259 shift + 129:0,target 1 + 175:317 reduce + 151:261 shift + 151:338,target 236 + 60:366,target 203 + 71:274,target 193 + 151:262 shift + 21:298,target 117 + 181:0 reduce + 145:317 reduce + 12:357,target 51 + 23:265,target 136 + 24:339 shift + 38:259,target 3 + 38:260,target 4 + 63:316,target 181 + 24:342 shift + 233:0 reduce + 155:262,target 6 + 3:317,target 3 + 115:317 reduce + 140:366 goto + 90:317 reduce + 89:317 reduce + 7:384 goto + 137:370,target 227 + 41:0,target 120 + 128:317,target 220 + 59:317 shift + 60:317 reduce + 174:317,target 121 + 230:317,target 139 + 229:317,target 146 + 111:0 reduce + 63:375,target 206 + 66:0 reduce + 29:317 shift + 30:317 reduce + 230:0,target 139 + 229:0,target 146 + 15:366,target 80 + 153:0 reduce + 146:379,target 233 + 31:361,target 163 + 54:367 goto + 61:366,target 204 + 72:274,target 197 + 188:0,target 9 + 33:327,target 170 + 78:327,target 170 + 73:368,target 213 + 205:0 reduce + 195:0 reduce + 221:317 reduce + 4:317,target 6 + 126:0,target 91 + 247:0 reduce + 181:317 reduce + 12:332,target 48 + 7:257,target 1 + 24:378 goto + 151:317 reduce + 129:317,target 1 + 79:258,target 2 + 24:381 goto + 175:317,target 123 + 151:261,target 5 + 38:0 reduce + 231:317,target 140 + 99:0,target 23 + 46:261,target 5 + 121:317 reduce + 125:0 reduce + 95:317 reduce + 81:0 reduce + 68:0,target 85 + 147:379,target 234 + 13:263,target 54 + 167:0 reduce + 65:317 shift + 21:289,target 108 + 21:290,target 109 + 21:300,target 119 + 151:336 shift + 5:317,target 4 + 35:317 reduce + 220:0 reduce + 219:0 reduce + 71:273 shift + 226:0,target 144 + 151:338 shift + 60:366 goto + 71:274 shift + 0:257 shift + 140:258,target 2 + 0:258 shift + 13:332,target 63 + 0:260 shift + 0:259 shift + 185:0,target 96 + 8:257,target 1 + 0:261 shift + 0:262 shift + 30:366 goto + 176:317,target 124 + 152:261,target 5 + 25:334,target 153 + 232:317,target 138 + 226:317 reduce + 154:0,target 1 + 26:317,target 67 + 53:0 reduce + 151:352 shift + 123:0,target 47 + 186:317 reduce + 235:257,target 1 + 30:257,target 1 + 140:0 reduce + 95:0 reduce + 156:317 reduce + 96:0,target 20 + 182:0 reduce + 126:317 reduce + 6:317,target 7 + 151:366 goto + 46:257 shift + 234:0 reduce + 46:258 shift + 46:259 shift + 46:260 shift + 69:367,target 209 + 46:261 shift + 132:317,target 115 + 46:262 shift + 177:317,target 122 + 153:261,target 5 + 233:317,target 88 + 12:323,target 46 + 41:317 reduce + 237:257 shift + 223:0,target 117 + 237:258 shift + 237:260 shift + 237:259 shift + 236:257,target 1 + 112:0 reduce + 15:263,target 69 + 237:261 shift + 11:317 shift + 67:0 reduce + 237:262 shift + 182:0,target 97 + 0:0 reduce + 57:271,target 195 + 232:317 reduce + 154:0 reduce + 151:0,target 1 + 0:317 reduce + 33:335,target 171 + 151:392 goto + 78:335,target 171 + 7:317,target 1 + 0:319 shift + 0:320 shift + 120:0,target 44 + 119:0,target 43 + 202:317 reduce + 192:317 reduce + 0:322 shift + 19:307,target 84 + 206:0 reduce + 196:0 reduce + 15:332,target 76 + 21:281,target 100 + 162:317 reduce + 62:315,target 180 + 133:317,target 78 + 0:328 shift + 178:317,target 93 + 154:261,target 5 + 0:329 shift + 234:317,target 89 + 93:0,target 73 + 28:317,target 61 + 132:317 reduce + 74:317,target 214 + 0:334 shift + 24:342,target 148 + 0:336 shift + 237:257,target 1 + 137:271 shift + 0:337 shift + 137:272 shift + 102:317 reduce + 76:315 shift + 0:339 shift + 31:385,target 168 + 76:316 shift + 137:274 shift + 0:341 shift + 126:0 reduce + 82:0 reduce + 0:343 shift + 22:257 shift + 58:271,target 199 + 0:344 shift + 22:258 shift + 0:345 shift + 22:259 shift + 22:260 shift + 0:346 shift + 22:261 shift + 46:317 reduce + 8:317,target 1 + 22:262 shift + 220:0,target 116 + 219:0,target 136 + 168:0 reduce + 0:348 shift + 71:273,target 192 + 21:297,target 116 + 0:366,target 26 + 0:352 shift + 16:317 reduce + 71:369 goto + 178:0,target 93 + 0:353 shift + 0:354 shift + 23:264,target 135 + 221:0 reduce + 38:258,target 2 + 63:315,target 180 + 0:356 shift + 237:317 reduce + 180:317,target 58 + 179:317,target 95 + 155:261,target 5 + 235:317,target 1 + 5:317 reduce + 29:317,target 158 + 30:317,target 1 + 136:274,target 193 + 116:0,target 40 + 12:0 reduce + 207:317 reduce + 197:317 reduce + 0:366 goto + 167:317 reduce + 90:0,target 72 + 89:0,target 55 + 96:0 reduce + 9:317,target 69 + 12:262,target 6 + 0:376 goto + 31:359,target 161 + 31:360,target 162 + 107:317 reduce + 0:380 goto + 183:0 reduce + 27:0,target 0 + 82:317 reduce + 54:269,target 188 + 54:270,target 189 + 247:0,target 167 + 181:317,target 59 + 236:317,target 1 + 235:0 reduce + 52:317 reduce + 137:274,target 197 + 0:341,target 16 + 216:0,target 133 + 12:331,target 47 + 22:366,target 132 + 57:271 shift + 22:317 reduce + 57:272 shift + 175:0,target 123 + 138:368,target 228 + 23:349,target 142 + 26:0 reduce + 79:257,target 1 + 46:366 goto + 57:274 shift + 151:260,target 4 + 151:259,target 3 + 22:321 shift + 243:317 reduce + 144:0,target 81 + 22:323 shift + 76:375 goto + 113:0 reduce + 46:259,target 3 + 46:260,target 4 + 68:0 reduce + 113:0,target 37 + 213:317 reduce + 1:0 reduce + 13:262,target 6 + 237:366 goto + 155:0 reduce + 173:317 reduce + 21:288,target 107 + 207:0 reduce + 197:0 reduce + 182:317,target 97 + 86:0,target 52 + 237:317,target 1 + 143:317 reduce + 12:347,target 50 + 140:257,target 1 + 13:331,target 62 + 23:366,target 143 + 113:317 reduce + 7:384,target 36 + 87:317 reduce + 22:347 shift + 152:260,target 4 + 152:259,target 3 + 20:374,target 93 + 244:0,target 62 + 137:370 goto + 41:0 reduce + 213:0,target 128 + 23:324,target 140 + 127:0 reduce + 134:367,target 224 + 83:0 reduce + 13:390,target 67 + 22:357 shift + 60:262,target 6 + 172:0,target 105 + 170:0 reduce + 169:0 reduce + 183:317,target 98 + 238:317,target 165 + 22:366 goto + 110:0,target 34 + 109:0,target 33 + 222:0 reduce + 218:317 reduce + 154:257 shift + 154:258 shift + 154:260 shift + 154:259 shift + 146:327,target 170 + 178:317 reduce + 154:261 shift + 154:262 shift + 153:260,target 4 + 153:259,target 3 + 9:0,target 69 + 13:0 reduce + 83:0,target 49 + 22:357,target 131 + 148:317 reduce + 100:0 reduce + 52:0,target 92 + 15:262,target 6 + 61:262,target 6 + 118:317 reduce + 22:386 goto + 93:317 reduce + 97:0 reduce + 38:257 shift + 241:0,target 160 + 38:258 shift + 63:315 shift + 184:317,target 99 + 38:259 shift + 38:260 shift + 63:316 shift + 240:317,target 163 + 239:317,target 161 + 38:261 shift + 184:0 reduce + 38:262 shift + 210:0,target 127 + 209:0,target 126 + 199:0,target 11 + 129:366,target 221 + 80:317,target 125 + 79:317,target 1 + 19:306,target 83 + 15:331,target 75 + 21:279,target 98 + 21:280,target 99 + 168:0,target 106 + 0:348,target 21 + 236:0 reduce + 147:327,target 170 + 154:260,target 4 + 154:259,target 3 + 57:370 goto + 27:0 accept + 106:0,target 30 + 33:327 shift + 224:317 reduce + 114:0 reduce + 184:317 reduce + 6:0,target 7 + 33:335 shift + 129:257 shift + 2:0 reduce + 140:317,target 1 + 139:317,target 229 + 129:258 shift + 80:0,target 125 + 79:0,target 1 + 185:317,target 96 + 156:0 reduce + 129:260 shift + 129:259 shift + 241:317,target 160 + 154:317 reduce + 129:261 shift + 151:336,target 235 + 129:262 shift + 35:317,target 100 + 81:317,target 80 + 21:296,target 115 + 208:0 reduce + 198:0 reduce + 124:317 reduce + 17:0,target 84 + 23:263,target 134 + 98:317 reduce + 38:257,target 1 + 155:260,target 4 + 155:259,target 3 + 237:0,target 1 + 136:273,target 192 + 68:317 reduce + 75:316,target 181 + 206:0,target 153 + 196:0,target 16 + 38:317 reduce + 42:0 reduce + 165:0,target 112 + 235:257 shift + 235:258 shift + 235:260 shift + 235:259 shift + 235:261 shift + 70:315,target 210 + 235:262 shift + 84:0 reduce + 186:317,target 94 + 242:317,target 162 + 75:375,target 215 + 103:0,target 27 + 12:261,target 5 + 31:358,target 160 + 36:317,target 77 + 72:272,target 196 + 230:317 reduce + 229:317 reduce + 82:317,target 86 + 63:375 goto + 171:0 reduce + 54:268,target 187 + 200:317 reduce + 190:317 reduce + 189:317 reduce + 3:0,target 3 + 223:0 reduce + 146:335,target 171 + 33:379 goto + 160:317 reduce + 159:317 reduce + 0:339,target 15 + 76:316,target 181 + 21:382,target 127 + 130:315 shift + 79:257 shift + 129:317 reduce + 79:258 shift + 130:315,target 222 + 79:260 shift + 79:259 shift + 154:366 goto + 151:258,target 2 + 79:261 shift + 7:366,target 35 + 101:0 reduce + 79:262 shift + 234:0,target 89 + 100:317 reduce + 46:258,target 2 + 142:317,target 232 + 187:317,target 8 + 74:317 shift + 243:317,target 164 + 22:323,target 129 + 76:375,target 216 + 203:0,target 150 + 193:0,target 14 + 143:0 reduce + 13:261,target 5 + 37:317,target 174 + 73:272,target 200 + 98:0 reduce + 83:317,target 49 + 44:317 reduce + 162:0,target 109 + 20:314,target 92 + 185:0 reduce + 8:257 shift + 8:258 shift + 21:287,target 106 + 8:260 shift + 8:259 shift + 14:317 shift + 8:261 shift + 0:356,target 25 + 147:335,target 171 + 8:262 shift + 38:366 goto + 77:316,target 181 + 237:0 reduce + 100:0,target 24 + 235:317 reduce + 3:317 reduce + 131:315,target 223 + 205:317 reduce + 195:317 reduce + 152:258,target 2 + 8:366,target 41 + 19:373,target 90 + 28:0 reduce + 0:0,target 1 + 143:317,target 137 + 188:317,target 9 + 165:317 reduce + 115:0 reduce + 77:375,target 217 + 38:317,target 1 + 42:0,target 79 + 135:315 shift + 84:317,target 50 + 60:261,target 5 + 3:0 reduce + 235:366,target 245 + 0:262,target 6 + 30:366,target 159 + 15:355,target 79 + 25:391,target 156 + 231:0,target 140 + 105:317 reduce + 210:0 reduce + 209:0 reduce + 199:0 reduce + 129:366 goto + 80:317 reduce + 79:317 reduce + 19:306 shift + 19:307 shift + 200:0,target 12 + 190:0,target 154 + 189:0,target 10 + 19:308 shift + 19:309 shift + 19:310 shift + 49:315 shift + 50:315 shift + 19:311 shift + 49:316 shift + 19:312 shift + 158:0,target 101 + 20:313 shift + 20:314 shift + 153:258,target 2 + 12:321,target 45 + 127:0,target 71 + 144:317,target 81 + 43:0 reduce + 200:317,target 12 + 190:317,target 154 + 189:317,target 10 + 245:317,target 168 + 7:357,target 34 + 241:317 reduce + 15:261,target 5 + 85:317,target 51 + 8:317 reduce + 61:261,target 5 + 129:0 reduce + 236:366,target 246 + 85:0 reduce + 8:321 shift + 211:317 reduce + 8:323 shift + 235:366 goto + 172:0 reduce + 171:317 reduce + 38:0,target 1 + 141:315 shift + 21:278,target 97 + 224:0 reduce + 141:316 shift + 22:262,target 6 + 154:258,target 2 + 13:321,target 59 + 61:257 shift + 227:0,target 145 + 111:317 reduce + 15:0 reduce + 61:258 shift + 100:317,target 24 + 61:259 shift + 61:260 shift + 145:317,target 63 + 85:317 reduce + 24:339,target 147 + 61:261 shift + 201:317,target 156 + 191:317,target 155 + 61:262 shift + 246:317,target 166 + 186:0,target 94 + 8:357,target 40 + 102:0 reduce + 41:317,target 120 + 55:315 shift + 86:317,target 52 + 15:388,target 81 + 237:366,target 247 + 155:0,target 1 + 8:347 shift + 79:366 goto + 144:0 reduce + 124:0,target 48 + 99:0 reduce + 25:319 shift + 25:320 shift + 21:295,target 114 + 21:305,target 124 + 246:317 reduce + 186:0 reduce + 8:357 shift + 23:262,target 6 + 97:0,target 21 + 216:317 reduce + 49:375 goto + 238:0 reduce + 155:258,target 2 + 152:257 shift + 152:258 shift + 8:366 goto + 19:373 goto + 66:0,target 147 + 152:260 shift + 152:259 shift + 101:317,target 25 + 20:374 goto + 75:315,target 180 + 176:317 reduce + 152:261 shift + 25:334 shift + 202:317,target 159 + 192:317,target 13 + 152:262 shift + 0:322,target 9 + 247:317,target 167 + 30:0 reduce + 35:0,target 100 + 42:317,target 79 + 87:317,target 53 + 22:347,target 130 + 116:0 reduce + 224:0,target 141 + 141:316,target 181 + 116:317 reduce + 151:352,target 237 + 4:0 reduce + 91:317 reduce + 158:0 reduce + 12:260,target 4 + 12:259,target 3 + 72:271,target 195 + 183:0,target 98 + 146:327 shift + 8:387 goto + 25:353 shift + 61:317 reduce + 152:0,target 1 + 211:0 reduce + 23:389,target 144 + 25:355 shift + 141:375 goto + 135:315,target 225 + 146:335 shift + 121:0,target 45 + 15:321,target 74 + 141:375,target 231 + 137:272,target 196 + 102:317,target 26 + 76:315,target 180 + 203:317,target 150 + 193:317,target 14 + 43:317,target 75 + 88:317,target 54 + 151:257,target 1 + 94:0,target 18 + 44:0 reduce + 222:317 reduce + 79:366,target 219 + 46:257,target 1 + 182:317 reduce + 86:0 reduce + 13:259,target 3 + 13:260,target 4 + 73:271,target 199 + 129:262,target 6 + 7:323,target 30 + 173:0 reduce + 152:317 reduce + 20:313,target 91 + 21:286,target 105 + 221:0,target 118 + 122:317 reduce + 225:0 reduce + 32:315,target 169 + 138:272,target 200 + 103:317,target 27 + 96:317 reduce + 77:315,target 180 + 148:317,target 64 + 204:317,target 151 + 194:317,target 157 + 180:0,target 58 + 179:0,target 95 + 25:391 goto + 44:317,target 76 + 140:366,target 230 + 90:317,target 72 + 89:317,target 55 + 16:0 reduce + 66:317 reduce + 148:0,target 64 + 152:257,target 1 + 12:257 shift + 12:258 shift + 12:260 shift + 12:259 shift + 72:271 shift + 117:0,target 41 + 103:0 reduce + 12:261 shift + 31:358 shift + 36:317 reduce + 72:272 shift + 12:262 shift + 31:359 shift + 31:360 shift + 146:379 goto + 31:361 shift + 61:366 goto + 72:274 shift + 31:362 shift + 31:363 shift + 7:340,target 31 + 31:364 shift + 60:259,target 3 + 60:260,target 4 + 145:0 reduce + 31:365 shift + 8:323,target 38 + 0:261,target 5 + 91:0,target 56 + 15:354,target 78 + 227:317 reduce + 187:0 reduce + 60:0,target 1 + 187:317 reduce + 104:317,target 28 + 150:317,target 70 + 149:317,target 87 + 205:317,target 152 + 195:317,target 15 + 28:0,target 60 + 240:0 reduce + 239:0 reduce + 45:317,target 178 + 157:317 shift + 91:317,target 56 + 0:329,target 11 + 153:257,target 1 + 21:372,target 126 + 31:385 goto + 217:0,target 134 + 127:317 reduce + 152:366 goto + 176:0,target 124 + 117:0 reduce + 15:259,target 3 + 15:260,target 4 + 61:259,target 3 + 61:260,target 4 + 145:0,target 63 + 5:0 reduce + 31:365,target 167 + 160:0 reduce + 159:0 reduce + 114:0,target 38 + 42:317 reduce + 34:315,target 173 + 69:269,target 188 + 69:270,target 189 + 105:317,target 29 + 212:0 reduce + 151:317,target 1 + 24:381,target 150 + 206:317,target 153 + 196:317,target 16 + 12:317 reduce + 21:277,target 96 + 0:346,target 20 + 22:261,target 5 + 46:317,target 1 + 92:317,target 57 + 12:321 shift + 87:0,target 53 + 233:317 reduce + 154:257,target 1 + 12:323 shift + 7:262,target 6 + 1:317 reduce + 203:317 reduce + 193:317 reduce + 12:331 shift + 12:332 shift + 12:333 shift + 163:317 reduce + 245:0,target 168 + 132:0 reduce + 13:267,target 58 + 87:0 reduce + 214:0,target 131 + 133:317 reduce + 174:0 reduce + 106:317,target 30 + 21:294,target 113 + 21:304,target 123 + 173:0,target 102 + 152:317,target 1 + 138:271 shift + 207:317,target 148 + 197:317,target 17 + 138:272 shift + 103:317 reduce + 77:315 shift + 56:369,target 194 + 77:316 shift + 12:347 shift + 23:261,target 5 + 226:0 reduce + 93:317,target 73 + 23:257 shift + 155:257,target 1 + 23:258 shift + 47:315 shift + 8:262,target 6 + 23:259 shift + 23:260 shift + 38:366,target 175 + 47:316 shift + 111:0,target 35 + 23:261 shift + 23:262 shift + 17:0 reduce + 23:263 shift + 23:264 shift + 12:357 shift + 23:265 shift + 17:317 reduce + 23:266 shift + 72:370 goto + 23:267 shift + 104:0 reduce + 23:330,target 141 + 60:0 reduce + 235:262,target 6 + 84:0,target 50 + 238:317 reduce + 7:347,target 32 + 30:262,target 6 + 6:317 reduce + 141:315,target 180 + 12:366 goto + 53:0,target 74 + 208:317 reduce + 198:317 reduce + 12:258,target 2 + 107:317,target 31 + 0:380,target 28 + 153:317,target 1 + 22:0,target 1 + 208:317,target 149 + 198:317,target 158 + 188:0 reduce + 57:370,target 198 + 168:317 reduce + 242:0,target 162 + 94:317,target 18 + 241:0 reduce + 211:0,target 129 + 25:355,target 155 + 137:271,target 195 + 0:337,target 14 + 12:383 goto + 170:0,target 66 + 169:0,target 104 + 108:317 reduce + 83:317 reduce + 236:262,target 6 + 15:267,target 73 + 8:347,target 39 + 118:0 reduce + 107:0,target 31 + 53:317 reduce + 22:321,target 128 + 6:0 reduce + 13:258,target 2 + 108:317,target 32 + 58:271 shift + 161:0 reduce + 154:317,target 1 + 129:261,target 5 + 23:317 reduce + 58:272 shift + 210:317,target 127 + 209:317,target 126 + 199:317,target 11 + 7:0,target 1 + 19:312,target 89 + 23:321 shift + 95:317,target 19 + 81:0,target 80 + 21:285,target 104 + 77:375 goto + 213:0 reduce + 23:324 shift + 0:354,target 24 + 138:271,target 199 + 214:317 reduce + 47:375 goto + 23:330 shift + 174:317 reduce + 238:0,target 165 + 237:262,target 6 + 46:0 reduce + 207:0,target 148 + 197:0,target 17 + 144:317 reduce + 23:321,target 139 + 133:0 reduce + 166:0,target 113 + 110:317,target 34 + 109:317,target 33 + 88:0 reduce + 60:258,target 2 + 155:317,target 1 + 114:317 reduce + 211:317,target 129 + 88:317 reduce + 0:260,target 4 + 0:259,target 3 + 175:0 reduce + 138:368 goto + 96:317,target 20 + 23:349 shift + 104:0,target 28 + 227:0 reduce + 28:317 reduce + 4:0,target 6 + 0:328,target 10 + 21:371,target 125 + 134:270,target 189 + 134:269,target 188 + 23:366 goto + 46:0,target 1 + 105:0 reduce + 220:317 reduce + 219:317 reduce + 61:0 reduce + 15:258,target 2 + 39:315,target 176 + 40:315,target 177 + 155:257 shift + 111:317,target 35 + 15:0,target 1 + 61:258,target 2 + 156:317,target 83 + 155:258 shift + 212:317,target 130 + 155:260 shift + 155:259 shift + 180:317 reduce + 179:317 reduce + 155:261 shift + 31:364,target 166 + 235:0,target 1 + 155:262 shift + 52:317,target 92 + 97:317,target 21 + 204:0,target 151 + 194:0,target 157 + 150:317 reduce + 149:317 reduce + 200:0 reduce + 190:0 reduce + 189:0 reduce + 69:268,target 187 + 163:0,target 110 + 21:276,target 95 + 120:317 reduce + 119:317 reduce + 0:345,target 19 + 22:259,target 3 + 22:260,target 4 + 242:0 reduce + 94:317 reduce + 132:0,target 115 + 23:389 goto + 7:261,target 5 + 101:0,target 25 + 79:262,target 6 + 64:317 shift + 69:268 shift + 34:315 shift + 69:269 shift + 69:270 shift + 112:317,target 36 + 157:317,target 244 + 120:0 reduce + 119:0 reduce + 213:317,target 128 + 1:0,target 2 + 13:266,target 57 + 53:317,target 74 + 58:368 goto + 98:317,target 22 + 7:0 reduce + 162:0 reduce + 43:0,target 75 + 225:317 reduce + 21:293,target 112 + 21:303,target 122 + 12:0,target 1 + 214:0 reduce + 23:259,target 3 + 23:260,target 4 + 47:316,target 181 + 185:317 reduce + 232:0,target 138 + 140:262,target 6 + 28:377 goto + 8:261,target 5 + 201:0,target 156 + 191:0,target 155 + 155:317 reduce + 151:392,target 239 + 0:319,target 7 + 0:320,target 8 + 160:0,target 107 + 159:0,target 103 + 125:317 reduce + 113:317,target 37 + 158:317,target 101 + 214:317,target 131 + 99:317 reduce + 47:375,target 182 + 235:261,target 5 + 30:261,target 5 + 99:317,target 23 + 70:315 shift + 90:0 reduce + 89:0 reduce + 56:274,target 193 + 12:257,target 1 + 15:257 shift + 15:258 shift + 39:315 shift + 40:315 shift + 176:0 reduce + 15:259 shift + 15:260 shift + 15:261 shift + 15:262 shift + 236:257 shift + 15:263 shift + 48:316,target 181 + 236:258 shift + 15:264 shift + 236:260 shift + 236:259 shift + 15:265 shift + 236:261 shift + 228:0 reduce + 10:317 shift + 15:266 shift + 236:262 shift + 15:267 shift + 0:336,target 13 + 231:317 reduce + 114:317,target 38 + 160:317,target 107 + 159:317,target 103 + 215:317,target 132 + 201:317 reduce + 191:317 reduce + 48:375,target 183 + 236:261,target 5 + 228:0,target 143 + 106:0 reduce + 10:317,target 43 + 15:266,target 72 + 151:366,target 238 + 187:0,target 8 + 161:317 reduce + 46:366,target 179 + 57:274,target 197 + 148:0 reduce + 13:257,target 1 + 131:315 shift + 156:0,target 83 + 129:260,target 4 + 129:259,target 3 + 7:321,target 29 + 58:368,target 201 + 155:366 goto + 19:311,target 88 + 49:316,target 181 + 201:0 reduce + 191:0 reduce + 125:0,target 90 + 21:284,target 103 + 101:317 reduce + 75:315 shift + 136:273 shift + 0:353,target 23 + 75:316 shift + 136:274 shift + 243:0 reduce + 13:326,target 61 + 98:0,target 22 + 45:317 shift + 115:317,target 39 + 161:317,target 108 + 216:317,target 133 + 49:375,target 184 + 69:367 goto + 237:261,target 5 + 11:317,target 44 + 67:0,target 82 + 15:317 reduce + 152:366,target 240 + 121:0 reduce + 15:321 shift + 36:0,target 77 + 236:317 reduce + 4:317 reduce + 60:257,target 1 + 8:0 reduce + 8:321,target 37 + 21:275 shift + 163:0 reduce + 0:258,target 2 + 21:276 shift + 206:317 reduce + 196:317 reduce + 21:277 shift + 225:0,target 142 + 21:278 shift + 15:331 shift + 21:279 shift + 21:280 shift + 15:332 shift + 21:281 shift + 15:333 shift + 21:282 shift + 23:267,target 138 + 215:0 reduce + 184:0,target 99 + 166:317 reduce + 21:283 shift + 38:262,target 6 + 21:284 shift + 21:285 shift + 21:286 shift + 153:0,target 1 + 21:287 shift + 54:367,target 190 + 21:288 shift +} + +array set grid::rules { + 9,l 367 + 164,l 391 + 49,l 373 + 50,l 373 + 136,l 388 + 92,l 383 + 22,l 372 + 108,l 385 + 64,l 378 + 151,l 390 + 36,l 372 + 123,l 387 + 78,l 380 + 165,l 392 + 51,l 373 + 137,l 389 + 93,l 383 + 23,l 372 + 109,l 385 + 110,l 385 + 65,l 379 + 152,l 390 + 37,l 372 + 124,l 387 + 79,l 380 + 80,l 380 + 166,l 392 + 10,l 367 + 52,l 373 + 138,l 389 + 94,l 383 + 24,l 372 + 111,l 385 + 66,l 379 + 153,l 390 + 38,l 372 + 125,l 388 + 81,l 380 + 167,l 392 + 11,l 368 + 53,l 373 + 139,l 389 + 140,l 389 + 95,l 383 + 25,l 372 + 112,l 385 + 67,l 380 + 0,l 393 + 154,l 390 + 39,l 372 + 40,l 372 + 126,l 388 + 82,l 380 + 168,l 392 + 12,l 368 + 54,l 373 + 141,l 389 + 96,l 383 + 26,l 372 + 113,l 385 + 68,l 380 + 1,l 366 + 155,l 390 + 41,l 372 + 127,l 388 + 83,l 380 + 13,l 369 + 100,l 384 + 55,l 373 + 142,l 389 + 97,l 383 + 27,l 372 + 114,l 385 + 69,l 380 + 70,l 380 + 2,l 366 + 156,l 390 + 42,l 372 + 128,l 388 + 84,l 380 + 14,l 369 + 101,l 384 + 56,l 374 + 143,l 389 + 98,l 383 + 28,l 372 + 115,l 386 + 71,l 380 + 3,l 366 + 157,l 390 + 43,l 372 + 129,l 388 + 130,l 388 + 85,l 380 + 15,l 370 + 102,l 384 + 57,l 374 + 144,l 389 + 99,l 383 + 30,l 372 + 29,l 372 + 116,l 386 + 72,l 380 + 4,l 366 + 158,l 390 + 44,l 372 + 131,l 388 + 86,l 380 + 16,l 370 + 103,l 384 + 58,l 375 + 145,l 389 + 31,l 372 + 117,l 386 + 73,l 380 + 5,l 366 + 160,l 391 + 159,l 390 + 45,l 372 + 132,l 388 + 87,l 381 + 17,l 370 + 104,l 384 + 59,l 375 + 60,l 376 + 146,l 389 + 32,l 372 + 118,l 386 + 74,l 380 + 6,l 366 + 161,l 391 + 46,l 372 + 133,l 388 + 88,l 381 + 18,l 371 + 105,l 384 + 61,l 377 + 147,l 390 + 33,l 372 + 119,l 386 + 120,l 387 + 75,l 380 + 7,l 366 + 162,l 391 + 47,l 372 + 134,l 388 + 89,l 381 + 90,l 382 + 20,l 371 + 19,l 371 + 106,l 384 + 62,l 376 + 148,l 390 + 34,l 372 + 121,l 387 + 76,l 380 + 8,l 367 + 163,l 391 + 48,l 372 + 135,l 388 + 91,l 382 + 21,l 371 + 107,l 385 + 63,l 378 + 149,l 390 + 150,l 390 + 35,l 372 + 122,l 387 + 77,l 380 +} + +array set grid::rules { + 122,dc 2 + 12,dc 1 + 77,dc 2 + 114,dc 1 + 69,dc 1 + 70,dc 2 + 106,dc 2 + 9,dc 1 + 62,dc 3 + 2,dc 1 + 164,dc 2 + 54,dc 1 + 156,dc 2 + 46,dc 1 + 148,dc 2 + 38,dc 1 + 141,dc 2 + 31,dc 1 + 96,dc 2 + 133,dc 2 + 23,dc 1 + 88,dc 2 + 125,dc 1 + 15,dc 1 + 81,dc 2 + 117,dc 2 + 73,dc 2 + 109,dc 1 + 110,dc 1 + 65,dc 1 + 102,dc 2 + 5,dc 1 + 167,dc 2 + 57,dc 1 + 160,dc 2 + 159,dc 2 + 49,dc 1 + 50,dc 1 + 152,dc 2 + 42,dc 1 + 144,dc 2 + 34,dc 1 + 99,dc 2 + 136,dc 2 + 26,dc 1 + 92,dc 1 + 128,dc 2 + 18,dc 1 + 84,dc 1 + 121,dc 2 + 11,dc 1 + 76,dc 2 + 113,dc 1 + 68,dc 1 + 105,dc 2 + 8,dc 1 + 61,dc 0 + 1,dc 0 + 163,dc 2 + 53,dc 1 + 155,dc 2 + 45,dc 1 + 147,dc 1 + 37,dc 1 + 139,dc 2 + 140,dc 2 + 30,dc 1 + 29,dc 1 + 95,dc 2 + 132,dc 2 + 22,dc 1 + 87,dc 1 + 124,dc 2 + 14,dc 1 + 79,dc 2 + 80,dc 2 + 116,dc 2 + 72,dc 2 + 108,dc 1 + 64,dc 1 + 101,dc 2 + 4,dc 1 + 166,dc 2 + 56,dc 1 + 158,dc 2 + 48,dc 1 + 151,dc 2 + 41,dc 1 + 143,dc 2 + 33,dc 1 + 98,dc 2 + 135,dc 2 + 25,dc 1 + 91,dc 1 + 127,dc 2 + 17,dc 1 + 83,dc 2 + 119,dc 2 + 120,dc 1 + 10,dc 1 + 75,dc 2 + 112,dc 1 + 67,dc 1 + 104,dc 2 + 7,dc 1 + 59,dc 1 + 60,dc 1 + 0,dc 1 + 162,dc 2 + 52,dc 1 + 154,dc 2 + 44,dc 1 + 146,dc 2 + 36,dc 1 + 138,dc 2 + 28,dc 1 + 94,dc 2 + 131,dc 2 + 21,dc 1 + 86,dc 2 + 123,dc 2 + 13,dc 1 + 78,dc 2 + 115,dc 1 + 71,dc 2 + 107,dc 1 + 63,dc 1 + 100,dc 1 + 3,dc 1 + 165,dc 1 + 55,dc 1 + 157,dc 2 + 47,dc 1 + 149,dc 2 + 150,dc 2 + 39,dc 1 + 40,dc 1 + 142,dc 2 + 32,dc 1 + 97,dc 2 + 134,dc 2 + 24,dc 1 + 89,dc 2 + 90,dc 1 + 126,dc 2 + 16,dc 1 + 82,dc 2 + 118,dc 2 + 74,dc 2 + 111,dc 1 + 66,dc 1 + 103,dc 2 + 6,dc 1 + 168,dc 2 + 58,dc 1 + 161,dc 2 + 51,dc 1 + 153,dc 2 + 43,dc 1 + 145,dc 2 + 35,dc 1 + 137,dc 1 + 27,dc 1 + 93,dc 2 + 129,dc 2 + 130,dc 2 + 20,dc 1 + 19,dc 1 + 85,dc 2 +} + +array set grid::rules { + 41,line 255 + 37,line 251 + 34,line 248 + 31,line 245 + 27,line 241 + 24,line 238 + 21,line 234 + 17,line 228 + 14,line 223 + 11,line 218 + 9,line 214 + 6,line 210 + 3,line 207 + 168,line 425 + 165,line 422 + 162,line 417 + 158,line 411 + 155,line 407 + 152,line 404 + 148,line 400 + 145,line 395 + 142,line 391 + 138,line 387 + 135,line 382 + 132,line 379 + 128,line 374 + 125,line 371 + 122,line 365 + 118,line 359 + 115,line 355 + 99,line 332 + 112,line 350 + 96,line 329 + 108,line 346 + 93,line 325 + 105,line 341 + 89,line 317 + 90,line 320 + 102,line 337 + 86,line 312 + 83,line 309 + 79,line 305 + 80,line 306 + 76,line 302 + 73,line 299 + 69,line 295 + 70,line 296 + 66,line 289 + 63,line 284 + 59,line 277 + 60,line 280 + 56,line 272 + 53,line 268 + 49,line 264 + 50,line 265 + 46,line 260 + 43,line 257 + 39,line 253 + 40,line 254 + 36,line 250 + 33,line 247 + 30,line 244 + 29,line 243 + 26,line 240 + 23,line 237 + 20,line 233 + 19,line 232 + 16,line 227 + 13,line 222 + 10,line 215 + 8,line 213 + 5,line 209 + 2,line 206 + 167,line 424 + 164,line 419 + 161,line 416 + 157,line 410 + 154,line 406 + 151,line 403 + 147,line 399 + 144,line 394 + 141,line 390 + 137,line 386 + 134,line 381 + 131,line 378 + 127,line 373 + 124,line 368 + 121,line 364 + 117,line 357 + 114,line 352 + 98,line 331 + 111,line 349 + 95,line 328 + 107,line 345 + 92,line 324 + 104,line 340 + 88,line 316 + 101,line 336 + 85,line 311 + 82,line 308 + 78,line 304 + 75,line 301 + 72,line 298 + 68,line 293 + 65,line 288 + 62,line 281 + 58,line 276 + 55,line 270 + 52,line 267 + 48,line 262 + 45,line 259 + 42,line 256 + 38,line 252 + 35,line 249 + 32,line 246 + 28,line 242 + 25,line 239 + 22,line 236 + 18,line 231 + 15,line 226 + 12,line 219 + 7,line 211 + 4,line 208 + 1,line 205 + 61,e 1 + 166,line 423 + 163,line 418 + 160,line 415 + 159,line 412 + 156,line 408 + 153,line 405 + 149,line 401 + 150,line 402 + 146,line 396 + 143,line 392 + 139,line 388 + 140,line 389 + 136,line 383 + 133,line 380 + 129,line 376 + 130,line 377 + 126,line 372 + 123,line 367 + 119,line 360 + 120,line 363 + 116,line 356 + 113,line 351 + 97,line 330 + 109,line 347 + 110,line 348 + 94,line 326 + 106,line 342 + 91,line 321 + 103,line 339 + 87,line 315 + 100,line 335 + 84,line 310 + 81,line 307 + 77,line 303 + 74,line 300 + 71,line 297 + 67,line 292 + 64,line 285 + 61,line 280 + 57,line 273 + 54,line 269 + 51,line 266 + 47,line 261 + 44,line 258 +} + +array set grid::lr1_table { + 66,trans {} + 35 {{100 {0 317} 1}} + 85,trans {} + 36 {{77 {0 317} 2}} + 37 {{121 {0 317} 1}} + 38 {{123 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 39 {{124 {0 317} 1}} + 40 {{122 {0 317} 1}} + 117,trans {} + 41 {{120 {0 317} 1}} + 136,trans {{273 192} {274 193} {369 226}} + 42 {{79 {0 317} 2}} + 155,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 243}} + 43 {{75 {0 317} 2}} + 174,trans {} + 44 {{76 {0 317} 2}} + 203,trans {} + 193,trans {} + 45 {{93 {0 317} 1}} + 222,trans {} + 46 {{95 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 241,trans {} + 47 {{97 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 48 {{98 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 49 {{99 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 50 {{96 {0 317} 1}} + 27,trans {} + 46,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 179}} + 51 {{94 {0 317} 1}} + 65,trans {{317 208}} + 52 {{92 {0 317} 1}} + 84,trans {} + 53 {{74 {0 317} 2}} + 54 {{154 {0 317} 1} {8 {0 317} 0} {9 {0 317} 0} {10 {0 317} 0}} + 55 {{155 {0 317} 1}} + 56 {{157 {0 317} 1} {13 {0 317} 0} {14 {0 317} 0}} + 116,trans {} + 57 {{158 {0 317} 1} {15 {0 317} 0} {16 {0 317} 0} {17 {0 317} 0}} + 135,trans {{315 225}} + 58 {{156 {0 317} 1} {11 {0 317} 0} {12 {0 317} 0}} + 154,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 242}} + 59 {{159 {0 317} 1}} + 60 {{150 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 173,trans {} + 61 {{151 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 202,trans {} + 192,trans {} + 62 {{152 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 221,trans {} + 63 {{153 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 240,trans {} + 239,trans {} + 64 {{148 {0 317} 1}} + 65 {{149 {0 317} 1}} + 66 {{147 {0 317} 1}} + 26,trans {} + 45,trans {{317 178}} + 67 {{82 {0 317} 2}} + 64,trans {{317 207}} + 68 {{85 {0 317} 2}} + 83,trans {} + 69 {{126 {0 317} 1} {8 {0 317} 0} {9 {0 317} 0} {10 {0 317} 0}} + 70 {{127 {0 317} 1}} + 71 {{129 {0 317} 1} {13 {0 317} 0} {14 {0 317} 0}} + 72 {{130 {0 317} 1} {15 {0 317} 0} {16 {0 317} 0} {17 {0 317} 0}} + 73 {{128 {0 317} 1} {11 {0 317} 0} {12 {0 317} 0}} + 115,trans {} + 74 {{131 {0 317} 1}} + 134,trans {{268 187} {269 188} {270 189} {367 224}} + 75 {{132 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 153,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 241}} + 76 {{133 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 172,trans {} + 77 {{134 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 201,trans {} + 191,trans {} + 78 {{135 {0 317} 1} {65 {0 317} 0} {66 {0 317} 0}} + 220,trans {} + 219,trans {} + 79 {{136 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 80 {{125 {0 317} 1}} + 238,trans {} + 81 {{80 {0 317} 2}} + 82 {{86 {0 317} 2}} + 83 {{49 {0 317} 1}} + 25,trans {{319 151} {320 152} {334 153} {353 154} {355 155} {391 156}} + 44,trans {} + 84 {{50 {0 317} 1}} + 63,trans {{315 180} {316 181} {375 206}} + 85 {{51 {0 317} 1}} + 82,trans {} + 86 {{52 {0 317} 1}} + 87 {{53 {0 317} 1}} + 0 {{0 0 0} {60 0 0} {62 0 0} {67 {0 317} 0} {68 {0 317} 0} {69 {0 317} 0} {70 {0 317} 0} {71 {0 317} 0} {72 {0 317} 0} {73 {0 317} 0} {74 {0 317} 0} {75 {0 317} 0} {76 {0 317} 0} {77 {0 317} 0} {78 {0 317} 0} {79 {0 317} 0} {80 {0 317} 0} {81 {0 317} 0} {82 {0 317} 0} {83 {0 317} 0} {84 {0 317} 0} {85 {0 317} 0} {86 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 88 {{54 {0 317} 1}} + 1 {{2 {0 317} 1}} + 89 {{55 {0 317} 1}} + 90 {{72 {0 317} 2}} + 114,trans {} + 2 {{5 {0 317} 1}} + 91 {{56 {0 317} 1}} + 133,trans {} + 3 {{3 {0 317} 1}} + 92 {{57 {0 317} 1}} + 152,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 240}} + 4 {{6 {0 317} 1}} + 93 {{73 {0 317} 2}} + 171,trans {} + 5 {{4 {0 317} 1}} + 94 {{18 {0 317} 1}} + 200,trans {} + 190,trans {} + 189,trans {} + 6 {{7 {0 317} 1}} + 95 {{19 {0 317} 1}} + 218,trans {} + 7 {{77 {0 317} 1} {100 {0 317} 0} {101 {0 317} 0} {102 {0 317} 0} {103 {0 317} 0} {104 {0 317} 0} {105 {0 317} 0} {106 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 96 {{20 {0 317} 1}} + 237,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 247}} + 8 {{79 {0 317} 1} {120 {0 317} 0} {121 {0 317} 0} {122 {0 317} 0} {123 {0 317} 0} {124 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 97 {{21 {0 317} 1}} + 9 {{69 {0 317} 1}} + 98 {{22 {0 317} 1}} + 99 {{23 {0 317} 1}} + 24,trans {{318 145} {319 146} {339 147} {342 148} {378 149} {381 150}} + 43,trans {} + 62,trans {{315 180} {316 181} {375 205}} + 81,trans {} + 99,trans {} + 113,trans {} + 132,trans {} + 151,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {336 235} {338 236} {352 237} {366 238} {392 239}} + 170,trans {} + 169,trans {} + 188,trans {} + 217,trans {} + 236,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 246}} + 23,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 134} {264 135} {265 136} {266 137} {267 138} {321 139} {324 140} {330 141} {349 142} {366 143} {389 144}} + 42,trans {} + 61,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 204}} + 80,trans {} + 79,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 219}} + 98,trans {} + 9,trans {} + 112,trans {} + 131,trans {{315 223}} + 150,trans {} + 149,trans {} + 168,trans {} + 187,trans {} + 216,trans {} + 235,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 245}} + 22,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {321 128} {323 129} {347 130} {357 131} {366 132} {386 133}} + 41,trans {} + 60,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 203}} + 59,trans {{317 202}} + 78,trans {{327 170} {335 171} {379 218}} + 97,trans {} + 8,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {321 37} {323 38} {347 39} {357 40} {366 41} {387 42}} + 111,trans {} + 130,trans {{315 222}} + 129,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 221}} + 148,trans {} + 100 {{24 {0 317} 1}} + 167,trans {} + 101 {{25 {0 317} 1}} + 186,trans {} + 102 {{26 {0 317} 1}} + 215,trans {} + 103 {{27 {0 317} 1}} + 234,trans {} + 104 {{28 {0 317} 1}} + 105 {{29 {0 317} 1}} + 106 {{30 {0 317} 1}} + 21,trans {{275 94} {276 95} {277 96} {278 97} {279 98} {280 99} {281 100} {282 101} {283 102} {284 103} {285 104} {286 105} {287 106} {288 107} {289 108} {290 109} {291 110} {292 111} {293 112} {294 113} {295 114} {296 115} {297 116} {298 117} {299 118} {300 119} {301 120} {302 121} {303 122} {304 123} {305 124} {371 125} {372 126} {382 127}} + 40,trans {{315 177}} + 39,trans {{315 176}} + 107 {{31 {0 317} 1}} + 58,trans {{271 199} {272 200} {368 201}} + 108 {{32 {0 317} 1}} + 77,trans {{315 180} {316 181} {375 217}} + 109 {{33 {0 317} 1}} + 110 {{34 {0 317} 1}} + 96,trans {} + 7,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {321 29} {323 30} {340 31} {347 32} {354 33} {357 34} {366 35} {384 36}} + 111 {{35 {0 317} 1}} + 112 {{36 {0 317} 1}} + 113 {{37 {0 317} 1}} + 110,trans {} + 109,trans {} + 114 {{38 {0 317} 1}} + 128,trans {{317 220}} + 115 {{39 {0 317} 1}} + 147,trans {{327 170} {335 171} {379 234}} + 116 {{40 {0 317} 1}} + 166,trans {} + 117 {{41 {0 317} 1}} + 185,trans {} + 118 {{42 {0 317} 1}} + 214,trans {} + 119 {{43 {0 317} 1}} + 120 {{44 {0 317} 1}} + 233,trans {} + 121 {{45 {0 317} 1}} + 122 {{46 {0 317} 1}} + 19,trans {{306 83} {307 84} {308 85} {309 86} {310 87} {311 88} {312 89} {373 90}} + 20,trans {{313 91} {314 92} {374 93}} + 123 {{47 {0 317} 1}} + 38,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 175}} + 124 {{48 {0 317} 1}} + 57,trans {{271 195} {272 196} {274 197} {370 198}} + 125 {{90 {0 317} 1}} + 76,trans {{315 180} {316 181} {375 216}} + 126 {{91 {0 317} 1}} + 95,trans {} + 6,trans {} + 127 {{71 {0 317} 2}} + 128 {{116 {0 317} 1}} + 129 {{118 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 130 {{119 {0 317} 1}} + 108,trans {} + 131 {{117 {0 317} 1}} + 127,trans {} + 132 {{115 {0 317} 1}} + 146,trans {{327 170} {335 171} {379 233}} + 133 {{78 {0 317} 2}} + 165,trans {} + 134 {{141 {0 317} 1} {8 {0 317} 0} {9 {0 317} 0} {10 {0 317} 0}} + 184,trans {} + 135 {{142 {0 317} 1}} + 213,trans {} + 136 {{144 {0 317} 1} {13 {0 317} 0} {14 {0 317} 0}} + 232,trans {} + 137 {{145 {0 317} 1} {15 {0 317} 0} {16 {0 317} 0} {17 {0 317} 0}} + 138 {{143 {0 317} 1} {11 {0 317} 0} {12 {0 317} 0}} + 18,trans {{317 82}} + 139 {{146 {0 317} 1}} + 140 {{139 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 37,trans {{317 174}} + 141 {{140 {0 317} 1} {58 {0 317} 0} {59 {0 317} 0}} + 56,trans {{273 192} {274 193} {369 194}} + 142 {{138 {0 317} 1}} + 75,trans {{315 180} {316 181} {375 215}} + 143 {{137 {0 317} 1}} + 94,trans {} + 5,trans {} + 144 {{81 {0 317} 2}} + 145 {{63 {0 317} 1}} + 146 {{88 {0 317} 1} {65 {0 317} 0} {66 {0 317} 0}} + 107,trans {} + 147 {{89 {0 317} 1} {65 {0 317} 0} {66 {0 317} 0}} + 126,trans {} + 148 {{64 {0 317} 1}} + 145,trans {} + 149 {{87 {0 317} 1}} + 150 {{70 {0 317} 2}} + 164,trans {} + 151 {{161 {0 317} 1} {165 {0 317} 0} {166 {0 317} 0} {167 {0 317} 0} {168 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 183,trans {} + 152 {{163 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 212,trans {} + 153 {{160 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 231,trans {} + 154 {{162 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 155 {{164 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 17,trans {} + 156 {{83 {0 317} 2}} + 36,trans {} + 157 {{62 0 2}} + 55,trans {{315 191}} + 158 {{101 {0 317} 2}} + 74,trans {{317 214}} + 159 {{103 {0 317} 2}} + 160 {{107 {0 317} 1}} + 93,trans {} + 161 {{108 {0 317} 1}} + 4,trans {} + 162 {{109 {0 317} 1}} + 163 {{110 {0 317} 1}} + 106,trans {} + 164 {{111 {0 317} 1}} + 125,trans {} + 165 {{112 {0 317} 1}} + 144,trans {} + 166 {{113 {0 317} 1}} + 163,trans {} + 167 {{114 {0 317} 1}} + 182,trans {} + 168 {{106 {0 317} 2}} + 211,trans {} + 170 {{66 {0 317} 1}} + 169 {{104 {0 317} 2}} + 230,trans {} + 229,trans {} + 171 {{65 {0 317} 1}} + 172 {{105 {0 317} 2}} + 173 {{102 {0 317} 2}} + 16,trans {} + 174 {{121 {0 317} 2}} + 35,trans {} + 54,trans {{268 187} {269 188} {270 189} {367 190}} + 175 {{123 {0 317} 2}} + 73,trans {{271 199} {272 200} {368 213}} + 176 {{124 {0 317} 2}} + 92,trans {} + 177 {{122 {0 317} 2}} + 3,trans {} + 178 {{93 {0 317} 2}} + 180 {{58 {0 317} 1}} + 179 {{95 {0 317} 2}} + 105,trans {} + 181 {{59 {0 317} 1}} + 124,trans {} + 182 {{97 {0 317} 2}} + 143,trans {} + 183 {{98 {0 317} 2}} + 162,trans {} + 184 {{99 {0 317} 2}} + 181,trans {} + 185 {{96 {0 317} 2}} + 210,trans {} + 209,trans {} + 199,trans {} + 186 {{94 {0 317} 2}} + 228,trans {} + 187 {{8 {0 317} 1}} + 247,trans {} + 188 {{9 {0 317} 1}} + 200 {{12 {0 317} 1}} + 190 {{154 {0 317} 2}} + 189 {{10 {0 317} 1}} + 15,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 69} {264 70} {265 71} {266 72} {267 73} {321 74} {331 75} {332 76} {333 77} {354 78} {355 79} {366 80} {388 81}} + 201 {{156 {0 317} 2}} + 191 {{155 {0 317} 2}} + 34,trans {{315 173}} + 202 {{159 {0 317} 2}} + 192 {{13 {0 317} 1}} + 53,trans {} + 72,trans {{271 195} {272 196} {274 197} {370 212}} + 203 {{150 {0 317} 2}} + 193 {{14 {0 317} 1}} + 91,trans {} + 204 {{151 {0 317} 2}} + 194 {{157 {0 317} 2}} + 2,trans {} + 205 {{152 {0 317} 2}} + 195 {{15 {0 317} 1}} + 206 {{153 {0 317} 2}} + 196 {{16 {0 317} 1}} + 104,trans {} + 207 {{148 {0 317} 2}} + 197 {{17 {0 317} 1}} + 123,trans {} + 208 {{149 {0 317} 2}} + 198 {{158 {0 317} 2}} + 142,trans {{317 232}} + 210 {{127 {0 317} 2}} + 209 {{126 {0 317} 2}} + 199 {{11 {0 317} 1}} + 161,trans {} + 211 {{129 {0 317} 2}} + 180,trans {} + 179,trans {} + 212 {{130 {0 317} 2}} + 208,trans {} + 198,trans {} + 213 {{128 {0 317} 2}} + 227,trans {} + 214 {{131 {0 317} 2}} + 246,trans {} + 215 {{132 {0 317} 2}} + 216 {{133 {0 317} 2}} + 14,trans {{317 68}} + 217 {{134 {0 317} 2}} + 33,trans {{327 170} {335 171} {379 172}} + 218 {{135 {0 317} 2}} + 52,trans {} + 220 {{116 {0 317} 2}} + 219 {{136 {0 317} 2}} + 71,trans {{273 192} {274 193} {369 211}} + 221 {{118 {0 317} 2}} + 90,trans {} + 89,trans {} + 1,trans {} + 222 {{119 {0 317} 2}} + 223 {{117 {0 317} 2}} + 224 {{141 {0 317} 2}} + 103,trans {} + 225 {{142 {0 317} 2}} + 122,trans {} + 141,trans {{315 180} {316 181} {375 231}} + 226 {{144 {0 317} 2}} + 160,trans {} + 159,trans {} + 227 {{145 {0 317} 2}} + 178,trans {} + 228 {{143 {0 317} 2}} + 207,trans {} + 197,trans {} + 230 {{139 {0 317} 2}} + 229 {{146 {0 317} 2}} + 226,trans {} + 231 {{140 {0 317} 2}} + 245,trans {} + 232 {{138 {0 317} 2}} + 233 {{88 {0 317} 2}} + 13,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 54} {264 55} {265 56} {266 57} {267 58} {321 59} {325 60} {326 61} {331 62} {332 63} {350 64} {351 65} {366 66} {390 67}} + 234 {{89 {0 317} 2}} + 32,trans {{315 169}} + 235 {{168 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 51,trans {{315 186}} + 236 {{166 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 70,trans {{315 210}} + 69,trans {{268 187} {269 188} {270 189} {367 209}} + 237 {{167 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 88,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {319 7} {320 8} {322 9} {328 10} {329 11} {334 12} {336 13} {337 14} {339 15} {341 16} {343 17} {344 18} {345 19} {346 20} {348 21} {352 22} {353 23} {354 24} {356 25} {366 26} {376 27} {380 28}} + 238 {{165 {0 317} 1}} + 240 {{163 {0 317} 2}} + 239 {{161 {0 317} 2}} + 241 {{160 {0 317} 2}} + 102,trans {} + 242 {{162 {0 317} 2}} + 121,trans {} + 243 {{164 {0 317} 2}} + 140,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 230}} + 139,trans {{317 229}} + 158,trans {} + 244 {{62 0 3}} + 245 {{168 {0 317} 2}} + 177,trans {} + 246 {{166 {0 317} 2}} + 206,trans {} + 196,trans {} + 247 {{167 {0 317} 2}} + 225,trans {} + 244,trans {} + 12,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {321 45} {323 46} {331 47} {332 48} {333 49} {347 50} {357 51} {366 52} {383 53}} + 31,trans {{358 160} {359 161} {360 162} {361 163} {362 164} {363 165} {364 166} {365 167} {385 168}} + 50,trans {{315 185}} + 49,trans {{315 180} {316 181} {375 184}} + 68,trans {} + 87,trans {} + 101,trans {} + 120,trans {} + 119,trans {} + 138,trans {{271 199} {272 200} {368 228}} + 157,trans {{317 244}} + 10 {{75 {0 317} 1}} + 176,trans {} + 11 {{76 {0 317} 1}} + 205,trans {} + 195,trans {} + 12 {{74 {0 317} 1} {92 {0 317} 0} {93 {0 317} 0} {94 {0 317} 0} {95 {0 317} 0} {96 {0 317} 0} {97 {0 317} 0} {98 {0 317} 0} {99 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 224,trans {} + 13 {{82 {0 317} 1} {147 {0 317} 0} {148 {0 317} 0} {149 {0 317} 0} {150 {0 317} 0} {151 {0 317} 0} {152 {0 317} 0} {153 {0 317} 0} {154 {0 317} 0} {155 {0 317} 0} {156 {0 317} 0} {157 {0 317} 0} {158 {0 317} 0} {159 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 243,trans {} + 14 {{85 {0 317} 1}} + 15 {{80 {0 317} 1} {125 {0 317} 0} {126 {0 317} 0} {127 {0 317} 0} {128 {0 317} 0} {129 {0 317} 0} {130 {0 317} 0} {131 {0 317} 0} {132 {0 317} 0} {133 {0 317} 0} {134 {0 317} 0} {135 {0 317} 0} {136 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 11,trans {{317 44}} + 16 {{68 {0 317} 1}} + 29,trans {{317 158}} + 30,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {366 159}} + 48,trans {{315 180} {316 181} {375 183}} + 17 {{84 {0 317} 1}} + 67,trans {} + 18 {{86 {0 317} 1}} + 86,trans {} + 20 {{73 {0 317} 1} {56 {0 317} 0} {57 {0 317} 0}} + 19 {{72 {0 317} 1} {49 {0 317} 0} {50 {0 317} 0} {51 {0 317} 0} {52 {0 317} 0} {53 {0 317} 0} {54 {0 317} 0} {55 {0 317} 0}} + 21 {{71 {0 317} 1} {90 {0 317} 0} {91 {0 317} 0} {18 {0 317} 0} {19 {0 317} 0} {20 {0 317} 0} {21 {0 317} 0} {22 {0 317} 0} {23 {0 317} 0} {24 {0 317} 0} {25 {0 317} 0} {26 {0 317} 0} {27 {0 317} 0} {28 {0 317} 0} {29 {0 317} 0} {30 {0 317} 0} {31 {0 317} 0} {32 {0 317} 0} {33 {0 317} 0} {34 {0 317} 0} {35 {0 317} 0} {36 {0 317} 0} {37 {0 317} 0} {38 {0 317} 0} {39 {0 317} 0} {40 {0 317} 0} {41 {0 317} 0} {42 {0 317} 0} {43 {0 317} 0} {44 {0 317} 0} {45 {0 317} 0} {46 {0 317} 0} {47 {0 317} 0} {48 {0 317} 0}} + 22 {{78 {0 317} 1} {115 {0 317} 0} {116 {0 317} 0} {117 {0 317} 0} {118 {0 317} 0} {119 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 100,trans {} + 23 {{81 {0 317} 1} {137 {0 317} 0} {138 {0 317} 0} {139 {0 317} 0} {140 {0 317} 0} {141 {0 317} 0} {142 {0 317} 0} {143 {0 317} 0} {144 {0 317} 0} {145 {0 317} 0} {146 {0 317} 0} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 118,trans {} + 24 {{70 {0 317} 1} {87 {0 317} 0} {88 {0 317} 0} {89 {0 317} 0} {63 {0 317} 0} {64 {0 317} 0}} + 137,trans {{271 195} {272 196} {274 197} {370 227}} + 25 {{83 {0 317} 1} {160 {0 317} 0} {161 {0 317} 0} {162 {0 317} 0} {163 {0 317} 0} {164 {0 317} 0}} + 156,trans {} + 26 {{67 {0 317} 1}} + 175,trans {} + 27 {{0 0 1}} + 204,trans {} + 194,trans {} + 28 {{60 0 1} {62 0 1} {61 317 0}} + 223,trans {} + 30 {{103 {0 317} 1} {1 {0 317} 0} {2 {0 317} 0} {3 {0 317} 0} {4 {0 317} 0} {5 {0 317} 0} {6 {0 317} 0} {7 {0 317} 0}} + 29 {{101 {0 317} 1}} + 242,trans {} + 31 {{106 {0 317} 1} {107 {0 317} 0} {108 {0 317} 0} {109 {0 317} 0} {110 {0 317} 0} {111 {0 317} 0} {112 {0 317} 0} {113 {0 317} 0} {114 {0 317} 0}} + 32 {{104 {0 317} 1}} + 10,trans {{317 43}} + 33 {{105 {0 317} 1} {65 {0 317} 0} {66 {0 317} 0}} + 28,trans {{377 157}} + 47,trans {{315 180} {316 181} {375 182}} + 34 {{102 {0 317} 1}} +} + +array set grid::token_id_table { + 286 WCSG_ + 286,t 0 + 287 WCSH_ + 292,line 45 + 302,line 55 + 288 WCSI_ + 357,line 117 + 317,t 0 + 265,title FONTSLANT + 289 WCSJ_ + 290 WCSK_ + 300 WCSU_ + 284,title WCSE + 291 WCSL_ + 301 WCSV_ + 313,title DEGREES + 292 WCSM_ + 302 WCSW_ + 338,t 0 + 332,title GAP2 + 288,line 41 + 293 WCSN_ + 303 WCSX_ + 351,title TEXT2 + 294 WCSO_ + 304 WCSY_ + 370,title {} + 369,title {} + 354,line 114 + 305 WCSZ_ + 295 WCSP_ + 388,title {} + 360,t 0 + 359,t 0 + 306 FK4_ + 296 WCSQ_ + 307 B1950_ + 262,t 0 + 297 WCSR_ + 308 FK5_ + 285,line 38 + 298 WCSS_ + 381,t 1 + 310 ICRS_ + 309 J2000_ + 299 WCST_ + 351,line 111 + 311 GALACTIC_ + 283,t 0 + 312 ECLIPTIC_ + 313 DEGREES_ + 314,t 0 + 314 SEXAGESIMAL_ + 282,line 35 + 315 INT_ + 347,line 107 + 316 REAL_ + 264,title FONTSIZE + 335,t 0 + 317 STRING_ + 283,title WCSD + 318 ANALYSIS_ + 312,title ECLIPTIC + 331,title GAP1 + 320 BORDER_ + 319 AXES_ + 278,line 30 + error,line 203 + 356,t 0 + 350,title TEXT1 + 349,title TEXT + 321 COLOR_ + 368,title {} + 344,line 104 + 322 CLOSE_ + 258,t 0 + 387,title {} + 323 DASH_ + 377,t 1 + 324 DEF_ + 325 DEF1_ + 275,line 27 + 279,t 0 + 280,t 0 + 326 DEF2_ + 341,line 101 + 327 EXTERIOR_ + 328 FORMAT1_ + 311,t 0 + 330 GAP_ + 329 FORMAT2_ + 331 GAP1_ + 272,line 23 + 332,t 0 + 332 GAP2_ + 337,line 97 + 333 GAP3_ + 263,title FONT + 334 GRID_ + 282,title WCSC + 393,line 426 + 353,t 0 + 335 INTERIOR_ + 311,title GALACTIC + 336 LABELS_ + 330,title GAP + 329,title FORMAT2 + 268,line 19 + 348,title SYSTEM + 337 LOAD_ + 374,t 1 + 367,title {} + 338 NUMBERS_ + 334,line 94 + 386,title {} + 340 ORIGIN_ + 339 NUMERICS_ + 276,t 0 + 390,line 398 + 389,line 385 + 341 OPEN_ + 342 PUBLICATION_ + 265,line 16 + 343 RESET_ + 307,t 0 + 297,t 0 + 344 SAVE_ + 331,line 91 + 345 SKYFRAME_ + 386,line 354 + 346 SKYFORMAT_ + 328,t 0 + 347 STYLE_ + 262,line 12 + 348 SYSTEM_ + 0,t 0 + 0 {$} + 350,t 0 + 350 TEXT1_ + 349,t 0 + 349 TEXT_ + 327,line 87 + 262,title FALSE + 351 TEXT2_ + 281,title WCSB + 383,line 323 + error,t 0 + 352 TICKMARKS_ + 310,title ICRS + 309,title J2000 + 299,title WCST + 371,t 1 + 353 TITLE_ + 328,title FORMAT1 + 258,line 8 + 354 TYPE_ + 347,title STYLE + 273,t 0 + 366,title {} + 355 VERTICAL_ + 324,line 84 + 392,t 1 + 385,title {} + 356 VIEW_ + 380,line 291 + 379,line 287 + 357 WIDTH_ + 294,t 0 + 304,t 0 + 358 LLL_ + 360 LUL_ + 359 LLU_ + 361 LUU_ + 325,t 0 + 321,line 81 + 362 ULL_ + 376,line 279 + 363 ULU_ + 364 UUL_ + 346,t 0 + 365 UUU_ + 366 yesno + 317,line 74 + 261,title TRUE + 367,t 1 + 367 font + 279,title WCS + 280,title WCSA + 373,line 263 + 368 fontWeight + 308,title FK5 + 269,t 0 + 270,t 0 + 298,title WCSS + 370 fontStyle + 369 fontSlant + 327,title EXTERIOR + 388,t 1 + 371 coordsys + 346,title SKYFORMAT + 372 wcssys + 365,title UUU + 314,line 69 + 291,t 0 + 301,t 0 + 384,title {} + 373 skyframe + 374 skyformat + 370,line 225 + 369,line 221 + 375 numeric + 322,t 0 + 376 command + 377 @PSEUDO1 + 311,line 65 + 378 typegrid + 343,t 0 + 380 grid + 379 interiortype + 366,line 204 + 381 type + 382 system + 364,t 0 + 383 gridgrid + 307,line 61 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 50 + 384 axes + 278,title DETECTOR + 385,t 1 + 385 origin + 363,line 124 + 307,title B1950 + 297,title WCSR + 386 tickmarks + 326,title DEF2 + 287,t 0 + 387 border + 345,title SKYFRAME + 388 numerics + 364,title UUL + 294,line 47 + 304,line 57 + 390 labels + 389 title + 383,title {} + 318,t 0 + 391 view + 360,line 121 + 359,line 120 + 392 viewaxes + 393 start' + 340,t 0 + 339,t 0 + error,title {} + 291,line 44 + 301,line 54 + 361,t 0 + 356,line 116 + 263,t 0 + 382,t 1 + 258,title NO + 287,line 40 + 277,title AMPLIFIER + 284,t 0 + 353,line 113 + 306,title FK4 + 296,title WCSQ + 325,title DEF1 + 344,title SAVE + 315,t 0 + 363,title ULU + 284,line 37 + 382,title {} + 350,line 110 + 349,line 109 + 336,t 0 + 357,t 0 + 281,line 34 + 260,t 0 + 259,t 0 + 346,line 106 + 378,t 1 + 281,t 0 + 257,title YES + 277,line 29 + 276,title PHYSICAL + 343,line 103 + 312,t 0 + 305,title WCSZ + 295,title WCSP + 324,title DEF + 343,title RESET + 362,title ULL + 333,t 0 + 274,line 25 + 381,title {} + 340,line 100 + 339,line 99 + 354,t 0 + 271,line 22 + 375,t 1 + 336,line 96 + 277,t 0 + 392,line 421 + 308,t 0 + 267,line 18 + 298,t 0 + 275,title IMAGE + 333,line 93 + 294,title WCSO + 304,title WCSY + 330,t 0 + 329,t 0 + 323,title DASH + 388,line 370 + 342,title PUBLICATION + 361,title LUU + 264,line 15 + 380,title {} + 379,title {} + 351,t 0 + 330,line 90 + 329,line 89 + 385,line 344 + 372,t 1 + 261,line 11 + 274,t 0 + 393,t 1 + 326,line 86 + 305,t 0 + 295,t 0 + 382,line 319 + 257,line 7 + 326,t 0 + 274,title ITALIC + 323,line 83 + 293,title WCSN + 303,title WCSX + 322,title CLOSE + 378,line 283 + 347,t 0 + 341,title OPEN + 360,title LUL + 359,title LLU + 378,title {} + 368,t 1 + 320,line 80 + 319,line 79 + error error + 271,t 0 + 375,line 275 + 390,t 1 + 389,t 1 + 292,t 0 + 302,t 0 + 316,line 72 + 372,line 235 + 323,t 0 + 273,title ROMAN + 344,t 0 + 313,line 68 + 292,title WCSM + 302,title WCSW + 321,title COLOR + 368,line 217 + 340,title ORIGIN + 339,title NUMERICS + 365,t 0 + 358,title LLL + 377,title {} + 267,t 0 + 310,line 64 + 309,line 63 + 299,line 52 + 386,t 1 + 365,line 126 + 288,t 0 + 320,t 0 + 319,t 0 + 306,line 60 + 296,line 49 + 362,line 123 + 341,t 0 + 272,title BOLD + 291,title WCSL + 293,line 46 + 301,title WCSV + 303,line 56 + 362,t 0 + 320,title BORDER + 319,title AXES + 358,line 119 + 338,title NUMBERS + 264,t 0 + 357,title WIDTH + 383,t 1 + 376,title {} + 285,t 0 + 289,line 42 + 290,line 43 + 300,line 53 + 355,line 115 + 316,t 0 + 286,line 39 + 337,t 0 + 352,line 112 + 358,t 0 + 271,title NORMAL + 261,t 0 + 283,line 36 + 289,title WCSJ + 290,title WCSK + 300,title WCSU + 318,title ANALYSIS + 380,t 1 + 379,t 1 + 348,line 108 + 337,title LOAD + 356,title VIEW + 282,t 0 + 375,title {} + 279,line 32 + 280,line 33 + 313,t 0 + 345,line 105 + 334,t 0 + 276,line 28 + 355,t 0 + 342,line 102 + 257,t 0 + 269,title HELVETICA + 270,title COURIER + 376,t 1 + 273,line 24 + 288,title WCSI + 317,title string + 278,t 0 + 338,line 98 + 336,title LABELS + 355,title VERTICAL + 374,title {} + 310,t 0 + 309,t 0 + 299,t 0 + 393,title {} + 269,line 20 + 270,line 21 + 335,line 95 + 331,t 0 + 391,line 414 + 352,t 0 + 266,line 17 + 332,line 92 + 373,t 1 + 387,line 362 + 268,title TIMES + 275,t 0 + 263,line 14 + 287,title WCSH + 316,title float + 335,title INTERIOR + 328,line 88 + 306,t 0 + 296,t 0 + 354,title TYPE + 384,line 334 + 373,title {} + 392,title {} + 327,t 0 + 260,line 10 + 259,line 9 + 325,line 85 + 348,t 0 + 381,line 314 + 370,t 1 + 369,t 1 + 322,line 82 + 272,t 0 + 391,t 1 + 377,line 280 + 267,title FONTWEIGHT + 257 YES_ + 286,title WCSG + 293,t 0 + 303,t 0 + 315,title integer + 258 NO_ + 334,title GRID + 318,line 78 + 260 OFF_ + 259 ON_ + 353,title TITLE + 324,t 0 + 261 TRUE_ + 374,line 271 + 372,title {} + 262 FALSE_ + 391,title {} + 263 FONT_ + 345,t 0 + 264 FONTSIZE_ + 315,line 71 + 265 FONTSLANT_ + 266 FONTSTYLE_ + 371,line 230 + 366,t 1 + 267 FONTWEIGHT_ + 268,t 0 + 268 TIMES_ + 269 HELVETICA_ + 270 COURIER_ + 387,t 1 + 312,line 66 + 271 NORMAL_ + 272 BOLD_ + 289,t 0 + 290,t 0 + 300,t 0 + 367,line 212 + 266,title FONTSTYLE + 273 ROMAN_ + 274 ITALIC_ + 285,title WCSF + 321,t 0 + 314,title SEXAGESIMAL + 275 IMAGE_ + 333,title GAP3 + 308,line 62 + 276 PHYSICAL_ + 298,line 51 + 352,title TICKMARKS + 277 AMPLIFIER_ + 371,title {} + 364,line 125 + 342,t 0 + 278 DETECTOR_ + 390,title {} + 389,title {} + 279 WCS_ + 280 WCSA_ + 281 WCSB_ + 363,t 0 + 305,line 58 + 282 WCSC_ + 295,line 48 + 265,t 0 + 283 WCSD_ + 361,line 122 + 284 WCSE_ + 384,t 1 + 285 WCSF_ +} + +proc grid::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ times } + 9 { set _ helvetica } + 10 { set _ courier } + 11 { set _ normal } + 12 { set _ bold } + 13 { set _ roman } + 14 { set _ italic } + 15 { set _ normal } + 16 { set _ bold } + 17 { set _ italic } + 18 { set _ image } + 19 { set _ physical } + 20 { set _ amplifier } + 21 { set _ detector } + 22 { set _ wcs } + 23 { set _ wcsa } + 24 { set _ wcsb } + 25 { set _ wcsc } + 26 { set _ wcsd } + 27 { set _ wcse } + 28 { set _ wcsf } + 29 { set _ wcsg } + 30 { set _ wcsh } + 31 { set _ wcsi } + 32 { set _ wcsj } + 33 { set _ wcsk } + 34 { set _ wcsl } + 35 { set _ wcsm } + 36 { set _ wcsn } + 37 { set _ wcso } + 38 { set _ wcsp } + 39 { set _ wcsq } + 40 { set _ wcsr } + 41 { set _ wcss } + 42 { set _ wcst } + 43 { set _ wcsu } + 44 { set _ wcsv } + 45 { set _ wcsw } + 46 { set _ wcsx } + 47 { set _ wcsy } + 48 { set _ wcsz } + 49 { set _ fk4 } + 50 { set _ fk4 } + 51 { set _ fk5 } + 52 { set _ fk5 } + 53 { set _ icrs } + 54 { set _ galactic } + 55 { set _ ecliptic } + 56 { set _ degrees } + 57 { set _ sexagesimal } + 58 { set _ $1 } + 59 { set _ $1 } + 61 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 63 { set _ analysis } + 64 { set _ publication } + 65 { set _ interior } + 66 { set _ exterior } + 67 { ProcessCmdSet grid view $1 GridUpdateCurrent } + 68 { GridDialog } + 69 { GridDestroyDialog } + 70 { GridUpdateCurrent } + 71 { ProcessCmdSet grid system $2 GridUpdateCurrent } + 72 { ProcessCmdSet grid sky $2 GridUpdateCurrent } + 73 { ProcessCmdSet grid skyformat $2 GridUpdateCurrent } + 74 { GridUpdateCurrent } + 75 { ProcessCmdSet grid format1 $2 GridUpdateCurrent } + 76 { ProcessCmdSet grid format2 $2 GridUpdateCurrent } + 77 { GridUpdateCurrent } + 78 { GridUpdateCurrent } + 79 { GridUpdateCurrent } + 80 { GridUpdateCurrent } + 81 { GridUpdateCurrent } + 82 { GridUpdateCurrent } + 83 { GridUpdateCurrent } + 84 { GridResetDialog } + 85 { FileLast gridfbox $2; GridLoad $2 } + 86 { FileLast gridfbox $2; GridSave $2 } + 87 { ProcessCmdSet grid type $1 } + 88 { ProcessCmdSet grid axes,type $2 } + 89 { ProcessCmdSet grid numlab,type $2 } + 90 { set _ $1 } + 91 { set _ $1 } + 92 { ProcessCmdSet grid grid $1 } + 93 { ProcessCmdSet grid grid,color $2 } + 94 { ProcessCmdSet grid grid,width $2 } + 95 { ProcessCmdSet grid grid,style $2 } + 96 { ProcessCmdSet grid grid,style $2 } + 97 { ProcessCmdSet grid grid,gap1 $2 } + 98 { ProcessCmdSet grid grid,gap2 $2 } + 99 { ProcessCmdSet grid grid,gap3 $2 } + 100 { ProcessCmdSet grid axes $1 } + 101 { ProcessCmdSet grid axes,color $2 } + 102 { ProcessCmdSet grid axes,width $2 } + 103 { ProcessCmdSet grid axes,style $2 } + 104 { ProcessCmdSet grid axes,style $2 } + 105 { ProcessCmdSet grid axes,type $2 } + 106 { ProcessCmdSet grid axes,origin $2 } + 107 { set _ lll } + 108 { set _ llu } + 109 { set _ lul } + 110 { set _ luu } + 111 { set _ ull } + 112 { set _ ulu } + 113 { set _ uul } + 114 { set _ uuu } + 115 { ProcessCmdSet grid tick $1 } + 116 { ProcessCmdSet grid tick,color $2 } + 117 { ProcessCmdSet grid tick,width $2 } + 118 { ProcessCmdSet grid tick,style $2 } + 119 { ProcessCmdSet grid tick,style $2 } + 120 { ProcessCmdSet grid border $1 } + 121 { ProcessCmdSet grid border,color $2 } + 122 { ProcessCmdSet grid border,width $2 } + 123 { ProcessCmdSet grid border,style $2 } + 124 { ProcessCmdSet grid border,style $2 } + 125 { ProcessCmdSet grid numlab $1 } + 126 { ProcessCmdSet grid numlab,font $2 } + 127 { ProcessCmdSet grid numlab,size $2 } + 128 { ProcessCmdSet grid numlab,weight $2 } + 129 { ProcessCmdSet grid numlab,slant $2 } + 130 { ProcessCmdFontStyle grid numlab $2 } + 131 { ProcessCmdSet grid numlab,color $2 } + 132 { ProcessCmdSet grid numlab,gap1 $2 } + 133 { ProcessCmdSet grid numlab,gap2 $2 } + 134 { ProcessCmdSet grid numlab,gap3 $2 } + 135 { ProcessCmdSet grid numlab,type $2 } + 136 { ProcessCmdSet grid numlab,vertical $2 } + 137 { ProcessCmdSet grid title $1 } + 138 { ProcessCmdSet grid title,text $2 } + 139 { ProcessCmdSet grid title,def $2 } + 140 { ProcessCmdSet grid title,gap $2 } + 141 { ProcessCmdSet grid title,font $2 } + 142 { ProcessCmdSet grid title,size $2 } + 143 { ProcessCmdSet grid title,weight $2 } + 144 { ProcessCmdSet grid title,slant $2 } + 145 { ProcessCmdFontStyle grid title $2 } + 146 { ProcessCmdSet grid title,color $2 } + 147 { ProcessCmdSet grid textlab $1 } + 148 { ProcessCmdSet grid textlab,text1 $2 } + 149 { ProcessCmdSet grid textlab,text2 $2 } + 150 { ProcessCmdSet grid textlab,def1 $2 } + 151 { ProcessCmdSet grid textlab,def2 $2 } + 152 { ProcessCmdSet grid textlab,gap1 $2 } + 153 { ProcessCmdSet grid textlab,gap2 $2 } + 154 { ProcessCmdSet grid textlab,font $2 } + 155 { ProcessCmdSet grid textlab,size $2 } + 156 { ProcessCmdSet grid textlab,weight $2 } + 157 { ProcessCmdSet grid textlab,slant $2 } + 158 { ProcessCmdFontStyle grid textlab $2 } + 159 { ProcessCmdSet grid textlab,color $2 } + 160 { ProcessCmdSet grid grid $1 } + 162 { ProcessCmdSet grid title $2 } + 163 { ProcessCmdSet grid border $2 } + 164 { ProcessCmdSet grid numlab,vertical $2 } + 165 { ProcessCmdSet grid axes $1 } + 166 { ProcessCmdSet grid numlab $2 } + 167 { ProcessCmdSet grid tick $2 } + 168 { ProcessCmdSet grid textlab $2 } + } + 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 grid::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/gridsendlex.tcl b/ds9/parsers/gridsendlex.tcl new file mode 100644 index 0000000..f7a8686 --- /dev/null +++ b/ds9/parsers/gridsendlex.tcl @@ -0,0 +1,711 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval gridsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc gridsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc gridsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc gridsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc gridsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc gridsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc gridsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc gridsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc gridsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc gridsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set FONT_ 257 +set FONTSIZE_ 258 +set FONTSLANT_ 259 +set FONTSTYLE_ 260 +set FONTWEIGHT_ 261 +set AXES_ 262 +set BORDER_ 263 +set COLOR_ 264 +set DASH_ 265 +set DEF_ 266 +set DEF1_ 267 +set DEF2_ 268 +set FORMAT1_ 269 +set FORMAT2_ 270 +set GAP_ 271 +set GAP1_ 272 +set GAP2_ 273 +set GAP3_ 274 +set GRID_ 275 +set LABELS_ 276 +set NUMBERS_ 277 +set NUMERICS_ 278 +set ORIGIN_ 279 +set SKYFRAME_ 280 +set SKYFORMAT_ 281 +set STYLE_ 282 +set SYSTEM_ 283 +set TEXT_ 284 +set TEXT1_ 285 +set TEXT2_ 286 +set TICKMARKS_ 287 +set TITLE_ 288 +set TYPE_ 289 +set VERTICAL_ 290 +set WIDTH_ 291 +set VIEW_ 292 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: border + if {[regexp -start $index_ -indices -line -nocase -- {\A(border)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: dash + if {[regexp -start $index_ -indices -line -nocase -- {\A(dash)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: def + if {[regexp -start $index_ -indices -line -nocase -- {\A(def)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: def1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(def1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: def2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(def2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: format1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(format1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: format2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(format2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: gap + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: gap1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: gap2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: gap3 + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap3)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: label + if {[regexp -start $index_ -indices -line -nocase -- {\A(label)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: labels + if {[regexp -start $index_ -indices -line -nocase -- {\A(labels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: textlab + if {[regexp -start $index_ -indices -line -nocase -- {\A(textlab)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: numlab + if {[regexp -start $index_ -indices -line -nocase -- {\A(numlab)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: numbers + if {[regexp -start $index_ -indices -line -nocase -- {\A(numbers)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: numeric + if {[regexp -start $index_ -indices -line -nocase -- {\A(numeric)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: numerics + if {[regexp -start $index_ -indices -line -nocase -- {\A(numerics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: origin + if {[regexp -start $index_ -indices -line -nocase -- {\A(origin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: skyframe + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyframe)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: style + if {[regexp -start $index_ -indices -line -nocase -- {\A(style)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: text + if {[regexp -start $index_ -indices -line -nocase -- {\A(text)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: text1 + if {[regexp -start $index_ -indices -line -nocase -- {\A(text1)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: text2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(text2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: tick + if {[regexp -start $index_ -indices -line -nocase -- {\A(tick)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: tickmark + if {[regexp -start $index_ -indices -line -nocase -- {\A(tickmark)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: tickmarks + if {[regexp -start $index_ -indices -line -nocase -- {\A(tickmarks)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: title + if {[regexp -start $index_ -indices -line -nocase -- {\A(title)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: type + if {[regexp -start $index_ -indices -line -nocase -- {\A(type)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: vertical + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AXES_ + } + 1 { +return $BORDER_ + } + 2 { +return $COLOR_ + } + 3 { +return $DASH_ + } + 4 { +return $DEF_ + } + 5 { +return $DEF1_ + } + 6 { +return $DEF2_ + } + 7 { +return $FORMAT1_ + } + 8 { +return $FORMAT2_ + } + 9 { +return $GAP_ + } + 10 { +return $GAP1_ + } + 11 { +return $GAP2_ + } + 12 { +return $GAP3_ + } + 13 { +return $GRID_ + } + 14 { +return $LABELS_ + } + 15 { +return $LABELS_ + } + 16 { +return $LABELS_ + } + 17 { +return $NUMERICS_ + } + 18 { +return $NUMBERS_ + } + 19 { +return $NUMERICS_ + } + 20 { +return $NUMERICS_ + } + 21 { +return $ORIGIN_ + } + 22 { +return $SKYFRAME_ + } + 23 { +return $SKYFRAME_ + } + 24 { +return $SKYFORMAT_ + } + 25 { +return $STYLE_ + } + 26 { +return $SYSTEM_ + } + 27 { +return $TEXT_ + } + 28 { +return $TEXT1_ + } + 29 { +return $TEXT2_ + } + 30 { +return $TICKMARKS_ + } + 31 { +return $TICKMARKS_ + } + 32 { +return $TICKMARKS_ + } + 33 { +return $TITLE_ + } + 34 { +return $TYPE_ + } + 35 { +return $VERTICAL_ + } + 36 { +return $VIEW_ + } + 37 { +return $WIDTH_ + } + 38 { +return $FONT_ + } + 39 { +return $FONTSIZE_ + } + 40 { +return $FONTSLANT_ + } + 41 { +return $FONTSTYLE_ + } + 42 { +return $FONTWEIGHT_ + } + 43 { +# ignore whitespace + } + 44 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/gridsendparser.tab.tcl b/ds9/parsers/gridsendparser.tab.tcl new file mode 100644 index 0000000..ed7b5cd --- /dev/null +++ b/ds9/parsers/gridsendparser.tab.tcl @@ -0,0 +1,36 @@ +set FONT_ 257 +set FONTSIZE_ 258 +set FONTSLANT_ 259 +set FONTSTYLE_ 260 +set FONTWEIGHT_ 261 +set AXES_ 262 +set BORDER_ 263 +set COLOR_ 264 +set DASH_ 265 +set DEF_ 266 +set DEF1_ 267 +set DEF2_ 268 +set FORMAT1_ 269 +set FORMAT2_ 270 +set GAP_ 271 +set GAP1_ 272 +set GAP2_ 273 +set GAP3_ 274 +set GRID_ 275 +set LABELS_ 276 +set NUMBERS_ 277 +set NUMERICS_ 278 +set ORIGIN_ 279 +set SKYFRAME_ 280 +set SKYFORMAT_ 281 +set STYLE_ 282 +set SYSTEM_ 283 +set TEXT_ 284 +set TEXT1_ 285 +set TEXT2_ 286 +set TICKMARKS_ 287 +set TITLE_ 288 +set TYPE_ 289 +set VERTICAL_ 290 +set WIDTH_ 291 +set VIEW_ 292 diff --git a/ds9/parsers/gridsendparser.tcl b/ds9/parsers/gridsendparser.tcl new file mode 100644 index 0000000..e334155 --- /dev/null +++ b/ds9/parsers/gridsendparser.tcl @@ -0,0 +1,1278 @@ +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 gridsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc gridsend::YYABORT {} { + return -code return 1 +} + +proc gridsend::YYACCEPT {} { + return -code return 0 +} + +proc gridsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc gridsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc gridsend::yyerror {s} { + puts stderr $s +} + +proc gridsend::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 gridsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set gridsend::table { + 7:264,target 54 + 27:0 reduce + 6:259,target 38 + 6:260,target 39 + 1:296 goto + 48:0 reduce + 6:257 shift + 6:258 shift + 1:279,target 18 + 6:259 shift + 6:260 shift + 70:0 reduce + 69:0 reduce + 6:261 shift + 5:295,target 35 + 0:275,target 5 + 6:0,target 66 + 11:282,target 63 + 87:0,target 86 + 2:0 reduce + 6:264 shift + 80:0,target 82 + 79:0,target 84 + 72:0,target 58 + 64:0,target 36 + 5:274,target 32 + 6:267 shift + 56:0,target 52 + 24:0 reduce + 6:268 shift + 48:0,target 14 + 6:257,target 36 + 41:0,target 78 + 45:0 reduce + 33:0,target 23 + 2:282,target 25 + 6:272 shift + 25:0,target 43 + 6:273 shift + 17:0,target 30 + 66:0 reduce + 10:0,target 3 + 12:284,target 74 + 87:0 reduce + 7:259,target 51 + 7:260,target 52 + 21:0 reduce + 5:272,target 30 + 1:296,target 22 + 6:285 shift + 42:0 reduce + 6:286 shift + 7:299,target 60 + 14:262 shift + 14:263 shift + 0:292,target 14 + 63:0 reduce + 6:301 goto + 84:0 reduce + 5:291,target 34 + 12:261,target 70 + 17:0 reduce + 2:298,target 27 + 7:257,target 49 + 14:288,target 82 + 38:0 reduce + 14:275 shift + 60:0 reduce + 59:0 reduce + 0:289,target 13 + 3:0,target 8 + 84:0,target 15 + 76:0,target 17 + 81:0 reduce + 68:0,target 63 + 61:0,target 35 + 79:277,target 86 + 53:0,target 47 + 45:0,target 72 + 6:272,target 44 + 37:0,target 74 + 12:258,target 67 + 30:0,target 24 + 29:0,target 22 + 22:0,target 7 + 14:288 shift + 35:0 reduce + 14:290 shift + 14:302 goto + 56:0 reduce + 0:287,target 11 + 6:301,target 48 + 77:0 reduce + 11:264 shift + 7:274,target 57 + 11:265 shift + 9:0 reduce + 0:262 shift + 11:0 reduce + 0:263 shift + 32:0 reduce + 5:265,target 29 + 79:276 shift + 1:289,target 20 + 79:277 shift + 53:0 reduce + 0:270 shift + 0:269 shift + 74:0 reduce + 14:263,target 80 + 7:272,target 55 + 0:275 shift + 6:0 reduce + 11:282 shift + 0:276 shift + 6:267,target 42 + 79:287 shift + 0:278 shift + 28:0 reduce + 0:280 shift + 7:0,target 44 + 88:0,target 80 + 0:0,target 1 + 0:281 shift + 81:0,target 79 + 73:0,target 59 + 50:0 reduce + 49:0 reduce + 0:283 shift + 79:303 goto + 65:0,target 10 + 11:291 shift + 57:0,target 53 + 71:0 reduce + 50:0,target 46 + 49:0,target 45 + 0:283,target 10 + 42:0,target 69 + 0:287 shift + 6:286,target 47 + 34:0,target 21 + 0:288 shift + 26:0,target 41 + 0:289 shift + 3:0 reduce + 18:0,target 33 + 5:282,target 33 + 11:297 goto + 0:292 shift + 0:262,target 1 + 11:0,target 34 + 0:293 goto + 25:0 reduce + 46:0 reduce + 67:0 reduce + 0:281,target 9 + 88:0 reduce + 1:264,target 16 + 0:0 reduce + 12:271,target 73 + 5:264 shift + 5:265 shift + 22:0 reduce + 13:294,target 78 + 43:0 reduce + 5:272 shift + 5:273 shift + 12:300,target 75 + 64:0 reduce + 5:274 shift + 79:287,target 87 + 0:278,target 7 + 85:0 reduce + 4:0,target 9 + 85:0,target 87 + 77:0,target 18 + 18:0 reduce + 5:282 shift + 11:264,target 61 + 70:0,target 62 + 69:0,target 64 + 6:261,target 40 + 62:0,target 37 + 54:0,target 50 + 40:0 reduce + 39:0 reduce + 46:0,target 67 + 38:0,target 76 + 13:262 shift + 14:275,target 81 + 61:0 reduce + 31:0,target 25 + 23:0,target 40 + 15:0,target 0 + 2:264,target 23 + 5:291 shift + 82:0 reduce + 0:276,target 6 + 12:266,target 72 + 5:295 goto + 15:0 accept + 2:264 shift + 2:265 shift + 6:258,target 37 + 36:0 reduce + 57:0 reduce + 13:278 shift + 78:0 reduce + 12:264,target 71 + 7:261,target 53 + 12:0 reduce + 5:273,target 31 + 14:302,target 84 + 33:0 reduce + 2:282 shift + 54:0 reduce + 0:293,target 15 + 8:0,target 4 + 13:294 goto + 75:0 reduce + 1:0,target 27 + 82:0,target 81 + 74:0,target 57 + 2:291 shift + 66:0,target 60 + 7:0 reduce + 58:0,target 54 + 51:0,target 48 + 7:258,target 50 + 43:0,target 70 + 35:0,target 6 + 30:0 reduce + 29:0 reduce + 14:290,target 83 + 27:0,target 11 + 20:0,target 32 + 19:0,target 31 + 2:298 goto + 7:257 shift + 51:0 reduce + 7:258 shift + 12:0,target 56 + 7:259 shift + 7:260 shift + 11:297,target 65 + 7:261 shift + 72:0 reduce + 7:264 shift + 0:270,target 4 + 0:269,target 3 + 4:0 reduce + 6:273,target 45 + 12:259,target 68 + 12:260,target 69 + 26:0 reduce + 7:272 shift + 47:0 reduce + 7:273 shift + 7:274 shift + 0:288,target 12 + 68:0 reduce + 1:0 reduce + 13:262,target 76 + 79:276,target 85 + 12:257,target 66 + 23:0 reduce + 44:0 reduce + 1:291,target 21 + 5:0,target 19 + 86:0,target 85 + 78:0,target 2 + 7:289 shift + 7:290 shift + 71:0,target 65 + 65:0 reduce + 63:0,target 38 + 55:0,target 51 + 86:0 reduce + 47:0,target 68 + 7:273,target 56 + 40:0,target 75 + 39:0,target 77 + 32:0,target 26 + 24:0,target 42 + 6:268,target 43 + 20:0 reduce + 19:0 reduce + 16:0,target 28 + 7:299 goto + 5:264,target 28 + 41:0 reduce + 62:0 reduce + 13:278,target 77 + 79:303,target 88 + 11:291,target 64 + 14:262,target 79 + 83:0 reduce + 0:263,target 2 + 16:0 reduce + 2:291,target 26 + 12:257 shift + 37:0 reduce + 12:258 shift + 12:259 shift + 12:260 shift + 12:261 shift + 58:0 reduce + 7:289,target 58 + 7:290,target 59 + 12:264 shift + 80:0 reduce + 79:0 reduce + 6:285,target 46 + 1:265,target 17 + 12:266 shift + 9:0,target 5 + 13:0 reduce + 1:264 shift + 2:0,target 39 + 6:264,target 41 + 12:271 shift + 83:0,target 83 + 1:265 shift + 75:0,target 13 + 34:0 reduce + 67:0,target 61 + 60:0,target 12 + 59:0,target 55 + 55:0 reduce + 52:0,target 49 + 44:0,target 71 + 36:0,target 73 + 76:0 reduce + 28:0,target 20 + 0:280,target 8 + 21:0,target 29 + 13:0,target 16 + 8:0 reduce + 10:0 reduce + 12:284 shift + 11:265,target 62 + 1:279 shift + 31:0 reduce + 1:282 shift + 12:300 goto + 52:0 reduce + 1:282,target 19 + 73:0 reduce + 2:265,target 24 + 1:289 shift + 1:291 shift + 5:0 reduce +} + +array set gridsend::rules { + 9,l 293 + 11,l 293 + 32,l 296 + 53,l 299 + 74,l 301 + 6,l 293 + 28,l 296 + 50,l 299 + 49,l 299 + 71,l 301 + 3,l 293 + 25,l 295 + 46,l 299 + 67,l 301 + 0,l 304 + 22,l 295 + 43,l 298 + 64,l 300 + 85,l 303 + 18,l 294 + 40,l 298 + 39,l 298 + 61,l 300 + 82,l 302 + 15,l 293 + 36,l 297 + 57,l 300 + 78,l 301 + 12,l 293 + 33,l 296 + 54,l 299 + 75,l 301 + 7,l 293 + 29,l 296 + 30,l 296 + 51,l 299 + 72,l 301 + 4,l 293 + 26,l 295 + 47,l 299 + 68,l 301 + 1,l 293 + 23,l 295 + 44,l 299 + 65,l 300 + 86,l 303 + 19,l 295 + 20,l 295 + 41,l 298 + 62,l 300 + 83,l 302 + 16,l 294 + 37,l 297 + 58,l 300 + 80,l 302 + 79,l 302 + 13,l 293 + 34,l 297 + 55,l 299 + 76,l 301 + 8,l 293 + 10,l 293 + 31,l 296 + 52,l 299 + 73,l 301 + 5,l 293 + 27,l 296 + 48,l 299 + 70,l 301 + 69,l 301 + 2,l 293 + 24,l 295 + 45,l 299 + 66,l 301 + 87,l 303 + 21,l 295 + 42,l 298 + 63,l 300 + 84,l 303 + 17,l 294 + 38,l 297 + 60,l 300 + 59,l 300 + 81,l 302 + 14,l 293 + 35,l 297 + 56,l 300 + 77,l 301 +} + +array set gridsend::rules { + 63,dc 1 + 12,dc 2 + 77,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 70,dc 1 + 69,dc 1 + 18,dc 1 + 84,dc 0 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 1 + 11,dc 2 + 76,dc 1 + 25,dc 1 + 2,dc 2 + 40,dc 1 + 39,dc 0 + 54,dc 1 + 68,dc 1 + 17,dc 1 + 83,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 61,dc 1 + 10,dc 2 + 75,dc 1 + 24,dc 1 + 1,dc 0 + 38,dc 1 + 53,dc 1 + 67,dc 1 + 16,dc 0 + 82,dc 1 + 31,dc 1 + 7,dc 2 + 45,dc 1 + 60,dc 1 + 59,dc 1 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 1 + 66,dc 0 + 15,dc 2 + 81,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 2 + 44,dc 0 + 58,dc 1 + 73,dc 1 + 22,dc 1 + 87,dc 1 + 36,dc 1 + 51,dc 1 + 65,dc 1 + 14,dc 2 + 80,dc 2 + 79,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 57,dc 1 + 72,dc 1 + 21,dc 1 + 86,dc 1 + 35,dc 1 + 50,dc 1 + 49,dc 1 + 64,dc 1 + 13,dc 2 + 78,dc 1 + 27,dc 0 + 4,dc 1 + 42,dc 1 + 56,dc 0 + 71,dc 1 + 19,dc 0 + 20,dc 1 + 85,dc 1 + 34,dc 0 + 48,dc 1 +} + +array set gridsend::rules { + 41,line 105 + 7,line 56 + 37,line 99 + 4,line 53 + 34,line 95 + 1,line 50 + 31,line 90 + 86,line 164 + 27,line 85 + 83,line 159 + 24,line 80 + 80,line 156 + 79,line 155 + 21,line 77 + 76,line 150 + 17,line 71 + 73,line 146 + 14,line 64 + 70,line 143 + 69,line 142 + 11,line 60 + 66,line 139 + 63,line 134 + 60,line 130 + 59,line 129 + 56,line 126 + 53,line 121 + 50,line 118 + 49,line 117 + 46,line 113 + 43,line 108 + 9,line 58 + 40,line 104 + 39,line 103 + 6,line 55 + 36,line 97 + 3,line 52 + 33,line 92 + 29,line 87 + 30,line 89 + 85,line 163 + 26,line 82 + 82,line 158 + 23,line 79 + 78,line 152 + 19,line 75 + 20,line 76 + 75,line 148 + 16,line 69 + 72,line 145 + 13,line 62 + 68,line 141 + 10,line 59 + 65,line 136 + 62,line 132 + 58,line 128 + 55,line 123 + 52,line 120 + 48,line 116 + 45,line 112 + 42,line 107 + 8,line 57 + 38,line 100 + 5,line 54 + 35,line 96 + 2,line 51 + 32,line 91 + 87,line 165 + 28,line 86 + 84,line 162 + 25,line 81 + 81,line 157 + 22,line 78 + 77,line 151 + 18,line 72 + 74,line 147 + 15,line 65 + 71,line 144 + 12,line 61 + 67,line 140 + 64,line 135 + 61,line 131 + 57,line 127 + 54,line 122 + 51,line 119 + 47,line 114 + 44,line 111 +} + +array set gridsend::lr1_table { + 66,trans {} + 35 {{6 0 2}} + 85,trans {} + 14,trans {{262 79} {263 80} {275 81} {288 82} {290 83} {302 84}} + 36 {{73 0 1}} + 33,trans {} + 37 {{74 0 1}} + 52,trans {} + 38 {{76 0 1}} + 71,trans {} + 39 {{77 0 1}} + 40 {{75 0 1}} + 18,trans {} + 1,trans {{264 16} {265 17} {279 18} {282 19} {289 20} {291 21} {296 22}} + 41 {{78 0 1}} + 37,trans {} + 42 {{69 0 1}} + 56,trans {} + 43 {{70 0 1}} + 75,trans {} + 44 {{71 0 1}} + 23,trans {} + 45 {{72 0 1}} + 5,trans {{264 28} {265 29} {272 30} {273 31} {274 32} {282 33} {291 34} {295 35}} + 42,trans {} + 46 {{67 0 1}} + 61,trans {} + 47 {{68 0 1}} + 80,trans {} + 79,trans {{276 85} {277 86} {287 87} {303 88}} + 48 {{14 0 2}} + 27,trans {} + 9,trans {} + 50 {{46 0 1}} + 49 {{45 0 1}} + 46,trans {} + 51 {{48 0 1}} + 65,trans {} + 52 {{49 0 1}} + 84,trans {} + 13,trans {{262 76} {278 77} {294 78}} + 53 {{47 0 1}} + 32,trans {} + 54 {{50 0 1}} + 51,trans {} + 55 {{51 0 1}} + 70,trans {} + 69,trans {} + 56 {{52 0 1}} + 88,trans {} + 17,trans {} + 57 {{53 0 1}} + 0,trans {{262 1} {263 2} {269 3} {270 4} {275 5} {276 6} {278 7} {280 8} {281 9} {283 10} {287 11} {288 12} {289 13} {292 14} {293 15}} + 36,trans {} + 58 {{54 0 1}} + 55,trans {} + 60 {{12 0 2}} + 59 {{55 0 1}} + 74,trans {} + 61 {{35 0 1}} + 22,trans {} + 62 {{37 0 1}} + 4,trans {} + 41,trans {} + 63 {{38 0 1}} + 60,trans {} + 59,trans {} + 64 {{36 0 1}} + 78,trans {} + 65 {{10 0 2}} + 26,trans {} + 66 {{60 0 1}} + 8,trans {} + 45,trans {} + 67 {{61 0 1}} + 64,trans {} + 68 {{63 0 1}} + 83,trans {} + 12,trans {{257 66} {258 67} {259 68} {260 69} {261 70} {264 71} {266 72} {271 73} {284 74} {300 75}} + 70 {{62 0 1}} + 69 {{64 0 1}} + 31,trans {} + 71 {{65 0 1}} + 50,trans {} + 49,trans {} + 72 {{58 0 1}} + 68,trans {} + 73 {{59 0 1}} + 87,trans {} + 16,trans {} + 74 {{57 0 1}} + 35,trans {} + 75 {{13 0 2}} + 54,trans {} + 76 {{17 0 1}} + 73,trans {} + 77 {{18 0 1}} + 21,trans {} + 78 {{2 0 2}} + 3,trans {} + 40,trans {} + 39,trans {} + 80 {{82 0 1}} + 79 {{80 0 1} {84 0 0} {85 0 0} {86 0 0} {87 0 0}} + 58,trans {} + 81 {{79 0 1}} + 10 {{3 0 1}} + 77,trans {} + 82 {{81 0 1}} + 11 {{10 0 1} {34 0 0} {35 0 0} {36 0 0} {37 0 0} {38 0 0}} + 25,trans {} + 83 {{83 0 1}} + 7,trans {{257 49} {258 50} {259 51} {260 52} {261 53} {264 54} {272 55} {273 56} {274 57} {289 58} {290 59} {299 60}} + 12 {{13 0 1} {56 0 0} {57 0 0} {58 0 0} {59 0 0} {60 0 0} {61 0 0} {62 0 0} {63 0 0} {64 0 0} {65 0 0}} + 44,trans {} + 84 {{15 0 2}} + 13 {{2 0 1} {16 0 0} {17 0 0} {18 0 0}} + 85 {{87 0 1}} + 63,trans {} + 14 {{15 0 1} {79 0 0} {80 0 0} {81 0 0} {82 0 0} {83 0 0}} + 82,trans {} + 86 {{85 0 1}} + 11,trans {{264 61} {265 62} {282 63} {291 64} {297 65}} + 15 {{0 0 1}} + 87 {{86 0 1}} + 30,trans {} + 29,trans {} + 16 {{28 0 1}} + 88 {{80 0 2}} + 48,trans {} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0}} + 17 {{30 0 1}} + 67,trans {} + 1 {{7 0 1} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0} {32 0 0} {33 0 0}} + 18 {{33 0 1}} + 86,trans {} + 15,trans {} + 2 {{11 0 1} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0}} + 19 {{31 0 1}} + 20 {{32 0 1}} + 34,trans {} + 3 {{8 0 1}} + 21 {{29 0 1}} + 53,trans {} + 4 {{9 0 1}} + 22 {{7 0 2}} + 72,trans {} + 5 {{6 0 1} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0}} + 23 {{40 0 1}} + 20,trans {} + 19,trans {} + 6 {{14 0 1} {66 0 0} {67 0 0} {68 0 0} {69 0 0} {70 0 0} {71 0 0} {72 0 0} {73 0 0} {74 0 0} {75 0 0} {76 0 0} {77 0 0} {78 0 0}} + 24 {{42 0 1}} + 2,trans {{264 23} {265 24} {282 25} {291 26} {298 27}} + 38,trans {} + 7 {{12 0 1} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 0 0} {55 0 0}} + 25 {{43 0 1}} + 57,trans {} + 8 {{4 0 1}} + 26 {{41 0 1}} + 76,trans {} + 9 {{5 0 1}} + 27 {{11 0 2}} + 24,trans {} + 6,trans {{257 36} {258 37} {259 38} {260 39} {261 40} {264 41} {267 42} {268 43} {272 44} {273 45} {285 46} {286 47} {301 48}} + 28 {{20 0 1}} + 43,trans {} + 29 {{22 0 1}} + 30 {{24 0 1}} + 62,trans {} + 31 {{25 0 1}} + 81,trans {} + 10,trans {} + 32 {{26 0 1}} + 28,trans {} + 33 {{23 0 1}} + 47,trans {} + 34 {{21 0 1}} +} + +array set gridsend::token_id_table { + 286 TEXT2_ + 286,t 0 + 287 TICKMARKS_ + 292,line 45 + 302,line 154 + 288 TITLE_ + 265,title DASH + 289 TYPE_ + 290 VERTICAL_ + 300 title + 284,title TEXT + 291 WIDTH_ + 301 labels + 292 VIEW_ + 302 view + 288,line 41 + 293 gridsend + 303 viewaxes + 304 start' + 294 type + 295 grid + 296 axes + 262,t 0 + 297 tickmarks + 285,line 38 + 298 border + 299 numerics + 283,t 0 + 282,line 35 + 264,title COLOR + 283,title SYSTEM + 278,line 31 + error,line 48 + 258,t 0 + 275,line 28 + 279,t 0 + 280,t 0 + 272,line 25 + 263,title BORDER + 282,title STYLE + 268,line 21 + 276,t 0 + 265,line 18 + 297,t 1 + 262,line 15 + 262,title AXES + 0 {$} + 0,t 0 + 281,title SKYFORMAT + error,t 0 + 299,title {} + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 1 + 261,title FONTWEIGHT + 279,title ORIGIN + 280,title SKYFRAME + 269,t 0 + 270,t 0 + 298,title {} + 291,t 0 + 301,t 1 + 266,t 0 + 260,title FONTSTYLE + 259,title FONTSLANT + 297,line 94 + 278,title NUMERICS + 297,title {} + 287,t 0 + 304,line 166 + 294,line 67 + 291,line 44 + error,title {} + 301,line 138 + 263,t 0 + 258,title FONTSIZE + 287,line 40 + 277,title NUMBERS + 284,t 0 + 296,title {} + 284,line 37 + 281,line 34 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title FONT + 277,line 30 + 276,title LABELS + 295,title {} + 274,line 27 + 271,line 24 + 277,t 0 + 267,line 20 + 298,t 1 + 275,title GRID + 304,title {} + 294,title {} + 264,line 17 + 261,line 11 + 274,t 0 + 295,t 1 + 257,line 7 + 274,title GAP3 + 293,title {} + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 1 + 273,title GAP2 + 292,title VIEW + 302,title {} + 267,t 0 + 299,line 110 + 288,t 0 + 296,line 84 + 272,title GAP1 + 303,line 161 + 291,title WIDTH + 293,line 49 + 301,title {} + 264,t 0 + 285,t 0 + 289,line 42 + 290,line 43 + 300,line 125 + 286,line 39 + 271,title GAP + 261,t 0 + 283,line 36 + 289,title TYPE + 290,title VERTICAL + 300,title {} + 282,t 0 + 279,line 32 + 280,line 33 + 276,line 29 + 257,t 0 + 269,title FORMAT1 + 270,title FORMAT2 + 273,line 26 + 288,title TITLE + 278,t 0 + 299,t 1 + 269,line 22 + 270,line 23 + 266,line 19 + 268,title DEF2 + 275,t 0 + 263,line 16 + 287,title TICKMARKS + 296,t 1 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title DEF1 + 303,t 1 + 257 FONT_ + 286,title TEXT2 + 293,t 1 + 258 FONTSIZE_ + 260 FONTSTYLE_ + 259 FONTSLANT_ + 261 FONTWEIGHT_ + 262 AXES_ + 263 BORDER_ + 264 COLOR_ + 265 DASH_ + 266 DEF_ + 267 DEF1_ + 268,t 0 + 268 DEF2_ + 269 FORMAT1_ + 270 FORMAT2_ + 271 GAP_ + 272 GAP1_ + 289,t 0 + 290,t 0 + 300,t 1 + 266,title DEF + 273 GAP2_ + 274 GAP3_ + 285,title TEXT1 + 275 GRID_ + 276 LABELS_ + 298,line 102 + 277 NUMBERS_ + 278 NUMERICS_ + 279 ORIGIN_ + 280 SKYFRAME_ + 281 SKYFORMAT_ + 282 STYLE_ + 295,line 74 + 265,t 0 + 283 SYSTEM_ + 284 TEXT_ + 285 TEXT1_ +} + +proc gridsend::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 { ProcessSendCmdYesNo grid view } + 3 { ProcessSendCmdGet grid system } + 4 { ProcessSendCmdGet grid sky } + 5 { ProcessSendCmdGet grid skyformat } + 8 { ProcessSendCmdGet grid format1 } + 9 { ProcessSendCmdGet grid format2 } + 16 { ProcessSendCmdGet grid type } + 17 { ProcessSendCmdGet grid axis,type } + 18 { ProcessSendCmdGet grid numlab,type } + 19 { ProcessSendCmdYesNo grid grid } + 20 { ProcessSendCmdGet grid grid,color } + 21 { ProcessSendCmdGet grid grid,width } + 22 { ProcessSendCmdYesNo grid grid,style } + 23 { ProcessSendCmdGet grid grid,style } + 24 { ProcessSendCmdGet grid grid,gap1 } + 25 { ProcessSendCmdGet grid grid,gap2 } + 26 { ProcessSendCmdGet grid grid,gap3 } + 27 { ProcessSendCmdYesNo grid axes } + 28 { ProcessSendCmdGet grid axes,color } + 29 { ProcessSendCmdGet grid axes,width } + 30 { ProcessSendCmdYesNo grid axes,style } + 31 { ProcessSendCmdGet grid axes,style } + 32 { ProcessSendCmdGet grid axes,type } + 33 { ProcessSendCmdGet grid axes,origin } + 34 { ProcessSendCmdYesNo grid tick } + 35 { ProcessSendCmdGet grid tick,color } + 36 { ProcessSendCmdGet grid tick,width } + 37 { ProcessSendCmdYesNo grid tick,style } + 38 { ProcessSendCmdGet grid tick,style } + 39 { ProcessSendCmdYesNo grid border } + 40 { ProcessSendCmdGet grid border,color } + 41 { ProcessSendCmdGet grid border,width } + 42 { ProcessSendCmdYesNo grid border,style } + 43 { ProcessSendCmdGet grid border,style } + 44 { ProcessSendCmdYesNo grid numlab } + 45 { ProcessSendCmdGet grid numlab,font } + 46 { ProcessSendCmdGet grid numlab,size } + 47 { ProcessSendCmdGet grid numlab,weight } + 48 { ProcessSendCmdGet grid numlab,slant } + 49 { ProcessSendCmdGet grid numlab,weight } + 50 { ProcessSendCmdGet grid numlab,color } + 51 { ProcessSendCmdGet grid numlab,gap1 } + 52 { ProcessSendCmdGet grid numlab,gap2 } + 53 { ProcessSendCmdGet grid numlab,gap3 } + 54 { ProcessSendCmdGet grid numlab,type } + 55 { ProcessSendCmdGet grid numlab,vertical } + 56 { ProcessSendCmdYesNo grid title } + 57 { ProcessSendCmdGet grid title,text } + 58 { ProcessSendCmdYesNo grid title,def } + 59 { ProcessSendCmdGet grid title,gap } + 60 { ProcessSendCmdGet grid title,font } + 61 { ProcessSendCmdGet grid title,size } + 62 { ProcessSendCmdGet grid title,weight } + 63 { ProcessSendCmdGet grid title,slant } + 64 { ProcessSendCmdGet grid title,weight } + 65 { ProcessSendCmdGet grid title,color } + 66 { ProcessSendCmdYesNo grid textlab } + 67 { ProcessSendCmdGet grid textlab,text1 } + 68 { ProcessSendCmdGet grid textlab,text2 } + 69 { ProcessSendCmdYesNo grid textlab,def1 } + 70 { ProcessSendCmdYesNo grid textlab,def2 } + 71 { ProcessSendCmdGet grid textlab,gap1 } + 72 { ProcessSendCmdGet grid textlab,gap2 } + 73 { ProcessSendCmdGet grid textlab,font } + 74 { ProcessSendCmdGet grid textlab,size } + 75 { ProcessSendCmdGet grid textlab,weight } + 76 { ProcessSendCmdGet grid textlab,slant } + 77 { ProcessSendCmdGet grid textlab,weight } + 78 { ProcessSendCmdGet grid textlab,color } + 79 { ProcessSendCmdYesNo grid grid } + 81 { ProcessSendCmdYesNo grid title } + 82 { ProcessSendCmdYesNo grid border } + 83 { ProcessSendCmdYesNo grid numlab,vertical } + 84 { ProcessSendCmdYesNo grid axes } + 85 { ProcessSendCmdYesNo grid numlab } + 86 { ProcessSendCmdYesNo grid tick } + 87 { ProcessSendCmdYesNo grid textlab } + } + 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 gridsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/headerlex.tcl b/ds9/parsers/headerlex.tcl new file mode 100644 index 0000000..c9d972d --- /dev/null +++ b/ds9/parsers/headerlex.tcl @@ -0,0 +1,319 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval header { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc header::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc header::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc header::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc header::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc header::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc header::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc header::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc header::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc header::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 +set CLOSE_ 259 +set SAVE_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $SAVE_ + } + 2 { +set yylval $yytext; return $INT_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/headerparser.tab.tcl b/ds9/parsers/headerparser.tab.tcl new file mode 100644 index 0000000..b8acb35 --- /dev/null +++ b/ds9/parsers/headerparser.tab.tcl @@ -0,0 +1,4 @@ +set INT_ 257 +set STRING_ 258 +set CLOSE_ 259 +set SAVE_ 260 diff --git a/ds9/parsers/headerparser.tcl b/ds9/parsers/headerparser.tcl new file mode 100644 index 0000000..d62c09e --- /dev/null +++ b/ds9/parsers/headerparser.tcl @@ -0,0 +1,409 @@ +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 header { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc header::YYABORT {} { + return -code return 1 +} + +proc header::YYACCEPT {} { + return -code return 0 +} + +proc header::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc header::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc header::yyerror {s} { + puts stderr $s +} + +proc header::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 header::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set header::table { + 0:257 shift + 0:258 reduce + 0:260 shift + 0:259 shift + 2:257 shift + 5:0,target 1 + 0:261 goto + 2:258 reduce + 11:0 reduce + 10:258,target 11 + 0:263 goto + 0:264 goto + 3:257,target 9 + 6:258 reduce + 8:258 reduce + 2:265 goto + 6:258,target 4 + 6:0,target 4 + 2:0 reduce + 1:258,target 8 + 3:266,target 11 + 13:258,target 12 + 6:0 reduce + 0:264,target 6 + 7:0,target 10 + 9:258,target 13 + 0:0,target 7 + 10:0,target 11 + 0:263,target 5 + 10:258 reduce + 12:258 shift + 5:262,target 12 + 8:0,target 5 + 11:258,target 6 + 1:0,target 8 + 11:0,target 6 + 7:0 reduce + 1:258 reduce + 7:258,target 10 + 3:257 shift + 3:258 shift + 13:0 reduce + 0:261,target 4 + 2:258,target 9 + 5:258 reduce + 2:0,target 9 + 7:258 reduce + 5:262 goto + 9:258 shift + 0:0 reduce + 3:266 goto + 0:260,target 3 + 0:259,target 2 + 2:257,target 7 + 4:0 accept + 13:0,target 12 + 5:258,target 2 + 8:0 reduce + 10:0 reduce + 0:258,target 7 + 14:0 reduce + 12:258,target 14 + 4:0,target 0 + 14:0,target 3 + 11:258 reduce + 0:257,target 1 + 1:0 reduce + 8:258,target 5 + 2:265,target 8 + 13:258 reduce + 3:258,target 10 + 5:0 reduce +} + +array set header::rules { + 9,l 265 + 11,l 266 + 2,l 262 + 6,l 263 + 12,l 266 + 3,l 261 + 7,l 264 + 0,l 267 + 4,l 263 + 8,l 264 + 10,l 265 + 1,l 261 + 5,l 263 +} + +array set header::rules { + 5,dc 2 + 0,dc 1 + 12,dc 2 + 8,dc 1 + 3,dc 3 + 10,dc 1 + 6,dc 2 + 1,dc 1 + 9,dc 0 + 4,dc 1 + 11,dc 1 + 7,dc 0 + 2,dc 0 +} + +array set header::rules { + 2,e 1 + 7,line 29 + 10,line 34 + 4,line 24 + 1,line 19 + 9,line 33 + 12,line 38 + 6,line 26 + 3,line 20 + 8,line 30 + 11,line 37 + 5,line 25 + 2,line 19 +} + +array set header::lr1_table { + 13,trans {} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0} {5 {0 258} 0} {6 {0 258} 0} {7 {0 258} 0} {8 {0 258} 0}} + 14,trans {} + 1 {{8 {0 258} 1}} + 2 {{5 {0 258} 1} {9 {0 258} 0} {10 {0 258} 0}} + 3 {{6 {0 258} 1} {11 {0 258} 0} {12 {0 258} 0}} + 4 {{0 0 1}} + 0,trans {{257 1} {259 2} {260 3} {261 4} {263 5} {264 6}} + 5 {{1 0 1} {3 0 1} {2 258 0}} + 1,trans {} + 6 {{4 {0 258} 1}} + 2,trans {{257 7} {265 8}} + 3,trans {{257 9} {258 10} {266 11}} + 7 {{10 {0 258} 1}} + 4,trans {} + 8 {{5 {0 258} 2}} + 5,trans {{262 12}} + 10 {{11 {0 258} 1}} + 9 {{12 {0 258} 1}} + 6,trans {} + 11 {{6 {0 258} 2}} + 7,trans {} + 12 {{3 0 2}} + 13 {{12 {0 258} 2}} + 8,trans {} + 14 {{3 0 3}} + 10,trans {} + 9,trans {{258 13}} + 11,trans {} + 12,trans {{258 14}} +} + +array set header::token_id_table { + 264,line 28 + 265,title {} + 261,line 18 + 257,t 0 + 257,line 7 + 262,t 1 + 259,title CLOSE + 260,title SAVE + 266,t 1 + error error + 264,title {} + 266,line 36 + error,line 17 + 258,t 0 + 263,line 23 + error,title {} + 263,t 1 + 259,line 13 + 260,line 14 + 258,title string + 267,t 1 + 263,title {} + 267,title {} + 257 INT_ + 258 STRING_ + 259,t 0 + 259 CLOSE_ + 260 SAVE_ + 260,t 0 + 261 command + 265,line 32 + 262 @PSEUDO1 + 263 header + 257,title integer + 264 display + 264,t 1 + 265 close + 262,line 19 + 266 save + 267 start' + 0 {$} + 0,t 0 + 262,title {} + error,t 0 + 258,line 9 + 266,title {} + 261,t 1 + 267,line 39 + 265,t 1 + 261,title {} +} + +proc header::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 5 { CloseHeaderCmd $2 } + 7 { DisplayHeaderCmd 1 } + 8 { DisplayHeaderCmd $1 } + 9 { set _ 1 } + 10 { set _ $1 } + 11 { SaveHeaderCmd 1 $1 } + 12 { SaveHeaderCmd $1 $2 } + } + 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 header::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/heightlex.tcl b/ds9/parsers/heightlex.tcl new file mode 100644 index 0000000..915ae37 --- /dev/null +++ b/ds9/parsers/heightlex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval height { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc height::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc height::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc height::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc height::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc height::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc height::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc height::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc height::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc height::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval $yytext; return $INT_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/heightparser.tab.tcl b/ds9/parsers/heightparser.tab.tcl new file mode 100644 index 0000000..e736960 --- /dev/null +++ b/ds9/parsers/heightparser.tab.tcl @@ -0,0 +1,2 @@ +set INT_ 257 +set STRING_ 258 diff --git a/ds9/parsers/heightparser.tcl b/ds9/parsers/heightparser.tcl new file mode 100644 index 0000000..f5889d0 --- /dev/null +++ b/ds9/parsers/heightparser.tcl @@ -0,0 +1,291 @@ +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 height { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc height::YYABORT {} { + return -code return 1 +} + +proc height::YYACCEPT {} { + return -code return 0 +} + +proc height::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc height::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc height::yyerror {s} { + puts stderr $s +} + +proc height::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 height::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set height::table { + 3:0,target 1 + 0:257 shift + 5:0,target 3 + 0:259 goto + 1:258 reduce + 0:261 goto + 3:258 reduce + 4:258 shift + 3:260 goto + 0:261,target 3 + 2:0,target 0 + 4:258,target 5 + 3:260,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:259,target 2 + 1:258,target 4 + 1:0,target 4 + 5:0 reduce + 3:258,target 2 +} + +array set height::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 259 + 4,l 261 +} + +array set height::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set height::rules { + 2,e 1 + 2,line 16 + 4,line 20 + 1,line 16 + 3,line 17 +} + +array set height::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0}} + 1 {{4 {0 258} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{257 1} {259 2} {261 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{260 4}} + 4,trans {{258 5}} + 5,trans {} +} + +array set height::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 9 + 261,line 19 + error,line 14 + 257 INT_ + 257,t 0 + 258 STRING_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 height + 262,t 1 + 262 start' + 257,line 7 + 260,line 16 + 259,line 15 + 257,title integer + 258,title string + 262,line 21 + 260,title {} + 259,title {} + 261,title {} +} + +proc height::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet canvas height $1 UpdateView } + } + 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 height::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/iconifylex.tcl b/ds9/parsers/iconifylex.tcl new file mode 100644 index 0000000..d2b0f68 --- /dev/null +++ b/ds9/parsers/iconifylex.tcl @@ -0,0 +1,352 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval iconify { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc iconify::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc iconify::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc iconify::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc iconify::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc iconify::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc iconify::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc iconify::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc iconify::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc iconify::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $YES_ + } + 1 { +return $NO_ + } + 2 { +return $ON_ + } + 3 { +return $OFF_ + } + 4 { +return $TRUE_ + } + 5 { +return $FALSE_ + } + 6 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 7 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval $yytext; return $STRING_ + } + 10 { +# ignore whitespace + } + 11 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/iconifyparser.tab.tcl b/ds9/parsers/iconifyparser.tab.tcl new file mode 100644 index 0000000..3cd65f3 --- /dev/null +++ b/ds9/parsers/iconifyparser.tab.tcl @@ -0,0 +1,7 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 diff --git a/ds9/parsers/iconifyparser.tcl b/ds9/parsers/iconifyparser.tcl new file mode 100644 index 0000000..5338842 --- /dev/null +++ b/ds9/parsers/iconifyparser.tcl @@ -0,0 +1,395 @@ +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 iconify { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc iconify::YYABORT {} { + return -code return 1 +} + +proc iconify::YYACCEPT {} { + return -code return 0 +} + +proc iconify::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc iconify::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc iconify::yyerror {s} { + puts stderr $s +} + +proc iconify::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 iconify::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set iconify::table { + 0:257 shift + 0:258 shift + 0:259 shift + 0:260 shift + 5:0,target 4 + 9:0 reduce + 0:261 shift + 11:0 reduce + 0:262 shift + 0:263 reduce + 0:264 goto + 7:263,target 11 + 0:265 goto + 2:263 reduce + 0:267 goto + 4:263 reduce + 0:265,target 8 + 2:263,target 5 + 6:0,target 7 + 6:263 reduce + 2:0 reduce + 6:0 reduce + 0:264,target 7 + 7:0,target 11 + 0:0,target 1 + 5:263,target 4 + 0:263,target 1 + 8:0,target 0 + 3:0 reduce + 10:263 shift + 1:0,target 2 + 11:0,target 10 + 0:262,target 6 + 7:0 reduce + 3:263,target 3 + 9:266,target 10 + 9:0,target 8 + 0:261,target 5 + 1:263 reduce + 2:0,target 5 + 3:263 reduce + 10:263,target 11 + 0:0 reduce + 5:263 reduce + 7:263 reduce + 0:259,target 3 + 0:260,target 4 + 9:263 reduce + 4:0 reduce + 6:263,target 7 + 3:0,target 3 + 9:266 goto + 1:263,target 2 + 8:0 accept + 0:258,target 2 + 9:263,target 9 + 4:0,target 6 + 0:257,target 1 + 1:0 reduce + 0:267,target 9 + 4:263,target 6 + 5:0 reduce +} + +array set iconify::rules { + 9,l 266 + 11,l 267 + 2,l 264 + 6,l 264 + 3,l 264 + 7,l 264 + 0,l 268 + 4,l 264 + 8,l 265 + 10,l 265 + 1,l 264 + 5,l 264 +} + +array set iconify::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 10,dc 3 + 6,dc 1 + 1,dc 0 + 9,dc 0 + 4,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set iconify::rules { + 7,line 35 + 10,line 39 + 4,line 32 + 1,line 29 + 9,line 38 + 6,line 34 + 3,line 31 + 8,line 38 + 11,line 42 + 5,line 33 + 2,line 30 + 9,e 1 +} + +array set iconify::lr1_table { + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 263} 0} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0}} + 1 {{2 {0 263} 1}} + 2 {{5 {0 263} 1}} + 3 {{3 {0 263} 1}} + 4 {{6 {0 263} 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {267 9}} + 5 {{4 {0 263} 1}} + 1,trans {} + 2,trans {} + 6 {{7 {0 263} 1}} + 3,trans {} + 7 {{11 {0 263} 1}} + 4,trans {} + 8 {{0 0 1}} + 10 {{10 0 2}} + 5,trans {} + 9 {{8 0 1} {10 0 1} {9 263 0}} + 11 {{10 0 3}} + 6,trans {} + 7,trans {} + 8,trans {} + 10,trans {{263 11}} + 9,trans {{266 10}} + 11,trans {} +} + +array set iconify::token_id_table { + 264,line 28 + 265,title {} + 261,line 11 + 257,t 0 + 257,line 7 + 262,t 0 + 259,title ON + 260,title OFF + 266,t 1 + error error + 264,title {} + 266,line 38 + 268,title {} + error,line 27 + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 267,t 1 + 263,title string + 268,line 43 + 267,title {} + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 261 TRUE_ + 265,line 37 + 262 FALSE_ + 263 STRING_ + 257,title YES + 264 yesno + 264,t 1 + 265 command + 262,line 12 + 266 @PSEUDO1 + 267 iconify + 268,t 1 + 268 start' + 262,title FALSE + 0 {$} + 0,t 0 + error,t 0 + 258,line 8 + 266,title {} + 261,t 0 + 267,line 41 + 265,t 1 + 261,title TRUE +} + +proc iconify::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { IconifyCmd $1 } + } + 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 iconify::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/iexamsendlex.tcl b/ds9/parsers/iexamsendlex.tcl new file mode 100644 index 0000000..2c8250b --- /dev/null +++ b/ds9/parsers/iexamsendlex.tcl @@ -0,0 +1,793 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval iexamsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc iexamsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc iexamsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc iexamsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc iexamsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc iexamsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc iexamsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc iexamsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc iexamsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc iexamsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 +set STRING_ 297 +set INT_ 298 +set ANY_ 299 +set BUTTON_ 300 +set COORDINATE_ 301 +set DATA_ 302 +set KEY_ 303 +set VALUE_ 304 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: any + if {[regexp -start $index_ -indices -line -nocase -- {\A(any)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: button + if {[regexp -start $index_ -indices -line -nocase -- {\A(button)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: coordinate + if {[regexp -start $index_ -indices -line -nocase -- {\A(coordinate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: data + if {[regexp -start $index_ -indices -line -nocase -- {\A(data)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: key + if {[regexp -start $index_ -indices -line -nocase -- {\A(key)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: value + if {[regexp -start $index_ -indices -line -nocase -- {\A(value)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ANY_ + } + 1 { +return $BUTTON_ + } + 2 { +return $COORDINATE_ + } + 3 { +return $DATA_ + } + 4 { +return $KEY_ + } + 5 { +return $VALUE_ + } + 6 { +return $IMAGE_ + } + 7 { +return $PHYSICAL_ + } + 8 { +return $AMPLIFIER_ + } + 9 { +return $DETECTOR_ + } + 10 { +return $WCS_ + } + 11 { +return $WCSA_ + } + 12 { +return $WCSB_ + } + 13 { +return $WCSC_ + } + 14 { +return $WCSD_ + } + 15 { +return $WCSE_ + } + 16 { +return $WCSF_ + } + 17 { +return $WCSG_ + } + 18 { +return $WCSH_ + } + 19 { +return $WCSI_ + } + 20 { +return $WCSJ_ + } + 21 { +return $WCSK_ + } + 22 { +return $WCSL_ + } + 23 { +return $WCSM_ + } + 24 { +return $WCSN_ + } + 25 { +return $WCSO_ + } + 26 { +return $WCSP_ + } + 27 { +return $WCSQ_ + } + 28 { +return $WCSR_ + } + 29 { +return $WCSS_ + } + 30 { +return $WCST_ + } + 31 { +return $WCSU_ + } + 32 { +return $WCSV_ + } + 33 { +return $WCSW_ + } + 34 { +return $WCSX_ + } + 35 { +return $WCSY_ + } + 36 { +return $WCSZ_ + } + 37 { +return $FK4_ + } + 38 { +return $FK4_ + } + 39 { +return $FK5_ + } + 40 { +return $FK5_ + } + 41 { +return $ICRS_ + } + 42 { +return $GALACTIC_ + } + 43 { +return $ECLIPTIC_ + } + 44 { +return $DEGREES_ + } + 45 { +return $SEXAGESIMAL_ + } + 46 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 47 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 48 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 49 { +set yylval $yytext; return $STRING_ + } + 50 { +# ignore whitespace + } + 51 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/iexamsendparser.tab.tcl b/ds9/parsers/iexamsendparser.tab.tcl new file mode 100644 index 0000000..86d5daf --- /dev/null +++ b/ds9/parsers/iexamsendparser.tab.tcl @@ -0,0 +1,48 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 +set STRING_ 297 +set INT_ 298 +set ANY_ 299 +set BUTTON_ 300 +set COORDINATE_ 301 +set DATA_ 302 +set KEY_ 303 +set VALUE_ 304 diff --git a/ds9/parsers/iexamsendparser.tcl b/ds9/parsers/iexamsendparser.tcl new file mode 100644 index 0000000..e82adba --- /dev/null +++ b/ds9/parsers/iexamsendparser.tcl @@ -0,0 +1,1621 @@ +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 iexamsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc iexamsend::YYABORT {} { + return -code return 1 +} + +proc iexamsend::YYACCEPT {} { + return -code return 0 +} + +proc iexamsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc iexamsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc iexamsend::yyerror {s} { + puts stderr $s +} + +proc iexamsend::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 iexamsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set iexamsend::table { + 51:295 shift + 21:289 reduce + 21:290 reduce + 31:294,target 21 + 51:296 shift + 21:291 reduce + 21:292 reduce + 51:308 goto + 21:293 reduce + 21:294 reduce + 21:295 reduce + 43:296,target 33 + 21:296 reduce + 48:0 reduce + 25:293,target 15 + 37:295,target 27 + 33:0,target 23 + 19:292,target 9 + 20:292,target 10 + 50:307,target 59 + 32:294,target 22 + 21:0 reduce + 44:296,target 34 + 4:267,target 21 + 0:302,target 5 + 63:0 reduce + 26:293,target 16 + 26:288 reduce + 26:289 reduce + 26:290 reduce + 26:291 reduce + 26:292 reduce + 26:293 reduce + 38:295,target 28 + 26:294 reduce + 26:295 reduce + 26:296 reduce + 21:292,target 11 + 33:294,target 23 + 61:0,target 56 + 15:291,target 5 + 4:284,target 38 + 45:296,target 35 + 29:0,target 19 + 30:0,target 20 + 35:0 reduce + 27:293,target 17 + 39:295,target 29 + 40:295,target 30 + 9:0 reduce + 22:292,target 12 + 32:288 reduce + 32:289 reduce + 32:290 reduce + 32:291 reduce + 34:294,target 24 + 32:292 reduce + 50:288,target 42 + 32:293 reduce + 32:294 reduce + 32:295 reduce + 16:291,target 6 + 32:296 reduce + 46:296,target 36 + 2:302,target 49 + 28:293,target 18 + 49:0 reduce + 50:0 reduce + 4:258,target 12 + 57:0,target 39 + 41:295,target 31 + 26:0,target 16 + 23:292,target 13 + 35:294,target 25 + 17:291,target 7 + 47:296,target 37 + 3:302,target 47 + 59:308,target 63 + 22:0 reduce + 29:293,target 19 + 30:293,target 20 + 37:288 reduce + 4:275,target 29 + 37:289 reduce + 37:290 reduce + 37:291 reduce + 0:310,target 9 + 0:309,target 8 + 0:299,target 2 + 37:292 reduce + 37:293 reduce + 37:294 reduce + 42:295,target 32 + 37:295 reduce + 37:296 reduce + 24:292,target 14 + 36:294,target 26 + 54:0,target 44 + 18:291,target 8 + 23:0,target 13 + 48:296,target 38 + 4:292,target 46 + 31:293,target 21 + 36:0 reduce + 43:295,target 33 + 10:297,target 1 + 25:292,target 15 + 37:294,target 27 + 43:295 reduce + 43:296 reduce + 50:296,target 58 + 19:291,target 9 + 20:291,target 10 + 8:0,target 0 + 2:301 reduce + 32:293,target 22 + 2:302 reduce + 51:0,target 53 + 2:304 reduce + 44:295,target 34 + 2:297 reduce + 4:266,target 20 + 19:0,target 9 + 20:0,target 10 + 51:0 reduce + 0:301,target 4 + 26:292,target 16 + 38:294,target 28 + 51:296,target 58 + 21:291,target 11 + 6:302,target 48 + 33:293,target 23 + 18:288 reduce + 15:290,target 5 + 15:289,target 5 + 4:283,target 37 + 18:289 reduce + 18:290 reduce + 45:295,target 35 + 48:295 reduce + 18:291 reduce + 23:0 reduce + 48:296 reduce + 18:292 reduce + 18:293 reduce + 5:0,target 58 + 18:294 reduce + 18:295 reduce + 27:292,target 17 + 18:296 reduce + 39:294,target 29 + 40:294,target 30 + 47:0,target 37 + 16:0,target 6 + 7:298 shift + 22:291,target 12 + 7:313 goto + 34:293,target 24 + 16:289,target 6 + 16:290,target 6 + 46:295,target 36 + 2:301,target 49 + 28:292,target 18 + 37:0 reduce + 4:257,target 11 + 41:294,target 31 + 24:288 reduce + 24:289 reduce + 24:290 reduce + 24:291 reduce + 24:292 reduce + 23:291,target 13 + 24:293 reduce + 24:294 reduce + 24:295 reduce + 24:296 reduce + 35:293,target 25 + 44:0,target 34 + 17:289,target 7 + 17:290,target 7 + 47:295,target 37 + 13:0,target 3 + 3:301,target 47 + 29:292,target 19 + 30:292,target 20 + 4:274,target 28 + 52:0 reduce + 24:291,target 14 + 36:293,target 26 + 29:288 reduce + 30:288 reduce + 59:295 shift + 29:289 reduce + 29:290 reduce + 30:289 reduce + 30:290 reduce + 59:296 shift + 18:289,target 8 + 18:290,target 8 + 29:291 reduce + 30:291 reduce + 48:295,target 38 + 29:292 reduce + 30:292 reduce + 59:308 goto + 29:293 reduce + 30:293 reduce + 29:294 reduce + 30:294 reduce + 4:291,target 45 + 29:295 reduce + 30:295 reduce + 29:296 reduce + 30:296 reduce + 31:292,target 21 + 24:0 reduce + 41:0,target 31 + 25:291,target 15 + 37:293,target 27 + 50:295,target 57 + 19:289,target 9 + 19:290,target 9 + 20:289,target 10 + 20:290,target 10 + 32:292,target 22 + 35:288 reduce + 35:289 reduce + 35:290 reduce + 38:0 reduce + 4:265,target 19 + 35:291 reduce + 35:292 reduce + 0:300,target 3 + 35:293 reduce + 26:291,target 16 + 35:294 reduce + 35:295 reduce + 35:296 reduce + 38:293,target 28 + 37:0,target 27 + 51:295,target 57 + 21:289,target 11 + 21:290,target 11 + 6:301,target 48 + 33:292,target 23 + 11:0 reduce + 15:288,target 5 + 4:282,target 36 + 27:291,target 17 + 39:293,target 29 + 40:293,target 30 + 41:288 reduce + 41:289 reduce + 41:290 reduce + 41:291 reduce + 22:289,target 12 + 22:290,target 12 + 41:292 reduce + 41:293 reduce + 41:294 reduce + 41:295 reduce + 41:296 reduce + 34:292,target 24 + 34:0,target 24 + 0:300 shift + 16:288,target 6 + 0:301 shift + 0:302 shift + 0:303 shift + 0:304 shift + 25:0 reduce + 28:291,target 18 + 0:297 shift + 0:299 shift + 0:310 goto + 0:309 goto + 0:311 goto + 41:293,target 31 + 23:289,target 13 + 23:290,target 13 + 35:292,target 25 + 5:298,target 53 + 17:288,target 7 + 16:288 reduce + 59:296,target 58 + 16:289 reduce + 16:290 reduce + 29:291,target 19 + 30:291,target 20 + 46:295 reduce + 62:0,target 59 + 4:273,target 27 + 16:291 reduce + 46:296 reduce + 16:292 reduce + 39:0 reduce + 40:0 reduce + 0:297,target 1 + 16:293 reduce + 16:294 reduce + 16:295 reduce + 31:0,target 21 + 16:296 reduce + 24:289,target 14 + 24:290,target 14 + 5:298 shift + 36:292,target 26 + 5:313 goto + 18:288,target 8 + 15:296,target 5 + 4:290,target 44 + 4:289,target 43 + 12:0 reduce + 31:291,target 21 + 54:0 reduce + 25:289,target 15 + 25:290,target 15 + 22:288 reduce + 22:289 reduce + 22:290 reduce + 58:0,target 40 + 22:291 reduce + 22:292 reduce + 22:293 reduce + 37:292,target 27 + 22:294 reduce + 22:295 reduce + 27:0,target 17 + 7:298,target 53 + 22:296 reduce + 50:294,target 48 + 19:288,target 9 + 20:288,target 10 + 16:296,target 6 + 32:291,target 22 + 2:297,target 49 + 26:0 reduce + 4:264,target 18 + 26:289,target 16 + 26:290,target 16 + 1:0 reduce + 38:292,target 28 + 21:288,target 11 + 27:288 reduce + 17:296,target 7 + 27:289 reduce + 27:290 reduce + 55:0,target 45 + 27:291 reduce + 33:291,target 23 + 27:292 reduce + 27:293 reduce + 3:297,target 47 + 27:294 reduce + 24:0,target 14 + 27:295 reduce + 4:281,target 35 + 27:296 reduce + 41:0 reduce + 27:289,target 17 + 27:290,target 17 + 39:292,target 29 + 40:292,target 30 + 22:288,target 12 + 18:296,target 8 + 34:291,target 24 + 4:307,target 51 + 13:0 reduce + 9:0,target 42 + 28:289,target 18 + 28:290,target 18 + 33:288 reduce + 33:289 reduce + 33:290 reduce + 55:0 reduce + 52:0,target 43 + 33:291 reduce + 33:292 reduce + 33:293 reduce + 33:294 reduce + 41:292,target 31 + 21:0,target 11 + 33:295 reduce + 33:296 reduce + 23:288,target 13 + 19:296,target 9 + 20:296,target 10 + 35:291,target 25 + 59:295,target 57 + 27:0 reduce + 29:289,target 19 + 29:290,target 19 + 30:289,target 20 + 30:290,target 20 + 4:272,target 26 + 24:288,target 14 + 38:288 reduce + 38:289 reduce + 38:290 reduce + 21:296,target 11 + 38:291 reduce + 48:0,target 38 + 36:291,target 26 + 38:292 reduce + 38:293 reduce + 38:294 reduce + 6:297,target 48 + 17:0,target 7 + 38:295 reduce + 38:296 reduce + 15:295,target 5 + 4:288,target 42 + 31:289,target 21 + 31:290,target 21 + 42:0 reduce + 10:304,target 7 + 25:288,target 15 + 22:296,target 12 + 37:291,target 27 + 50:293,target 47 + 16:295,target 6 + 32:289,target 22 + 32:290,target 22 + 45:0,target 35 + 14:0 reduce + 14:0,target 4 + 44:295 reduce + 44:296 reduce + 4:263,target 17 + 56:0 reduce + 26:288,target 16 + 3:301 reduce + 3:302 reduce + 23:296,target 13 + 3:304 reduce + 38:291,target 28 + 3:297 reduce + 17:295,target 7 + 33:289,target 23 + 33:290,target 23 + 4:280,target 34 + 4:279,target 33 + 28:0 reduce + 27:288,target 17 + 50:288 shift + 50:289 shift + 50:290 shift + 42:0,target 32 + 50:291 shift + 24:296,target 14 + 50:292 shift + 39:291,target 29 + 40:291,target 30 + 50:293 shift + 50:294 shift + 19:288 reduce + 20:288 reduce + 50:295 shift + 11:0,target 1 + 19:289 reduce + 19:290 reduce + 20:289 reduce + 20:290 reduce + 50:296 shift + 19:291 reduce + 20:291 reduce + 19:292 reduce + 20:292 reduce + 50:307 goto + 19:293 reduce + 20:293 reduce + 50:308 goto + 19:294 reduce + 20:294 reduce + 19:295 reduce + 20:295 reduce + 19:296 reduce + 20:296 reduce + 18:295,target 8 + 34:289,target 24 + 34:290,target 24 + 4:306,target 50 + 28:288,target 18 + 43:0 reduce + 25:296,target 15 + 41:291,target 31 + 19:295,target 9 + 20:295,target 10 + 35:289,target 25 + 35:290,target 25 + 38:0,target 28 + 25:288 reduce + 25:289 reduce + 25:290 reduce + 25:291 reduce + 25:292 reduce + 25:293 reduce + 15:0 reduce + 25:294 reduce + 25:295 reduce + 25:296 reduce + 29:288,target 19 + 30:288,target 20 + 4:271,target 25 + 57:0 reduce + 26:296,target 16 + 21:295,target 11 + 36:289,target 26 + 36:290,target 26 + 15:294,target 5 + 4:287,target 41 + 31:288,target 21 + 29:0 reduce + 30:0 reduce + 35:0,target 25 + 27:296,target 17 + 31:288 reduce + 31:289 reduce + 31:290 reduce + 31:291 reduce + 31:292 reduce + 31:293 reduce + 31:294 reduce + 4:0 reduce + 31:295 reduce + 31:296 reduce + 22:295,target 12 + 37:289,target 27 + 37:290,target 27 + 50:292,target 46 + 16:294,target 6 + 32:288,target 22 + 28:296,target 18 + 44:0 reduce + 4:262,target 16 + 63:0,target 57 + 23:295,target 13 + 32:0,target 22 + 38:289,target 28 + 38:290,target 28 + 36:288 reduce + 36:289 reduce + 36:290 reduce + 36:291 reduce + 36:292 reduce + 36:293 reduce + 36:294 reduce + 36:295 reduce + 17:294,target 7 + 36:296 reduce + 33:288,target 23 + 16:0 reduce + 29:296,target 19 + 30:296,target 20 + 4:278,target 32 + 58:0 reduce + 24:295,target 14 + 39:289,target 29 + 39:290,target 29 + 40:289,target 30 + 40:290,target 30 + 60:0,target 55 + 59:0,target 54 + 18:294,target 8 + 34:288,target 24 + 28:0,target 18 + 4:305,target 49 + 31:296,target 21 + 31:0 reduce + 42:295 reduce + 42:296 reduce + 25:295,target 15 + 41:289,target 31 + 41:290,target 31 + 5:0 reduce + 19:294,target 9 + 20:294,target 10 + 35:288,target 25 + 32:296,target 22 + 56:0,target 41 + 4:270,target 24 + 4:269,target 23 + 45:0 reduce + 0:304,target 7 + 25:0,target 15 + 26:295,target 16 + 17:288 reduce + 17:289 reduce + 17:290 reduce + 47:295 reduce + 17:291 reduce + 47:296 reduce + 17:292 reduce + 21:294,target 11 + 17:293 reduce + 36:288,target 26 + 17:294 reduce + 17:295 reduce + 17:296 reduce + 6:301 reduce + 33:296,target 23 + 6:302 reduce + 6:304 reduce + 15:293,target 5 + 4:286,target 40 + 6:297 reduce + 17:0 reduce + 27:295,target 17 + 60:0 reduce + 59:0 reduce + 10:302,target 5 + 22:294,target 12 + 22:0,target 12 + 37:288,target 27 + 34:296,target 24 + 50:291,target 45 + 23:288 reduce + 16:293,target 6 + 23:289 reduce + 23:290 reduce + 23:291 reduce + 23:292 reduce + 53:298 shift + 23:293 reduce + 2:304,target 49 + 23:294 reduce + 23:295 reduce + 28:295,target 18 + 32:0 reduce + 23:296 reduce + 4:261,target 15 + 23:294,target 13 + 38:288,target 28 + 7:0,target 58 + 35:296,target 25 + 5:313,target 54 + 49:0,target 51 + 50:0,target 52 + 17:293,target 7 + 18:0,target 8 + 3:304,target 47 + 29:295,target 19 + 30:295,target 20 + 4:277,target 31 + 46:0 reduce + 28:288 reduce + 28:289 reduce + 28:290 reduce + 28:291 reduce + 28:292 reduce + 24:294,target 14 + 28:293 reduce + 28:294 reduce + 39:288,target 29 + 40:288,target 30 + 28:295 reduce + 28:296 reduce + 36:296,target 26 + 18:293,target 8 + 4:294,target 48 + 4:0,target 50 + 31:295,target 21 + 18:0 reduce + 46:0,target 36 + 61:0 reduce + 10:310,target 56 + 15:0,target 5 + 25:294,target 15 + 41:288,target 31 + 37:296,target 27 + 7:313,target 55 + 34:288 reduce + 34:289 reduce + 34:290 reduce + 19:293,target 9 + 20:293,target 10 + 34:291 reduce + 50:308,target 60 + 34:292 reduce + 34:293 reduce + 34:294 reduce + 34:295 reduce + 32:295,target 22 + 34:296 reduce + 33:0 reduce + 4:268,target 22 + 0:303,target 6 + 26:294,target 16 + 1:0,target 46 + 7:0 reduce + 38:296,target 28 + 43:0,target 33 + 51:308,target 61 + 21:293,target 11 + 12:0,target 2 + 6:304,target 48 + 33:295,target 23 + 15:292,target 5 + 4:285,target 39 + 39:288 reduce + 40:288 reduce + 39:289 reduce + 39:290 reduce + 40:289 reduce + 40:290 reduce + 39:291 reduce + 40:291 reduce + 39:292 reduce + 40:292 reduce + 39:293 reduce + 40:293 reduce + 27:294,target 17 + 39:294 reduce + 40:294 reduce + 47:0 reduce + 39:295 reduce + 40:295 reduce + 10:301 shift + 39:296 reduce + 40:296 reduce + 10:302 shift + 10:304 shift + 10:301,target 4 + 39:296,target 29 + 40:296,target 30 + 10:297 shift + 10:310 goto + 22:293,target 12 + 4:257 shift + 34:295,target 24 + 4:258 shift + 50:289,target 43 + 50:290,target 44 + 4:260 shift + 4:259 shift + 4:261 shift + 4:312,target 52 + 4:262 shift + 4:263 shift + 16:292,target 6 + 39:0,target 29 + 40:0,target 30 + 4:264 shift + 4:265 shift + 4:266 shift + 19:0 reduce + 20:0 reduce + 4:267 shift + 4:268 shift + 28:294,target 18 + 4:270 shift + 4:269 shift + 4:271 shift + 4:272 shift + 4:260,target 14 + 4:259,target 13 + 62:0 reduce + 4:273 shift + 4:274 shift + 41:296,target 31 + 4:275 shift + 4:276 shift + 4:277 shift + 4:278 shift + 53:298,target 62 + 4:280 shift + 4:279 shift + 23:293,target 13 + 4:281 shift + 15:288 reduce + 4:282 shift + 15:290 reduce + 15:289 reduce + 4:283 shift + 45:295 reduce + 15:291 reduce + 4:284 shift + 45:296 reduce + 15:292 reduce + 4:285 shift + 35:295,target 25 + 15:293 reduce + 4:286 shift + 15:294 reduce + 4:287 shift + 15:295 reduce + 4:288 shift + 15:296 reduce + 4:290 shift + 4:289 shift + 4:291 shift + 17:292,target 7 + 4:292 shift + 4:293 shift + 4:294 shift + 4:305 goto + 4:306 goto + 29:294,target 19 + 30:294,target 20 + 4:276,target 30 + 4:307 goto + 34:0 reduce + 0:311,target 10 + 4:312 goto + 42:296,target 32 + 36:0,target 26 + 24:293,target 14 + 8:0 accept + 36:295,target 26 + 18:292,target 8 + 4:293,target 47 + 21:288 reduce +} + +array set iexamsend::rules { + 9,l 306 + 11,l 306 + 32,l 307 + 53,l 312 + 6,l 306 + 28,l 306 + 50,l 312 + 49,l 311 + 3,l 305 + 25,l 306 + 46,l 310 + 0,l 314 + 22,l 306 + 43,l 310 + 18,l 306 + 40,l 308 + 39,l 308 + 15,l 306 + 36,l 307 + 57,l 312 + 12,l 306 + 33,l 307 + 54,l 312 + 7,l 306 + 29,l 306 + 30,l 306 + 51,l 312 + 4,l 305 + 26,l 306 + 47,l 311 + 1,l 305 + 23,l 306 + 44,l 310 + 19,l 306 + 20,l 306 + 41,l 309 + 16,l 306 + 37,l 307 + 58,l 313 + 13,l 306 + 34,l 307 + 55,l 312 + 8,l 306 + 10,l 306 + 31,l 306 + 52,l 312 + 5,l 306 + 27,l 306 + 48,l 311 + 2,l 305 + 24,l 306 + 45,l 310 + 21,l 306 + 42,l 309 + 17,l 306 + 38,l 307 + 59,l 313 + 14,l 306 + 35,l 307 + 56,l 312 +} + +array set iexamsend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 2 + 55,dc 2 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 2 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 59,dc 2 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 0 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 2 + 57,dc 3 + 21,dc 1 + 35,dc 1 + 50,dc 0 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 2 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set iexamsend::rules { + 41,line 158 + 7,line 119 + 37,line 150 + 4,line 115 + 34,line 147 + 1,line 112 + 31,line 143 + 27,line 139 + 24,line 136 + 21,line 133 + 17,line 129 + 14,line 126 + 11,line 123 + 59,line 185 + 56,line 180 + 53,line 177 + 50,line 174 + 49,line 171 + 46,line 166 + 43,line 162 + 9,line 121 + 40,line 154 + 39,line 153 + 6,line 118 + 36,line 149 + 3,line 114 + 33,line 146 + 29,line 141 + 30,line 142 + 26,line 138 + 23,line 135 + 19,line 131 + 20,line 132 + 16,line 128 + 13,line 125 + 10,line 122 + 58,line 184 + 55,line 179 + 52,line 176 + 48,line 170 + 45,line 165 + 42,line 159 + 8,line 120 + 38,line 151 + 5,line 117 + 35,line 148 + 2,line 113 + 32,line 145 + 28,line 140 + 25,line 137 + 22,line 134 + 18,line 130 + 15,line 127 + 12,line 124 + 57,line 181 + 54,line 178 + 51,line 175 + 47,line 169 + 44,line 164 +} + +array set iexamsend::lr1_table { + 35 {{25 {0 288 289 290 291 292 293 294 295 296} 1}} + 14,trans {} + 36 {{26 {0 288 289 290 291 292 293 294 295 296} 1}} + 33,trans {} + 37 {{27 {0 288 289 290 291 292 293 294 295 296} 1}} + 52,trans {} + 38 {{28 {0 288 289 290 291 292 293 294 295 296} 1}} + 39 {{29 {0 288 289 290 291 292 293 294 295 296} 1}} + 40 {{30 {0 288 289 290 291 292 293 294 295 296} 1}} + 18,trans {} + 1,trans {} + 41 {{31 {0 288 289 290 291 292 293 294 295 296} 1}} + 37,trans {} + 42 {{32 {0 295 296} 1}} + 56,trans {} + 43 {{33 {0 295 296} 1}} + 44 {{34 {0 295 296} 1}} + 23,trans {} + 5,trans {{298 53} {313 54}} + 45 {{35 {0 295 296} 1}} + 42,trans {} + 46 {{36 {0 295 296} 1}} + 61,trans {} + 47 {{37 {0 295 296} 1}} + 48 {{38 {0 295 296} 1}} + 27,trans {} + 9,trans {} + 50 {{52 0 1} {54 0 1} {55 0 1} {57 0 1} {32 {0 295 296} 0} {33 {0 295 296} 0} {34 {0 295 296} 0} {35 {0 295 296} 0} {36 {0 295 296} 0} {37 {0 295 296} 0} {38 {0 295 296} 0} {39 0 0} {40 0 0}} + 49 {{51 0 1}} + 46,trans {} + 51 {{53 0 1} {56 0 1} {39 0 0} {40 0 0}} + 52 {{43 0 2}} + 13,trans {} + 53 {{59 0 1}} + 32,trans {} + 54 {{44 0 2}} + 51,trans {{295 57} {296 58} {308 61}} + 55 {{45 0 2}} + 56 {{41 0 2}} + 57 {{39 0 1}} + 17,trans {} + 0,trans {{297 1} {299 2} {300 3} {301 4} {302 5} {303 6} {304 7} {309 8} {310 9} {311 10}} + 58 {{40 0 1}} + 36,trans {} + 55,trans {} + 60 {{55 0 2}} + 59 {{54 0 2} {57 0 2} {39 0 0} {40 0 0}} + 61 {{56 0 2}} + 62 {{59 0 2}} + 22,trans {} + 4,trans {{257 11} {258 12} {259 13} {260 14} {261 15} {262 16} {263 17} {264 18} {265 19} {266 20} {267 21} {268 22} {269 23} {270 24} {271 25} {272 26} {273 27} {274 28} {275 29} {276 30} {277 31} {278 32} {279 33} {280 34} {281 35} {282 36} {283 37} {284 38} {285 39} {286 40} {287 41} {288 42} {289 43} {290 44} {291 45} {292 46} {293 47} {294 48} {305 49} {306 50} {307 51} {312 52}} + 63 {{57 0 3}} + 41,trans {} + 60,trans {} + 59,trans {{295 57} {296 58} {308 63}} + 26,trans {} + 8,trans {} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {{288 42} {289 43} {290 44} {291 45} {292 46} {293 47} {294 48} {295 57} {296 58} {307 59} {308 60}} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{41 0 1} {43 0 0} {44 0 0} {45 0 0} {46 0 0}} + 11 {{1 0 1}} + 25,trans {} + 7,trans {{298 53} {313 55}} + 12 {{2 0 1}} + 44,trans {} + 13 {{3 0 1}} + 63,trans {} + 14 {{4 0 1}} + 11,trans {} + 15 {{5 {0 288 289 290 291 292 293 294 295 296} 1}} + 30,trans {} + 29,trans {} + 16 {{6 {0 288 289 290 291 292 293 294 295 296} 1}} + 48,trans {} + 0 {{0 0 0} {41 0 0} {42 0 0} {47 {297 301 302 304} 0} {48 {297 301 302 304} 0} {49 {297 301 302 304} 0} {43 0 0} {44 0 0} {45 0 0} {46 0 0}} + 17 {{7 {0 288 289 290 291 292 293 294 295 296} 1}} + 1 {{46 0 1}} + 18 {{8 {0 288 289 290 291 292 293 294 295 296} 1}} + 15,trans {} + 2 {{49 {297 301 302 304} 1}} + 19 {{9 {0 288 289 290 291 292 293 294 295 296} 1}} + 20 {{10 {0 288 289 290 291 292 293 294 295 296} 1}} + 34,trans {} + 3 {{47 {297 301 302 304} 1}} + 21 {{11 {0 288 289 290 291 292 293 294 295 296} 1}} + 53,trans {{298 62}} + 4 {{43 0 1} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 0 0} {55 0 0} {56 0 0} {57 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 {0 288 289 290 291 292 293 294 295 296} 0} {6 {0 288 289 290 291 292 293 294 295 296} 0} {7 {0 288 289 290 291 292 293 294 295 296} 0} {8 {0 288 289 290 291 292 293 294 295 296} 0} {9 {0 288 289 290 291 292 293 294 295 296} 0} {10 {0 288 289 290 291 292 293 294 295 296} 0} {11 {0 288 289 290 291 292 293 294 295 296} 0} {12 {0 288 289 290 291 292 293 294 295 296} 0} {13 {0 288 289 290 291 292 293 294 295 296} 0} {14 {0 288 289 290 291 292 293 294 295 296} 0} {15 {0 288 289 290 291 292 293 294 295 296} 0} {16 {0 288 289 290 291 292 293 294 295 296} 0} {17 {0 288 289 290 291 292 293 294 295 296} 0} {18 {0 288 289 290 291 292 293 294 295 296} 0} {19 {0 288 289 290 291 292 293 294 295 296} 0} {20 {0 288 289 290 291 292 293 294 295 296} 0} {21 {0 288 289 290 291 292 293 294 295 296} 0} {22 {0 288 289 290 291 292 293 294 295 296} 0} {23 {0 288 289 290 291 292 293 294 295 296} 0} {24 {0 288 289 290 291 292 293 294 295 296} 0} {25 {0 288 289 290 291 292 293 294 295 296} 0} {26 {0 288 289 290 291 292 293 294 295 296} 0} {27 {0 288 289 290 291 292 293 294 295 296} 0} {28 {0 288 289 290 291 292 293 294 295 296} 0} {29 {0 288 289 290 291 292 293 294 295 296} 0} {30 {0 288 289 290 291 292 293 294 295 296} 0} {31 {0 288 289 290 291 292 293 294 295 296} 0} {32 {0 295 296} 0} {33 {0 295 296} 0} {34 {0 295 296} 0} {35 {0 295 296} 0} {36 {0 295 296} 0} {37 {0 295 296} 0} {38 {0 295 296} 0}} + 22 {{12 {0 288 289 290 291 292 293 294 295 296} 1}} + 5 {{44 0 1} {58 0 0} {59 0 0}} + 23 {{13 {0 288 289 290 291 292 293 294 295 296} 1}} + 20,trans {} + 19,trans {} + 6 {{48 {297 301 302 304} 1}} + 2,trans {} + 24 {{14 {0 288 289 290 291 292 293 294 295 296} 1}} + 38,trans {} + 7 {{45 0 1} {58 0 0} {59 0 0}} + 25 {{15 {0 288 289 290 291 292 293 294 295 296} 1}} + 57,trans {} + 8 {{0 0 1}} + 26 {{16 {0 288 289 290 291 292 293 294 295 296} 1}} + 9 {{42 0 1}} + 27 {{17 {0 288 289 290 291 292 293 294 295 296} 1}} + 24,trans {} + 6,trans {} + 28 {{18 {0 288 289 290 291 292 293 294 295 296} 1}} + 43,trans {} + 29 {{19 {0 288 289 290 291 292 293 294 295 296} 1}} + 30 {{20 {0 288 289 290 291 292 293 294 295 296} 1}} + 62,trans {} + 31 {{21 {0 288 289 290 291 292 293 294 295 296} 1}} + 10,trans {{297 1} {301 4} {302 5} {304 7} {310 56}} + 32 {{22 {0 288 289 290 291 292 293 294 295 296} 1}} + 28,trans {} + 33 {{23 {0 288 289 290 291 292 293 294 295 296} 1}} + 47,trans {} + 34 {{24 {0 288 289 290 291 292 293 294 295 296} 1}} +} + +array set iexamsend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 60 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 BUTTON_ + 284,title WCSW + 291 J2000_ + 301 COORDINATE_ + 313,title {} + 292 ICRS_ + 302 DATA_ + 288,line 40 + 293 GALACTIC_ + 303 KEY_ + 294 ECLIPTIC_ + 304 VALUE_ + 305 coordsys + 295 DEGREES_ + 306 wcssys + 296 SEXAGESIMAL_ + 307 skyframe + 262,t 0 + 297 STRING_ + 308 skyformat + 285,line 36 + 298 INT_ + 310 cmd + 309 iexamsend + 299 ANY_ + 311 dest + 283,t 0 + 312 coordinate + 313 data + 314,t 1 + 314 start' + 282,line 33 + 264,title WCSC + 283,title WCSV + 312,title {} + 278,line 29 + error,line 110 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title ANY + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title integer + 314,line 186 + 291,t 0 + 301,t 0 + 311,line 168 + 307,line 144 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 51 + 278,title WCSQ + 307,title {} + 297,title string + 287,t 0 + 294,line 46 + 304,line 62 + error,title {} + 291,line 43 + 301,line 59 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title SEXAGESIMAL + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title {} + 295,title DEGREES + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title ECLIPTIC + 304,title VALUE + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title KEY + error error + 271,t 0 + 292,t 0 + 302,t 0 + 273,title WCSL + 313,line 183 + 292,title ICRS + 302,title DATA + 267,t 0 + 310,line 161 + 309,line 157 + 299,line 57 + 288,t 0 + 306,line 116 + 296,line 49 + 272,title WCSK + 291,title J2000 + 293,line 45 + 301,title COORDINATE + 303,line 61 + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 58 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title BUTTON + 282,t 0 + 279,line 30 + 280,line 31 + 313,t 1 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 173 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 314,title {} + 275 WCSN_ + 308,line 152 + 276 WCSO_ + 298,line 53 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 111 + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc iexamsend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ degrees } + 40 { set _ sexagesimal } + 46 { IExamSendCmdMacro $1 } + 47 { IExamSendCmdDest button } + 48 { IExamSendCmdDest key } + 49 { IExamSendCmdDest any } + 50 { IExamSendCmdCoord image fk5 degrees } + 51 { IExamSendCmdCoord $1 fk5 degrees } + 52 { IExamSendCmdCoord $1 fk5 degrees } + 53 { IExamSendCmdCoord wcs $1 degrees } + 54 { IExamSendCmdCoord $1 $2 degrees } + 55 { IExamSendCmdCoord $1 fk5 $2 } + 56 { IExamSendCmdCoord wcs $1 $2 } + 57 { IExamSendCmdCoord $1 $2 $3 } + 58 { IExamSendCmdData 1 1 } + 59 { IExamSendCmdData $1 $2 } + } + 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 iexamsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/iislex.tcl b/ds9/parsers/iislex.tcl new file mode 100644 index 0000000..2680481 --- /dev/null +++ b/ds9/parsers/iislex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval iis { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc iis::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc iis::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc iis::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc iis::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc iis::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc iis::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc iis::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc iis::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc iis::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 +set FILENAME_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $FILENAME_ + } + 1 { +set yylval $yytext; return $INT_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/iisparser.tab.tcl b/ds9/parsers/iisparser.tab.tcl new file mode 100644 index 0000000..25ede1f --- /dev/null +++ b/ds9/parsers/iisparser.tab.tcl @@ -0,0 +1,3 @@ +set INT_ 257 +set STRING_ 258 +set FILENAME_ 259 diff --git a/ds9/parsers/iisparser.tcl b/ds9/parsers/iisparser.tcl new file mode 100644 index 0000000..6e06336 --- /dev/null +++ b/ds9/parsers/iisparser.tcl @@ -0,0 +1,311 @@ +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 iis { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc iis::YYABORT {} { + return -code return 1 +} + +proc iis::YYACCEPT {} { + return -code return 0 +} + +proc iis::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc iis::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc iis::yyerror {s} { + puts stderr $s +} + +proc iis::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 iis::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set iis::table { + 6:0 reduce + 3:0,target 1 + 7:0 reduce + 5:258,target 7 + 3:261,target 5 + 0:260 goto + 0:259 shift + 1:258 shift + 7:0,target 3 + 4:257 shift + 3:258 reduce + 0:262 goto + 4:258 reduce + 5:258 shift + 3:261 goto + 6:258 reduce + 2:0,target 0 + 4:258,target 4 + 4:0,target 4 + 6:258,target 5 + 6:0,target 5 + 2:0 accept + 0:260,target 2 + 0:259,target 1 + 1:258,target 4 + 3:0 reduce + 4:0 reduce + 4:257,target 6 + 3:258,target 2 + 0:262,target 3 +} + +array set iis::rules { + 0,l 263 + 1,l 260 + 2,l 261 + 3,l 260 + 4,l 262 + 5,l 262 +} + +array set iis::rules { + 5,dc 3 + 0,dc 1 + 2,dc 0 + 4,dc 2 + 1,dc 1 + 3,dc 3 +} + +array set iis::rules { + 5,line 23 + 2,e 1 + 2,line 18 + 4,line 22 + 1,line 18 + 3,line 19 +} + +array set iis::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0} {5 {0 258} 0}} + 1 {{4 {0 258} 1} {5 {0 258} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{259 1} {260 2} {262 3}} + 4 {{4 {0 258} 2} {5 {0 258} 2}} + 1,trans {{258 4}} + 5 {{3 0 2}} + 2,trans {} + 6 {{5 {0 258} 3}} + 7 {{3 0 3}} + 3,trans {{261 5}} + 4,trans {{257 6}} + 5,trans {{258 7}} + 6,trans {} + 7,trans {} +} + +array set iis::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 9 + 261,line 18 + error,line 16 + 257 INT_ + 257,t 0 + 263,line 24 + 258 STRING_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 FILENAME_ + 259,t 0 + 261,t 1 + 261 @PSEUDO1 + 262,t 1 + 262 iis + 257,line 7 + 263,t 1 + 263 start' + 260,line 17 + 257,title integer + 259,line 13 + 258,title string + 262,line 21 + 260,title {} + 259,title FILENAME + 261,title {} +} + +proc iis::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { IISCmd $2 } + 5 { IISCmd $2 $3 } + } + 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 iis::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/iissendlex.tcl b/ds9/parsers/iissendlex.tcl new file mode 100644 index 0000000..1686f4f --- /dev/null +++ b/ds9/parsers/iissendlex.tcl @@ -0,0 +1,267 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval iissend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc iissend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc iissend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc iissend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc iissend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc iissend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc iissend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc iissend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc iissend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc iissend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set FILENAME_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $FILENAME_ + } + 1 { +set yylval $yytext; return $INT_ + } + 2 { +# ignore whitespace + } + 3 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/iissendparser.tab.tcl b/ds9/parsers/iissendparser.tab.tcl new file mode 100644 index 0000000..1e68251 --- /dev/null +++ b/ds9/parsers/iissendparser.tab.tcl @@ -0,0 +1,2 @@ +set INT_ 257 +set FILENAME_ 258 diff --git a/ds9/parsers/iissendparser.tcl b/ds9/parsers/iissendparser.tcl new file mode 100644 index 0000000..2c8a665 --- /dev/null +++ b/ds9/parsers/iissendparser.tcl @@ -0,0 +1,278 @@ +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 iissend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc iissend::YYABORT {} { + return -code return 1 +} + +proc iissend::YYACCEPT {} { + return -code return 0 +} + +proc iissend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc iissend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc iissend::yyerror {s} { + puts stderr $s +} + +proc iissend::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 iissend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set iissend::table { + 3:0,target 0 + 0:257 shift + 0:258 shift + 2:257 shift + 0:259 goto + 0:258,target 2 + 0:0,target 1 + 2:0,target 3 + 4:0,target 4 + 0:0 reduce + 0:257,target 1 + 1:0 reduce + 2:0 reduce + 3:0 accept + 2:257,target 4 + 0:259,target 3 + 4:0 reduce + 1:0,target 2 +} + +array set iissend::rules { + 0,l 260 + 1,l 259 + 2,l 259 + 3,l 259 + 4,l 259 +} + +array set iissend::rules { + 0,dc 1 + 2,dc 1 + 4,dc 2 + 1,dc 0 + 3,dc 1 +} + +array set iissend::rules { + 2,line 17 + 4,line 19 + 1,line 16 + 3,line 18 +} + +array set iissend::lr1_table { + 4,trans {} + 4 {{4 0 2}} + 0,trans {{257 1} {258 2} {259 3}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0}} + 1,trans {} + 1 {{2 0 1}} + 2,trans {{257 4}} + 2 {{3 0 1} {4 0 1}} + 3,trans {} + 3 {{0 0 1}} +} + +array set iissend::token_id_table { + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 11 + error,line 14 + 257 INT_ + 257,t 0 + 258 FILENAME_ + 258,t 0 + 260,t 1 + 260 start' + 259,t 1 + 259 iissend + error,title {} + 257,line 7 + 260,line 20 + 259,line 15 + 257,title integer + 258,title FILENAME + 260,title {} + 259,title {} +} + +proc iissend::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 { ProcessSendCmdCurrent "get iis file name 1" } + 2 { ProcessSendCmdCurrent "get iis file name $1" } + 3 { ProcessSendCmdCurrent "get iis file name 1" } + 4 { ProcessSendCmdCurrent "get iis file name $2" } + } + 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 iissend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/locklex.tcl b/ds9/parsers/locklex.tcl new file mode 100644 index 0000000..91dba66 --- /dev/null +++ b/ds9/parsers/locklex.tcl @@ -0,0 +1,806 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval lock { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc lock::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc lock::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc lock::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc lock::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc lock::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc lock::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc lock::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc lock::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc lock::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set YES_ 288 +set NO_ 289 +set ON_ 290 +set OFF_ 291 +set TRUE_ 292 +set FALSE_ 293 +set STRING_ 294 +set 3D_ 295 +set AXES_ 296 +set BIN_ 297 +set BLOCK_ 298 +set COLORBAR_ 299 +set CROP_ 300 +set CROSSHAIR_ 301 +set FRAME_ 302 +set SCALE_ 303 +set SCALELIMITS_ 304 +set SLICE_ 305 +set SMOOTH_ 306 +set NONE_ 307 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: bin + if {[regexp -start $index_ -indices -line -nocase -- {\A(bin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: block + if {[regexp -start $index_ -indices -line -nocase -- {\A(block)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: crop + if {[regexp -start $index_ -indices -line -nocase -- {\A(crop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $AXES_ + } + 2 { +return $BIN_ + } + 3 { +return $BLOCK_ + } + 4 { +return $COLORBAR_ + } + 5 { +return $CROP_ + } + 6 { +return $CROSSHAIR_ + } + 7 { +return $FRAME_ + } + 8 { +return $IMAGE_ + } + 9 { +return $NONE_ + } + 10 { +return $SCALE_ + } + 11 { +return $SCALELIMITS_ + } + 12 { +return $SLICE_ + } + 13 { +return $SMOOTH_ + } + 14 { +return $WCS_ + } + 15 { +return $WCSA_ + } + 16 { +return $WCSB_ + } + 17 { +return $WCSC_ + } + 18 { +return $WCSD_ + } + 19 { +return $WCSE_ + } + 20 { +return $WCSF_ + } + 21 { +return $WCSG_ + } + 22 { +return $WCSH_ + } + 23 { +return $WCSI_ + } + 24 { +return $WCSJ_ + } + 25 { +return $WCSK_ + } + 26 { +return $WCSL_ + } + 27 { +return $WCSM_ + } + 28 { +return $WCSN_ + } + 29 { +return $WCSO_ + } + 30 { +return $WCSP_ + } + 31 { +return $WCSQ_ + } + 32 { +return $WCSR_ + } + 33 { +return $WCSS_ + } + 34 { +return $WCST_ + } + 35 { +return $WCSU_ + } + 36 { +return $WCSV_ + } + 37 { +return $WCSW_ + } + 38 { +return $WCSX_ + } + 39 { +return $WCSY_ + } + 40 { +return $WCSZ_ + } + 41 { +return $YES_ + } + 42 { +return $NO_ + } + 43 { +return $ON_ + } + 44 { +return $OFF_ + } + 45 { +return $TRUE_ + } + 46 { +return $FALSE_ + } + 47 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 48 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 49 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 50 { +set yylval $yytext; return $STRING_ + } + 51 { +# ignore whitespace + } + 52 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/lockparser.tab.tcl b/ds9/parsers/lockparser.tab.tcl new file mode 100644 index 0000000..0293f6f --- /dev/null +++ b/ds9/parsers/lockparser.tab.tcl @@ -0,0 +1,51 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set YES_ 288 +set NO_ 289 +set ON_ 290 +set OFF_ 291 +set TRUE_ 292 +set FALSE_ 293 +set STRING_ 294 +set 3D_ 295 +set AXES_ 296 +set BIN_ 297 +set BLOCK_ 298 +set COLORBAR_ 299 +set CROP_ 300 +set CROSSHAIR_ 301 +set FRAME_ 302 +set SCALE_ 303 +set SCALELIMITS_ 304 +set SLICE_ 305 +set SMOOTH_ 306 +set NONE_ 307 diff --git a/ds9/parsers/lockparser.tcl b/ds9/parsers/lockparser.tcl new file mode 100644 index 0000000..21bee20 --- /dev/null +++ b/ds9/parsers/lockparser.tcl @@ -0,0 +1,1657 @@ +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 lock { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc lock::YYABORT {} { + return -code return 1 +} + +proc lock::YYACCEPT {} { + return -code return 0 +} + +proc lock::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc lock::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc lock::yyerror {s} { + puts stderr $s +} + +proc lock::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 lock::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set lock::table { + 31:294,target 31 + 21:294 reduce + 48:0 reduce + 9:294 reduce + 0:275,target 19 + 42:271,target 15 + 64:0,target 49 + 37:305,target 42 + 37:295,target 32 + 38:278,target 22 + 33:0,target 32 + 39:262,target 6 + 32:294,target 32 + 21:0 reduce + 0:302,target 39 + 63:0 reduce + 42:287,target 31 + 56:294 reduce + 38:305,target 42 + 38:295,target 32 + 26:294 reduce + 39:278,target 22 + 37:269,target 13 + 37:270,target 14 + 33:294,target 32 + 61:0,target 43 + 29:0,target 29 + 30:0,target 30 + 35:0 reduce + 42:314,target 68 + 39:305,target 42 + 39:295,target 32 + 9:0 reduce + 0:266,target 10 + 42:262,target 6 + 37:286,target 30 + 62:294 reduce + 32:288 shift + 38:269,target 13 + 38:270,target 14 + 32:290 shift + 32:289 shift + 32:291 shift + 34:294,target 32 + 32:292 shift + 32:293 shift + 32:294 reduce + 37:257 shift + 32:310 goto + 37:258 shift + 37:259 shift + 37:260 shift + 37:261 shift + 37:262 shift + 37:263 shift + 49:0 reduce + 50:0 reduce + 37:264 shift + 37:265 shift + 57:0,target 46 + 0:283,target 27 + 37:266 shift + 37:267 shift + 37:268 shift + 42:278,target 22 + 26:0,target 26 + 37:269 shift + 37:270 shift + 37:313,target 60 + 37:271 shift + 37:272 shift + 37:273 shift + 38:286,target 30 + 37:274 shift + 37:275 shift + 39:269,target 13 + 39:270,target 14 + 37:276 shift + 35:294,target 32 + 37:277 shift + 37:278 shift + 37:279 shift + 37:280 shift + 37:281 shift + 37:261,target 5 + 37:282 shift + 37:283 shift + 37:284 shift + 37:285 shift + 37:286 shift + 37:287 shift + 67:294 reduce + 22:0 reduce + 37:300 shift + 37:301 shift + 0:299,target 36 + 0:309,target 46 + 37:302 shift + 37:303 shift + 37:304 shift + 64:0 reduce + 37:305 shift + 37:295 shift + 37:296 shift + 37:306 shift + 37:297 shift + 37:307 shift + 37:298 shift + 37:308 goto + 38:313,target 61 + 37:299 shift + 37:309 goto + 39:286,target 30 + 0:257,target 1 + 37:313 goto + 36:294,target 32 + 54:0,target 38 + 37:277,target 21 + 38:261,target 5 + 23:0,target 23 + 36:0 reduce + 39:313,target 62 + 0:274,target 18 + 43:288 shift + 42:269,target 13 + 42:270,target 14 + 43:290 shift + 43:289 shift + 43:291 shift + 37:304,target 41 + 43:292 shift + 43:293 shift + 38:277,target 21 + 43:294 reduce + 39:261,target 5 + 13:294 reduce + 8:0,target 8 + 43:310 goto + 32:293,target 54 + 2:294 reduce + 51:0,target 34 + 20:0,target 20 + 19:0,target 19 + 51:0 reduce + 0:301,target 38 + 42:286,target 30 + 38:304,target 41 + 39:277,target 21 + 37:268,target 12 + 33:293,target 54 + 48:294 reduce + 23:0 reduce + 18:294 reduce + 5:0,target 5 + 48:312 goto + 65:0 reduce + 7:294 reduce + 39:304,target 41 + 40:294,target 32 + 47:0,target 0 + 0:265,target 9 + 16:0,target 16 + 42:261,target 5 + 37:285,target 29 + 38:268,target 12 + 34:293,target 54 + 0:282,target 26 + 41:294,target 32 + 54:294 reduce + 42:277,target 21 + 24:294 reduce + 2:0,target 2 + 38:285,target 29 + 39:268,target 12 + 35:293,target 54 + 44:0,target 56 + 37:259,target 3 + 37:260,target 4 + 13:0,target 13 + 10:0 reduce + 0:298,target 35 + 0:308,target 45 + 52:0 reduce + 42:294,target 57 + 39:285,target 29 + 36:293,target 54 + 37:276,target 20 + 60:294 reduce + 59:294 reduce + 38:259,target 3 + 38:260,target 4 + 29:294 reduce + 30:294 reduce + 24:0 reduce + 41:0,target 32 + 43:294,target 32 + 66:0 reduce + 10:0,target 10 + 0:273,target 17 + 42:268,target 12 + 37:303,target 40 + 38:276,target 20 + 39:259,target 3 + 39:260,target 4 + 32:292,target 53 + 65:294 reduce + 35:288 shift + 44:294,target 56 + 35:290 shift + 35:289 shift + 35:291 shift + 35:292 shift + 0:300,target 37 + 35:293 shift + 35:294 reduce + 42:285,target 29 + 68:0,target 45 + 35:310 goto + 38:303,target 40 + 39:276,target 20 + 37:267,target 11 + 0:257 shift + 33:292,target 53 + 0:258 shift + 0:259 shift + 0:260 shift + 0:261 shift + 11:0 reduce + 0:262 shift + 0:263 shift + 45:294,target 54 + 0:264 shift + 0:265 shift + 0:266 shift + 0:267 shift + 0:268 shift + 53:0 reduce + 0:270 shift + 0:269 shift + 0:271 shift + 0:272 shift + 0:273 shift + 0:274 shift + 39:303,target 40 + 40:293,target 54 + 0:275 shift + 0:276 shift + 0:264,target 8 + 41:288 shift + 0:277 shift + 41:290 shift + 41:289 shift + 0:278 shift + 41:291 shift + 0:280 shift + 0:279 shift + 41:292 shift + 0:281 shift + 37:284,target 28 + 41:293 shift + 0:282 shift + 41:294 reduce + 0:283 shift + 38:267,target 11 + 65:0,target 58 + 0:284 shift + 0:285 shift + 34:292,target 53 + 0:286 shift + 11:294 reduce + 0:287 shift + 41:310 goto + 34:0,target 32 + 0:300 shift + 0:301 shift + 46:294,target 55 + 0:302 shift + 0:303 shift + 0:304 shift + 25:0 reduce + 0:305 shift + 0:295 shift + 0:296 shift + 0:306 shift + 0:297 shift + 0:307 shift + 0:298 shift + 0:308 goto + 0:299 shift + 0:309 goto + 67:0 reduce + 0:311 goto + 0:281,target 25 + 41:293,target 54 + 0:313 goto + 42:276,target 20 + 38:284,target 28 + 39:267,target 11 + 35:292,target 53 + 32:310,target 55 + 37:258,target 2 + 46:294 reduce + 62:0,target 42 + 40:0 reduce + 0:297,target 34 + 0:307,target 44 + 16:294 reduce + 31:0,target 31 + 5:294 reduce + 39:284,target 28 + 36:292,target 53 + 37:275,target 19 + 33:310,target 56 + 38:258,target 2 + 48:294,target 40 + 12:0 reduce + 43:293,target 54 + 54:0 reduce + 0:272,target 16 + 52:294 reduce + 58:0,target 51 + 42:267,target 11 + 37:302,target 39 + 22:294 reduce + 27:0,target 27 + 38:275,target 19 + 34:310,target 57 + 39:258,target 2 + 49:294,target 33 + 50:294,target 36 + 32:291,target 52 + 26:0 reduce + 68:0 reduce + 42:284,target 28 + 1:0 reduce + 38:302,target 39 + 39:275,target 19 + 35:310,target 58 + 51:294,target 34 + 37:266,target 10 + 57:294 reduce + 33:291,target 52 + 55:0,target 53 + 27:294 reduce + 24:0,target 24 + 41:0 reduce + 39:302,target 39 + 40:292,target 53 + 0:263,target 7 + 36:310,target 59 + 52:294,target 37 + 37:283,target 27 + 38:266,target 10 + 48:312,target 70 + 34:291,target 52 + 13:0 reduce + 9:0,target 9 + 63:294 reduce + 33:288 shift + 33:290 shift + 33:289 shift + 33:291 shift + 52:0,target 37 + 55:0 reduce + 33:292 shift + 33:293 shift + 0:280,target 24 + 0:279,target 23 + 33:294 reduce + 41:292,target 53 + 21:0,target 21 + 42:275,target 19 + 37:299,target 36 + 37:309,target 46 + 38:257 shift + 33:310 goto + 38:258 shift + 53:294,target 35 + 38:259 shift + 38:260 shift + 38:283,target 27 + 38:261 shift + 38:262 shift + 39:266,target 10 + 38:263 shift + 35:291,target 52 + 38:264 shift + 38:265 shift + 38:266 shift + 38:267 shift + 37:257,target 1 + 38:268 shift + 38:269 shift + 38:270 shift + 38:271 shift + 38:272 shift + 38:273 shift + 38:274 shift + 27:0 reduce + 38:275 shift + 38:276 shift + 38:277 shift + 0:296,target 33 + 0:306,target 43 + 38:278 shift + 38:279 shift + 38:280 shift + 38:281 shift + 69:0 reduce + 38:282 shift + 38:283 shift + 6:0,target 6 + 38:284 shift + 2:0 reduce + 38:299,target 36 + 38:309,target 46 + 38:285 shift + 38:286 shift + 54:294,target 38 + 38:287 shift + 39:283,target 27 + 68:294 reduce + 38:300 shift + 38:301 shift + 48:0,target 39 + 36:291,target 52 + 38:302 shift + 38:303 shift + 37:274,target 18 + 38:304 shift + 17:0,target 17 + 38:305 shift + 38:295 shift + 38:296 shift + 38:306 shift + 38:257,target 1 + 38:297 shift + 38:307 shift + 38:298 shift + 38:308 goto + 38:299 shift + 38:309 goto + 38:313 goto + 42:0 reduce + 43:292,target 53 + 10:294,target 10 + 39:299,target 36 + 39:309,target 46 + 40:310,target 63 + 55:294,target 53 + 0:271,target 15 + 42:266,target 10 + 37:301,target 38 + 38:274,target 18 + 39:257,target 1 + 3:0,target 3 + 32:290,target 51 + 32:289,target 50 + 45:0,target 54 + 14:0 reduce + 44:294 reduce + 14:0,target 14 + 56:0 reduce + 14:294 reduce + 11:294,target 11 + 0:287,target 31 + 41:310,target 64 + 56:294,target 47 + 42:283,target 27 + 3:294 reduce + 38:301,target 38 + 39:274,target 18 + 37:265,target 9 + 33:290,target 51 + 33:289,target 50 + 28:0 reduce + 12:294,target 12 + 42:309,target 67 + 57:294,target 46 + 71:0 reduce + 42:0,target 57 + 3:0 reduce + 39:301,target 38 + 40:291,target 52 + 49:294 reduce + 50:294 reduce + 11:0,target 11 + 0:262,target 6 + 42:257,target 65 + 20:294 reduce + 19:294 reduce + 37:282,target 26 + 38:265,target 9 + 34:290,target 51 + 34:289,target 50 + 8:294 reduce + 13:294,target 13 + 43:310,target 69 + 58:294,target 51 + 43:0 reduce + 0:278,target 22 + 41:291,target 52 + 42:274,target 18 + 37:298,target 35 + 37:308,target 45 + 69:0,target 52 + 38:282,target 26 + 39:265,target 9 + 35:290,target 51 + 35:289,target 50 + 55:294 reduce + 15:0 reduce + 25:294 reduce + 14:294,target 14 + 60:294,target 44 + 59:294,target 50 + 0:305,target 42 + 0:295,target 32 + 57:0 reduce + 38:298,target 35 + 38:308,target 45 + 39:282,target 26 + 36:290,target 51 + 36:289,target 50 + 37:273,target 17 + 66:0,target 60 + 15:294,target 15 + 61:294,target 43 + 29:0 reduce + 30:0 reduce + 35:0,target 32 + 61:294 reduce + 43:291,target 52 + 39:298,target 35 + 39:308,target 45 + 31:294 reduce + 4:0 reduce + 0:270,target 14 + 0:269,target 13 + 42:265,target 9 + 37:300,target 37 + 38:273,target 17 + 16:294,target 16 + 62:294,target 42 + 32:288,target 49 + 44:0 reduce + 0:286,target 30 + 63:0,target 48 + 42:282,target 26 + 32:0,target 32 + 38:300,target 37 + 66:294 reduce + 36:288 shift + 39:273,target 17 + 36:290 shift + 36:289 shift + 36:291 shift + 36:292 shift + 36:293 shift + 36:294 reduce + 37:264,target 8 + 17:294,target 17 + 63:294,target 48 + 33:288,target 49 + 42:257 shift + 36:310 goto + 16:0 reduce + 42:261 shift + 42:262 shift + 42:263 shift + 0:313,target 48 + 42:264 shift + 42:265 shift + 42:266 shift + 58:0 reduce + 42:267 shift + 42:268 shift + 42:269 shift + 42:270 shift + 42:271 shift + 42:272 shift + 39:300,target 37 + 40:290,target 51 + 40:289,target 50 + 42:273 shift + 42:274 shift + 0:261,target 5 + 42:275 shift + 42:276 shift + 42:277 shift + 42:278 shift + 37:281,target 25 + 42:279 shift + 42:280 shift + 60:0,target 44 + 59:0,target 50 + 42:281 shift + 38:264,target 8 + 42:282 shift + 18:294,target 18 + 42:283 shift + 64:294,target 49 + 34:288,target 49 + 42:284 shift + 28:0,target 28 + 42:285 shift + 42:286 shift + 42:287 shift + 31:0 reduce + 42:294 reduce + 42:307 shift + 12:294 reduce + 42:309 goto + 0:277,target 21 + 41:290,target 51 + 41:289,target 50 + 5:0 reduce + 42:273,target 17 + 42:314 goto + 37:297,target 34 + 37:307,target 44 + 1:294 reduce + 38:281,target 25 + 39:264,target 8 + 20:294,target 20 + 19:294,target 19 + 65:294,target 58 + 35:288,target 49 + 56:0,target 47 + 45:0 reduce + 0:304,target 41 + 25:0,target 25 + 38:297,target 34 + 38:307,target 44 + 39:281,target 25 + 21:294,target 21 + 66:294,target 60 + 36:288,target 49 + 17:294 reduce + 37:272,target 16 + 6:294 reduce + 17:0 reduce + 1:294,target 1 + 43:290,target 51 + 43:289,target 50 + 60:0 reduce + 59:0 reduce + 39:297,target 34 + 39:307,target 44 + 0:268,target 12 + 53:0,target 35 + 42:264,target 8 + 22:294,target 22 + 67:294,target 59 + 22:0,target 22 + 38:272,target 16 + 53:294 reduce + 23:294 reduce + 2:294,target 2 + 32:0 reduce + 0:285,target 29 + 42:281,target 25 + 6:0 reduce + 23:294,target 23 + 68:294,target 45 + 7:0,target 7 + 39:272,target 16 + 37:263,target 7 + 49:0,target 33 + 50:0,target 36 + 18:0,target 18 + 3:294,target 3 + 46:0 reduce + 42:307,target 66 + 58:294 reduce + 24:294,target 24 + 70:294,target 71 + 69:294,target 52 + 28:294 reduce + 40:288,target 49 + 0:259,target 3 + 0:260,target 4 + 37:279,target 23 + 37:280,target 24 + 38:263,target 7 + 4:294,target 4 + 4:0,target 4 + 18:0 reduce + 46:0,target 55 + 61:0 reduce + 15:0,target 15 + 25:294,target 25 + 0:276,target 20 + 41:288,target 49 + 42:272,target 16 + 37:296,target 33 + 37:306,target 43 + 38:279,target 23 + 38:280,target 24 + 64:294 reduce + 34:288 shift + 34:290 shift + 34:289 shift + 39:263,target 7 + 34:291 shift + 34:292 shift + 34:293 shift + 34:294 reduce + 5:294,target 5 + 39:257 shift + 34:310 goto + 39:258 shift + 39:259 shift + 39:260 shift + 39:261 shift + 33:0 reduce + 39:262 shift + 39:263 shift + 39:264 shift + 0:303,target 40 + 39:265 shift + 26:294,target 26 + 39:266 shift + 39:267 shift + 1:0,target 1 + 39:268 shift + 39:269 shift + 39:270 shift + 39:271 shift + 7:0 reduce + 38:296,target 33 + 38:306,target 43 + 39:272 shift + 39:273 shift + 39:274 shift + 39:279,target 23 + 39:280,target 24 + 39:275 shift + 43:0,target 32 + 39:276 shift + 39:277 shift + 39:278 shift + 12:0,target 12 + 39:279 shift + 39:280 shift + 37:271,target 15 + 39:281 shift + 6:294,target 6 + 39:282 shift + 39:283 shift + 39:284 shift + 39:285 shift + 39:286 shift + 39:287 shift + 70:294 shift + 69:294 reduce + 40:288 shift + 39:300 shift + 40:290 shift + 40:289 shift + 39:301 shift + 40:291 shift + 39:302 shift + 40:292 shift + 39:303 shift + 40:293 shift + 27:294,target 27 + 39:304 shift + 40:294 reduce + 47:0 accept + 39:305 shift + 39:295 shift + 43:288,target 49 + 39:296 shift + 39:306 shift + 39:297 shift + 39:307 shift + 39:298 shift + 39:308 goto + 10:294 reduce + 39:296,target 33 + 39:299 shift + 39:306,target 43 + 39:309 goto + 40:310 goto + 0:267,target 11 + 39:313 goto + 42:263,target 7 + 37:287,target 31 + 38:271,target 15 + 7:294,target 7 + 71:0,target 41 + 40:0,target 32 + 20:0 reduce + 19:0 reduce + 28:294,target 28 + 62:0 reduce + 0:284,target 28 + 42:279,target 23 + 42:280,target 24 + 38:287,target 31 + 45:294 reduce + 39:271,target 15 + 8:294,target 8 + 15:294 reduce + 37:262,target 6 + 4:294 reduce + 29:294,target 29 + 30:294,target 30 + 34:0 reduce + 67:0,target 59 + 0:311,target 47 + 36:0,target 32 + 8:0 reduce + 39:287,target 31 + 0:258,target 2 + 9:294,target 9 + 37:278,target 22 + 38:262,target 6 + 51:294 reduce +} + +array set lock::rules { + 9,l 309 + 11,l 309 + 32,l 310 + 53,l 313 + 6,l 309 + 28,l 309 + 50,l 313 + 49,l 313 + 3,l 308 + 25,l 309 + 46,l 313 + 0,l 315 + 22,l 309 + 43,l 313 + 18,l 309 + 40,l 312 + 39,l 311 + 15,l 309 + 36,l 310 + 57,l 314 + 12,l 309 + 33,l 310 + 54,l 313 + 7,l 309 + 29,l 309 + 30,l 309 + 51,l 313 + 4,l 308 + 26,l 309 + 47,l 313 + 1,l 308 + 23,l 309 + 44,l 313 + 19,l 309 + 20,l 309 + 41,l 311 + 16,l 309 + 37,l 310 + 58,l 314 + 13,l 309 + 34,l 310 + 55,l 313 + 8,l 309 + 10,l 309 + 31,l 309 + 52,l 313 + 5,l 309 + 27,l 309 + 48,l 313 + 2,l 308 + 24,l 309 + 45,l 313 + 21,l 309 + 42,l 313 + 17,l 309 + 38,l 310 + 60,l 314 + 59,l 314 + 14,l 309 + 35,l 310 + 56,l 313 +} + +array set lock::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 3 + 55,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 0 + 39,dc 1 + 54,dc 1 + 17,dc 1 + 32,dc 0 + 8,dc 1 + 46,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 2 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 60,dc 1 + 59,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 2 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 2 + 57,dc 0 + 21,dc 1 + 35,dc 1 + 50,dc 2 + 49,dc 2 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 2 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 2 +} + +array set lock::rules { + 41,line 153 + 7,line 117 + 37,line 148 + 4,line 113 + 34,line 145 + 1,line 110 + 31,line 141 + 27,line 137 + 24,line 134 + 21,line 131 + 17,line 127 + 14,line 124 + 11,line 121 + 40,e 1 + 60,line 178 + 59,line 177 + 56,line 172 + 53,line 167 + 50,line 164 + 49,line 163 + 46,line 160 + 43,line 157 + 9,line 119 + 40,line 152 + 39,line 152 + 6,line 116 + 36,line 147 + 3,line 112 + 33,line 144 + 29,line 139 + 30,line 140 + 26,line 136 + 23,line 133 + 19,line 129 + 20,line 130 + 16,line 126 + 13,line 123 + 10,line 120 + 58,line 176 + 55,line 171 + 52,line 166 + 48,line 162 + 45,line 159 + 42,line 156 + 8,line 118 + 38,line 149 + 5,line 115 + 35,line 146 + 2,line 111 + 32,line 143 + 28,line 138 + 25,line 135 + 22,line 132 + 18,line 128 + 15,line 125 + 12,line 122 + 57,line 175 + 54,line 170 + 51,line 165 + 47,line 161 + 44,line 158 +} + +array set lock::lr1_table { + 66,trans {} + 35 {{51 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 14,trans {} + 36 {{50 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 33,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 56}} + 37 {{44 {0 294} 1} {42 {0 294} 0} {43 {0 294} 0} {44 {0 294} 0} {45 {0 294} 0} {46 {0 294} 0} {47 {0 294} 0} {48 {0 294} 0} {49 {0 294} 0} {50 {0 294} 0} {51 {0 294} 0} {52 {0 294} 0} {53 {0 294} 0} {54 {0 294} 0} {55 {0 294} 0} {56 {0 294} 0} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0} {8 {0 294} 0} {9 {0 294} 0} {10 {0 294} 0} {11 {0 294} 0} {12 {0 294} 0} {13 {0 294} 0} {14 {0 294} 0} {15 {0 294} 0} {16 {0 294} 0} {17 {0 294} 0} {18 {0 294} 0} {19 {0 294} 0} {20 {0 294} 0} {21 {0 294} 0} {22 {0 294} 0} {23 {0 294} 0} {24 {0 294} 0} {25 {0 294} 0} {26 {0 294} 0} {27 {0 294} 0} {28 {0 294} 0} {29 {0 294} 0} {30 {0 294} 0} {31 {0 294} 0}} + 52,trans {} + 38 {{43 {0 294} 1} {42 {0 294} 0} {43 {0 294} 0} {44 {0 294} 0} {45 {0 294} 0} {46 {0 294} 0} {47 {0 294} 0} {48 {0 294} 0} {49 {0 294} 0} {50 {0 294} 0} {51 {0 294} 0} {52 {0 294} 0} {53 {0 294} 0} {54 {0 294} 0} {55 {0 294} 0} {56 {0 294} 0} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0} {8 {0 294} 0} {9 {0 294} 0} {10 {0 294} 0} {11 {0 294} 0} {12 {0 294} 0} {13 {0 294} 0} {14 {0 294} 0} {15 {0 294} 0} {16 {0 294} 0} {17 {0 294} 0} {18 {0 294} 0} {19 {0 294} 0} {20 {0 294} 0} {21 {0 294} 0} {22 {0 294} 0} {23 {0 294} 0} {24 {0 294} 0} {25 {0 294} 0} {26 {0 294} 0} {27 {0 294} 0} {28 {0 294} 0} {29 {0 294} 0} {30 {0 294} 0} {31 {0 294} 0}} + 71,trans {} + 39 {{42 {0 294} 1} {42 {0 294} 0} {43 {0 294} 0} {44 {0 294} 0} {45 {0 294} 0} {46 {0 294} 0} {47 {0 294} 0} {48 {0 294} 0} {49 {0 294} 0} {50 {0 294} 0} {51 {0 294} 0} {52 {0 294} 0} {53 {0 294} 0} {54 {0 294} 0} {55 {0 294} 0} {56 {0 294} 0} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0} {8 {0 294} 0} {9 {0 294} 0} {10 {0 294} 0} {11 {0 294} 0} {12 {0 294} 0} {13 {0 294} 0} {14 {0 294} 0} {15 {0 294} 0} {16 {0 294} 0} {17 {0 294} 0} {18 {0 294} 0} {19 {0 294} 0} {20 {0 294} 0} {21 {0 294} 0} {22 {0 294} 0} {23 {0 294} 0} {24 {0 294} 0} {25 {0 294} 0} {26 {0 294} 0} {27 {0 294} 0} {28 {0 294} 0} {29 {0 294} 0} {30 {0 294} 0} {31 {0 294} 0}} + 40 {{48 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 18,trans {} + 1,trans {} + 41 {{49 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 37,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {295 32} {296 33} {297 34} {298 35} {299 36} {300 37} {301 38} {302 39} {303 40} {304 41} {305 42} {306 43} {307 44} {308 45} {309 46} {313 60}} + 42 {{45 {0 294} 1} {57 {0 294} 0} {58 {0 294} 0} {59 {0 294} 0} {60 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0} {8 {0 294} 0} {9 {0 294} 0} {10 {0 294} 0} {11 {0 294} 0} {12 {0 294} 0} {13 {0 294} 0} {14 {0 294} 0} {15 {0 294} 0} {16 {0 294} 0} {17 {0 294} 0} {18 {0 294} 0} {19 {0 294} 0} {20 {0 294} 0} {21 {0 294} 0} {22 {0 294} 0} {23 {0 294} 0} {24 {0 294} 0} {25 {0 294} 0} {26 {0 294} 0} {27 {0 294} 0} {28 {0 294} 0} {29 {0 294} 0} {30 {0 294} 0} {31 {0 294} 0}} + 56,trans {} + 43 {{52 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 44 {{56 {0 294} 1}} + 23,trans {} + 5,trans {} + 45 {{54 {0 294} 1}} + 42,trans {{257 65} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {307 66} {309 67} {314 68}} + 46 {{55 {0 294} 1}} + 61,trans {} + 47 {{0 0 1}} + 48 {{39 0 1} {41 0 1} {40 294 0}} + 50 {{36 {0 294} 1}} + 49 {{33 {0 294} 1}} + 27,trans {} + 9,trans {} + 46,trans {} + 51 {{34 {0 294} 1}} + 65,trans {} + 52 {{37 {0 294} 1}} + 53 {{35 {0 294} 1}} + 13,trans {} + 32,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 55}} + 54 {{38 {0 294} 1}} + 51,trans {} + 55 {{53 {0 294} 2}} + 70,trans {{294 71}} + 69,trans {} + 56 {{47 {0 294} 2}} + 57 {{46 {0 294} 2}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {295 32} {296 33} {297 34} {298 35} {299 36} {300 37} {301 38} {302 39} {303 40} {304 41} {305 42} {306 43} {307 44} {308 45} {309 46} {311 47} {313 48}} + 36,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 59}} + 58 {{51 {0 294} 2}} + 55,trans {} + 60 {{44 {0 294} 2}} + 59 {{50 {0 294} 2}} + 61 {{43 {0 294} 2}} + 62 {{42 {0 294} 2}} + 22,trans {} + 4,trans {} + 41,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 64}} + 63 {{48 {0 294} 2}} + 60,trans {} + 59,trans {} + 64 {{49 {0 294} 2}} + 65 {{58 {0 294} 1}} + 66 {{60 {0 294} 1}} + 26,trans {} + 8,trans {} + 45,trans {} + 67 {{59 {0 294} 1}} + 64,trans {} + 68 {{45 {0 294} 2}} + 70 {{41 0 2}} + 69 {{52 {0 294} 2}} + 12,trans {} + 71 {{41 0 3}} + 31,trans {} + 50,trans {} + 49,trans {} + 68,trans {} + 16,trans {} + 35,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 58}} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 63}} + 39,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {295 32} {296 33} {297 34} {298 35} {299 36} {300 37} {301 38} {302 39} {303 40} {304 41} {305 42} {306 43} {307 44} {308 45} {309 46} {313 62}} + 58,trans {} + 10 {{10 {0 294} 1}} + 11 {{11 {0 294} 1}} + 25,trans {} + 7,trans {} + 12 {{12 {0 294} 1}} + 44,trans {} + 13 {{13 {0 294} 1}} + 63,trans {} + 14 {{14 {0 294} 1}} + 11,trans {} + 15 {{15 {0 294} 1}} + 30,trans {} + 29,trans {} + 16 {{16 {0 294} 1}} + 48,trans {{312 70}} + 0 {{0 0 0} {39 0 0} {41 0 0} {42 {0 294} 0} {43 {0 294} 0} {44 {0 294} 0} {45 {0 294} 0} {46 {0 294} 0} {47 {0 294} 0} {48 {0 294} 0} {49 {0 294} 0} {50 {0 294} 0} {51 {0 294} 0} {52 {0 294} 0} {53 {0 294} 0} {54 {0 294} 0} {55 {0 294} 0} {56 {0 294} 0} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0} {8 {0 294} 0} {9 {0 294} 0} {10 {0 294} 0} {11 {0 294} 0} {12 {0 294} 0} {13 {0 294} 0} {14 {0 294} 0} {15 {0 294} 0} {16 {0 294} 0} {17 {0 294} 0} {18 {0 294} 0} {19 {0 294} 0} {20 {0 294} 0} {21 {0 294} 0} {22 {0 294} 0} {23 {0 294} 0} {24 {0 294} 0} {25 {0 294} 0} {26 {0 294} 0} {27 {0 294} 0} {28 {0 294} 0} {29 {0 294} 0} {30 {0 294} 0} {31 {0 294} 0}} + 17 {{17 {0 294} 1}} + 67,trans {} + 1 {{1 {0 294} 1}} + 18 {{18 {0 294} 1}} + 15,trans {} + 2 {{2 {0 294} 1}} + 19 {{19 {0 294} 1}} + 20 {{20 {0 294} 1}} + 34,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 57}} + 3 {{3 {0 294} 1}} + 21 {{21 {0 294} 1}} + 53,trans {} + 4 {{4 {0 294} 1}} + 22 {{22 {0 294} 1}} + 5 {{5 {0 294} 1}} + 23 {{23 {0 294} 1}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{6 {0 294} 1}} + 24 {{24 {0 294} 1}} + 38,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {295 32} {296 33} {297 34} {298 35} {299 36} {300 37} {301 38} {302 39} {303 40} {304 41} {305 42} {306 43} {307 44} {308 45} {309 46} {313 61}} + 7 {{7 {0 294} 1}} + 25 {{25 {0 294} 1}} + 57,trans {} + 8 {{8 {0 294} 1}} + 26 {{26 {0 294} 1}} + 9 {{9 {0 294} 1}} + 27 {{27 {0 294} 1}} + 24,trans {} + 6,trans {} + 28 {{28 {0 294} 1}} + 43,trans {{288 49} {289 50} {290 51} {291 52} {292 53} {293 54} {310 69}} + 29 {{29 {0 294} 1}} + 30 {{30 {0 294} 1}} + 62,trans {} + 31 {{31 {0 294} 1}} + 10,trans {} + 32 {{53 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 28,trans {} + 33 {{47 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} + 47,trans {} + 34 {{46 {0 294} 1} {32 {0 294} 0} {33 {0 294} 0} {34 {0 294} 0} {35 {0 294} 0} {36 {0 294} 0} {37 {0 294} 0} {38 {0 294} 0}} +} + +array set lock::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 58 + 288 YES_ + 265,title WCSD + 289 NO_ + 290 ON_ + 300 CROP_ + 284,title WCSW + 291 OFF_ + 301 CROSSHAIR_ + 313,title {} + 292 TRUE_ + 302 FRAME_ + 288,line 40 + 293 FALSE_ + 303 SCALE_ + 294 STRING_ + 304 SCALELIMITS_ + 305 SLICE_ + 295 3D_ + 306 SMOOTH_ + 296 AXES_ + 307 NONE_ + 262,t 0 + 297 BIN_ + 308 coordsys + 285,line 36 + 298 BLOCK_ + 310 yesno + 309 wcssys + 299 COLORBAR_ + 311 command + 283,t 0 + 312 @PSEUDO1 + 313 lock + 314,t 1 + 314 lockslice + 282,line 33 + 315 start' + 264,title WCSC + 283,title WCSV + 312,title {} + 278,line 29 + error,line 108 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title COLORBAR + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title BLOCK + 314,line 174 + 291,t 0 + 301,t 0 + 311,line 151 + 307,line 64 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 53 + 278,title WCSQ + 307,title NONE + 297,title BIN + 287,t 0 + 294,line 47 + 304,line 60 + error,title {} + 291,line 43 + 301,line 57 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title SMOOTH + 296,title AXES + 315,t 1 + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title SLICE + 295,title 3D + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title string + 304,title SCALELIMITS + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title FALSE + 303,title SCALE + error error + 271,t 0 + 292,t 0 + 302,t 0 + 273,title WCSL + 313,line 169 + 292,title TRUE + 302,title FRAME + 267,t 0 + 310,line 142 + 309,line 114 + 299,line 55 + 288,t 0 + 306,line 62 + 296,line 52 + 272,title WCSK + 291,title OFF + 293,line 45 + 301,title CROSSHAIR + 303,line 59 + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 56 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title NO + 290,title ON + 300,title CROP + 282,t 0 + 279,line 30 + 280,line 31 + 313,t 1 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title YES + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 315,title {} + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 315,line 179 + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 152 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 314,title {} + 275 WCSN_ + 308,line 109 + 276 WCSO_ + 298,line 54 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 61 + 282 WCSU_ + 295,line 51 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc lock::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ 1 } + 33 { set _ 1 } + 34 { set _ 1 } + 35 { set _ 1 } + 36 { set _ 0 } + 37 { set _ 0 } + 38 { set _ 0 } + 40 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 42 { ProcessCmdSet panzoom lock $2 LockFrameCurrent } + 43 { ProcessCmdSet crosshair lock $2 LockCrosshairCurrent } + 44 { ProcessCmdSet crop lock $2 LockCropCurrent } + 45 { ProcessCmdSet cube lock $2 LockCubeCurrent } + 46 { ProcessCmdSet bin lock $2 LockBinCurrent } + 47 { ProcessCmdSet cube lock,axes $2 LockAxesCurrent } + 48 { ProcessCmdSet scale lock $2 LockScaleCurrent } + 49 { ProcessCmdSet scale lock,limits $2 LockScaleLimitsCurrent } + 50 { ProcessCmdSet colorbar lock $2 LockColorCurrent } + 51 { ProcessCmdSet block lock $2 LockBlockCurrent } + 52 { ProcessCmdSet smooth lock $2 LockSmoothCurrent } + 53 { ProcessCmdSet threed lock $2 Lock3DCurrent } + 54 { set _ $1 } + 55 { set _ $1 } + 56 { set _ none } + 57 { set _ image } + 58 { set _ image } + 59 { set _ $1 } + 60 { set _ none } + } + 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 lock::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/locksendlex.tcl b/ds9/parsers/locksendlex.tcl new file mode 100644 index 0000000..25feccd --- /dev/null +++ b/ds9/parsers/locksendlex.tcl @@ -0,0 +1,377 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval locksend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc locksend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc locksend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc locksend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc locksend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc locksend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc locksend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc locksend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc locksend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc locksend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set 3D_ 257 +set AXES_ 258 +set BIN_ 259 +set BLOCK_ 260 +set COLORBAR_ 261 +set CROP_ 262 +set CROSSHAIR_ 263 +set FRAME_ 264 +set SCALE_ 265 +set SCALELIMITS_ 266 +set SLICE_ 267 +set SMOOTH_ 268 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: bin + if {[regexp -start $index_ -indices -line -nocase -- {\A(bin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: block + if {[regexp -start $index_ -indices -line -nocase -- {\A(block)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: crop + if {[regexp -start $index_ -indices -line -nocase -- {\A(crop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $AXES_ + } + 2 { +return $BIN_ + } + 3 { +return $BLOCK_ + } + 4 { +return $COLORBAR_ + } + 5 { +return $CROP_ + } + 6 { +return $CROSSHAIR_ + } + 7 { +return $FRAME_ + } + 8 { +return $SCALE_ + } + 9 { +return $SCALELIMITS_ + } + 10 { +return $SLICE_ + } + 11 { +return $SMOOTH_ + } + 12 { +# ignore whitespace + } + 13 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/locksendparser.tab.tcl b/ds9/parsers/locksendparser.tab.tcl new file mode 100644 index 0000000..056f55b --- /dev/null +++ b/ds9/parsers/locksendparser.tab.tcl @@ -0,0 +1,12 @@ +set 3D_ 257 +set AXES_ 258 +set BIN_ 259 +set BLOCK_ 260 +set COLORBAR_ 261 +set CROP_ 262 +set CROSSHAIR_ 263 +set FRAME_ 264 +set SCALE_ 265 +set SCALELIMITS_ 266 +set SLICE_ 267 +set SMOOTH_ 268 diff --git a/ds9/parsers/locksendparser.tcl b/ds9/parsers/locksendparser.tcl new file mode 100644 index 0000000..02597bf --- /dev/null +++ b/ds9/parsers/locksendparser.tcl @@ -0,0 +1,402 @@ +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 locksend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc locksend::YYABORT {} { + return -code return 1 +} + +proc locksend::YYACCEPT {} { + return -code return 0 +} + +proc locksend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc locksend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc locksend::yyerror {s} { + puts stderr $s +} + +proc locksend::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 locksend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set locksend::table { + 0:257 shift + 0:258 shift + 0:259 shift + 0:260 shift + 5:0,target 9 + 0:266,target 10 + 0:261 shift + 9:0 reduce + 0:262 shift + 11:0 reduce + 0:263 shift + 0:264 shift + 0:265 shift + 0:266 shift + 0:267 shift + 0:265,target 9 + 0:268 shift + 0:269 goto + 6:0,target 3 + 2:0 reduce + 6:0 reduce + 0:264,target 8 + 7:0,target 2 + 12:0 reduce + 10:0,target 8 + 0:263,target 7 + 3:0 reduce + 8:0,target 1 + 1:0,target 12 + 11:0,target 4 + 0:262,target 6 + 7:0 reduce + 13:0 accept + 0:261,target 5 + 9:0,target 7 + 2:0,target 6 + 12:0,target 11 + 0:259,target 3 + 0:260,target 4 + 0:269,target 13 + 4:0 reduce + 3:0,target 5 + 13:0,target 0 + 8:0 reduce + 10:0 reduce + 0:258,target 2 + 0:268,target 12 + 4:0,target 10 + 0:257,target 1 + 1:0 reduce + 0:267,target 11 + 5:0 reduce +} + +array set locksend::rules { + 9,l 269 + 11,l 269 + 2,l 269 + 6,l 269 + 12,l 269 + 3,l 269 + 7,l 269 + 0,l 270 + 4,l 269 + 8,l 269 + 10,l 269 + 1,l 269 + 5,l 269 +} + +array set locksend::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 1 + 10,dc 1 + 6,dc 1 + 1,dc 1 + 9,dc 1 + 4,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set locksend::rules { + 7,line 30 + 10,line 33 + 4,line 27 + 1,line 24 + 9,line 32 + 12,line 35 + 6,line 29 + 3,line 26 + 8,line 31 + 11,line 34 + 5,line 28 + 2,line 25 +} + +array set locksend::lr1_table { + 13,trans {} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0}} + 1 {{12 0 1}} + 2 {{6 0 1}} + 3 {{5 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13}} + 4 {{10 0 1}} + 1,trans {} + 5 {{9 0 1}} + 2,trans {} + 6 {{3 0 1}} + 3,trans {} + 7 {{2 0 1}} + 4,trans {} + 8 {{1 0 1}} + 5,trans {} + 9 {{7 0 1}} + 10 {{8 0 1}} + 6,trans {} + 11 {{4 0 1}} + 7,trans {} + 12 {{11 0 1}} + 8,trans {} + 13 {{0 0 1}} + 10,trans {} + 9,trans {} + 11,trans {} + 12,trans {} +} + +array set locksend::token_id_table { + 264,line 15 + 270,t 1 + 269,t 1 + 265,title SCALE + 261,line 12 + 257,t 0 + 270,title {} + 269,title {} + 257,line 8 + 262,t 0 + 270,line 36 + 269,line 23 + 259,title BIN + 260,title BLOCK + 266,t 0 + error error + 264,title FRAME + 266,line 17 + error,line 22 + 268,title SMOOTH + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 10 + 260,line 11 + 258,title AXES + 267,t 0 + 263,title CROSSHAIR + 268,line 19 + 267,title SLICE + 257 3D_ + 258 AXES_ + 259,t 0 + 259 BIN_ + 260 BLOCK_ + 260,t 0 + 261 COLORBAR_ + 265,line 16 + 262 CROP_ + 263 CROSSHAIR_ + 257,title 3D + 264 FRAME_ + 264,t 0 + 265 SCALE_ + 262,line 13 + 266 SCALELIMITS_ + 267 SLICE_ + 0,t 0 + 0 {$} + 262,title CROP + 268 SMOOTH_ + 268,t 0 + 270 start' + 269 locksend + error,t 0 + 258,line 9 + 266,title SCALELIMITS + 261,t 0 + 267,line 18 + 265,t 0 + 261,title COLORBAR +} + +proc locksend::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 { ProcessSendCmdGet panzoom lock } + 2 { ProcessSendCmdGet crosshair lock } + 3 { ProcessSendCmdGet crop lock } + 4 { ProcessSendCmdGet cube lock } + 5 { ProcessSendCmdYesNo bin lock } + 6 { ProcessSendCmdYesNo cube lock,axes } + 7 { ProcessSendCmdYesNo scale lock } + 8 { ProcessSendCmdYesNo scale lock,limits } + 9 { ProcessSendCmdYesNo colorbar lock } + 10 { ProcessSendCmdYesNo block lock } + 11 { ProcessSendCmdYesNo smooth lock } + 12 { ProcessSendCmdYesNo threed lock } + } + 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 locksend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/magnifierlex.tcl b/ds9/parsers/magnifierlex.tcl new file mode 100644 index 0000000..70b8f44 --- /dev/null +++ b/ds9/parsers/magnifierlex.tcl @@ -0,0 +1,426 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval magnifier { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc magnifier::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc magnifier::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc magnifier::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc magnifier::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc magnifier::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc magnifier::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc magnifier::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc magnifier::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc magnifier::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set COLOR_ 266 +set CURSOR_ 267 +set REGION_ 268 +set ZOOM_ 269 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: cursor + if {[regexp -start $index_ -indices -line -nocase -- {\A(cursor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: region + if {[regexp -start $index_ -indices -line -nocase -- {\A(region)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: zoom + if {[regexp -start $index_ -indices -line -nocase -- {\A(zoom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COLOR_ + } + 1 { +return $CURSOR_ + } + 2 { +return $REGION_ + } + 3 { +return $ZOOM_ + } + 4 { +return $YES_ + } + 5 { +return $NO_ + } + 6 { +return $ON_ + } + 7 { +return $OFF_ + } + 8 { +return $TRUE_ + } + 9 { +return $FALSE_ + } + 10 { +set yylval $yytext; return $INT_ + } + 11 - + 12 { +set yylval $yytext; return $REAL_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval $yytext; return $STRING_ + } + 17 { +# ignore whitespace + } + 18 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/magnifierparser.tab.tcl b/ds9/parsers/magnifierparser.tab.tcl new file mode 100644 index 0000000..30fc447 --- /dev/null +++ b/ds9/parsers/magnifierparser.tab.tcl @@ -0,0 +1,13 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set COLOR_ 266 +set CURSOR_ 267 +set REGION_ 268 +set ZOOM_ 269 diff --git a/ds9/parsers/magnifierparser.tcl b/ds9/parsers/magnifierparser.tcl new file mode 100644 index 0000000..e3e73e5 --- /dev/null +++ b/ds9/parsers/magnifierparser.tcl @@ -0,0 +1,543 @@ +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 magnifier { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc magnifier::YYABORT {} { + return -code return 1 +} + +proc magnifier::YYACCEPT {} { + return -code return 0 +} + +proc magnifier::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc magnifier::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc magnifier::yyerror {s} { + puts stderr $s +} + +proc magnifier::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 magnifier::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set magnifier::table { + 9:262,target 6 + 0:257 shift + 11:265 reduce + 0:258 shift + 5:0,target 4 + 0:259 shift + 0:260 shift + 15:0,target 15 + 13:265 reduce + 9:0 reduce + 8:257,target 1 + 0:266,target 7 + 0:261 shift + 11:0 reduce + 0:262 shift + 15:265 reduce + 17:265 reduce + 9:261,target 5 + 5:265,target 4 + 0:265 reduce + 15:0 reduce + 8:257 shift + 0:266 shift + 20:265 shift + 19:265 reduce + 8:258 shift + 0:267 shift + 2:265 reduce + 17:265,target 8 + 13:273 goto + 8:260 shift + 8:259 shift + 0:268 shift + 0:265,target 1 + 8:261 shift + 6:0,target 7 + 0:269 shift + 0:270 goto + 4:265 reduce + 19:0 reduce + 16:0,target 16 + 8:262 shift + 2:0 reduce + 6:265 reduce + 0:272 goto + 9:260,target 4 + 9:259,target 3 + 9:270,target 16 + 8:265 reduce + 0:274 goto + 6:0 reduce + 8:265,target 1 + 0:274,target 13 + 8:270 goto + 17:0,target 8 + 12:0 accept + 9:258,target 2 + 0:0,target 1 + 3:265,target 3 + 15:265,target 15 + 16:0 reduce + 9:257,target 1 + 21:0 reduce + 8:0,target 1 + 3:0 reduce + 18:0,target 9 + 10:263 shift + 1:0,target 2 + 11:0,target 17 + 10:264 shift + 0:262,target 6 + 6:265,target 7 + 0:272,target 12 + 10:264,target 18 + 18:265,target 9 + 1:265,target 2 + 14:265 reduce + 10:271 goto + 16:265 reduce + 13:265,target 11 + 13:0 reduce + 9:0,target 1 + 0:261,target 5 + 19:0,target 14 + 8:262,target 6 + 2:0,target 5 + 18:265 reduce + 12:0,target 0 + 1:265 reduce + 10:263,target 17 + 9:257 shift + 17:0 reduce + 9:258 shift + 0:0 reduce + 3:265 reduce + 9:260 shift + 9:259 shift + 9:265,target 1 + 9:261 shift + 5:265 reduce + 9:262 shift + 0:259,target 3 + 0:260,target 4 + 8:261,target 5 + 7:265 shift + 0:269,target 10 + 0:270,target 11 + 4:0 reduce + 4:265,target 6 + 21:0,target 12 + 9:265 reduce + 3:0,target 3 + 16:265,target 16 + 13:0,target 10 + 8:0 reduce + 11:265,target 17 + 9:270 goto + 0:258,target 2 + 13:273,target 20 + 8:260,target 4 + 8:259,target 3 + 0:268,target 9 + 8:270,target 15 + 14:0 reduce + 10:271,target 19 + 7:265,target 14 + 4:0,target 6 + 14:0,target 13 + 18:0 reduce + 0:257,target 1 + 1:0 reduce + 20:265,target 21 + 19:265,target 14 + 8:258,target 2 + 0:267,target 8 + 2:265,target 5 + 14:265,target 13 + 5:0 reduce +} + +array set magnifier::rules { + 9,l 271 + 11,l 273 + 15,l 274 + 2,l 270 + 6,l 270 + 12,l 272 + 16,l 274 + 3,l 270 + 7,l 270 + 13,l 274 + 0,l 275 + 17,l 274 + 4,l 270 + 8,l 271 + 10,l 272 + 14,l 274 + 1,l 270 + 5,l 270 +} + +array set magnifier::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 3 + 8,dc 1 + 3,dc 1 + 15,dc 2 + 10,dc 1 + 6,dc 1 + 1,dc 0 + 13,dc 2 + 9,dc 1 + 4,dc 1 + 16,dc 2 + 11,dc 0 + 7,dc 1 + 2,dc 1 + 14,dc 2 +} + +array set magnifier::rules { + 13,line 56 + 7,line 46 + 10,line 52 + 4,line 43 + 1,line 40 + 15,line 58 + 9,line 49 + 12,line 53 + 6,line 45 + 3,line 42 + 17,line 61 + 14,line 57 + 8,line 48 + 11,line 52 + 5,line 44 + 2,line 41 + 16,line 60 + 11,e 1 +} + +array set magnifier::lr1_table { + 13,trans {{273 20}} + 17 {{8 {0 265} 1}} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 14,trans {} + 18 {{9 {0 265} 1}} + 1 {{2 {0 265} 1}} + 15,trans {} + 20 {{12 0 2}} + 19 {{14 {0 265} 2}} + 2 {{5 {0 265} 1}} + 21 {{12 0 3}} + 16,trans {} + 3 {{3 {0 265} 1}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {266 7} {267 8} {268 9} {269 10} {270 11} {272 12} {274 13}} + 4 {{6 {0 265} 1}} + 18,trans {} + 1,trans {} + 5 {{4 {0 265} 1}} + 20,trans {{265 21}} + 19,trans {} + 2,trans {} + 6 {{7 {0 265} 1}} + 21,trans {} + 3,trans {} + 7 {{13 {0 265} 1}} + 4,trans {} + 8 {{15 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 5,trans {} + 9 {{16 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 10 {{14 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 6,trans {} + 11 {{17 {0 265} 1}} + 7,trans {{265 14}} + 12 {{0 0 1}} + 8,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {270 15}} + 13 {{10 0 1} {12 0 1} {11 265 0}} + 10,trans {{263 17} {264 18} {271 19}} + 9,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {270 16}} + 14 {{13 {0 265} 2}} + 11,trans {} + 15 {{15 {0 265} 2}} + 12,trans {} + 16 {{16 {0 265} 2}} +} + +array set magnifier::token_id_table { + 264,line 15 + 270,t 1 + 269,t 0 + 265,title string + 274,t 1 + 261,line 11 + 257,t 0 + 270,title {} + 269,title ZOOM + 273,line 52 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 39 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 271,t 1 + error error + 264,title float + 266,line 21 + 275,t 1 + error,line 38 + 268,title REGION + 258,t 0 + 263,line 14 + error,title {} + 275,line 62 + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 272,line 51 + 267,t 0 + 263,title integer + 272,t 1 + 268,line 23 + 267,title CURSOR + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title {} + 261 TRUE_ + 265,line 17 + 262 FALSE_ + 263 INT_ + 257,title YES + 264 REAL_ + 264,t 0 + 265 STRING_ + 262,line 12 + 266 COLOR_ + 267 CURSOR_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 REGION_ + 268,t 0 + 274,line 55 + 270 yesno + 269 ZOOM_ + 271 numeric + error,t 0 + 272 command + 258,line 8 + 273,t 1 + 273 @PSEUDO1 + 266,title COLOR + 274 magnifier + 275 start' + 271,line 47 + 271,title {} + 261,t 0 + 267,line 22 + 275,title {} + 265,t 0 + 261,title TRUE +} + +proc magnifier::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { ProcessCmdSet pmagnifier color $2 MagnifierColor } + 14 { ProcessCmdSet pmagnifier zoom $2 MagnifierZoom } + 15 { ProcessCmdSet pmagnifier cursor $2 MagnifierCursor } + 16 { ProcessCmdSet pmagnifier region $2 MagnifierRegion } + 17 { ProcessCmdSet view magnifier $1 UpdateView } + } + 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 magnifier::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/magnifiersendlex.tcl b/ds9/parsers/magnifiersendlex.tcl new file mode 100644 index 0000000..0e58739 --- /dev/null +++ b/ds9/parsers/magnifiersendlex.tcl @@ -0,0 +1,289 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval magnifiersend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc magnifiersend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc magnifiersend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc magnifiersend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc magnifiersend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc magnifiersend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc magnifiersend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc magnifiersend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc magnifiersend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc magnifiersend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COLOR_ 257 +set CURSOR_ 258 +set REGION_ 259 +set ZOOM_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: cursor + if {[regexp -start $index_ -indices -line -nocase -- {\A(cursor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: region + if {[regexp -start $index_ -indices -line -nocase -- {\A(region)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: zoom + if {[regexp -start $index_ -indices -line -nocase -- {\A(zoom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COLOR_ + } + 1 { +return $CURSOR_ + } + 2 { +return $REGION_ + } + 3 { +return $ZOOM_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/magnifiersendparser.tab.tcl b/ds9/parsers/magnifiersendparser.tab.tcl new file mode 100644 index 0000000..5888b26 --- /dev/null +++ b/ds9/parsers/magnifiersendparser.tab.tcl @@ -0,0 +1,4 @@ +set COLOR_ 257 +set CURSOR_ 258 +set REGION_ 259 +set ZOOM_ 260 diff --git a/ds9/parsers/magnifiersendparser.tcl b/ds9/parsers/magnifiersendparser.tcl new file mode 100644 index 0000000..4b37d63 --- /dev/null +++ b/ds9/parsers/magnifiersendparser.tcl @@ -0,0 +1,296 @@ +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 magnifiersend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc magnifiersend::YYABORT {} { + return -code return 1 +} + +proc magnifiersend::YYACCEPT {} { + return -code return 0 +} + +proc magnifiersend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc magnifiersend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc magnifiersend::yyerror {s} { + puts stderr $s +} + +proc magnifiersend::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 magnifiersend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set magnifiersend::table { + 3:0,target 4 + 0:257 shift + 0:258 shift + 5:0,target 0 + 0:260 shift + 0:259 shift + 0:261 goto + 0:258,target 2 + 0:0,target 5 + 0:261,target 5 + 2:0,target 3 + 4:0,target 2 + 0:0 reduce + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 reduce + 1:0,target 1 + 5:0 accept +} + +array set magnifiersend::rules { + 0,l 262 + 1,l 261 + 2,l 261 + 3,l 261 + 4,l 261 + 5,l 261 +} + +array set magnifiersend::rules { + 5,dc 0 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set magnifiersend::rules { + 5,line 21 + 2,line 17 + 4,line 20 + 1,line 16 + 3,line 18 +} + +array set magnifiersend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0}} + 1 {{1 0 1}} + 2 {{3 0 1}} + 3 {{4 0 1}} + 4 {{2 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5}} + 5 {{0 0 1}} + 1,trans {} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} +} + +array set magnifiersend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 9 + 261,line 15 + error,line 14 + 257 COLOR_ + 257,t 0 + 258 CURSOR_ + 258,t 0 + error,title {} + 260,t 0 + 260 ZOOM_ + 259 REGION_ + 259,t 0 + 261,t 1 + 261 magnifiersend + 262,t 1 + 262 start' + 257,line 8 + 260,line 11 + 257,title COLOR + 259,line 10 + 258,title CURSOR + 262,line 22 + 260,title ZOOM + 259,title REGION + 261,title {} +} + +proc magnifiersend::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 { ProcessSendCmdGet pmagnifier color } + 2 { ProcessSendCmdGet pmagnifier zoom } + 3 { ProcessSendCmdYesNo pmagnifier cursor } + 4 { ProcessSendCmdYesNo pmagnifier region } + 5 { ProcessSendCmdYesNo view magnifier } + } + 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 magnifiersend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/masklex.tcl b/ds9/parsers/masklex.tcl new file mode 100644 index 0000000..5d33c03 --- /dev/null +++ b/ds9/parsers/masklex.tcl @@ -0,0 +1,789 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mask { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mask::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mask::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mask::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mask::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mask::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mask::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mask::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mask::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mask::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set INT_ 288 +set REAL_ 289 +set STRING_ 290 +set CLEAR_ 291 +set CLOSE_ 292 +set COLOR_ 293 +set MARK_ 294 +set NAN_ 295 +set NONNAN_ 296 +set NONZERO_ 297 +set OPEN_ 298 +set RANGE_ 299 +set SYSTEM_ 300 +set TRANSPARENCY_ 301 +set ZERO_ 302 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: mark + if {[regexp -start $index_ -indices -line -nocase -- {\A(mark)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: nan + if {[regexp -start $index_ -indices -line -nocase -- {\A(nan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: nonnan + if {[regexp -start $index_ -indices -line -nocase -- {\A(nonnan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: nonzero + if {[regexp -start $index_ -indices -line -nocase -- {\A(nonzero)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: range + if {[regexp -start $index_ -indices -line -nocase -- {\A(range)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: transparency + if {[regexp -start $index_ -indices -line -nocase -- {\A(transparency)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: zero + if {[regexp -start $index_ -indices -line -nocase -- {\A(zero)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $CLEAR_ + } + 2 { +return $COLOR_ + } + 3 { +return $MARK_ + } + 4 { +return $NAN_ + } + 5 { +return $NONNAN_ + } + 6 { +return $NONZERO_ + } + 7 { +return $OPEN_ + } + 8 { +return $RANGE_ + } + 9 { +return $SYSTEM_ + } + 10 { +return $TRANSPARENCY_ + } + 11 { +return $ZERO_ + } + 12 { +return $IMAGE_ + } + 13 { +return $PHYSICAL_ + } + 14 { +return $AMPLIFIER_ + } + 15 { +return $DETECTOR_ + } + 16 { +return $WCS_ + } + 17 { +return $WCSA_ + } + 18 { +return $WCSB_ + } + 19 { +return $WCSC_ + } + 20 { +return $WCSD_ + } + 21 { +return $WCSE_ + } + 22 { +return $WCSF_ + } + 23 { +return $WCSG_ + } + 24 { +return $WCSH_ + } + 25 { +return $WCSI_ + } + 26 { +return $WCSJ_ + } + 27 { +return $WCSK_ + } + 28 { +return $WCSL_ + } + 29 { +return $WCSM_ + } + 30 { +return $WCSN_ + } + 31 { +return $WCSO_ + } + 32 { +return $WCSP_ + } + 33 { +return $WCSQ_ + } + 34 { +return $WCSR_ + } + 35 { +return $WCSS_ + } + 36 { +return $WCST_ + } + 37 { +return $WCSU_ + } + 38 { +return $WCSV_ + } + 39 { +return $WCSW_ + } + 40 { +return $WCSX_ + } + 41 { +return $WCSY_ + } + 42 { +return $WCSZ_ + } + 43 { +set yylval $yytext; return $INT_ + } + 44 - + 45 { +set yylval $yytext; return $REAL_ + } + 46 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 47 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 48 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 49 { +set yylval $yytext; return $STRING_ + } + 50 { +# ignore whitespace + } + 51 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/maskparser.tab.tcl b/ds9/parsers/maskparser.tab.tcl new file mode 100644 index 0000000..3acafaf --- /dev/null +++ b/ds9/parsers/maskparser.tab.tcl @@ -0,0 +1,46 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set INT_ 288 +set REAL_ 289 +set STRING_ 290 +set CLEAR_ 291 +set CLOSE_ 292 +set COLOR_ 293 +set MARK_ 294 +set NAN_ 295 +set NONNAN_ 296 +set NONZERO_ 297 +set OPEN_ 298 +set RANGE_ 299 +set SYSTEM_ 300 +set TRANSPARENCY_ 301 +set ZERO_ 302 diff --git a/ds9/parsers/maskparser.tcl b/ds9/parsers/maskparser.tcl new file mode 100644 index 0000000..9e8b031 --- /dev/null +++ b/ds9/parsers/maskparser.tcl @@ -0,0 +1,1113 @@ +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 mask { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mask::YYABORT {} { + return -code return 1 +} + +proc mask::YYACCEPT {} { + return -code return 0 +} + +proc mask::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mask::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mask::yyerror {s} { + puts stderr $s +} + +proc mask::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 mask::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mask::table { + 21:289 shift + 7:264,target 29 + 30:290,target 9 + 29:290,target 8 + 27:0 reduce + 21:305 goto + 48:0 reduce + 0:306,target 9 + 30:290 reduce + 29:290 reduce + 7:283,target 48 + 18:290,target 42 + 2:0 reduce + 7:262,target 27 + 56:0,target 45 + 53:290,target 52 + 38:290 reduce + 24:0 reduce + 48:0,target 27 + 41:0,target 20 + 45:0 reduce + 33:0,target 12 + 25:0,target 4 + 0:294,target 4 + 17:0,target 47 + 42:290,target 21 + 10:0,target 34 + 7:281,target 46 + 47:290 reduce + 4:288,target 12 + 31:290,target 10 + 7:259,target 24 + 7:260,target 25 + 17:290 reduce + 56:290 reduce + 42:0 reduce + 7:310,target 55 + 0:292,target 2 + 6:288 shift + 19:289,target 32 + 19:290,target 32 + 20:289,target 33 + 20:290,target 33 + 6:305,target 21 + 6:289 shift + 26:290 reduce + 7:278,target 43 + 6:305 goto + 54:290,target 53 + 7:257,target 22 + 17:0 reduce + 38:0 reduce + 35:290 reduce + 43:290,target 22 + 59:0 reduce + 0:300,target 7 + 0:290,target 37 + 7:276,target 41 + 53:0,target 52 + 44:290 reduce + 32:290,target 11 + 45:0,target 24 + 37:0,target 16 + 14:0 reduce + 30:0,target 9 + 29:0,target 8 + 22:0,target 1 + 35:0 reduce + 14:0,target 50 + 14:290 reduce + 21:289,target 20 + 56:0 reduce + 53:290 reduce + 3:290 shift + 7:274,target 39 + 10:290,target 35 + 55:290,target 44 + 23:290 reduce + 9:0 accept + 11:0 reduce + 32:0 reduce + 44:290,target 23 + 1:290,target 40 + 53:0 reduce + 32:290 reduce + 7:303,target 53 + 6:288,target 19 + 33:290,target 12 + 7:272,target 37 + 41:290 reduce + 28:0 reduce + 22:290,target 1 + 0:0,target 37 + 8:305,target 56 + 50:0 reduce + 49:0 reduce + 11:290 reduce + 50:290 reduce + 50:0,target 29 + 49:290 reduce + 49:0,target 28 + 11:290,target 41 + 56:290,target 45 + 42:0,target 21 + 34:0,target 13 + 26:0,target 5 + 0:300 shift + 0:290 reduce + 7:269,target 34 + 7:270,target 35 + 0:301 shift + 0:291 shift + 18:0,target 42 + 19:288 reduce + 20:288 reduce + 0:292 shift + 11:0,target 41 + 19:289 reduce + 19:290 reduce + 20:289 reduce + 20:290 reduce + 0:293 shift + 45:290,target 24 + 25:0 reduce + 0:294 shift + 58:290 reduce + 2:290,target 39 + 0:306 goto + 46:0 reduce + 8:288 shift + 0:308 goto + 0:298 shift + 8:289 shift + 0:299 shift + 34:290,target 13 + 28:290 reduce + 4:296,target 14 + 0:0 reduce + 8:305 goto + 7:267,target 32 + 23:290,target 2 + 22:0 reduce + 37:290 reduce + 43:0 reduce + 0:299,target 6 + 12:290,target 46 + 57:290,target 59 + 7:286,target 51 + 46:290 reduce + 7:265,target 30 + 46:290,target 25 + 3:290,target 11 + 18:0 reduce + 16:290 reduce + 54:0,target 53 + 40:0 reduce + 39:0 reduce + 55:290 reduce + 46:0,target 25 + 8:288,target 19 + 38:0,target 17 + 35:290,target 14 + 31:0,target 10 + 23:0,target 2 + 5:290 reduce + 7:284,target 49 + 15:0,target 48 + 25:290 reduce + 24:290,target 3 + 4:302,target 17 + 7:263,target 28 + 15:0 reduce + 36:0 reduce + 34:290 reduce + 13:290,target 49 + 58:290,target 43 + 7:282,target 47 + 10:307,target 57 + 47:290,target 26 + 43:290 reduce + 7:261,target 26 + 12:0 reduce + 33:0 reduce + 21:305,target 58 + 36:290,target 15 + 13:290 reduce + 54:0 reduce + 0:293,target 3 + 52:290 reduce + 1:0,target 40 + 7:279,target 44 + 7:280,target 45 + 25:290,target 4 + 2:290 reduce + 22:290 reduce + 58:0,target 43 + 51:0,target 30 + 7:258,target 23 + 43:0,target 22 + 35:0,target 14 + 30:0 reduce + 29:0 reduce + 14:290,target 50 + 27:0,target 6 + 7:257 shift + 19:0,target 32 + 20:0,target 33 + 51:0 reduce + 7:258 shift + 12:0,target 46 + 31:290 reduce + 0:301,target 8 + 0:291,target 1 + 7:259 shift + 7:260 shift + 19:288,target 32 + 20:288,target 33 + 7:261 shift + 7:262 shift + 48:290,target 27 + 7:263 shift + 7:277,target 42 + 5:290,target 38 + 7:264 shift + 7:265 shift + 7:266 shift + 7:267 shift + 40:290 reduce + 39:290 reduce + 7:268 shift + 37:290,target 16 + 26:0 reduce + 7:269 shift + 7:270 shift + 7:271 shift + 7:272 shift + 47:0 reduce + 7:273 shift + 7:274 shift + 10:290 reduce + 7:275 shift + 26:290,target 5 + 7:276 shift + 48:290 reduce + 7:277 shift + 7:275,target 40 + 7:278 shift + 1:0 reduce + 7:279 shift + 7:280 shift + 7:281 shift + 7:282 shift + 10:307 goto + 7:283 shift + 15:290,target 48 + 18:290 reduce + 23:0 reduce + 7:284 shift + 7:285 shift + 57:290 shift + 7:286 shift + 44:0 reduce + 21:288,target 19 + 5:0,target 38 + 7:287 shift + 7:304,target 54 + 50:290,target 29 + 49:290,target 28 + 27:290 reduce + 6:289,target 20 + 55:0,target 44 + 7:303 goto + 47:0,target 26 + 7:304 goto + 7:273,target 38 + 40:0,target 19 + 39:0,target 18 + 32:0,target 11 + 38:290,target 17 + 24:0,target 3 + 16:0,target 51 + 19:0 reduce + 20:0 reduce + 7:310 goto + 36:290 reduce + 41:0 reduce + 27:290,target 6 + 4:309,target 18 + 4:299,target 16 + 45:290 reduce + 7:271,target 36 + 16:290,target 51 + 16:0 reduce + 15:290 reduce + 37:0 reduce + 54:290 reduce + 51:290,target 30 + 58:0 reduce + 4:288 shift + 24:290 reduce + 4:297,target 15 + 4:302 shift + 40:290,target 19 + 39:290,target 18 + 7:268,target 33 + 4:295 shift + 9:0,target 0 + 13:0 reduce + 4:296 shift + 2:0,target 39 + 4:297 shift + 34:0 reduce + 28:290,target 7 + 4:299 shift + 4:309 goto + 59:0,target 36 + 33:290 reduce + 55:0 reduce + 52:0,target 31 + 44:0,target 23 + 7:287,target 52 + 36:0,target 15 + 28:0,target 7 + 17:290,target 47 + 4:295,target 13 + 13:0,target 49 + 7:266,target 31 + 42:290 reduce + 10:0 reduce + 31:0 reduce + 52:290,target 31 + 0:308,target 10 + 0:298,target 5 + 8:289,target 20 + 12:290 reduce + 52:0 reduce + 51:290 reduce + 7:285,target 50 + 41:290,target 20 + 1:290 reduce + 5:0 reduce + 21:288 shift +} + +array set mask::rules { + 9,l 304 + 11,l 304 + 32,l 305 + 53,l 310 + 6,l 304 + 28,l 304 + 50,l 309 + 49,l 309 + 3,l 303 + 25,l 304 + 46,l 308 + 0,l 311 + 22,l 304 + 43,l 308 + 18,l 304 + 40,l 308 + 39,l 308 + 15,l 304 + 36,l 306 + 12,l 304 + 33,l 305 + 7,l 304 + 29,l 304 + 30,l 304 + 51,l 309 + 4,l 303 + 26,l 304 + 47,l 309 + 1,l 303 + 23,l 304 + 44,l 308 + 19,l 304 + 20,l 304 + 41,l 308 + 16,l 304 + 37,l 308 + 13,l 304 + 34,l 306 + 8,l 304 + 10,l 304 + 31,l 304 + 52,l 310 + 5,l 304 + 27,l 304 + 48,l 309 + 2,l 303 + 24,l 304 + 45,l 308 + 21,l 304 + 42,l 308 + 17,l 304 + 38,l 308 + 14,l 304 + 35,l 307 +} + +array set mask::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 2 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 23,dc 1 + 0,dc 1 + 37,dc 0 + 52,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 22,dc 1 + 36,dc 3 + 51,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 3 + 21,dc 1 + 35,dc 0 + 50,dc 1 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 2 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set mask::rules { + 41,line 144 + 7,line 106 + 37,line 140 + 4,line 102 + 34,line 136 + 1,line 99 + 31,line 130 + 27,line 126 + 24,line 123 + 21,line 120 + 17,line 116 + 14,line 113 + 11,line 110 + 53,line 161 + 50,line 156 + 49,line 155 + 46,line 150 + 43,line 146 + 9,line 108 + 40,line 143 + 39,line 142 + 6,line 105 + 36,line 137 + 3,line 101 + 33,line 133 + 29,line 128 + 30,line 129 + 26,line 125 + 23,line 122 + 19,line 118 + 20,line 119 + 16,line 115 + 13,line 112 + 10,line 109 + 52,line 160 + 48,line 154 + 45,line 149 + 42,line 145 + 8,line 107 + 38,line 141 + 5,line 104 + 35,line 136 + 2,line 100 + 32,line 132 + 28,line 127 + 25,line 124 + 22,line 121 + 18,line 117 + 15,line 114 + 12,line 111 + 35,e 1 + 51,line 157 + 47,line 153 + 44,line 147 +} + +array set mask::lr1_table { + 35 {{14 {0 290} 1}} + 14,trans {} + 36 {{15 {0 290} 1}} + 33,trans {} + 37 {{16 {0 290} 1}} + 52,trans {} + 38 {{17 {0 290} 1}} + 39 {{18 {0 290} 1}} + 40 {{19 {0 290} 1}} + 18,trans {} + 41 {{20 {0 290} 1}} + 1,trans {} + 37,trans {} + 42 {{21 {0 290} 1}} + 56,trans {} + 43 {{22 {0 290} 1}} + 44 {{23 {0 290} 1}} + 23,trans {} + 45 {{24 {0 290} 1}} + 5,trans {} + 42,trans {} + 46 {{25 {0 290} 1}} + 61,trans {} + 47 {{26 {0 290} 1}} + 48 {{27 {0 290} 1}} + 27,trans {} + 9,trans {} + 50 {{29 {0 290} 1}} + 49 {{28 {0 290} 1}} + 46,trans {} + 51 {{30 {0 290} 1}} + 52 {{31 {0 290} 1}} + 13,trans {} + 53 {{52 {0 290} 1}} + 32,trans {} + 54 {{53 {0 290} 1}} + 51,trans {} + 55 {{44 {0 290} 2}} + 56 {{32 {0 290} 1}} + 17,trans {} + 57 {{33 {0 290} 1}} + 0,trans {{291 1} {292 2} {293 3} {294 4} {298 5} {299 6} {300 7} {301 8} {306 9} {308 10}} + 36,trans {} + 58 {{45 {0 290} 2}} + 55,trans {} + 60 {{43 {0 290} 3}} + 59 {{36 0 2}} + 61 {{36 0 3}} + 22,trans {} + 4,trans {{288 12} {295 13} {296 14} {297 15} {299 16} {302 17} {309 18}} + 41,trans {} + 60,trans {} + 59,trans {{290 61}} + 26,trans {} + 8,trans {{288 56} {289 57} {305 58}} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {{288 56} {289 57} {305 60}} + 3,trans {{290 11}} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{34 0 1} {36 0 1} {35 290 0}} + 11 {{41 {0 290} 2}} + 25,trans {} + 7,trans {{257 22} {258 23} {259 24} {260 25} {261 26} {262 27} {263 28} {264 29} {265 30} {266 31} {267 32} {268 33} {269 34} {270 35} {271 36} {272 37} {273 38} {274 39} {275 40} {276 41} {277 42} {278 43} {279 44} {280 45} {281 46} {282 47} {283 48} {284 49} {285 50} {286 51} {287 52} {303 53} {304 54} {310 55}} + 12 {{46 {0 290} 2}} + 44,trans {} + 13 {{49 {0 290} 1}} + 14 {{50 {0 290} 1}} + 11,trans {} + 15 {{48 {0 290} 1}} + 30,trans {} + 29,trans {} + 16 {{51 {0 290} 1}} + 48,trans {} + 0 {{0 0 0} {34 0 0} {36 0 0} {37 {0 290} 0} {38 {0 290} 0} {39 {0 290} 0} {40 {0 290} 0} {41 {0 290} 0} {42 {0 290} 0} {43 {0 290} 0} {44 {0 290} 0} {45 {0 290} 0} {46 {0 290} 0}} + 17 {{47 {0 290} 1}} + 1 {{40 {0 290} 1}} + 18 {{42 {0 290} 2}} + 15,trans {} + 2 {{39 {0 290} 1}} + 19 {{32 {288 289} 1}} + 20 {{33 {288 289} 1}} + 34,trans {} + 3 {{41 {0 290} 1}} + 21 {{43 {0 290} 2} {32 {0 290} 0} {33 {0 290} 0}} + 53,trans {} + 4 {{42 {0 290} 1} {46 {0 290} 1} {47 {0 290} 0} {48 {0 290} 0} {49 {0 290} 0} {50 {0 290} 0} {51 {0 290} 0}} + 22 {{1 {0 290} 1}} + 5 {{38 {0 290} 1}} + 23 {{2 {0 290} 1}} + 20,trans {} + 19,trans {} + 6 {{43 {0 290} 1} {32 {288 289} 0} {33 {288 289} 0}} + 2,trans {} + 24 {{3 {0 290} 1}} + 38,trans {} + 7 {{44 {0 290} 1} {52 {0 290} 0} {53 {0 290} 0} {1 {0 290} 0} {2 {0 290} 0} {3 {0 290} 0} {4 {0 290} 0} {5 {0 290} 0} {6 {0 290} 0} {7 {0 290} 0} {8 {0 290} 0} {9 {0 290} 0} {10 {0 290} 0} {11 {0 290} 0} {12 {0 290} 0} {13 {0 290} 0} {14 {0 290} 0} {15 {0 290} 0} {16 {0 290} 0} {17 {0 290} 0} {18 {0 290} 0} {19 {0 290} 0} {20 {0 290} 0} {21 {0 290} 0} {22 {0 290} 0} {23 {0 290} 0} {24 {0 290} 0} {25 {0 290} 0} {26 {0 290} 0} {27 {0 290} 0} {28 {0 290} 0} {29 {0 290} 0} {30 {0 290} 0} {31 {0 290} 0}} + 25 {{4 {0 290} 1}} + 57,trans {} + 8 {{45 {0 290} 1} {32 {0 290} 0} {33 {0 290} 0}} + 26 {{5 {0 290} 1}} + 9 {{0 0 1}} + 27 {{6 {0 290} 1}} + 24,trans {} + 6,trans {{288 19} {289 20} {305 21}} + 28 {{7 {0 290} 1}} + 43,trans {} + 29 {{8 {0 290} 1}} + 30 {{9 {0 290} 1}} + 31 {{10 {0 290} 1}} + 10,trans {{307 59}} + 32 {{11 {0 290} 1}} + 28,trans {} + 33 {{12 {0 290} 1}} + 47,trans {} + 34 {{13 {0 290} 1}} +} + +array set mask::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 48 + 302,line 58 + 288 INT_ + 265,title WCSD + 289 REAL_ + 290 STRING_ + 300 SYSTEM_ + 284,title WCSW + 291 CLEAR_ + 301 TRANSPARENCY_ + 292 CLOSE_ + 302 ZERO_ + 288,line 40 + 293 COLOR_ + 303 coordsys + 304 wcssys + 294 MARK_ + 305 numeric + 295 NAN_ + 306 command + 296 NONNAN_ + 307 @PSEUDO1 + 262,t 0 + 297 NONZERO_ + 308 mask + 285,line 36 + 298 OPEN_ + 310 system + 309 mark + 299 RANGE_ + 311 start' + 283,t 0 + 282,line 33 + 264,title WCSC + 283,title WCSV + 278,line 29 + error,line 97 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + 310,title {} + 309,title {} + 299,title RANGE + error,t 0 + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title OPEN + 291,t 0 + 301,t 0 + 311,line 162 + 307,line 136 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 53 + 278,title WCSQ + 307,title {} + 297,title NONZERO + 287,t 0 + 304,line 103 + 294,line 50 + 291,line 47 + 301,line 57 + error,title {} + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title NONNAN + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 305,title {} + 295,title NAN + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 304,title {} + 294,title MARK + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title COLOR + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 0 + 273,title WCSL + 292,title CLOSE + 302,title ZERO + 267,t 0 + 310,line 159 + 309,line 152 + 299,line 55 + 288,t 0 + 306,line 135 + 296,line 52 + 272,title WCSK + 303,line 98 + 291,title CLEAR + 293,line 49 + 301,title TRANSPARENCY + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 43 + 300,line 56 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title float + 290,title string + 300,title SYSTEM + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title integer + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 303,t 1 + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 139 + 276 WCSO_ + 298,line 54 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 131 + 282 WCSU_ + 295,line 51 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc mask::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ $1 } + 33 { set _ $1 } + 35 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 37 { global parse; set parse(result) mask } + 39 { MaskDestroyDialog } + 40 { MaskClear } + 41 { ProcessCmdSet mask color $2 MaskColor } + 42 { ProcessCmdSet mask mark $2 MaskMark } + 43 { ProcessCmdSet2 mask low $2 high $3 MaskRange } + 45 { ProcessCmdSet mask transparency $2 MaskTransparency } + 46 { ProcessCmdSet mask mark $2 MaskMark } + 47 { set _ zero } + 48 { set _ nonzero } + 49 { set _ nan } + 50 { set _ nonnan } + 51 { set _ range } + 52 { ProcessCmdSet mask system $1 MaskSystem } + 53 { ProcessCmdSet mask system $1 MaskSystem } + } + 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 mask::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/masksendlex.tcl b/ds9/parsers/masksendlex.tcl new file mode 100644 index 0000000..9aad31a --- /dev/null +++ b/ds9/parsers/masksendlex.tcl @@ -0,0 +1,300 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval masksend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc masksend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc masksend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc masksend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc masksend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc masksend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc masksend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc masksend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc masksend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc masksend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COLOR_ 257 +set MARK_ 258 +set RANGE_ 259 +set SYSTEM_ 260 +set TRANSPARENCY_ 261 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: mark + if {[regexp -start $index_ -indices -line -nocase -- {\A(mark)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: range + if {[regexp -start $index_ -indices -line -nocase -- {\A(range)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: transparency + if {[regexp -start $index_ -indices -line -nocase -- {\A(transparency)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COLOR_ + } + 1 { +return $MARK_ + } + 2 { +return $RANGE_ + } + 3 { +return $SYSTEM_ + } + 4 { +return $TRANSPARENCY_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/masksendparser.tab.tcl b/ds9/parsers/masksendparser.tab.tcl new file mode 100644 index 0000000..099275b --- /dev/null +++ b/ds9/parsers/masksendparser.tab.tcl @@ -0,0 +1,5 @@ +set COLOR_ 257 +set MARK_ 258 +set RANGE_ 259 +set SYSTEM_ 260 +set TRANSPARENCY_ 261 diff --git a/ds9/parsers/masksendparser.tcl b/ds9/parsers/masksendparser.tcl new file mode 100644 index 0000000..7e3b05f --- /dev/null +++ b/ds9/parsers/masksendparser.tcl @@ -0,0 +1,304 @@ +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 masksend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc masksend::YYABORT {} { + return -code return 1 +} + +proc masksend::YYACCEPT {} { + return -code return 0 +} + +proc masksend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc masksend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc masksend::yyerror {s} { + puts stderr $s +} + +proc masksend::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 masksend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set masksend::table { + 6:0 accept + 3:0,target 3 + 0:257 shift + 0:258 shift + 5:0,target 5 + 0:259 shift + 0:260 shift + 0:261 shift + 0:262 goto + 0:258,target 2 + 0:261,target 5 + 2:0,target 2 + 4:0,target 4 + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 1 + 5:0 reduce + 0:262,target 6 +} + +array set masksend::rules { + 0,l 263 + 1,l 262 + 2,l 262 + 3,l 262 + 4,l 262 + 5,l 262 +} + +array set masksend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set masksend::rules { + 5,line 21 + 2,line 18 + 4,line 20 + 1,line 17 + 3,line 19 +} + +array set masksend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0}} + 1 {{1 0 1}} + 2 {{2 0 1}} + 3 {{3 0 1}} + 4 {{4 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6}} + 5 {{5 0 1}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} +} + +array set masksend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 9 + 261,line 12 + error,line 15 + 257 COLOR_ + 257,t 0 + 263,line 22 + 258 MARK_ + 258,t 0 + error,title {} + 260,t 0 + 260 SYSTEM_ + 259 RANGE_ + 259,t 0 + 261,t 0 + 261 TRANSPARENCY_ + 262,t 1 + 262 masksend + 257,line 8 + 263,t 1 + 263 start' + 260,line 11 + 257,title COLOR + 259,line 10 + 258,title MARK + 262,line 16 + 260,title SYSTEM + 259,title RANGE + 261,title TRANSPARENCY +} + +proc masksend::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 { ProcessSendCmdGet mask color } + 2 { ProcessSendCmdGet mask mark } + 3 { ProcessSendCmdGet2 mask low high } + 4 { ProcessSendCmdGet mask system } + 5 { ProcessSendCmdGet mask transparency } + } + 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 masksend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/matchlex.tcl b/ds9/parsers/matchlex.tcl new file mode 100644 index 0000000..13535d7 --- /dev/null +++ b/ds9/parsers/matchlex.tcl @@ -0,0 +1,759 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval match { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc match::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc match::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc match::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc match::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc match::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc match::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc match::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc match::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc match::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set STRING_ 288 +set 3D_ 289 +set AXES_ 290 +set BIN_ 291 +set BLOCK_ 292 +set COLORBAR_ 293 +set CROP_ 294 +set CROSSHAIR_ 295 +set FRAME_ 296 +set SCALE_ 297 +set SCALELIMITS_ 298 +set SLICE_ 299 +set SMOOTH_ 300 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: bin + if {[regexp -start $index_ -indices -line -nocase -- {\A(bin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: block + if {[regexp -start $index_ -indices -line -nocase -- {\A(block)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: crop + if {[regexp -start $index_ -indices -line -nocase -- {\A(crop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $AXES_ + } + 2 { +return $BIN_ + } + 3 { +return $BLOCK_ + } + 4 { +return $COLORBAR_ + } + 5 { +return $CROP_ + } + 6 { +return $CROSSHAIR_ + } + 7 { +return $FRAME_ + } + 8 { +return $SCALE_ + } + 9 { +return $SCALELIMITS_ + } + 10 { +return $SLICE_ + } + 11 { +return $SMOOTH_ + } + 12 { +return $IMAGE_ + } + 13 { +return $PHYSICAL_ + } + 14 { +return $AMPLIFIER_ + } + 15 { +return $DETECTOR_ + } + 16 { +return $WCS_ + } + 17 { +return $WCSA_ + } + 18 { +return $WCSB_ + } + 19 { +return $WCSC_ + } + 20 { +return $WCSD_ + } + 21 { +return $WCSE_ + } + 22 { +return $WCSF_ + } + 23 { +return $WCSG_ + } + 24 { +return $WCSH_ + } + 25 { +return $WCSI_ + } + 26 { +return $WCSJ_ + } + 27 { +return $WCSK_ + } + 28 { +return $WCSL_ + } + 29 { +return $WCSM_ + } + 30 { +return $WCSN_ + } + 31 { +return $WCSO_ + } + 32 { +return $WCSP_ + } + 33 { +return $WCSQ_ + } + 34 { +return $WCSR_ + } + 35 { +return $WCSS_ + } + 36 { +return $WCST_ + } + 37 { +return $WCSU_ + } + 38 { +return $WCSV_ + } + 39 { +return $WCSW_ + } + 40 { +return $WCSX_ + } + 41 { +return $WCSY_ + } + 42 { +return $WCSZ_ + } + 43 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 44 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 45 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 46 { +set yylval $yytext; return $STRING_ + } + 47 { +# ignore whitespace + } + 48 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/matchparser.tab.tcl b/ds9/parsers/matchparser.tab.tcl new file mode 100644 index 0000000..82b27ad --- /dev/null +++ b/ds9/parsers/matchparser.tab.tcl @@ -0,0 +1,44 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set STRING_ 288 +set 3D_ 289 +set AXES_ 290 +set BIN_ 291 +set BLOCK_ 292 +set COLORBAR_ 293 +set CROP_ 294 +set CROSSHAIR_ 295 +set FRAME_ 296 +set SCALE_ 297 +set SCALELIMITS_ 298 +set SLICE_ 299 +set SMOOTH_ 300 diff --git a/ds9/parsers/matchparser.tcl b/ds9/parsers/matchparser.tcl new file mode 100644 index 0000000..d13e662 --- /dev/null +++ b/ds9/parsers/matchparser.tcl @@ -0,0 +1,1363 @@ +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 match { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc match::YYABORT {} { + return -code return 1 +} + +proc match::YYACCEPT {} { + return -code return 0 +} + +proc match::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc match::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc match::yyerror {s} { + puts stderr $s +} + +proc match::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 match::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set match::table { + 39:285,target 29 + 38:272 shift + 38:273 shift + 37:297,target 40 + 38:274 shift + 3:288,target 3 + 38:281,target 25 + 38:275 shift + 27:0 reduce + 38:276 shift + 39:264,target 8 + 38:277 shift + 9:288 reduce + 48:0 reduce + 38:278 shift + 37:276,target 20 + 0:296,target 39 + 38:280 shift + 38:279 shift + 35:288,target 44 + 30:288 reduce + 29:288 reduce + 42:302,target 52 + 38:281 shift + 38:260,target 4 + 38:259,target 3 + 38:282 shift + 38:283 shift + 38:284 shift + 0:275,target 19 + 6:0,target 6 + 38:285 shift + 38:299,target 42 + 2:0 reduce + 42:271,target 15 + 38:286 shift + 24:288,target 24 + 39:283,target 27 + 38:287 shift + 37:295,target 38 + 37:305,target 48 + 38:289 shift + 38:300 shift + 38:290 shift + 24:0 reduce + 48:0,target 37 + 38:278,target 22 + 38:301 goto + 38:291 shift + 41:0,target 42 + 38:302 goto + 38:292 shift + 45:0 reduce + 39:262,target 6 + 38:293 shift + 33:0,target 40 + 13:288,target 13 + 38:294 shift + 37:274,target 18 + 25:0,target 25 + 0:294,target 37 + 38:295 shift + 38:305 goto + 17:0,target 17 + 38:257,target 1 + 38:296 shift + 10:0,target 10 + 47:288 reduce + 38:297 shift + 38:298 shift + 38:299 shift + 0:273,target 17 + 47:288,target 33 + 38:297,target 40 + 42:268,target 12 + 4:288,target 4 + 47:304 goto + 39:281,target 25 + 17:288 reduce + 37:293,target 36 + 21:0 reduce + 38:276,target 20 + 36:288,target 43 + 39:260,target 4 + 39:259,target 3 + 37:272,target 16 + 0:302,target 45 + 0:292,target 35 + 6:288 reduce + 42:287,target 31 + 26:288 reduce + 39:299,target 42 + 25:288,target 25 + 0:271,target 15 + 38:295,target 38 + 38:305,target 49 + 42:266,target 10 + 39:278,target 22 + 17:0 reduce + 37:301,target 44 + 37:291,target 34 + 35:288 reduce + 14:288,target 14 + 38:274,target 18 + 39:257,target 1 + 37:270,target 14 + 37:269,target 13 + 0:289,target 32 + 0:300,target 43 + 0:290,target 33 + 3:0,target 3 + 42:285,target 29 + 48:288,target 37 + 39:297,target 40 + 44:288 reduce + 5:288,target 5 + 53:0,target 38 + 0:268,target 12 + 45:0,target 48 + 38:293,target 36 + 42:264,target 8 + 14:0 reduce + 39:276,target 20 + 30:0,target 30 + 29:0,target 29 + 14:288 reduce + 22:0,target 22 + 35:0 reduce + 14:0,target 14 + 38:272,target 16 + 53:288 reduce + 37:267,target 11 + 0:287,target 31 + 26:288,target 26 + 3:288 reduce + 42:283,target 27 + 0:257 shift + 39:295,target 38 + 39:305,target 50 + 0:258 shift + 23:288 reduce + 0:260 shift + 0:259 shift + 0:261 shift + 0:266,target 10 + 9:0 reduce + 38:301,target 44 + 38:291,target 34 + 0:262 shift + 11:0 reduce + 42:262,target 6 + 0:263 shift + 15:288,target 15 + 39:274,target 18 + 0:264 shift + 37:286,target 30 + 32:0 reduce + 0:265 shift + 0:266 shift + 38:270,target 14 + 38:269,target 13 + 32:288 reduce + 0:267 shift + 53:0 reduce + 0:268 shift + 0:269 shift + 0:270 shift + 50:288,target 35 + 49:288,target 36 + 37:265,target 9 + 0:271 shift + 0:285,target 29 + 0:272 shift + 6:288,target 6 + 42:281,target 25 + 0:273 shift + 39:293,target 36 + 0:274 shift + 0:275 shift + 6:0 reduce + 41:288 reduce + 0:264,target 8 + 0:276 shift + 37:257 shift + 0:277 shift + 37:258 shift + 0:278 shift + 39:272,target 16 + 37:260 shift + 37:259 shift + 28:0 reduce + 0:279 shift + 0:280 shift + 7:0,target 7 + 37:284,target 28 + 37:261 shift + 0:281 shift + 37:262 shift + 0:282 shift + 11:288 reduce + 50:0 reduce + 49:0 reduce + 38:267,target 11 + 37:263 shift + 0:283 shift + 37:264 shift + 27:288,target 27 + 0:284 shift + 50:288 reduce + 49:288 reduce + 37:265 shift + 0:285 shift + 50:0,target 35 + 49:0,target 36 + 37:266 shift + 37:263,target 7 + 0:283,target 27 + 0:286 shift + 37:267 shift + 0:287 shift + 42:278,target 22 + 37:268 shift + 34:0,target 39 + 39:301,target 44 + 39:291,target 34 + 37:270 shift + 37:269 shift + 26:0,target 26 + 0:289 shift + 0:300 shift + 0:290 shift + 3:0 reduce + 37:271 shift + 0:301 goto + 0:291 shift + 16:288,target 16 + 18:0,target 18 + 19:288 reduce + 20:288 reduce + 37:272 shift + 0:262,target 6 + 0:302 goto + 0:292 shift + 11:0,target 11 + 38:286,target 30 + 37:273 shift + 0:293 shift + 0:303 goto + 42:257,target 51 + 37:274 shift + 0:294 shift + 25:0 reduce + 39:270,target 14 + 39:269,target 13 + 37:275 shift + 0:305 goto + 0:295 shift + 37:282,target 26 + 37:276 shift + 0:296 shift + 46:0 accept + 37:277 shift + 0:297 shift + 8:288 reduce + 51:288,target 49 + 38:265,target 9 + 37:278 shift + 0:298 shift + 37:280 shift + 37:279 shift + 28:288 reduce + 0:299 shift + 7:288,target 7 + 37:281 shift + 37:282 shift + 37:261,target 5 + 0:281,target 25 + 37:283 shift + 42:276,target 20 + 37:284 shift + 40:288,target 41 + 37:285 shift + 37:286 shift + 37:287 shift + 0:260,target 4 + 0:259,target 3 + 38:284,target 28 + 22:0 reduce + 37:289 shift + 37:300 shift + 37:290 shift + 39:267,target 11 + 37:301 goto + 37:291 shift + 43:0 reduce + 37:280,target 24 + 37:279,target 23 + 37:302 goto + 37:292 shift + 28:288,target 28 + 0:299,target 42 + 37:293 shift + 38:263,target 7 + 37:294 shift + 37:295 shift + 37:305 goto + 37:296 shift + 37:258,target 2 + 37:297 shift + 0:278,target 22 + 47:304,target 54 + 37:298 shift + 17:288,target 17 + 42:274,target 18 + 37:299 shift + 39:286,target 30 + 4:0,target 4 + 37:298,target 41 + 0:257,target 1 + 16:288 reduce + 18:0 reduce + 38:282,target 26 + 52:288,target 50 + 40:0 reduce + 39:265,target 9 + 46:0,target 0 + 37:277,target 21 + 0:297,target 40 + 8:288,target 8 + 38:261,target 5 + 31:0,target 31 + 5:288 reduce + 23:0,target 23 + 25:288 reduce + 15:0,target 15 + 41:288,target 42 + 0:276,target 20 + 42:272,target 16 + 39:284,target 28 + 37:296,target 39 + 15:0 reduce + 38:280,target 24 + 38:279,target 23 + 30:288,target 30 + 29:288,target 29 + 36:0 reduce + 34:288 reduce + 39:263,target 7 + 37:275,target 19 + 0:305,target 47 + 0:295,target 38 + 38:258,target 2 + 18:288,target 18 + 0:274,target 18 + 43:288 reduce + 38:298,target 41 + 42:270,target 14 + 42:269,target 13 + 39:257 shift + 39:282,target 26 + 39:258 shift + 12:0 reduce + 39:260 shift + 39:259 shift + 37:294,target 37 + 53:288,target 38 + 39:261 shift + 39:262 shift + 38:277,target 21 + 33:0 reduce + 9:288,target 9 + 13:288 reduce + 39:263 shift + 39:264 shift + 39:261,target 5 + 52:288 reduce + 39:265 shift + 37:273,target 17 + 0:293,target 36 + 0:303,target 46 + 39:266 shift + 39:267 shift + 8:0,target 8 + 39:268 shift + 1:0,target 1 + 2:288 reduce + 39:270 shift + 39:269 shift + 39:271 shift + 0:272,target 16 + 22:288 reduce + 39:272 shift + 38:296,target 39 + 7:0 reduce + 42:267,target 11 + 39:273 shift + 51:0,target 49 + 39:280,target 24 + 39:279,target 23 + 39:274 shift + 31:288,target 31 + 43:0,target 45 + 39:275 shift + 37:302,target 45 + 37:292,target 35 + 39:276 shift + 35:0,target 44 + 30:0 reduce + 29:0 reduce + 39:277 shift + 38:275,target 19 + 27:0,target 27 + 39:278 shift + 19:0,target 19 + 20:0,target 20 + 51:0 reduce + 39:280 shift + 39:279 shift + 39:258,target 2 + 31:288 reduce + 12:0,target 12 + 39:281 shift + 37:271,target 15 + 0:301,target 44 + 0:291,target 34 + 19:288,target 19 + 20:288,target 20 + 39:282 shift + 42:286,target 30 + 39:283 shift + 39:284 shift + 39:298,target 41 + 39:285 shift + 39:286 shift + 0:269,target 13 + 0:270,target 14 + 4:0 reduce + 39:287 shift + 38:294,target 37 + 54:288,target 55 + 42:265,target 9 + 40:288 reduce + 39:277,target 21 + 39:289 shift + 39:300 shift + 39:290 shift + 39:301 goto + 39:291 shift + 37:289,target 32 + 37:300,target 43 + 37:290,target 33 + 26:0 reduce + 39:302 goto + 39:292 shift + 39:293 shift + 38:273,target 17 + 47:0 reduce + 39:294 shift + 10:288 reduce + 43:288,target 45 + 39:295 shift + 39:305 goto + 39:296 shift + 37:268,target 12 + 48:288 reduce + 39:297 shift + 42:284,target 28 + 39:298 shift + 39:299 shift + 39:296,target 39 + 1:0 reduce + 32:288,target 46 + 0:267,target 11 + 38:302,target 45 + 38:292,target 35 + 18:288 reduce + 42:263,target 7 + 39:275,target 19 + 23:0 reduce + 37:287,target 31 + 44:0 reduce + 38:271,target 15 + 5:0,target 5 + 21:288,target 21 + 7:288 reduce + 37:266,target 10 + 27:288 reduce + 0:286,target 30 + 55:0,target 34 + 42:282,target 26 + 47:0,target 32 + 39:294,target 37 + 10:288,target 10 + 40:0,target 41 + 32:0,target 46 + 0:265,target 9 + 38:289,target 32 + 38:300,target 43 + 38:290,target 33 + 24:0,target 24 + 42:261,target 5 + 16:0,target 16 + 19:0 reduce + 20:0 reduce + 39:273,target 17 + 36:288 reduce + 37:285,target 29 + 44:288,target 47 + 41:0 reduce + 38:268,target 12 + 1:288,target 1 + 37:264,target 8 + 0:284,target 28 + 45:288 reduce + 42:280,target 24 + 42:279,target 23 + 33:288,target 40 + 42:257 shift + 39:302,target 45 + 39:292,target 35 + 0:263,target 7 + 42:261 shift + 38:287,target 31 + 16:0 reduce + 42:262 shift + 15:288 reduce + 42:263 shift + 39:271,target 15 + 22:288,target 22 + 42:264 shift + 37:283,target 27 + 54:288 shift + 42:265 shift + 42:266 shift + 38:266,target 10 + 42:267 shift + 42:268 shift + 4:288 reduce + 42:270 shift + 42:269 shift + 37:262,target 6 + 0:282,target 26 + 11:288,target 11 + 42:271 shift + 24:288 reduce + 42:277,target 21 + 42:272 shift + 42:273 shift + 39:289,target 32 + 39:300,target 43 + 39:290,target 33 + 42:274 shift + 42:275 shift + 0:261,target 5 + 9:0,target 9 + 13:0 reduce + 42:276 shift + 38:285,target 29 + 2:0,target 2 + 45:288,target 48 + 42:277 shift + 42:278 shift + 39:268,target 12 + 34:0 reduce + 2:288,target 2 + 42:280 shift + 42:279 shift + 37:281,target 25 + 33:288 reduce + 42:281 shift + 55:0 reduce + 52:0,target 50 + 42:282 shift + 42:306,target 53 + 38:264,target 8 + 44:0,target 47 + 42:283 shift + 42:284 shift + 36:0,target 43 + 34:288,target 39 + 42:285 shift + 37:260,target 4 + 37:259,target 3 + 28:0,target 28 + 0:279,target 23 + 0:280,target 24 + 42:286 shift + 21:0,target 21 + 42:287 shift + 42:275,target 19 + 13:0,target 13 + 39:287,target 31 + 8:0 reduce + 38:257 shift + 37:299,target 42 + 10:0 reduce + 38:258 shift + 0:258,target 2 + 23:288,target 23 + 42:302 goto + 38:283,target 27 + 38:260 shift + 38:259 shift + 38:261 shift + 31:0 reduce + 39:266,target 10 + 38:262 shift + 12:288 reduce + 38:263 shift + 37:278,target 22 + 0:298,target 41 + 52:0 reduce + 42:306 goto + 38:264 shift + 51:288 reduce + 38:265 shift + 38:262,target 6 + 12:288,target 12 + 38:266 shift + 38:267 shift + 38:268 shift + 37:257,target 1 + 0:277,target 21 + 1:288 reduce + 38:270 shift + 38:269 shift + 42:273,target 17 + 38:271 shift + 5:0 reduce + 21:288 reduce +} + +array set match::rules { + 9,l 302 + 11,l 302 + 32,l 303 + 6,l 302 + 28,l 302 + 50,l 306 + 49,l 306 + 3,l 301 + 25,l 302 + 46,l 305 + 0,l 307 + 22,l 302 + 43,l 305 + 18,l 302 + 40,l 305 + 39,l 305 + 15,l 302 + 36,l 305 + 12,l 302 + 33,l 304 + 7,l 302 + 29,l 302 + 30,l 302 + 4,l 301 + 26,l 302 + 47,l 305 + 1,l 301 + 23,l 302 + 44,l 305 + 19,l 302 + 20,l 302 + 41,l 305 + 16,l 302 + 37,l 305 + 13,l 302 + 34,l 303 + 8,l 302 + 10,l 302 + 31,l 302 + 5,l 302 + 27,l 302 + 48,l 305 + 2,l 301 + 24,l 302 + 45,l 305 + 21,l 302 + 42,l 305 + 17,l 302 + 38,l 305 + 14,l 302 + 35,l 305 +} + +array set match::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 0 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 2 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 2 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 2 + 50,dc 1 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 3 + 48,dc 1 +} + +array set match::rules { + 41,line 137 + 7,line 100 + 37,line 133 + 4,line 96 + 34,line 128 + 1,line 93 + 31,line 124 + 27,line 120 + 24,line 117 + 21,line 114 + 17,line 110 + 14,line 107 + 11,line 104 + 50,line 150 + 49,line 149 + 46,line 142 + 33,e 1 + 43,line 139 + 9,line 102 + 40,line 136 + 39,line 135 + 6,line 99 + 36,line 132 + 3,line 95 + 33,line 127 + 29,line 122 + 30,line 123 + 26,line 119 + 23,line 116 + 19,line 112 + 20,line 113 + 16,line 109 + 13,line 106 + 10,line 103 + 48,line 146 + 45,line 141 + 42,line 138 + 8,line 101 + 38,line 134 + 5,line 98 + 35,line 131 + 2,line 94 + 32,line 127 + 28,line 121 + 25,line 118 + 22,line 115 + 18,line 111 + 15,line 108 + 12,line 105 + 47,line 145 + 44,line 140 +} + +array set match::lr1_table { + 35 {{44 {0 288} 1}} + 14,trans {} + 36 {{43 {0 288} 1}} + 33,trans {} + 37 {{37 {0 288} 1} {35 {0 288} 0} {36 {0 288} 0} {37 {0 288} 0} {38 {0 288} 0} {39 {0 288} 0} {40 {0 288} 0} {41 {0 288} 0} {42 {0 288} 0} {43 {0 288} 0} {44 {0 288} 0} {45 {0 288} 0} {46 {0 288} 0} {47 {0 288} 0} {48 {0 288} 0} {1 {0 288} 0} {2 {0 288} 0} {3 {0 288} 0} {4 {0 288} 0} {5 {0 288} 0} {6 {0 288} 0} {7 {0 288} 0} {8 {0 288} 0} {9 {0 288} 0} {10 {0 288} 0} {11 {0 288} 0} {12 {0 288} 0} {13 {0 288} 0} {14 {0 288} 0} {15 {0 288} 0} {16 {0 288} 0} {17 {0 288} 0} {18 {0 288} 0} {19 {0 288} 0} {20 {0 288} 0} {21 {0 288} 0} {22 {0 288} 0} {23 {0 288} 0} {24 {0 288} 0} {25 {0 288} 0} {26 {0 288} 0} {27 {0 288} 0} {28 {0 288} 0} {29 {0 288} 0} {30 {0 288} 0} {31 {0 288} 0}} + 52,trans {} + 38 {{36 {0 288} 1} {35 {0 288} 0} {36 {0 288} 0} {37 {0 288} 0} {38 {0 288} 0} {39 {0 288} 0} {40 {0 288} 0} {41 {0 288} 0} {42 {0 288} 0} {43 {0 288} 0} {44 {0 288} 0} {45 {0 288} 0} {46 {0 288} 0} {47 {0 288} 0} {48 {0 288} 0} {1 {0 288} 0} {2 {0 288} 0} {3 {0 288} 0} {4 {0 288} 0} {5 {0 288} 0} {6 {0 288} 0} {7 {0 288} 0} {8 {0 288} 0} {9 {0 288} 0} {10 {0 288} 0} {11 {0 288} 0} {12 {0 288} 0} {13 {0 288} 0} {14 {0 288} 0} {15 {0 288} 0} {16 {0 288} 0} {17 {0 288} 0} {18 {0 288} 0} {19 {0 288} 0} {20 {0 288} 0} {21 {0 288} 0} {22 {0 288} 0} {23 {0 288} 0} {24 {0 288} 0} {25 {0 288} 0} {26 {0 288} 0} {27 {0 288} 0} {28 {0 288} 0} {29 {0 288} 0} {30 {0 288} 0} {31 {0 288} 0}} + 39 {{35 {0 288} 1} {35 {0 288} 0} {36 {0 288} 0} {37 {0 288} 0} {38 {0 288} 0} {39 {0 288} 0} {40 {0 288} 0} {41 {0 288} 0} {42 {0 288} 0} {43 {0 288} 0} {44 {0 288} 0} {45 {0 288} 0} {46 {0 288} 0} {47 {0 288} 0} {48 {0 288} 0} {1 {0 288} 0} {2 {0 288} 0} {3 {0 288} 0} {4 {0 288} 0} {5 {0 288} 0} {6 {0 288} 0} {7 {0 288} 0} {8 {0 288} 0} {9 {0 288} 0} {10 {0 288} 0} {11 {0 288} 0} {12 {0 288} 0} {13 {0 288} 0} {14 {0 288} 0} {15 {0 288} 0} {16 {0 288} 0} {17 {0 288} 0} {18 {0 288} 0} {19 {0 288} 0} {20 {0 288} 0} {21 {0 288} 0} {22 {0 288} 0} {23 {0 288} 0} {24 {0 288} 0} {25 {0 288} 0} {26 {0 288} 0} {27 {0 288} 0} {28 {0 288} 0} {29 {0 288} 0} {30 {0 288} 0} {31 {0 288} 0}} + 40 {{41 {0 288} 1}} + 18,trans {} + 1,trans {} + 41 {{42 {0 288} 1}} + 37,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {289 32} {290 33} {291 34} {292 35} {293 36} {294 37} {295 38} {296 39} {297 40} {298 41} {299 42} {300 43} {301 44} {302 45} {305 48}} + 42 {{38 {0 288} 1} {49 {0 288} 0} {50 {0 288} 0} {5 {0 288} 0} {6 {0 288} 0} {7 {0 288} 0} {8 {0 288} 0} {9 {0 288} 0} {10 {0 288} 0} {11 {0 288} 0} {12 {0 288} 0} {13 {0 288} 0} {14 {0 288} 0} {15 {0 288} 0} {16 {0 288} 0} {17 {0 288} 0} {18 {0 288} 0} {19 {0 288} 0} {20 {0 288} 0} {21 {0 288} 0} {22 {0 288} 0} {23 {0 288} 0} {24 {0 288} 0} {25 {0 288} 0} {26 {0 288} 0} {27 {0 288} 0} {28 {0 288} 0} {29 {0 288} 0} {30 {0 288} 0} {31 {0 288} 0}} + 43 {{45 {0 288} 1}} + 44 {{47 {0 288} 1}} + 23,trans {} + 5,trans {} + 45 {{48 {0 288} 1}} + 42,trans {{257 51} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {302 52} {306 53}} + 46 {{0 0 1}} + 47 {{32 0 1} {34 0 1} {33 288 0}} + 48 {{37 {0 288} 2}} + 50 {{35 {0 288} 2}} + 49 {{36 {0 288} 2}} + 27,trans {} + 9,trans {} + 46,trans {} + 51 {{49 {0 288} 1}} + 52 {{50 {0 288} 1}} + 53 {{38 {0 288} 2}} + 13,trans {} + 54 {{34 0 2}} + 32,trans {} + 55 {{34 0 3}} + 51,trans {} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {289 32} {290 33} {291 34} {292 35} {293 36} {294 37} {295 38} {296 39} {297 40} {298 41} {299 42} {300 43} {301 44} {302 45} {303 46} {305 47}} + 36,trans {} + 55,trans {} + 22,trans {} + 4,trans {} + 41,trans {} + 26,trans {} + 8,trans {} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {{288 55}} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {289 32} {290 33} {291 34} {292 35} {293 36} {294 37} {295 38} {296 39} {297 40} {298 41} {299 42} {300 43} {301 44} {302 45} {305 50}} + 10 {{10 {0 288} 1}} + 11 {{11 {0 288} 1}} + 25,trans {} + 7,trans {} + 12 {{12 {0 288} 1}} + 44,trans {} + 13 {{13 {0 288} 1}} + 14 {{14 {0 288} 1}} + 11,trans {} + 15 {{15 {0 288} 1}} + 30,trans {} + 29,trans {} + 16 {{16 {0 288} 1}} + 48,trans {} + 0 {{0 0 0} {32 0 0} {34 0 0} {35 {0 288} 0} {36 {0 288} 0} {37 {0 288} 0} {38 {0 288} 0} {39 {0 288} 0} {40 {0 288} 0} {41 {0 288} 0} {42 {0 288} 0} {43 {0 288} 0} {44 {0 288} 0} {45 {0 288} 0} {46 {0 288} 0} {47 {0 288} 0} {48 {0 288} 0} {1 {0 288} 0} {2 {0 288} 0} {3 {0 288} 0} {4 {0 288} 0} {5 {0 288} 0} {6 {0 288} 0} {7 {0 288} 0} {8 {0 288} 0} {9 {0 288} 0} {10 {0 288} 0} {11 {0 288} 0} {12 {0 288} 0} {13 {0 288} 0} {14 {0 288} 0} {15 {0 288} 0} {16 {0 288} 0} {17 {0 288} 0} {18 {0 288} 0} {19 {0 288} 0} {20 {0 288} 0} {21 {0 288} 0} {22 {0 288} 0} {23 {0 288} 0} {24 {0 288} 0} {25 {0 288} 0} {26 {0 288} 0} {27 {0 288} 0} {28 {0 288} 0} {29 {0 288} 0} {30 {0 288} 0} {31 {0 288} 0}} + 17 {{17 {0 288} 1}} + 1 {{1 {0 288} 1}} + 18 {{18 {0 288} 1}} + 15,trans {} + 2 {{2 {0 288} 1}} + 19 {{19 {0 288} 1}} + 20 {{20 {0 288} 1}} + 34,trans {} + 3 {{3 {0 288} 1}} + 21 {{21 {0 288} 1}} + 53,trans {} + 4 {{4 {0 288} 1}} + 22 {{22 {0 288} 1}} + 5 {{5 {0 288} 1}} + 23 {{23 {0 288} 1}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{6 {0 288} 1}} + 24 {{24 {0 288} 1}} + 38,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {289 32} {290 33} {291 34} {292 35} {293 36} {294 37} {295 38} {296 39} {297 40} {298 41} {299 42} {300 43} {301 44} {302 45} {305 49}} + 7 {{7 {0 288} 1}} + 25 {{25 {0 288} 1}} + 8 {{8 {0 288} 1}} + 26 {{26 {0 288} 1}} + 9 {{9 {0 288} 1}} + 27 {{27 {0 288} 1}} + 24,trans {} + 6,trans {} + 28 {{28 {0 288} 1}} + 43,trans {} + 29 {{29 {0 288} 1}} + 30 {{30 {0 288} 1}} + 31 {{31 {0 288} 1}} + 10,trans {} + 32 {{46 {0 288} 1}} + 28,trans {} + 33 {{40 {0 288} 1}} + 47,trans {{304 54}} + 34 {{39 {0 288} 1}} +} + +array set match::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 47 + 302,line 97 + 288 STRING_ + 265,title WCSD + 289 3D_ + 290 AXES_ + 300 SMOOTH_ + 284,title WCSW + 291 BIN_ + 301 coordsys + 292 BLOCK_ + 302 wcssys + 288,line 40 + 293 COLORBAR_ + 303 command + 304 @PSEUDO1 + 294 CROP_ + 305 match + 295 CROSSHAIR_ + 306 matchslice + 296 FRAME_ + 307 start' + 262,t 0 + 297 SCALE_ + 285,line 36 + 298 SCALELIMITS_ + 299 SLICE_ + 283,t 0 + 282,line 33 + 264,title WCSC + 283,title WCSV + 278,line 29 + error,line 91 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 272,line 23 + 263,title WCSB + 282,title WCSU + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + 299,title SLICE + error,t 0 + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 269,t 0 + 270,t 0 + 298,title SCALELIMITS + 291,t 0 + 301,t 1 + 307,line 151 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 52 + 278,title WCSQ + 307,title {} + 297,title SCALE + 287,t 0 + 304,line 127 + 294,line 49 + 291,line 46 + error,title {} + 301,line 92 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title FRAME + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 305,title {} + 295,title CROSSHAIR + 274,line 25 + 271,line 22 + 277,t 0 + 267,line 18 + 298,t 0 + 275,title WCSN + 304,title {} + 294,title CROP + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title COLORBAR + 303,title {} + 271,t 0 + error error + 292,t 0 + 302,t 1 + 273,title WCSL + 292,title BLOCK + 302,title {} + 267,t 0 + 299,line 54 + 288,t 0 + 306,line 148 + 296,line 51 + 272,title WCSK + 303,line 126 + 291,title BIN + 293,line 48 + 301,title {} + 264,t 0 + 285,t 0 + 289,line 44 + 290,line 45 + 300,line 55 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title 3D + 290,title AXES + 300,title SMOOTH + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title string + 278,t 0 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 303,t 1 + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 276 WCSO_ + 298,line 53 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 144 + 282 WCSU_ + 295,line 50 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc match::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 33 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 35 { MatchFrameCurrent $2 } + 36 { MatchCrosshairCurrent $2 } + 37 { MatchCropCurrent $2 } + 38 { MatchCubeCurrent $2 } + 39 { MatchBinCurrent } + 40 { MatchAxesCurrent } + 41 { MatchScaleCurrent } + 42 { MatchScaleLimitsCurrent } + 43 { MatchColorCurrent } + 44 { MatchBlockCurrent } + 45 { MatchSmoothCurrent } + 46 { Match3DCurrent } + 47 { set _ $1 } + 48 { set _ $1 } + 49 { set _ image } + 50 { set _ $1 } + } + 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 match::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/mecubelex.tcl b/ds9/parsers/mecubelex.tcl new file mode 100644 index 0000000..669aca2 --- /dev/null +++ b/ds9/parsers/mecubelex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mecube { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mecube::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mecube::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mecube::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mecube::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mecube::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mecube::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mecube::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mecube::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mecube::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NEW_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/mecubeparser.tab.tcl b/ds9/parsers/mecubeparser.tab.tcl new file mode 100644 index 0000000..f492518 --- /dev/null +++ b/ds9/parsers/mecubeparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set NEW_ 258 diff --git a/ds9/parsers/mecubeparser.tcl b/ds9/parsers/mecubeparser.tcl new file mode 100644 index 0000000..964a3be --- /dev/null +++ b/ds9/parsers/mecubeparser.tcl @@ -0,0 +1,298 @@ +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 mecube { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mecube::YYABORT {} { + return -code return 1 +} + +proc mecube::YYACCEPT {} { + return -code return 0 +} + +proc mecube::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mecube::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mecube::yyerror {s} { + puts stderr $s +} + +proc mecube::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 mecube::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mecube::table { + 3:0,target 1 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 3 + 0:259 goto + 0:260 goto + 0:261 goto + 4:257 shift + 1:257,target 5 + 0:258,target 1 + 0:0,target 4 + 0:261,target 4 + 2:0,target 0 + 4:0,target 2 + 0:0 reduce + 1:0 reduce + 0:257,target 4 + 2:0 accept + 3:0 reduce + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 5 + 5:0 reduce + 4:257,target 5 +} + +array set mecube::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 260 + 4,l 261 + 5,l 261 +} + +array set mecube::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 1,dc 1 + 3,dc 2 +} + +array set mecube::rules { + 5,line 25 + 2,line 20 + 4,line 24 + 1,line 17 + 3,line 21 +} + +array set mecube::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0}} + 1 {{5 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4}} + 1,trans {} + 5 {{3 0 2}} + 2,trans {} + 3,trans {} + 4,trans {{257 5}} + 5,trans {} +} + +array set mecube::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 11 + 261,line 23 + error,line 14 + 257 STRING_ + 257,t 0 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 mecube + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 opts + 262,t 1 + 262 start' + 257,line 7 + 260,line 19 + 259,line 16 + 257,title string + 258,title NEW + 262,line 26 + 260,title {} + 259,title {} + 261,title {} +} + +proc mecube::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 { + 2 { MECubeCmdLoad {} } + 3 { MECubeCmdLoad $2 } + 5 { CreateFrame } + } + 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 mecube::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/minmaxlex.tcl b/ds9/parsers/minmaxlex.tcl new file mode 100644 index 0000000..4256409 --- /dev/null +++ b/ds9/parsers/minmaxlex.tcl @@ -0,0 +1,384 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval minmax { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc minmax::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc minmax::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc minmax::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc minmax::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc minmax::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc minmax::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc minmax::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc minmax::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc minmax::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 +set AUTO_ 259 +set DATAMIN_ 260 +set IRAFMIN_ 261 +set INTERVAL_ 262 +set MODE_ 263 +set SAMPLE_ 264 +set SCAN_ 265 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: auto + if {[regexp -start $index_ -indices -line -nocase -- {\A(auto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: datamin + if {[regexp -start $index_ -indices -line -nocase -- {\A(datamin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: irafmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(irafmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: interval + if {[regexp -start $index_ -indices -line -nocase -- {\A(interval)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: sample + if {[regexp -start $index_ -indices -line -nocase -- {\A(sample)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: scan + if {[regexp -start $index_ -indices -line -nocase -- {\A(scan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $AUTO_ + } + 2 { +return $DATAMIN_ + } + 3 { +return $IRAFMIN_ + } + 4 { +return $INTERVAL_ + } + 5 { +return $MODE_ + } + 6 { +return $SAMPLE_ + } + 7 { +return $SCAN_ + } + 8 { +set yylval $yytext; return $INT_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 12 { +set yylval $yytext; return $STRING_ + } + 13 { +# ignore whitespace + } + 14 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/minmaxparser.tab.tcl b/ds9/parsers/minmaxparser.tab.tcl new file mode 100644 index 0000000..a1486b8 --- /dev/null +++ b/ds9/parsers/minmaxparser.tab.tcl @@ -0,0 +1,9 @@ +set INT_ 257 +set STRING_ 258 +set AUTO_ 259 +set DATAMIN_ 260 +set IRAFMIN_ 261 +set INTERVAL_ 262 +set MODE_ 263 +set SAMPLE_ 264 +set SCAN_ 265 diff --git a/ds9/parsers/minmaxparser.tcl b/ds9/parsers/minmaxparser.tcl new file mode 100644 index 0000000..7e4557d --- /dev/null +++ b/ds9/parsers/minmaxparser.tcl @@ -0,0 +1,433 @@ +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 minmax { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc minmax::YYABORT {} { + return -code return 1 +} + +proc minmax::YYACCEPT {} { + return -code return 0 +} + +proc minmax::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc minmax::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc minmax::yyerror {s} { + puts stderr $s +} + +proc minmax::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 minmax::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set minmax::table { + 0:258 reduce + 0:260 shift + 0:259 shift + 9:0 reduce + 0:266,target 8 + 0:261 shift + 2:258 reduce + 11:0 reduce + 0:262 shift + 4:257 shift + 10:258,target 5 + 0:263 shift + 0:264 shift + 6:258 reduce + 0:265 shift + 5:265,target 7 + 0:266 goto + 6:258,target 9 + 0:268 goto + 0:265,target 7 + 6:0,target 9 + 0:269 goto + 2:0 reduce + 1:258,target 12 + 5:264,target 6 + 13:258,target 14 + 6:0 reduce + 0:264,target 6 + 7:0,target 8 + 12:0 reduce + 9:258,target 2 + 0:0,target 4 + 10:0,target 5 + 0:263,target 5 + 10:258 reduce + 12:258 reduce + 9:267,target 13 + 8:0,target 0 + 3:0 reduce + 11:258,target 7 + 1:0,target 12 + 11:0,target 7 + 0:262,target 4 + 4:257,target 11 + 7:0 reduce + 1:258 reduce + 7:258,target 8 + 5:261,target 3 + 3:258 reduce + 9:0,target 1 + 0:261,target 3 + 2:258,target 10 + 5:259 shift + 2:0,target 10 + 5:260 shift + 12:0,target 6 + 7:258 reduce + 5:261 shift + 9:258 reduce + 5:259,target 1 + 0:0 reduce + 5:260,target 2 + 5:269,target 12 + 5:264 shift + 5:265 shift + 0:260,target 2 + 0:259,target 1 + 0:269,target 10 + 3:0,target 11 + 5:269 goto + 9:267 goto + 8:0 accept + 10:0 reduce + 0:258,target 4 + 0:268,target 9 + 14:0 reduce + 12:258,target 6 + 14:0,target 3 + 11:258 reduce + 1:0 reduce + 13:258 shift + 3:258,target 11 +} + +array set minmax::rules { + 9,l 269 + 11,l 269 + 2,l 267 + 6,l 268 + 12,l 269 + 3,l 266 + 7,l 268 + 0,l 270 + 4,l 268 + 8,l 269 + 10,l 269 + 1,l 266 + 5,l 268 +} + +array set minmax::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 3 + 10,dc 1 + 6,dc 2 + 1,dc 1 + 9,dc 1 + 4,dc 0 + 11,dc 1 + 7,dc 2 + 2,dc 0 +} + +array set minmax::rules { + 2,e 1 + 7,line 31 + 10,line 36 + 4,line 28 + 1,line 24 + 9,line 35 + 12,line 39 + 6,line 30 + 3,line 25 + 8,line 34 + 11,line 38 + 5,line 29 + 2,line 24 +} + +array set minmax::lr1_table { + 13,trans {{258 14}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0} {5 {0 258} 0} {6 {0 258} 0} {7 {0 258} 0} {8 {0 258} 0} {9 {0 258} 0} {10 {0 258} 0} {11 {0 258} 0} {12 {0 258} 0}} + 14,trans {} + 1 {{12 {0 258} 1}} + 2 {{10 {0 258} 1}} + 3 {{11 {0 258} 1}} + 4 {{7 {0 258} 1}} + 0,trans {{259 1} {260 2} {261 3} {262 4} {263 5} {264 6} {265 7} {266 8} {268 9} {269 10}} + 1,trans {} + 5 {{6 {0 258} 1} {8 {0 258} 0} {9 {0 258} 0} {10 {0 258} 0} {11 {0 258} 0} {12 {0 258} 0}} + 2,trans {} + 6 {{9 {0 258} 1}} + 3,trans {} + 7 {{8 {0 258} 1}} + 4,trans {{257 11}} + 8 {{0 0 1}} + 5,trans {{259 1} {260 2} {261 3} {264 6} {265 7} {269 12}} + 9 {{1 0 1} {3 0 1} {2 258 0}} + 10 {{5 {0 258} 1}} + 6,trans {} + 11 {{7 {0 258} 2}} + 7,trans {} + 12 {{6 {0 258} 2}} + 13 {{3 0 2}} + 8,trans {} + 14 {{3 0 3}} + 10,trans {} + 9,trans {{267 13}} + 11,trans {} + 12,trans {} +} + +array set minmax::token_id_table { + 264,line 18 + 270,t 1 + 269,t 1 + 265,title SCAN + 261,line 15 + 257,t 0 + 270,title {} + 269,title {} + 257,line 7 + 262,t 0 + 270,line 40 + 269,line 33 + 259,title AUTO + 260,title DATAMIN + 266,t 1 + 264,title SAMPLE + error error + 266,line 23 + 268,title {} + error,line 22 + 258,t 0 + 263,line 17 + error,title {} + 263,t 0 + 259,line 13 + 260,line 14 + 258,title string + 267,t 1 + 263,title MODE + 268,line 27 + 267,title {} + 257 INT_ + 258 STRING_ + 259,t 0 + 259 AUTO_ + 260 DATAMIN_ + 260,t 0 + 261 IRAFMIN_ + 265,line 19 + 262 INTERVAL_ + 263 MODE_ + 257,title integer + 264 SAMPLE_ + 264,t 0 + 265 SCAN_ + 262,line 16 + 266 command + 267 @PSEUDO1 + 268,t 1 + 268 minmax + 262,title INTERVAL + 0 {$} + 0,t 0 + 270 start' + 269 mode + error,t 0 + 258,line 9 + 266,title {} + 261,t 0 + 267,line 24 + 265,t 0 + 261,title IRAFMIN +} + +proc minmax::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet scale mode minmax ChangeScaleMode } + 5 { ProcessCmdSet minmax mode $1 ChangeMinMax } + 6 { ProcessCmdSet minmax mode $2 ChangeMinMax } + 7 { ProcessCmdSet minmax sample $2 ChangeMinMax } + 8 { set _ scan } + 9 { set _ sample } + 10 { set _ datamin } + 11 { set _ irafmin } + 12 { set _ scan } + } + 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 minmax::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/minmaxsendlex.tcl b/ds9/parsers/minmaxsendlex.tcl new file mode 100644 index 0000000..273b0f8 --- /dev/null +++ b/ds9/parsers/minmaxsendlex.tcl @@ -0,0 +1,267 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval minmaxsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc minmaxsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc minmaxsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc minmaxsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc minmaxsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc minmaxsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc minmaxsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc minmaxsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc minmaxsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc minmaxsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INTERVAL_ 257 +set MODE_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: interval + if {[regexp -start $index_ -indices -line -nocase -- {\A(interval)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $INTERVAL_ + } + 1 { +return $MODE_ + } + 2 { +# ignore whitespace + } + 3 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/minmaxsendparser.tab.tcl b/ds9/parsers/minmaxsendparser.tab.tcl new file mode 100644 index 0000000..2565722 --- /dev/null +++ b/ds9/parsers/minmaxsendparser.tab.tcl @@ -0,0 +1,2 @@ +set INTERVAL_ 257 +set MODE_ 258 diff --git a/ds9/parsers/minmaxsendparser.tcl b/ds9/parsers/minmaxsendparser.tcl new file mode 100644 index 0000000..f5adc39 --- /dev/null +++ b/ds9/parsers/minmaxsendparser.tcl @@ -0,0 +1,268 @@ +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 minmaxsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc minmaxsend::YYABORT {} { + return -code return 1 +} + +proc minmaxsend::YYACCEPT {} { + return -code return 0 +} + +proc minmaxsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc minmaxsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc minmaxsend::yyerror {s} { + puts stderr $s +} + +proc minmaxsend::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 minmaxsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set minmaxsend::table { + 3:0,target 0 + 0:257 shift + 0:258 shift + 0:259 goto + 0:258,target 2 + 0:0,target 1 + 2:0,target 2 + 0:0 reduce + 0:257,target 1 + 1:0 reduce + 2:0 reduce + 3:0 accept + 0:259,target 3 + 1:0,target 3 +} + +array set minmaxsend::rules { + 0,l 260 + 1,l 259 + 2,l 259 + 3,l 259 +} + +array set minmaxsend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set minmaxsend::rules { + 2,line 15 + 1,line 14 + 3,line 16 +} + +array set minmaxsend::lr1_table { + 0,trans {{257 1} {258 2} {259 3}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0}} + 1,trans {} + 1 {{3 0 1}} + 2,trans {} + 2 {{2 0 1}} + 3,trans {} + 3 {{0 0 1}} +} + +array set minmaxsend::token_id_table { + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 9 + error,line 12 + 257 INTERVAL_ + 257,t 0 + 258 MODE_ + 258,t 0 + 260,t 1 + 260 start' + 259,t 1 + 259 minmaxsend + error,title {} + 257,line 8 + 260,line 17 + 259,line 13 + 257,title INTERVAL + 258,title MODE + 260,title {} + 259,title {} +} + +proc minmaxsend::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 { ProcessSendCmdGet minmax mode } + 2 { ProcessSendCmdGet minmax mode } + 3 { ProcessSendCmdGet minmax sample } + } + 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 minmaxsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/modelex.tcl b/ds9/parsers/modelex.tcl new file mode 100644 index 0000000..7de9bf5 --- /dev/null +++ b/ds9/parsers/modelex.tcl @@ -0,0 +1,407 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mode { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mode::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mode::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mode::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mode::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mode::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mode::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mode::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mode::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mode::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NONE_ 258 +set REGION_ 259 +set CROSSHAIR_ 260 +set COLORBAR_ 261 +set PAN_ 262 +set ZOOM_ 263 +set ROTATE_ 264 +set CROP_ 265 +set CATALOG_ 266 +set EXAMINE_ 267 +set POINTER_ 268 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: region + if {[regexp -start $index_ -indices -line -nocase -- {\A(region)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: pan + if {[regexp -start $index_ -indices -line -nocase -- {\A(pan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: zoom + if {[regexp -start $index_ -indices -line -nocase -- {\A(zoom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: rotate + if {[regexp -start $index_ -indices -line -nocase -- {\A(rotate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: crop + if {[regexp -start $index_ -indices -line -nocase -- {\A(crop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: catalog + if {[regexp -start $index_ -indices -line -nocase -- {\A(catalog)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: examine + if {[regexp -start $index_ -indices -line -nocase -- {\A(examine)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: pointer + if {[regexp -start $index_ -indices -line -nocase -- {\A(pointer)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NONE_ + } + 1 { +return $REGION_ + } + 2 { +return $CROSSHAIR_ + } + 3 { +return $COLORBAR_ + } + 4 { +return $PAN_ + } + 5 { +return $ZOOM_ + } + 6 { +return $ROTATE_ + } + 7 { +return $CROP_ + } + 8 { +return $CATALOG_ + } + 9 { +return $EXAMINE_ + } + 10 { +return $POINTER_ + } + 11 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 12 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval $yytext; return $STRING_ + } + 15 { +# ignore whitespace + } + 16 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/modeparser.tab.tcl b/ds9/parsers/modeparser.tab.tcl new file mode 100644 index 0000000..2059a9e --- /dev/null +++ b/ds9/parsers/modeparser.tab.tcl @@ -0,0 +1,12 @@ +set STRING_ 257 +set NONE_ 258 +set REGION_ 259 +set CROSSHAIR_ 260 +set COLORBAR_ 261 +set PAN_ 262 +set ZOOM_ 263 +set ROTATE_ 264 +set CROP_ 265 +set CATALOG_ 266 +set EXAMINE_ 267 +set POINTER_ 268 diff --git a/ds9/parsers/modeparser.tcl b/ds9/parsers/modeparser.tcl new file mode 100644 index 0000000..f709535 --- /dev/null +++ b/ds9/parsers/modeparser.tcl @@ -0,0 +1,467 @@ +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 mode { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mode::YYABORT {} { + return -code return 1 +} + +proc mode::YYACCEPT {} { + return -code return 0 +} + +proc mode::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mode::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mode::yyerror {s} { + puts stderr $s +} + +proc mode::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 mode::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mode::table { + 0:258 shift + 0:260 shift + 0:259 shift + 2:257 reduce + 5:0,target 9 + 9:0 reduce + 8:257,target 12 + 0:261 shift + 0:266,target 9 + 11:0 reduce + 0:262 shift + 4:257 reduce + 0:263 shift + 6:257 reduce + 0:264 shift + 3:257,target 7 + 13:270 goto + 0:265 shift + 8:257 reduce + 0:266 shift + 15:257,target 16 + 0:267 shift + 13:270,target 15 + 0:265,target 8 + 0:268 shift + 6:0,target 10 + 0:269 goto + 16:0,target 3 + 10:257,target 14 + 0:271 goto + 2:0 reduce + 0:272 goto + 6:0 reduce + 6:257,target 10 + 0:264,target 7 + 7:0,target 11 + 1:257,target 5 + 12:0 accept + 10:0,target 14 + 13:257,target 2 + 0:263,target 6 + 16:0 reduce + 10:257 reduce + 9:257,target 13 + 14:257 reduce + 8:0,target 12 + 3:0 reduce + 1:0,target 5 + 11:0,target 15 + 0:262,target 5 + 4:257,target 8 + 0:272,target 14 + 7:0 reduce + 1:257 reduce + 3:257 reduce + 11:257,target 15 + 5:257 reduce + 13:0 reduce + 9:0,target 13 + 0:261,target 4 + 7:257 reduce + 0:271,target 13 + 2:0,target 6 + 12:0,target 0 + 9:257 reduce + 7:257,target 11 + 0:259,target 2 + 0:260,target 3 + 2:257,target 6 + 0:269,target 12 + 4:0 reduce + 14:257,target 4 + 3:0,target 7 + 13:0,target 1 + 8:0 reduce + 10:0 reduce + 0:258,target 1 + 0:268,target 11 + 14:0 reduce + 5:257,target 9 + 4:0,target 8 + 14:0,target 4 + 11:257 reduce + 1:0 reduce + 13:257 reduce + 0:267,target 10 + 15:257 shift + 5:0 reduce +} + +array set mode::rules { + 9,l 272 + 11,l 272 + 15,l 272 + 2,l 270 + 6,l 272 + 12,l 272 + 3,l 269 + 7,l 272 + 13,l 272 + 0,l 273 + 4,l 271 + 8,l 272 + 10,l 272 + 14,l 272 + 1,l 269 + 5,l 272 +} + +array set mode::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 3 + 15,dc 1 + 10,dc 1 + 6,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 1 + 4,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 0 + 14,dc 1 +} + +array set mode::rules { + 13,line 41 + 2,e 1 + 7,line 35 + 10,line 38 + 4,line 30 + 1,line 26 + 15,line 44 + 9,line 37 + 12,line 40 + 6,line 34 + 3,line 27 + 14,line 43 + 8,line 36 + 11,line 39 + 5,line 33 + 2,line 26 +} + +array set mode::lr1_table { + 13,trans {{270 15}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0} {7 {0 257} 0} {8 {0 257} 0} {9 {0 257} 0} {10 {0 257} 0} {11 {0 257} 0} {12 {0 257} 0} {13 {0 257} 0} {14 {0 257} 0} {15 {0 257} 0}} + 14,trans {} + 1 {{5 {0 257} 1}} + 15,trans {{257 16}} + 2 {{6 {0 257} 1}} + 16,trans {} + 3 {{7 {0 257} 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5} {263 6} {264 7} {265 8} {266 9} {267 10} {268 11} {269 12} {271 13} {272 14}} + 4 {{8 {0 257} 1}} + 1,trans {} + 5 {{9 {0 257} 1}} + 2,trans {} + 6 {{10 {0 257} 1}} + 3,trans {} + 7 {{11 {0 257} 1}} + 4,trans {} + 8 {{12 {0 257} 1}} + 5,trans {} + 9 {{13 {0 257} 1}} + 10 {{14 {0 257} 1}} + 6,trans {} + 11 {{15 {0 257} 1}} + 7,trans {} + 12 {{0 0 1}} + 8,trans {} + 13 {{1 0 1} {3 0 1} {2 257 0}} + 10,trans {} + 9,trans {} + 14 {{4 {0 257} 1}} + 15 {{3 0 2}} + 11,trans {} + 16 {{3 0 3}} + 12,trans {} +} + +array set mode::token_id_table { + 264,line 17 + 270,t 1 + 269,t 1 + 265,title CROP + 261,line 14 + 257,t 0 + 270,title {} + 269,title {} + 273,line 45 + 257,line 7 + 262,t 0 + 270,line 26 + 269,line 25 + 259,title REGION + 260,title CROSSHAIR + 266,t 0 + 271,t 1 + error error + 264,title ROTATE + 266,line 19 + error,line 24 + 268,title POINTER + 258,t 0 + 263,line 16 + error,title {} + 273,title {} + 263,t 0 + 259,line 12 + 260,line 13 + 258,title NONE + 272,line 32 + 267,t 0 + 263,title ZOOM + 272,t 1 + 268,line 21 + 267,title EXAMINE + 257 STRING_ + 258 NONE_ + 259,t 0 + 259 REGION_ + 260 CROSSHAIR_ + 260,t 0 + 272,title {} + 261 COLORBAR_ + 265,line 18 + 262 PAN_ + 263 ZOOM_ + 257,title string + 264 ROTATE_ + 264,t 0 + 265 CROP_ + 262,line 15 + 266 CATALOG_ + 267 EXAMINE_ + 0,t 0 + 0 {$} + 262,title PAN + 268 POINTER_ + 268,t 0 + 270 @PSEUDO1 + 269 command + 271 mode + error,t 0 + 272 item + 258,line 11 + 273,t 1 + 273 start' + 266,title CATALOG + 271,line 29 + 271,title {} + 261,t 0 + 267,line 20 + 265,t 0 + 261,title COLORBAR +} + +proc mode::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet current mode $1 ChangeMode } + 5 { set _ none } + 6 { set _ region } + 7 { set _ crosshair } + 8 { set _ colorbar } + 9 { set _ pan } + 10 { set _ zoom } + 11 { set _ rotate } + 12 { set _ crop } + 13 { set _ catalog } + 14 { set _ examine } + 15 { set _ region } + } + 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 mode::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/mosaicimageiraflex.tcl b/ds9/parsers/mosaicimageiraflex.tcl new file mode 100644 index 0000000..d2d1f51 --- /dev/null +++ b/ds9/parsers/mosaicimageiraflex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mosaicimageiraf { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mosaicimageiraf::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mosaicimageiraf::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mosaicimageiraf::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mosaicimageiraf::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mosaicimageiraf::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mosaicimageiraf::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mosaicimageiraf::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mosaicimageiraf::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mosaicimageiraf::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/mosaicimageirafparser.tab.tcl b/ds9/parsers/mosaicimageirafparser.tab.tcl new file mode 100644 index 0000000..67faf4c --- /dev/null +++ b/ds9/parsers/mosaicimageirafparser.tab.tcl @@ -0,0 +1,3 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 diff --git a/ds9/parsers/mosaicimageirafparser.tcl b/ds9/parsers/mosaicimageirafparser.tcl new file mode 100644 index 0000000..a901590 --- /dev/null +++ b/ds9/parsers/mosaicimageirafparser.tcl @@ -0,0 +1,314 @@ +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 mosaicimageiraf { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mosaicimageiraf::YYABORT {} { + return -code return 1 +} + +proc mosaicimageiraf::YYACCEPT {} { + return -code return 0 +} + +proc mosaicimageiraf::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mosaicimageiraf::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mosaicimageiraf::yyerror {s} { + puts stderr $s +} + +proc mosaicimageiraf::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 mosaicimageiraf::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mosaicimageiraf::table { + 6:0 reduce + 3:0,target 0 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 2 + 2:257 reduce + 0:260 goto + 0:259 shift + 0:261 goto + 1:257,target 6 + 0:258,target 1 + 0:262 goto + 5:257 shift + 0:0,target 4 + 0:261,target 4 + 2:0,target 5 + 5:257,target 6 + 4:0,target 1 + 0:0 reduce + 6:0,target 3 + 1:0 reduce + 0:257,target 4 + 2:0 reduce + 3:0 accept + 2:257,target 5 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 6 + 5:0 reduce + 0:262,target 5 +} + +array set mosaicimageiraf::rules { + 0,l 263 + 1,l 260 + 2,l 261 + 3,l 261 + 4,l 262 + 5,l 262 + 6,l 262 +} + +array set mosaicimageiraf::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 6,dc 1 + 1,dc 1 + 3,dc 2 +} + +array set mosaicimageiraf::rules { + 5,line 26 + 2,line 21 + 4,line 25 + 6,line 27 + 1,line 18 + 3,line 22 +} + +array set mosaicimageiraf::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0}} + 1 {{6 {0 257} 1}} + 2 {{5 {0 257} 1}} + 3 {{0 0 1}} + 4 {{1 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5}} + 5 {{2 0 1} {3 0 1}} + 1,trans {} + 2,trans {} + 6 {{3 0 2}} + 3,trans {} + 4,trans {} + 5,trans {{257 6}} + 6,trans {} +} + +array set mosaicimageiraf::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 20 + error,line 15 + 257 STRING_ + 257,t 0 + 263,line 28 + 258 MASK_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 NEW_ + 259,t 0 + 261,t 1 + 261 mosaicimageiraf + 262,t 1 + 262 opts + 257,line 7 + 263,t 1 + 263 start' + 260,line 17 + 257,title string + 259,line 12 + 258,title MASK + 262,line 24 + 260,title {} + 259,title NEW + 261,title {} +} + +proc mosaicimageiraf::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 { + 2 { MosaicImageIRAFCmdLoad {} $1 } + 3 { MosaicImageIRAFCmdLoad $2 $1 } + 5 { CreateFrame; set _ {} } + 6 { 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 mosaicimageiraf::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/mosaicimagewcslex.tcl b/ds9/parsers/mosaicimagewcslex.tcl new file mode 100644 index 0000000..3ca7c6b --- /dev/null +++ b/ds9/parsers/mosaicimagewcslex.tcl @@ -0,0 +1,605 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mosaicimagewcs { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mosaicimagewcs::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mosaicimagewcs::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mosaicimagewcs::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mosaicimagewcs::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mosaicimagewcs::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mosaicimagewcs::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mosaicimagewcs::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mosaicimagewcs::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mosaicimagewcs::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set STRING_ 284 +set MASK_ 285 +set NEW_ 286 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $WCS_ + } + 3 { +return $WCSA_ + } + 4 { +return $WCSB_ + } + 5 { +return $WCSC_ + } + 6 { +return $WCSD_ + } + 7 { +return $WCSE_ + } + 8 { +return $WCSF_ + } + 9 { +return $WCSG_ + } + 10 { +return $WCSH_ + } + 11 { +return $WCSI_ + } + 12 { +return $WCSJ_ + } + 13 { +return $WCSK_ + } + 14 { +return $WCSL_ + } + 15 { +return $WCSM_ + } + 16 { +return $WCSN_ + } + 17 { +return $WCSO_ + } + 18 { +return $WCSP_ + } + 19 { +return $WCSQ_ + } + 20 { +return $WCSR_ + } + 21 { +return $WCSS_ + } + 22 { +return $WCST_ + } + 23 { +return $WCSU_ + } + 24 { +return $WCSV_ + } + 25 { +return $WCSW_ + } + 26 { +return $WCSX_ + } + 27 { +return $WCSY_ + } + 28 { +return $WCSZ_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval $yytext; return $STRING_ + } + 33 { +# ignore whitespace + } + 34 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/mosaicimagewcsparser.tab.tcl b/ds9/parsers/mosaicimagewcsparser.tab.tcl new file mode 100644 index 0000000..8e61664 --- /dev/null +++ b/ds9/parsers/mosaicimagewcsparser.tab.tcl @@ -0,0 +1,30 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set STRING_ 284 +set MASK_ 285 +set NEW_ 286 diff --git a/ds9/parsers/mosaicimagewcsparser.tcl b/ds9/parsers/mosaicimagewcsparser.tcl new file mode 100644 index 0000000..2d6fc1b --- /dev/null +++ b/ds9/parsers/mosaicimagewcsparser.tcl @@ -0,0 +1,940 @@ +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 mosaicimagewcs { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mosaicimagewcs::YYABORT {} { + return -code return 1 +} + +proc mosaicimagewcs::YYACCEPT {} { + return -code return 0 +} + +proc mosaicimagewcs::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mosaicimagewcs::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mosaicimagewcs::yyerror {s} { + puts stderr $s +} + +proc mosaicimagewcs::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 mosaicimagewcs::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mosaicimagewcs::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 mosaicimagewcs::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 mosaicimagewcs::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 mosaicimagewcs::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 mosaicimagewcs::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 mosaicimagewcs::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 mosaicimagewcs + 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 mosaicimagewcs::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 { MosaicImageWCSCmdLoad {} $1 $2 } + 30 { MosaicImageWCSCmdLoad $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 mosaicimagewcs::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/mosaicimagewfpc2lex.tcl b/ds9/parsers/mosaicimagewfpc2lex.tcl new file mode 100644 index 0000000..d48e11e --- /dev/null +++ b/ds9/parsers/mosaicimagewfpc2lex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mosaicimagewfpc2 { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mosaicimagewfpc2::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mosaicimagewfpc2::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mosaicimagewfpc2::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mosaicimagewfpc2::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mosaicimagewfpc2::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mosaicimagewfpc2::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mosaicimagewfpc2::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mosaicimagewfpc2::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mosaicimagewfpc2::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/mosaicimagewfpc2parser.tab.tcl b/ds9/parsers/mosaicimagewfpc2parser.tab.tcl new file mode 100644 index 0000000..67faf4c --- /dev/null +++ b/ds9/parsers/mosaicimagewfpc2parser.tab.tcl @@ -0,0 +1,3 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 diff --git a/ds9/parsers/mosaicimagewfpc2parser.tcl b/ds9/parsers/mosaicimagewfpc2parser.tcl new file mode 100644 index 0000000..d23b208 --- /dev/null +++ b/ds9/parsers/mosaicimagewfpc2parser.tcl @@ -0,0 +1,314 @@ +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 mosaicimagewfpc2 { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mosaicimagewfpc2::YYABORT {} { + return -code return 1 +} + +proc mosaicimagewfpc2::YYACCEPT {} { + return -code return 0 +} + +proc mosaicimagewfpc2::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mosaicimagewfpc2::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mosaicimagewfpc2::yyerror {s} { + puts stderr $s +} + +proc mosaicimagewfpc2::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 mosaicimagewfpc2::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mosaicimagewfpc2::table { + 6:0 reduce + 3:0,target 0 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 2 + 2:257 reduce + 0:260 goto + 0:259 shift + 0:261 goto + 1:257,target 6 + 0:258,target 1 + 0:262 goto + 5:257 shift + 0:0,target 4 + 0:261,target 4 + 2:0,target 5 + 5:257,target 6 + 4:0,target 1 + 0:0 reduce + 6:0,target 3 + 1:0 reduce + 0:257,target 4 + 2:0 reduce + 3:0 accept + 2:257,target 5 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 6 + 5:0 reduce + 0:262,target 5 +} + +array set mosaicimagewfpc2::rules { + 0,l 263 + 1,l 260 + 2,l 261 + 3,l 261 + 4,l 262 + 5,l 262 + 6,l 262 +} + +array set mosaicimagewfpc2::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 6,dc 1 + 1,dc 1 + 3,dc 2 +} + +array set mosaicimagewfpc2::rules { + 5,line 26 + 2,line 21 + 4,line 25 + 6,line 27 + 1,line 18 + 3,line 22 +} + +array set mosaicimagewfpc2::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0}} + 1 {{6 {0 257} 1}} + 2 {{5 {0 257} 1}} + 3 {{0 0 1}} + 4 {{1 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5}} + 5 {{2 0 1} {3 0 1}} + 1,trans {} + 2,trans {} + 6 {{3 0 2}} + 3,trans {} + 4,trans {} + 5,trans {{257 6}} + 6,trans {} +} + +array set mosaicimagewfpc2::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 20 + error,line 15 + 257 STRING_ + 257,t 0 + 263,line 28 + 258 MASK_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 NEW_ + 259,t 0 + 261,t 1 + 261 mosaicimagewfpc2 + 262,t 1 + 262 opts + 257,line 7 + 263,t 1 + 263 start' + 260,line 17 + 257,title string + 259,line 12 + 258,title MASK + 262,line 24 + 260,title {} + 259,title NEW + 261,title {} +} + +proc mosaicimagewfpc2::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 { + 2 { MosaicImageWFPC2CmdLoad {} $1 } + 3 { MosaicImageWFPC2CmdLoad $2 $1 } + 5 { CreateFrame; set _ {} } + 6 { 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 mosaicimagewfpc2::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/mosaiciraflex.tcl b/ds9/parsers/mosaiciraflex.tcl new file mode 100644 index 0000000..ad618db --- /dev/null +++ b/ds9/parsers/mosaiciraflex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mosaiciraf { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mosaiciraf::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mosaiciraf::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mosaiciraf::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mosaiciraf::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mosaiciraf::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mosaiciraf::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mosaiciraf::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mosaiciraf::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mosaiciraf::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/mosaicirafparser.tab.tcl b/ds9/parsers/mosaicirafparser.tab.tcl new file mode 100644 index 0000000..67faf4c --- /dev/null +++ b/ds9/parsers/mosaicirafparser.tab.tcl @@ -0,0 +1,3 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 diff --git a/ds9/parsers/mosaicirafparser.tcl b/ds9/parsers/mosaicirafparser.tcl new file mode 100644 index 0000000..78398ad --- /dev/null +++ b/ds9/parsers/mosaicirafparser.tcl @@ -0,0 +1,314 @@ +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 mosaiciraf { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc mosaiciraf::YYABORT {} { + return -code return 1 +} + +proc mosaiciraf::YYACCEPT {} { + return -code return 0 +} + +proc mosaiciraf::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc mosaiciraf::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc mosaiciraf::yyerror {s} { + puts stderr $s +} + +proc mosaiciraf::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 mosaiciraf::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set mosaiciraf::table { + 6:0 reduce + 3:0,target 0 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 2 + 2:257 reduce + 0:260 goto + 0:259 shift + 0:261 goto + 1:257,target 6 + 0:258,target 1 + 0:262 goto + 5:257 shift + 0:0,target 4 + 0:261,target 4 + 2:0,target 5 + 5:257,target 6 + 4:0,target 1 + 0:0 reduce + 6:0,target 3 + 1:0 reduce + 0:257,target 4 + 2:0 reduce + 3:0 accept + 2:257,target 5 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 6 + 5:0 reduce + 0:262,target 5 +} + +array set mosaiciraf::rules { + 0,l 263 + 1,l 260 + 2,l 261 + 3,l 261 + 4,l 262 + 5,l 262 + 6,l 262 +} + +array set mosaiciraf::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 6,dc 1 + 1,dc 1 + 3,dc 2 +} + +array set mosaiciraf::rules { + 5,line 26 + 2,line 21 + 4,line 25 + 6,line 27 + 1,line 18 + 3,line 22 +} + +array set mosaiciraf::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0}} + 1 {{6 {0 257} 1}} + 2 {{5 {0 257} 1}} + 3 {{0 0 1}} + 4 {{1 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5}} + 5 {{2 0 1} {3 0 1}} + 1,trans {} + 2,trans {} + 6 {{3 0 2}} + 3,trans {} + 4,trans {} + 5,trans {{257 6}} + 6,trans {} +} + +array set mosaiciraf::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 20 + error,line 15 + 257 STRING_ + 257,t 0 + 263,line 28 + 258 MASK_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 NEW_ + 259,t 0 + 261,t 1 + 261 mosaiciraf + 262,t 1 + 262 opts + 257,line 7 + 263,t 1 + 263 start' + 260,line 17 + 257,title string + 259,line 12 + 258,title MASK + 262,line 24 + 260,title {} + 259,title NEW + 261,title {} +} + +proc mosaiciraf::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 { + 2 { MosaicIRAFCmdLoad {} $1 } + 3 { MosaicIRAFCmdLoad $2 $1 } + 5 { CreateFrame; set _ {} } + 6 { 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 mosaiciraf::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/mosaicwcslex.tcl b/ds9/parsers/mosaicwcslex.tcl new file mode 100644 index 0000000..4dea75d --- /dev/null +++ b/ds9/parsers/mosaicwcslex.tcl @@ -0,0 +1,605 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval mosaicwcs { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc mosaicwcs::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc mosaicwcs::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc mosaicwcs::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc mosaicwcs::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc mosaicwcs::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc mosaicwcs::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc mosaicwcs::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc mosaicwcs::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc mosaicwcs::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set STRING_ 284 +set MASK_ 285 +set NEW_ 286 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $WCS_ + } + 3 { +return $WCSA_ + } + 4 { +return $WCSB_ + } + 5 { +return $WCSC_ + } + 6 { +return $WCSD_ + } + 7 { +return $WCSE_ + } + 8 { +return $WCSF_ + } + 9 { +return $WCSG_ + } + 10 { +return $WCSH_ + } + 11 { +return $WCSI_ + } + 12 { +return $WCSJ_ + } + 13 { +return $WCSK_ + } + 14 { +return $WCSL_ + } + 15 { +return $WCSM_ + } + 16 { +return $WCSN_ + } + 17 { +return $WCSO_ + } + 18 { +return $WCSP_ + } + 19 { +return $WCSQ_ + } + 20 { +return $WCSR_ + } + 21 { +return $WCSS_ + } + 22 { +return $WCST_ + } + 23 { +return $WCSU_ + } + 24 { +return $WCSV_ + } + 25 { +return $WCSW_ + } + 26 { +return $WCSX_ + } + 27 { +return $WCSY_ + } + 28 { +return $WCSZ_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval $yytext; return $STRING_ + } + 33 { +# ignore whitespace + } + 34 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/mosaicwcsparser.tab.tcl b/ds9/parsers/mosaicwcsparser.tab.tcl new file mode 100644 index 0000000..8e61664 --- /dev/null +++ b/ds9/parsers/mosaicwcsparser.tab.tcl @@ -0,0 +1,30 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set STRING_ 284 +set MASK_ 285 +set NEW_ 286 diff --git a/ds9/parsers/mosaicwcsparser.tcl b/ds9/parsers/mosaicwcsparser.tcl new file mode 100644 index 0000000..4f58103 --- /dev/null +++ b/ds9/parsers/mosaicwcsparser.tcl @@ -0,0 +1,940 @@ +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_ +} diff --git a/ds9/parsers/movielex.tcl b/ds9/parsers/movielex.tcl new file mode 100644 index 0000000..5de2f45 --- /dev/null +++ b/ds9/parsers/movielex.tcl @@ -0,0 +1,448 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval movie { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc movie::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc movie::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc movie::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc movie::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc movie::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc movie::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc movie::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc movie::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc movie::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set 3D_ 260 +set AZFROM_ 261 +set AZTO_ 262 +set ELFROM_ 263 +set ELTO_ 264 +set FRAME_ 265 +set NUMBER_ 266 +set OSCILLATE_ 267 +set REPEAT_ 268 +set SLICE_ 269 +set SLFROM_ 270 +set SLTO_ 271 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: 3d + if {[regexp -start $index_ -indices -line -nocase -- {\A(3d)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: azfrom + if {[regexp -start $index_ -indices -line -nocase -- {\A(azfrom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: azto + if {[regexp -start $index_ -indices -line -nocase -- {\A(azto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: elfrom + if {[regexp -start $index_ -indices -line -nocase -- {\A(elfrom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: elto + if {[regexp -start $index_ -indices -line -nocase -- {\A(elto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: number + if {[regexp -start $index_ -indices -line -nocase -- {\A(number)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: oscillate + if {[regexp -start $index_ -indices -line -nocase -- {\A(oscillate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: repeat + if {[regexp -start $index_ -indices -line -nocase -- {\A(repeat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: slfrom + if {[regexp -start $index_ -indices -line -nocase -- {\A(slfrom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: slto + if {[regexp -start $index_ -indices -line -nocase -- {\A(slto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $3D_ + } + 1 { +return $AZFROM_ + } + 2 { +return $AZTO_ + } + 3 { +return $ELFROM_ + } + 4 { +return $ELTO_ + } + 5 { +return $FRAME_ + } + 6 { +return $NUMBER_ + } + 7 { +return $OSCILLATE_ + } + 8 { +return $REPEAT_ + } + 9 { +return $SLICE_ + } + 10 { +return $SLFROM_ + } + 11 { +return $SLTO_ + } + 12 { +set yylval $yytext; return $INT_ + } + 13 - + 14 { +set yylval $yytext; return $REAL_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval $yytext; return $STRING_ + } + 19 { +# ignore whitespace + } + 20 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/movieparser.tab.tcl b/ds9/parsers/movieparser.tab.tcl new file mode 100644 index 0000000..f81690c --- /dev/null +++ b/ds9/parsers/movieparser.tab.tcl @@ -0,0 +1,15 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set 3D_ 260 +set AZFROM_ 261 +set AZTO_ 262 +set ELFROM_ 263 +set ELTO_ 264 +set FRAME_ 265 +set NUMBER_ 266 +set OSCILLATE_ 267 +set REPEAT_ 268 +set SLICE_ 269 +set SLFROM_ 270 +set SLTO_ 271 diff --git a/ds9/parsers/movieparser.tcl b/ds9/parsers/movieparser.tcl new file mode 100644 index 0000000..4151b37 --- /dev/null +++ b/ds9/parsers/movieparser.tcl @@ -0,0 +1,869 @@ +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 movie { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc movie::YYABORT {} { + return -code return 1 +} + +proc movie::YYACCEPT {} { + return -code return 0 +} + +proc movie::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc movie::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc movie::yyerror {s} { + puts stderr $s +} + +proc movie::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 movie::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set movie::table { + 27:262,target 16 + 7:264,target 14 + 17:257 shift + 27:0 reduce + 6:259,target 4 + 33:261,target 19 + 24:270,target 2 + 30:268,target 20 + 29:268,target 13 + 6:259 reduce + 15:257,target 29 + 26:259 reduce + 28:264,target 17 + 26:261 reduce + 6:0,target 3 + 0:275,target 6 + 26:262 reduce + 26:263 reduce + 27:259,target 16 + 26:264 reduce + 7:262,target 12 + 34:263,target 11 + 26:266 reduce + 24:0 reduce + 26:267 reduce + 26:268 reduce + 24:267,target 2 + 33:0,target 19 + 31:271,target 21 + 26:270 reduce + 26:271 reduce + 25:0,target 14 + 6:274 goto + 14:272,target 28 + 23:263,target 1 + 30:266,target 20 + 29:266,target 13 + 28:262,target 17 + 0:273,target 5 + 20:271,target 19 + 7:259,target 9 + 34:261,target 11 + 25:270,target 14 + 14:257 shift + 21:0 reduce + 11:258,target 24 + 14:258 shift + 31:268,target 21 + 16:257,target 30 + 23:261,target 1 + 30:264,target 20 + 29:264,target 13 + 3:259 shift + 28:259,target 17 + 20:268,target 17 + 23:259 reduce + 6:274,target 10 + 23:261 reduce + 23:262 reduce + 14:272 goto + 23:263 reduce + 25:267,target 14 + 23:264 reduce + 32:271,target 18 + 23:266 reduce + 23:267 reduce + 24:263,target 2 + 32:259 reduce + 31:266,target 21 + 23:268 reduce + 32:261 reduce + 23:270 reduce + 32:262 reduce + 23:271 reduce + 32:263 reduce + 30:262,target 20 + 29:262,target 13 + 21:271,target 12 + 32:264 reduce + 7:276,target 20 + 32:266 reduce + 8:259,target 7 + 20:266,target 15 + 32:267 reduce + 26:270,target 15 + 32:268 reduce + 12:258,target 24 + 32:270 reduce + 30:0,target 20 + 29:0,target 13 + 32:271 reduce + 22:0,target 5 + 32:268,target 18 + 11:257 shift + 11:258 shift + 17:257,target 31 + 24:261,target 2 + 31:264,target 21 + 30:259,target 20 + 29:259,target 13 + 21:268,target 12 + 0:259 shift + 0:260 shift + 19:257 shift + 9:0 reduce + 20:264,target 14 + 26:267,target 15 + 20:259 reduce + 33:271,target 19 + 20:261 shift + 20:262 shift + 32:0 reduce + 25:263,target 14 + 0:265 shift + 11:272 goto + 20:263 shift + 32:266,target 18 + 20:264 shift + 8:259 reduce + 20:266 shift + 31:262,target 21 + 0:269 shift + 20:267 shift + 28:259 reduce + 20:268 shift + 28:261 reduce + 20:270 shift + 28:262 reduce + 0:273 goto + 9:259,target 8 + 20:271 shift + 21:266,target 12 + 28:263 reduce + 27:270,target 16 + 28:264 reduce + 6:0 reduce + 0:275 goto + 13:258,target 24 + 20:262,target 12 + 28:266 reduce + 33:268,target 19 + 28:267 reduce + 28:268 reduce + 28:0 reduce + 7:0,target 9 + 18:257,target 32 + 20:277 goto + 28:270 reduce + 25:261,target 14 + 32:264,target 18 + 28:271 reduce + 31:259,target 21 + 34:0,target 11 + 21:264,target 12 + 27:267,target 16 + 26:0,target 15 + 7:270,target 18 + 34:271,target 11 + 16:257 shift + 20:259,target 10 + 26:263,target 15 + 33:266,target 19 + 25:0 reduce + 32:262,target 18 + 23:271,target 1 + 28:270,target 17 + 25:259 reduce + 14:258,target 24 + 25:261 reduce + 21:262,target 12 + 25:262 reduce + 7:267,target 16 + 34:268,target 11 + 25:263 reduce + 25:264 reduce + 0:260,target 2 + 0:259,target 1 + 19:257,target 33 + 26:261,target 15 + 22:0 reduce + 33:264,target 19 + 25:266 reduce + 25:267 reduce + 34:259 reduce + 25:268 reduce + 34:261 reduce + 32:259,target 18 + 25:270 reduce + 23:268,target 1 + 34:262 reduce + 25:271 reduce + 34:263 reduce + 34:264 reduce + 28:267,target 17 + 34:266 reduce + 34:267 reduce + 21:259,target 12 + 34:268 reduce + 27:263,target 16 + 34:270 reduce + 34:266,target 11 + 34:271 reduce + 13:257 shift + 33:262,target 19 + 24:271,target 2 + 13:258 shift + 10:259,target 22 + 23:266,target 1 + 31:0,target 21 + 30:270,target 20 + 29:270,target 13 + 23:0,target 1 + 2:259 shift + 1:259,target 6 + 27:261,target 16 + 7:263,target 13 + 34:264,target 11 + 13:272 goto + 33:259,target 19 + 24:268,target 2 + 31:259 reduce + 23:264,target 1 + 31:261 reduce + 30:267,target 20 + 29:267,target 13 + 31:262 reduce + 31:263 reduce + 31:264 reduce + 28:263,target 17 + 31:266 reduce + 31:267 reduce + 7:261,target 11 + 34:262,target 11 + 31:268 reduce + 25:271,target 14 + 31:270 reduce + 33:0 reduce + 31:271 reduce + 24:266,target 2 + 31:270,target 21 + 10:259 shift + 23:262,target 1 + 8:0,target 7 + 1:0,target 6 + 2:259,target 7 + 28:261,target 17 + 20:270,target 18 + 7:0 reduce + 18:257 shift + 34:259,target 11 + 25:268,target 14 + 30:0 reduce + 29:0 reduce + 11:257,target 23 + 27:0,target 16 + 20:0,target 10 + 24:264,target 2 + 31:267,target 21 + 7:259 reduce + 7:261 shift + 23:259,target 1 + 30:263,target 20 + 29:263,target 13 + 27:259 reduce + 7:262 shift + 27:261 reduce + 7:263 shift + 7:277,target 21 + 27:262 reduce + 7:264 shift + 27:263 reduce + 0:269,target 4 + 20:267,target 16 + 27:264 reduce + 26:271,target 15 + 7:266 shift + 7:267 shift + 27:266 reduce + 7:268 shift + 27:267 reduce + 26:0 reduce + 25:266,target 14 + 7:270 shift + 32:270,target 18 + 27:268 reduce + 7:271 shift + 27:270 reduce + 27:271 reduce + 24:262,target 2 + 7:276 goto + 3:259,target 8 + 30:261,target 20 + 29:261,target 13 + 7:277 goto + 21:270,target 12 + 1:0 reduce + 26:268,target 15 + 12:257,target 23 + 15:257 shift + 23:0 reduce + 25:264,target 14 + 32:267,target 18 + 5:0,target 0 + 24:259,target 2 + 31:263,target 21 + 4:259 shift + 21:267,target 12 + 27:271,target 16 + 24:259 reduce + 24:261 reduce + 32:0,target 18 + 0:265,target 3 + 11:272,target 25 + 20:263,target 13 + 24:262 reduce + 26:266,target 15 + 24:0,target 2 + 24:263 reduce + 33:270,target 19 + 20:0 reduce + 24:264 reduce + 25:262,target 14 + 24:266 reduce + 24:267 reduce + 33:259 reduce + 24:268 reduce + 33:261 reduce + 4:259,target 9 + 24:270 reduce + 33:262 reduce + 31:261,target 21 + 24:271 reduce + 33:263 reduce + 33:264 reduce + 33:266 reduce + 27:268,target 16 + 7:271,target 19 + 33:267 reduce + 13:257,target 23 + 33:268 reduce + 20:261,target 11 + 33:270 reduce + 26:264,target 15 + 33:271 reduce + 33:267,target 19 + 12:257 shift + 25:259,target 14 + 12:258 shift + 32:263,target 18 + 28:271,target 17 + 1:259 reduce + 12:272,target 26 + 21:263,target 12 + 27:266,target 16 + 7:268,target 17 + 34:270,target 11 + 21:259 reduce + 9:0,target 8 + 21:261 reduce + 26:262,target 15 + 21:262 reduce + 12:272 goto + 21:263 reduce + 34:0 reduce + 21:264 reduce + 32:261,target 18 + 9:259 reduce + 21:266 reduce + 23:270,target 1 + 21:267 reduce + 30:259 reduce + 29:259 reduce + 21:268 reduce + 30:261 reduce + 29:261 reduce + 21:270 reduce + 30:262 reduce + 29:262 reduce + 28:268,target 17 + 28:0,target 17 + 20:277,target 34 + 21:271 reduce + 30:263 reduce + 29:263 reduce + 14:257,target 23 + 21:0,target 12 + 30:264 reduce + 29:264 reduce + 21:261,target 12 + 27:264,target 16 + 7:266,target 15 + 8:0 reduce + 34:267,target 11 + 30:266 reduce + 29:266 reduce + 30:267 reduce + 29:267 reduce + 30:268 reduce + 29:268 reduce + 26:259,target 15 + 33:263,target 19 + 31:0 reduce + 30:270 reduce + 29:270 reduce + 30:271 reduce + 29:271 reduce + 23:267,target 1 + 30:271,target 20 + 29:271,target 13 + 13:272,target 27 + 28:266,target 17 + 5:0 accept +} + +array set movie::rules { + 9,l 275 + 11,l 276 + 15,l 277 + 20,l 277 + 19,l 277 + 2,l 272 + 6,l 275 + 12,l 276 + 16,l 277 + 21,l 277 + 3,l 273 + 7,l 275 + 13,l 277 + 0,l 278 + 17,l 277 + 4,l 274 + 8,l 275 + 10,l 275 + 14,l 277 + 18,l 277 + 1,l 272 + 5,l 273 +} + +array set movie::rules { + 5,dc 3 + 0,dc 1 + 17,dc 2 + 12,dc 1 + 8,dc 2 + 21,dc 2 + 3,dc 1 + 15,dc 2 + 10,dc 3 + 6,dc 1 + 18,dc 2 + 1,dc 1 + 13,dc 2 + 9,dc 2 + 4,dc 0 + 16,dc 2 + 11,dc 2 + 7,dc 2 + 20,dc 2 + 19,dc 2 + 2,dc 1 + 14,dc 2 +} + +array set movie::rules { + 13,line 52 + 7,line 42 + 10,line 45 + 4,line 37 + 18,line 57 + 1,line 33 + 15,line 54 + 9,line 44 + 12,line 49 + 6,line 41 + 21,line 60 + 3,line 37 + 17,line 56 + 4,e 1 + 14,line 53 + 8,line 43 + 11,line 48 + 5,line 38 + 20,line 59 + 19,line 58 + 2,line 34 + 16,line 55 +} + +array set movie::lr1_table { + 14,trans {{257 23} {258 24} {272 28}} + 33,trans {} + 18,trans {{257 32}} + 1,trans {} + 23,trans {} + 5,trans {} + 27,trans {} + 9,trans {} + 13,trans {{257 23} {258 24} {272 27}} + 32,trans {} + 17,trans {{257 31}} + 0,trans {{259 1} {260 2} {265 3} {269 4} {273 5} {275 6}} + 22,trans {} + 4,trans {{259 9}} + 26,trans {} + 8,trans {} + 12,trans {{257 23} {258 24} {272 26}} + 31,trans {} + 16,trans {{257 30}} + 21,trans {} + 3,trans {{259 8}} + 10 {{5 0 2}} + 11 {{14 {0 259 261 262 263 264 266 267 268 270 271} 1} {1 {0 259 261 262 263 264 266 267 268 270 271} 0} {2 {0 259 261 262 263 264 266 267 268 270 271} 0}} + 25,trans {} + 12 {{15 {0 259 261 262 263 264 266 267 268 270 271} 1} {1 {0 259 261 262 263 264 266 267 268 270 271} 0} {2 {0 259 261 262 263 264 266 267 268 270 271} 0}} + 7,trans {{261 11} {262 12} {263 13} {264 14} {266 15} {267 16} {268 17} {270 18} {271 19} {276 20} {277 21}} + 13 {{16 {0 259 261 262 263 264 266 267 268 270 271} 1} {1 {0 259 261 262 263 264 266 267 268 270 271} 0} {2 {0 259 261 262 263 264 266 267 268 270 271} 0}} + 14 {{17 {0 259 261 262 263 264 266 267 268 270 271} 1} {1 {0 259 261 262 263 264 266 267 268 270 271} 0} {2 {0 259 261 262 263 264 266 267 268 270 271} 0}} + 15 {{13 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 11,trans {{257 23} {258 24} {272 25}} + 30,trans {} + 29,trans {} + 16 {{20 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {8 {0 259} 0} {9 {0 259} 0} {10 {0 259} 0}} + 17 {{21 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 1 {{6 {0 259} 1}} + 18 {{18 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 2 {{9 {0 259} 1} {10 {0 259} 1}} + 19 {{19 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 20 {{10 {0 259} 3} {11 {0 259 261 262 263 264 266 267 268 270 271} 1} {13 {0 259 261 262 263 264 266 267 268 270 271} 0} {14 {0 259 261 262 263 264 266 267 268 270 271} 0} {15 {0 259 261 262 263 264 266 267 268 270 271} 0} {16 {0 259 261 262 263 264 266 267 268 270 271} 0} {17 {0 259 261 262 263 264 266 267 268 270 271} 0} {18 {0 259 261 262 263 264 266 267 268 270 271} 0} {19 {0 259 261 262 263 264 266 267 268 270 271} 0} {20 {0 259 261 262 263 264 266 267 268 270 271} 0} {21 {0 259 261 262 263 264 266 267 268 270 271} 0}} + 15,trans {{257 29}} + 34,trans {} + 3 {{7 {0 259} 1}} + 21 {{12 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 4 {{8 {0 259} 1}} + 22 {{5 0 3}} + 5 {{0 0 1}} + 23 {{1 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 20,trans {{261 11} {262 12} {263 13} {264 14} {266 15} {267 16} {268 17} {270 18} {271 19} {277 34}} + 19,trans {{257 33}} + 2,trans {{259 7}} + 6 {{3 0 1} {5 0 1} {4 259 0}} + 24 {{2 {0 259 261 262 263 264 266 267 268 270 271} 1}} + 7 {{9 {0 259} 2} {10 {0 259} 2} {11 {0 259 261 262 263 264 266 267 268 270 271} 0} {12 {0 259 261 262 263 264 266 267 268 270 271} 0} {13 {0 259 261 262 263 264 266 267 268 270 271} 0} {14 {0 259 261 262 263 264 266 267 268 270 271} 0} {15 {0 259 261 262 263 264 266 267 268 270 271} 0} {16 {0 259 261 262 263 264 266 267 268 270 271} 0} {17 {0 259 261 262 263 264 266 267 268 270 271} 0} {18 {0 259 261 262 263 264 266 267 268 270 271} 0} {19 {0 259 261 262 263 264 266 267 268 270 271} 0} {20 {0 259 261 262 263 264 266 267 268 270 271} 0} {21 {0 259 261 262 263 264 266 267 268 270 271} 0}} + 25 {{14 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 8 {{7 {0 259} 2}} + 26 {{15 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 9 {{8 {0 259} 2}} + 27 {{16 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 24,trans {} + 6,trans {{274 10}} + 28 {{17 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 29 {{13 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 30 {{20 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 31 {{21 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 32 {{18 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 10,trans {{259 22}} + 28,trans {} + 33 {{19 {0 259 261 262 263 264 266 267 268 270 271} 2}} + 34 {{11 {0 259 261 262 263 264 266 267 268 270 271} 2}} +} + +array set movie::token_id_table { + 264,line 18 + 270,t 0 + 269,t 0 + 276,line 47 + 265,title FRAME + 274,t 1 + 261,line 15 + 257,t 0 + 270,title SLFROM + 269,title SLICE + 273,line 36 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 24 + 269,line 23 + 259,title string + 260,title 3D + 266,t 0 + 278,title {} + error error + 271,t 0 + 264,title ELTO + 266,line 20 + 278,line 61 + 275,t 1 + error,line 31 + 268,title REPEAT + 258,t 0 + 263,line 17 + error,title {} + 275,line 40 + 273,title {} + 263,t 0 + 259,line 10 + 260,line 14 + 258,title float + 277,title {} + 272,line 32 + 267,t 0 + 263,title ELFROM + 272,t 1 + 268,line 22 + 267,title OSCILLATE + 257 INT_ + 276,t 1 + 258 REAL_ + 259,t 0 + 259 STRING_ + 260 3D_ + 260,t 0 + 272,title {} + 261 AZFROM_ + 265,line 19 + 262 AZTO_ + 263 ELFROM_ + 277,line 51 + 257,title integer + 264 ELTO_ + 264,t 0 + 276,title {} + 265 FRAME_ + 262,line 16 + 266 NUMBER_ + 267 OSCILLATE_ + 0,t 0 + 0 {$} + 262,title AZTO + 268 REPEAT_ + 268,t 0 + 274,line 37 + 270 SLFROM_ + 269 SLICE_ + error,t 0 + 271 SLTO_ + 272 numeric + 258,line 8 + 273,t 1 + 273 command + 266,title NUMBER + 274 @PSEUDO1 + 275 movie + 271,line 25 + 276 opts + 277,t 1 + 277 opt + 271,title SLTO + 278 start' + 261,t 0 + 267,line 21 + 275,title {} + 265,t 0 + 261,title AZFROM +} + +proc movie::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { ProcessCmdSet movie action frame; Movie $1 } + 7 { ProcessCmdSet movie action frame; Movie $2 } + 8 { ProcessCmdSet movie action slice; Movie $2 } + 9 { ProcessCmdSet movie action 3d; Movie $2 } + 10 { ProcessCmdSet movie action 3d; Movie $2 } + 13 { ProcessCmdSet movie number $2 } + 14 { ProcessCmdSet movie azfrom $2 } + 15 { ProcessCmdSet movie azto $2 } + 16 { ProcessCmdSet movie elfrom $2 } + 17 { ProcessCmdSet movie elto $2 } + 18 { ProcessCmdSet movie slfrom $2 } + 19 { ProcessCmdSet movie slto $2 } + 20 { ProcessCmdSet movie repeat oscillate; ProcessCmdSet movie repeat,num $2 } + 21 { ProcessCmdSet movie repeat repeat; ProcessCmdSet movie repeat,num $2 } + } + 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 movie::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/multiframelex.tcl b/ds9/parsers/multiframelex.tcl new file mode 100644 index 0000000..6e2bcdc --- /dev/null +++ b/ds9/parsers/multiframelex.tcl @@ -0,0 +1,286 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval multiframe { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc multiframe::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc multiframe::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc multiframe::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc multiframe::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc multiframe::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc multiframe::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc multiframe::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc multiframe::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc multiframe::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval $yytext; return $STRING_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/multiframeparser.tab.tcl b/ds9/parsers/multiframeparser.tab.tcl new file mode 100644 index 0000000..b7d9526 --- /dev/null +++ b/ds9/parsers/multiframeparser.tab.tcl @@ -0,0 +1 @@ +set STRING_ 257 diff --git a/ds9/parsers/multiframeparser.tcl b/ds9/parsers/multiframeparser.tcl new file mode 100644 index 0000000..1a9a41f --- /dev/null +++ b/ds9/parsers/multiframeparser.tcl @@ -0,0 +1,267 @@ +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 multiframe { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc multiframe::YYABORT {} { + return -code return 1 +} + +proc multiframe::YYACCEPT {} { + return -code return 0 +} + +proc multiframe::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc multiframe::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc multiframe::yyerror {s} { + puts stderr $s +} + +proc multiframe::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 multiframe::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set multiframe::table { + 3:0,target 1 + 0:257 shift + 0:258 goto + 0:259 goto + 0:258,target 2 + 0:0,target 2 + 2:0,target 0 + 0:0 reduce + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:259,target 3 + 1:0,target 3 +} + +array set multiframe::rules { + 0,l 260 + 1,l 258 + 2,l 259 + 3,l 259 +} + +array set multiframe::rules { + 0,dc 1 + 2,dc 0 + 1,dc 1 + 3,dc 1 +} + +array set multiframe::rules { + 2,line 18 + 1,line 15 + 3,line 19 +} + +array set multiframe::lr1_table { + 0,trans {{257 1} {258 2} {259 3}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0}} + 1,trans {} + 1 {{3 0 1}} + 2,trans {} + 2 {{0 0 1}} + 3,trans {} + 3 {{1 0 1}} +} + +array set multiframe::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 14 + 257 STRING_ + 257,t 0 + error,line 12 + 258,t 1 + 258 command + 260,t 1 + 260 start' + 259,t 1 + 259 multiframe + error,title {} + 257,line 7 + 260,line 20 + 259,line 17 + 257,title string + 258,title {} + 260,title {} + 259,title {} +} + +proc multiframe::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 { + 2 { MultiframeCmdLoad {} } + 3 { MultiframeCmdLoad $1 } + } + 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 multiframe::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/nanlex.tcl b/ds9/parsers/nanlex.tcl new file mode 100644 index 0000000..dd4b5d4 --- /dev/null +++ b/ds9/parsers/nanlex.tcl @@ -0,0 +1,286 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval nan { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc nan::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc nan::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc nan::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc nan::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc nan::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc nan::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc nan::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc nan::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc nan::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval $yytext; return $STRING_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/nanparser.tab.tcl b/ds9/parsers/nanparser.tab.tcl new file mode 100644 index 0000000..b7d9526 --- /dev/null +++ b/ds9/parsers/nanparser.tab.tcl @@ -0,0 +1 @@ +set STRING_ 257 diff --git a/ds9/parsers/nanparser.tcl b/ds9/parsers/nanparser.tcl new file mode 100644 index 0000000..709681d --- /dev/null +++ b/ds9/parsers/nanparser.tcl @@ -0,0 +1,287 @@ +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 nan { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc nan::YYABORT {} { + return -code return 1 +} + +proc nan::YYACCEPT {} { + return -code return 0 +} + +proc nan::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc nan::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc nan::yyerror {s} { + puts stderr $s +} + +proc nan::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 nan::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set nan::table { + 3:0,target 1 + 0:257 shift + 0:258 goto + 1:257 reduce + 5:0,target 3 + 0:260 goto + 3:257 reduce + 4:257 shift + 0:258,target 2 + 1:257,target 4 + 3:259 goto + 3:257,target 2 + 2:0,target 0 + 3:259,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:260,target 3 + 1:0,target 4 + 5:0 reduce + 4:257,target 5 +} + +array set nan::rules { + 0,l 261 + 1,l 258 + 2,l 259 + 3,l 258 + 4,l 260 +} + +array set nan::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set nan::rules { + 2,e 1 + 2,line 14 + 4,line 18 + 1,line 14 + 3,line 15 +} + +array set nan::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0}} + 1 {{4 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 257 0}} + 0,trans {{257 1} {258 2} {260 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{259 4}} + 4,trans {{257 5}} + 5,trans {} +} + +array set nan::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 13 + 261,line 19 + 257 STRING_ + 257,t 0 + error,line 12 + 258,t 1 + 258 command + 260,t 1 + 260 nan + 259,t 1 + 259 @PSEUDO1 + error,title {} + 261,t 1 + 261 start' + 257,line 7 + 260,line 17 + 259,line 14 + 257,title string + 258,title {} + 260,title {} + 259,title {} + 261,title {} +} + +proc nan::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet pds9 nan $1 PrefsNanColor } + } + 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 nan::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/nreslex.tcl b/ds9/parsers/nreslex.tcl new file mode 100644 index 0000000..da27365 --- /dev/null +++ b/ds9/parsers/nreslex.tcl @@ -0,0 +1,451 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval nres { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc nres::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc nres::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc nres::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc nres::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc nres::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc nres::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc nres::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc nres::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc nres::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set CLOSE_ 258 +set CROSSHAIR_ 259 +set NAME_ 260 +set OPEN_ 261 +set PAN_ 262 +set SERVER_ 263 +set SKYFORMAT_ 264 +set NEDSAO_ 265 +set NEDCDS_ 266 +set SIMBADSAO_ 267 +set SIMBADCDS_ 268 +set VIZIERSAO_ 269 +set VIZIERCDS_ 270 +set DEGREES_ 271 +set SEXAGESIMAL_ 272 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: pan + if {[regexp -start $index_ -indices -line -nocase -- {\A(pan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: server + if {[regexp -start $index_ -indices -line -nocase -- {\A(server)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: ned-sao + if {[regexp -start $index_ -indices -line -nocase -- {\A(ned-sao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: ned-cds + if {[regexp -start $index_ -indices -line -nocase -- {\A(ned-cds)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: simbad-sao + if {[regexp -start $index_ -indices -line -nocase -- {\A(simbad-sao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: simbad-cds + if {[regexp -start $index_ -indices -line -nocase -- {\A(simbad-cds)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: vizier-sao + if {[regexp -start $index_ -indices -line -nocase -- {\A(vizier-sao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: vizier-cds + if {[regexp -start $index_ -indices -line -nocase -- {\A(vizier-cds)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $CROSSHAIR_ + } + 2 { +return $NAME_ + } + 3 { +return $OPEN_ + } + 4 { +return $PAN_ + } + 5 { +return $SERVER_ + } + 6 { +return $SKYFORMAT_ + } + 7 { +return $NEDSAO_ + } + 8 { +return $NEDCDS_ + } + 9 { +return $SIMBADSAO_ + } + 10 { +return $SIMBADCDS_ + } + 11 { +return $VIZIERSAO_ + } + 12 { +return $VIZIERCDS_ + } + 13 { +return $DEGREES_ + } + 14 { +return $SEXAGESIMAL_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval $yytext; return $STRING_ + } + 19 { +# ignore whitespace + } + 20 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/nresparser.tab.tcl b/ds9/parsers/nresparser.tab.tcl new file mode 100644 index 0000000..39133ac --- /dev/null +++ b/ds9/parsers/nresparser.tab.tcl @@ -0,0 +1,16 @@ +set STRING_ 257 +set CLOSE_ 258 +set CROSSHAIR_ 259 +set NAME_ 260 +set OPEN_ 261 +set PAN_ 262 +set SERVER_ 263 +set SKYFORMAT_ 264 +set NEDSAO_ 265 +set NEDCDS_ 266 +set SIMBADSAO_ 267 +set SIMBADCDS_ 268 +set VIZIERSAO_ 269 +set VIZIERCDS_ 270 +set DEGREES_ 271 +set SEXAGESIMAL_ 272 diff --git a/ds9/parsers/nresparser.tcl b/ds9/parsers/nresparser.tcl new file mode 100644 index 0000000..f8426fc --- /dev/null +++ b/ds9/parsers/nresparser.tcl @@ -0,0 +1,546 @@ +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 nres { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc nres::YYABORT {} { + return -code return 1 +} + +proc nres::YYACCEPT {} { + return -code return 0 +} + +proc nres::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc nres::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc nres::yyerror {s} { + puts stderr $s +} + +proc nres::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 nres::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set nres::table { + 17:257 reduce + 0:257 shift + 0:258 shift + 23:0,target 3 + 20:257 reduce + 19:257 reduce + 0:259 shift + 0:260 shift + 2:257 reduce + 5:0,target 4 + 15:0,target 17 + 9:0 accept + 0:261 shift + 22:257 shift + 11:0 reduce + 0:262 shift + 4:257 shift + 0:263 shift + 21:257,target 9 + 0:264 shift + 3:257,target 8 + 6:257 reduce + 15:0 reduce + 15:257,target 17 + 0:275,target 10 + 6:0,target 7 + 20:0 reduce + 19:0 reduce + 16:0,target 18 + 10:257,target 2 + 8:276,target 21 + 2:0 reduce + 0:273 goto + 0:275 goto + 6:0 reduce + 0:264,target 8 + 6:257,target 7 + 18:257,target 6 + 8:271 shift + 1:257,target 11 + 17:0,target 19 + 12:0 reduce + 8:272 shift + 10:0,target 1 + 13:257,target 15 + 0:263,target 7 + 16:0 reduce + 10:257 reduce + 8:276 goto + 0:273,target 9 + 12:257 reduce + 21:0 reduce + 14:257 reduce + 7:270,target 17 + 7:269,target 16 + 3:0 reduce + 18:0,target 6 + 1:0,target 11 + 22:257,target 23 + 16:257 reduce + 11:0,target 10 + 0:262,target 6 + 4:257,target 11 + 18:257 reduce + 1:257 reduce + 16:257,target 18 + 21:257 reduce + 10:274,target 22 + 3:257 reduce + 7:268,target 15 + 11:257,target 10 + 5:257 reduce + 13:0 reduce + 9:0,target 0 + 0:261,target 5 + 20:0,target 13 + 19:0,target 12 + 2:0,target 5 + 12:0,target 14 + 10:274 goto + 8:272,target 20 + 17:0 reduce + 7:267,target 14 + 7:277,target 18 + 20:257,target 13 + 19:257,target 12 + 0:259,target 3 + 0:260,target 4 + 2:257,target 5 + 7:265 shift + 8:271,target 19 + 7:266 shift + 21:0,target 9 + 14:257,target 16 + 7:267 shift + 3:0,target 8 + 13:0,target 15 + 7:268 shift + 7:270 shift + 7:269 shift + 7:266,target 13 + 10:0 reduce + 0:258,target 2 + 14:0 reduce + 5:257,target 4 + 7:277 goto + 7:265,target 12 + 14:0,target 16 + 11:257 reduce + 18:0 reduce + 17:257,target 19 + 0:257,target 1 + 1:0 reduce + 13:257 reduce + 15:257 reduce + 12:257,target 14 + 23:0 reduce + 5:0 reduce +} + +array set nres::rules { + 9,l 275 + 11,l 275 + 15,l 277 + 19,l 277 + 2,l 274 + 6,l 275 + 12,l 276 + 16,l 277 + 3,l 273 + 7,l 275 + 13,l 276 + 0,l 278 + 17,l 277 + 4,l 275 + 8,l 275 + 10,l 275 + 14,l 277 + 18,l 277 + 1,l 273 + 5,l 275 +} + +array set nres::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 3 + 15,dc 1 + 10,dc 2 + 6,dc 2 + 18,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 2 + 4,dc 1 + 16,dc 1 + 11,dc 1 + 7,dc 1 + 19,dc 1 + 2,dc 0 + 14,dc 1 +} + +array set nres::rules { + 13,line 47 + 2,e 1 + 7,line 39 + 10,line 42 + 4,line 36 + 18,line 54 + 1,line 32 + 15,line 51 + 9,line 41 + 12,line 46 + 6,line 38 + 3,line 33 + 17,line 53 + 14,line 50 + 8,line 40 + 11,line 43 + 5,line 37 + 19,line 55 + 2,line 32 + 16,line 52 +} + +array set nres::lr1_table { + 14,trans {} + 1,trans {} + 18,trans {} + 5,trans {} + 23,trans {} + 9,trans {} + 13,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {273 9} {275 10}} + 17,trans {} + 4,trans {{257 11}} + 22,trans {{257 23}} + 8,trans {{271 19} {272 20} {276 21}} + 12,trans {} + 16,trans {} + 3,trans {} + 21,trans {} + 10 {{1 0 1} {3 0 1} {2 257 0}} + 11 {{10 {0 257} 2}} + 12 {{14 {0 257} 1}} + 7,trans {{265 12} {266 13} {267 14} {268 15} {269 16} {270 17} {277 18}} + 13 {{15 {0 257} 1}} + 14 {{16 {0 257} 1}} + 15 {{17 {0 257} 1}} + 11,trans {} + 16 {{18 {0 257} 1}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0} {7 {0 257} 0} {8 {0 257} 0} {9 {0 257} 0} {10 {0 257} 0} {11 {0 257} 0}} + 17 {{19 {0 257} 1}} + 1 {{11 {0 257} 1}} + 18 {{6 {0 257} 2}} + 2 {{5 {0 257} 1}} + 19 {{12 {0 257} 1}} + 20 {{13 {0 257} 1}} + 15,trans {} + 3 {{8 {0 257} 1}} + 21 {{9 {0 257} 2}} + 4 {{10 {0 257} 1}} + 22 {{3 0 2}} + 5 {{4 {0 257} 1}} + 23 {{3 0 3}} + 6 {{7 {0 257} 1}} + 2,trans {} + 19,trans {} + 20,trans {} + 7 {{6 {0 257} 1} {14 {0 257} 0} {15 {0 257} 0} {16 {0 257} 0} {17 {0 257} 0} {18 {0 257} 0} {19 {0 257} 0}} + 8 {{9 {0 257} 1} {12 {0 257} 0} {13 {0 257} 0}} + 9 {{0 0 1}} + 6,trans {} + 10,trans {{274 22}} +} + +array set nres::token_id_table { + 264,line 17 + 270,t 0 + 269,t 0 + 276,line 45 + 265,title NEDSAO + 274,t 1 + 261,line 14 + 257,t 0 + 270,title VIZIERCDS + 269,title VIZIERSAO + 273,line 31 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 24 + 269,line 23 + 259,title CROSSHAIR + 260,title NAME + 266,t 0 + 278,title {} + error error + 271,t 0 + 264,title SKYFORMAT + 266,line 20 + 278,line 56 + 275,t 1 + error,line 30 + 268,title SIMBADCDS + 258,t 0 + 263,line 16 + error,title {} + 275,line 35 + 273,title {} + 263,t 0 + 259,line 12 + 260,line 13 + 258,title CLOSE + 277,title {} + 272,line 27 + 267,t 0 + 263,title SERVER + 272,t 0 + 268,line 22 + 267,title SIMBADSAO + 257 STRING_ + 276,t 1 + 258 CLOSE_ + 259,t 0 + 259 CROSSHAIR_ + 260 NAME_ + 260,t 0 + 272,title SEXAGESIMAL + 261 OPEN_ + 265,line 19 + 262 PAN_ + 263 SERVER_ + 277,line 49 + 257,title string + 264 SKYFORMAT_ + 264,t 0 + 276,title {} + 265 NEDSAO_ + 262,line 15 + 266 NEDCDS_ + 267 SIMBADSAO_ + 0,t 0 + 0 {$} + 262,title PAN + 268 SIMBADCDS_ + 268,t 0 + 274,line 32 + 270 VIZIERCDS_ + 269 VIZIERSAO_ + error,t 0 + 271 DEGREES_ + 272 SEXAGESIMAL_ + 258,line 11 + 273,t 1 + 273 command + 266,title NEDCDS + 274 @PSEUDO1 + 275 nres + 271,line 26 + 276 skyformat + 277,t 1 + 277 server + 271,title DEGREES + 278 start' + 261,t 0 + 267,line 21 + 275,title {} + 265,t 0 + 261,title OPEN +} + +proc nres::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 5 { ARDestroy dnres } + 6 { ProcessCmdSet pnres server $2 } + 7 { NRESPan dnres } + 8 { NRESCrosshair dnres } + 9 { ProcessCmdSet2 dnres skyformat $2 format,msg $2 } + 10 { ProcessCmdSet dnres name $2 "NRESApply dnres 1" } + 11 { ProcessCmdSet dnres name $1 "NRESApply dnres 1" } + 12 { set _ degrees } + 13 { set _ sexagesimal } + 14 { set _ ned-sao } + 15 { set _ ned-cds } + 16 { set _ simbad-sao } + 17 { set _ simbad-cds } + 18 { set _ vizier-sao } + 19 { set _ vizier-cds } + } + 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 nres::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/nressendlex.tcl b/ds9/parsers/nressendlex.tcl new file mode 100644 index 0000000..a2c83f3 --- /dev/null +++ b/ds9/parsers/nressendlex.tcl @@ -0,0 +1,319 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval nressend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc nressend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc nressend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc nressend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc nressend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc nressend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc nressend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc nressend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc nressend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc nressend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NAME_ 258 +set SERVER_ 259 +set SKYFORMAT_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: server + if {[regexp -start $index_ -indices -line -nocase -- {\A(server)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NAME_ + } + 1 { +return $SERVER_ + } + 2 { +return $SKYFORMAT_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/nressendparser.tab.tcl b/ds9/parsers/nressendparser.tab.tcl new file mode 100644 index 0000000..4fa83f8 --- /dev/null +++ b/ds9/parsers/nressendparser.tab.tcl @@ -0,0 +1,4 @@ +set STRING_ 257 +set NAME_ 258 +set SERVER_ 259 +set SKYFORMAT_ 260 diff --git a/ds9/parsers/nressendparser.tcl b/ds9/parsers/nressendparser.tcl new file mode 100644 index 0000000..8a343a8 --- /dev/null +++ b/ds9/parsers/nressendparser.tcl @@ -0,0 +1,296 @@ +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 nressend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc nressend::YYABORT {} { + return -code return 1 +} + +proc nressend::YYACCEPT {} { + return -code return 0 +} + +proc nressend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc nressend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc nressend::yyerror {s} { + puts stderr $s +} + +proc nressend::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 nressend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set nressend::table { + 3:0,target 3 + 0:257 shift + 0:258 shift + 5:0,target 0 + 0:259 shift + 0:260 shift + 0:261 goto + 0:258,target 2 + 0:0,target 1 + 0:261,target 5 + 2:0,target 2 + 4:0,target 4 + 0:0 reduce + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 5 + 5:0 accept +} + +array set nressend::rules { + 0,l 262 + 1,l 261 + 2,l 261 + 3,l 261 + 4,l 261 + 5,l 261 +} + +array set nressend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set nressend::rules { + 5,line 22 + 2,line 19 + 4,line 21 + 1,line 18 + 3,line 20 +} + +array set nressend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0}} + 1 {{5 0 1}} + 2 {{2 0 1}} + 3 {{3 0 1}} + 4 {{4 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5}} + 5 {{0 0 1}} + 1,trans {} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} +} + +array set nressend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 11 + 261,line 17 + error,line 16 + 257 STRING_ + 257,t 0 + 258 NAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SKYFORMAT_ + 259 SERVER_ + 259,t 0 + 261,t 1 + 261 nressend + 262,t 1 + 262 start' + 257,line 7 + 260,line 13 + 257,title string + 259,line 12 + 258,title NAME + 262,line 23 + 260,title SKYFORMAT + 259,title SERVER + 261,title {} +} + +proc nressend::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 { ProcessSendCmdGet dnres name } + 2 { ProcessSendCmdGet dnres name } + 3 { ProcessSendCmdGet pnres server } + 4 { ProcessSendCmdGet dnres skyformat } + 5 { NRESSendCmd $1 } + } + 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 nressend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/nrrdlex.tcl b/ds9/parsers/nrrdlex.tcl new file mode 100644 index 0000000..37ff425 --- /dev/null +++ b/ds9/parsers/nrrdlex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval nrrd { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc nrrd::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc nrrd::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc nrrd::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc nrrd::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc nrrd::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc nrrd::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc nrrd::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc nrrd::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc nrrd::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/nrrdparser.tab.tcl b/ds9/parsers/nrrdparser.tab.tcl new file mode 100644 index 0000000..67faf4c --- /dev/null +++ b/ds9/parsers/nrrdparser.tab.tcl @@ -0,0 +1,3 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 diff --git a/ds9/parsers/nrrdparser.tcl b/ds9/parsers/nrrdparser.tcl new file mode 100644 index 0000000..cfd386f --- /dev/null +++ b/ds9/parsers/nrrdparser.tcl @@ -0,0 +1,340 @@ +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 nrrd { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc nrrd::YYABORT {} { + return -code return 1 +} + +proc nrrd::YYACCEPT {} { + return -code return 0 +} + +proc nrrd::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc nrrd::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc nrrd::yyerror {s} { + puts stderr $s +} + +proc nrrd::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 nrrd::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set nrrd::table { + 3:0,target 0 + 0:257 reduce + 7:0 reduce + 6:257,target 8 + 1:257 reduce + 0:258 shift + 8:0 reduce + 5:0,target 4 + 2:257 reduce + 0:260 goto + 0:259 shift + 7:0,target 5 + 4:257 reduce + 1:257,target 8 + 0:258,target 1 + 0:262 goto + 5:257 shift + 0:263 goto + 0:0,target 6 + 6:257 shift + 7:257 reduce + 4:261 goto + 2:0,target 7 + 5:257,target 7 + 0:263,target 5 + 4:0,target 1 + 7:257,target 5 + 4:261,target 6 + 0:0 reduce + 1:0 reduce + 0:257,target 6 + 2:0 reduce + 8:0,target 3 + 3:0 accept + 2:257,target 7 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 8 + 5:0 reduce + 4:257,target 2 + 0:262,target 4 +} + +array set nrrd::rules { + 2,l 261 + 6,l 263 + 3,l 260 + 7,l 263 + 0,l 264 + 4,l 262 + 8,l 263 + 1,l 260 + 5,l 262 +} + +array set nrrd::rules { + 5,dc 2 + 0,dc 1 + 8,dc 1 + 3,dc 3 + 6,dc 0 + 1,dc 1 + 4,dc 1 + 7,dc 1 + 2,dc 0 +} + +array set nrrd::rules { + 2,e 1 + 7,line 26 + 4,line 21 + 1,line 17 + 6,line 25 + 3,line 18 + 8,line 27 + 5,line 22 + 2,line 17 +} + +array set nrrd::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0} {7 {0 257} 0} {8 {0 257} 0}} + 1 {{8 {0 257} 1}} + 2 {{7 {0 257} 1}} + 3 {{0 0 1}} + 4 {{1 0 1} {3 0 1} {2 257 0}} + 0,trans {{258 1} {259 2} {260 3} {262 4} {263 5}} + 5 {{4 {0 257} 1} {5 {0 257} 1}} + 1,trans {} + 2,trans {} + 6 {{3 0 2}} + 7 {{5 {0 257} 2}} + 3,trans {} + 8 {{3 0 3}} + 4,trans {{261 6}} + 5,trans {{257 7}} + 6,trans {{257 8}} + 7,trans {} + 8,trans {} +} + +array set nrrd::token_id_table { + 264,line 28 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 11 + 261,line 17 + error,line 15 + 257 STRING_ + 257,t 0 + 263,line 24 + 258 MASK_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 NEW_ + 259,t 0 + 261,t 1 + 261 @PSEUDO1 + 262,t 1 + 262 nrrd + 257,line 7 + 263,t 1 + 263 opts + 264,t 1 + 264 start' + 260,line 16 + 257,title string + 259,line 12 + 258,title MASK + 262,line 20 + 260,title {} + 259,title NEW + 261,title {} +} + +proc nrrd::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { NRRDCmdLoad {} $1 } + 5 { NRRDCmdLoad $2 $1 } + 7 { CreateFrame; set _ {} } + 8 { 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 nrrd::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/nvsslex.tcl b/ds9/parsers/nvsslex.tcl new file mode 100644 index 0000000..91f24b0 --- /dev/null +++ b/ds9/parsers/nvsslex.tcl @@ -0,0 +1,588 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval nvss { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc nvss::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc nvss::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc nvss::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc nvss::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc nvss::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc nvss::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc nvss::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc nvss::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc nvss::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $YES_ + } + 1 { +return $NO_ + } + 2 { +return $ON_ + } + 3 { +return $OFF_ + } + 4 { +return $TRUE_ + } + 5 { +return $FALSE_ + } + 6 { +return $CLEAR_ + } + 7 { +return $CLOSE_ + } + 8 { +return $COORD_ + } + 9 { +return $CROSSHAIR_ + } + 10 { +return $CURRENT_ + } + 11 { +return $FRAME_ + } + 12 { +return $NAME_ + } + 13 { +return $NEW_ + } + 14 { +return $OPEN_ + } + 15 { +return $SAVE_ + } + 16 { +return $SIZE_ + } + 17 { +return $SURVEY_ + } + 18 { +return $UPDATE_ + } + 19 { +return $DEGREES_ + } + 20 { +return $ARCMIN_ + } + 21 { +return $ARCSEC_ + } + 22 { +return $SEXAGESIMAL_ + } + 23 - + 24 { +set yylval $yytext; return $SEXSTR_ + } + 25 { +set yylval $yytext; return $INT_ + } + 26 - + 27 { +set yylval $yytext; return $REAL_ + } + 28 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval $yytext; return $STRING_ + } + 32 { +# ignore whitespace + } + 33 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/nvssparser.tab.tcl b/ds9/parsers/nvssparser.tab.tcl new file mode 100644 index 0000000..0eda1ee --- /dev/null +++ b/ds9/parsers/nvssparser.tab.tcl @@ -0,0 +1,27 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 diff --git a/ds9/parsers/nvssparser.tcl b/ds9/parsers/nvssparser.tcl new file mode 100644 index 0000000..e9cc741 --- /dev/null +++ b/ds9/parsers/nvssparser.tcl @@ -0,0 +1,939 @@ +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 nvss { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc nvss::YYABORT {} { + return -code return 1 +} + +proc nvss::YYACCEPT {} { + return -code return 0 +} + +proc nvss::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc nvss::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc nvss::yyerror {s} { + puts stderr $s +} + +proc nvss::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 nvss::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set nvss::table { + 3:288,target 20 + 29:283 reduce + 30:283 reduce + 27:0 reduce + 38:276 shift + 48:0 reduce + 3:267,target 18 + 51:283,target 13 + 7:283,target 1 + 38:283 reduce + 11:282,target 20 + 38:285 goto + 40:283,target 11 + 39:283,target 12 + 6:266 shift + 7:262,target 31 + 10:277,target 19 + 6:268 shift + 24:0 reduce + 48:0,target 17 + 47:283 reduce + 41:0,target 35 + 45:0 reduce + 2:282,target 11 + 25:0,target 33 + 28:283,target 3 + 17:281 shift + 10:0,target 19 + 17:282 shift + 0:273,target 7 + 7:259,target 28 + 7:260,target 29 + 17:290 goto + 21:0 reduce + 38:276,target 42 + 26:283 reduce + 42:0 reduce + 35:276 shift + 2:280,target 16 + 34:279,target 40 + 41:283,target 35 + 35:283 reduce + 0:271,target 5 + 6:294 goto + 11:277,target 20 + 17:281,target 10 + 35:285 goto + 39:278,target 49 + 7:257,target 26 + 3:267 shift + 38:0 reduce + 30:283,target 4 + 29:283,target 6 + 3:270 shift + 0:290,target 13 + 8:281,target 10 + 18:283,target 15 + 0:268,target 3 + 45:0,target 37 + 37:0,target 10 + 14:0 accept + 39:276,target 47 + 29:0,target 6 + 30:0,target 4 + 22:0,target 29 + 35:0 reduce + 14:0,target 0 + 4:263,target 21 + 23:283 reduce + 13:282,target 11 + 3:288 goto + 42:283,target 9 + 32:283 reduce + 11:0 reduce + 31:283,target 7 + 0:264 shift + 37:286,target 45 + 32:0 reduce + 0:265 shift + 0:268 shift + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 19:283,target 14 + 20:283,target 32 + 0:272 shift + 11:278 reduce + 33:290,target 39 + 0:273 shift + 0:274 shift + 11:281 reduce + 11:282 reduce + 0:264,target 1 + 50:283 reduce + 49:283 reduce + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 0:282 shift + 50:0 reduce + 49:0 reduce + 0:283 shift + 43:283,target 34 + 19:283 reduce + 20:283 reduce + 50:0,target 30 + 49:0,target 18 + 0:283,target 12 + 42:0,target 9 + 34:0,target 10 + 0:290 goto + 8:281 shift + 26:0,target 2 + 0:291 goto + 8:282 shift + 18:0,target 15 + 32:283,target 31 + 11:0,target 20 + 0:293 goto + 25:0 reduce + 28:283 reduce + 2:290,target 17 + 46:0 reduce + 8:290 goto + 21:283,target 28 + 37:279 shift + 0:281,target 10 + 37:283 reduce + 0:0 reduce + 37:286 goto + 22:0 reduce + 46:283 reduce + 43:0 reduce + 37:279,target 40 + 1:283,target 26 + 16:280 shift + 10:281,target 19 + 18:0 reduce + 5:283 reduce + 40:0 reduce + 39:0 reduce + 22:283,target 29 + 25:283 reduce + 46:0,target 36 + 38:0,target 8 + 31:0,target 7 + 7:284,target 32 + 23:0,target 39 + 34:279 shift + 15:0,target 21 + 34:283 reduce + 33:281,target 10 + 10:278,target 19 + 15:0 reduce + 34:286 goto + 45:283,target 37 + 13:290,target 35 + 43:283 reduce + 34:283,target 10 + 13:281 shift + 0:274,target 8 + 11:281,target 20 + 13:282 shift + 7:261,target 30 + 10:276,target 19 + 12:0 reduce + 2:280 shift + 16:280,target 37 + 2:281 shift + 23:283,target 39 + 2:282 shift + 13:290 goto + 2:281,target 10 + 0:293,target 15 + 22:283 reduce + 35:285,target 43 + 12:283,target 27 + 1:0,target 26 + 2:290 goto + 0:272,target 6 + 11:278,target 20 + 7:0 reduce + 17:282,target 11 + 51:0,target 13 + 31:283 reduce + 7:258,target 27 + 46:283,target 36 + 43:0,target 34 + 39:276 shift + 35:0,target 8 + 29:0 reduce + 30:0 reduce + 39:277 shift + 27:0,target 5 + 39:278 shift + 7:257 shift + 19:0,target 14 + 20:0,target 32 + 51:0 reduce + 7:258 shift + 12:0,target 27 + 0:291,target 14 + 7:259 shift + 7:260 shift + 8:282,target 11 + 35:283,target 8 + 6:294,target 25 + 7:261 shift + 10:276 reduce + 40:283 reduce + 39:283 reduce + 7:262 shift + 10:277 reduce + 10:278 reduce + 0:269,target 4 + 10:281 reduce + 11:276,target 20 + 39:287 goto + 10:282 reduce + 15:292,target 36 + 24:283,target 38 + 39:277,target 48 + 39:289 goto + 26:0 reduce + 48:283 reduce + 47:0 reduce + 18:283 reduce + 1:0 reduce + 47:283,target 16 + 4:283,target 22 + 7:283 reduce + 7:284 goto + 23:0 reduce + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 36:283,target 44 + 13:281,target 10 + 47:0,target 16 + 36:283 shift + 40:0,target 11 + 39:0,target 12 + 4:263 shift + 25:283,target 33 + 32:0,target 31 + 0:265,target 2 + 6:268,target 24 + 24:0,target 38 + 19:0 reduce + 20:0 reduce + 41:0 reduce + 45:283 reduce + 9:280,target 34 + 35:276,target 42 + 15:283 reduce + 48:283,target 17 + 5:283,target 25 + 6:266,target 23 + 4:283 shift + 37:283,target 10 + 37:0 reduce + 15:292 goto + 24:283 reduce + 0:282,target 11 + 26:283,target 2 + 33:281 shift + 39:289,target 51 + 33:282 shift + 38:285,target 46 + 15:283,target 22 + 34:0 reduce + 33:290 goto + 44:0,target 23 + 42:283 reduce + 50:283,target 30 + 49:283,target 18 + 0:280,target 9 + 28:0,target 3 + 17:290,target 38 + 21:0,target 28 + 39:287,target 50 + 10:282,target 19 + 12:283 reduce + 10:0 reduce + 51:283 reduce + 38:283,target 8 + 31:0 reduce + 1:283 reduce + 8:290,target 33 + 3:270,target 19 + 21:283 reduce + 27:283,target 5 + 34:286,target 41 + 9:280 shift + 33:282,target 11 + 5:0 reduce +} + +array set nvss::rules { + 9,l 285 + 11,l 286 + 32,l 293 + 6,l 284 + 28,l 293 + 3,l 284 + 25,l 293 + 0,l 295 + 22,l 292 + 18,l 289 + 39,l 294 + 15,l 288 + 36,l 293 + 12,l 287 + 33,l 293 + 7,l 284 + 29,l 293 + 30,l 293 + 4,l 284 + 26,l 293 + 1,l 284 + 23,l 291 + 19,l 290 + 20,l 290 + 16,l 289 + 37,l 293 + 13,l 287 + 34,l 293 + 8,l 285 + 10,l 286 + 31,l 293 + 5,l 284 + 27,l 293 + 2,l 284 + 24,l 293 + 21,l 291 + 17,l 289 + 38,l 294 + 14,l 288 + 35,l 293 +} + +array set nvss::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 1 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 22,dc 0 + 36,dc 4 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 21,dc 1 + 35,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 3 +} + +array set nvss::rules { + 7,line 88 + 37,line 139 + 4,line 85 + 34,line 135 + 1,line 82 + 31,line 131 + 27,line 126 + 24,line 123 + 21,line 119 + 17,line 112 + 22,e 1 + 14,line 107 + 11,line 100 + 9,line 96 + 39,line 143 + 6,line 87 + 36,line 138 + 3,line 84 + 33,line 134 + 29,line 128 + 30,line 130 + 26,line 125 + 23,line 120 + 19,line 115 + 20,line 116 + 16,line 111 + 13,line 104 + 10,line 99 + 8,line 95 + 38,line 142 + 5,line 86 + 35,line 137 + 2,line 83 + 32,line 132 + 28,line 127 + 25,line 124 + 22,line 119 + 18,line 113 + 15,line 108 + 12,line 103 +} + +array set nvss::lr1_table { + 35 {{19 {0 276} 1}} + 14,trans {} + 36 {{20 {0 276} 1}} + 33,trans {{281 41} {282 42} {290 43}} + 37 {{34 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 52,trans {} + 38 {{23 0 2}} + 40 {{36 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 39 {{37 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 41 {{19 {0 276 277 278} 1}} + 18,trans {} + 1,trans {} + 37,trans {{276 46} {285 47}} + 42 {{20 {0 276 277 278} 1}} + 43 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 44 {{11 {0 283} 1}} + 45 {{35 {0 283} 3}} + 23,trans {} + 5,trans {} + 42,trans {} + 46 {{9 {0 283} 1}} + 47 {{34 {0 283} 3}} + 48 {{23 0 3}} + 50 {{36 {0 283} 4}} + 49 {{37 {0 283} 4}} + 27,trans {} + 9,trans {{280 34}} + 46,trans {} + 51 {{16 {0 283} 1}} + 52 {{17 {0 283} 1}} + 53 {{18 {0 283} 1}} + 13,trans {{281 35} {282 36} {290 37}} + 54 {{30 {0 283} 4}} + 32,trans {} + 51,trans {} + 55 {{13 {0 283} 1}} + 17,trans {{281 35} {282 36} {290 40}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {280 9} {281 10} {282 11} {283 12} {290 13} {291 14} {293 15}} + 36,trans {} + 55,trans {} + 22,trans {} + 4,trans {{263 21} {283 22}} + 41,trans {} + 26,trans {} + 8,trans {{281 10} {282 11} {290 33}} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {{280 39}} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {{267 18} {270 19} {288 20}} + 40,trans {{276 46} {285 50}} + 39,trans {{279 44} {286 49}} + 10 {{19 {281 282} 1}} + 11 {{20 {281 282} 1}} + 25,trans {} + 12 {{27 {0 283} 1}} + 7,trans {{257 26} {258 27} {259 28} {260 29} {261 30} {262 31} {284 32}} + 44,trans {} + 13 {{34 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 14 {{0 0 1}} + 15 {{21 0 1} {23 0 1} {22 283 0}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{37 {0 283} 2}} + 48,trans {} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{36 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 1 {{26 {0 283} 1}} + 18 {{15 {0 283} 1}} + 15,trans {{292 38}} + 2 {{36 {0 283} 1} {37 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{14 {0 283} 1}} + 20 {{32 {0 283} 2}} + 34,trans {{279 44} {286 45}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{28 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{29 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{39 {0 283} 1}} + 20,trans {} + 19,trans {} + 6 {{33 {0 283} 1} {38 {0 283} 0} {39 {0 283} 0}} + 2,trans {{280 16} {281 10} {282 11} {290 17}} + 24 {{38 {0 283} 1}} + 38,trans {{283 48}} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{33 {0 283} 2}} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{2 {0 283} 1}} + 9 {{35 {0 283} 1}} + 27 {{5 {0 283} 1}} + 24,trans {} + 6,trans {{266 23} {268 24} {294 25}} + 28 {{3 {0 283} 1}} + 43,trans {{276 51} {277 52} {278 53} {287 54} {289 55}} + 29 {{6 {0 283} 1}} + 30 {{4 {0 283} 1}} + 31 {{7 {0 283} 1}} + 32 {{31 {0 283} 2}} + 10,trans {} + 28,trans {} + 33 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} + 47,trans {} + 34 {{35 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} +} + +array set nvss::token_id_table { + 286,t 1 + 286 sex + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 292,line 119 + 287 sizeOpt + 270,t 0 + 269,t 0 + 288 frame + 290 numeric + 289 rformat + 276,line 28 + 265,title COORD + 291,t 1 + 291 command + 284,title {} + 292 @PSEUDO1 + 274,t 0 + 261,line 11 + 293 nvss + 288,line 106 + 257,t 0 + 294 update + 270,title NEW + 269,title NAME + 295,t 1 + 295 start' + 288,title {} + 273,line 24 + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 94 + 274,title SIZE + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 141 + 283,title string + 292,t 1 + 278,line 30 + error,line 80 + 275,t 0 + 268,title FRAME + 287,title {} + 258,t 0 + 263,line 14 + 291,line 118 + error,title {} + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 102 + 258,title NO + 284,t 1 + 277,title ARCMIN + 272,line 23 + 267,t 0 + 263,title CLEAR + 288,t 1 + 284,line 81 + 282,title float + 272,t 0 + 268,line 19 + 267,title CURRENT + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + 293,line 122 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 290,line 114 + 289,line 110 + 285,t 1 + 267 CURRENT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + error,t 0 + 271 OPEN_ + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 98 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title {} + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 281 INT_ + 267,line 18 + 295,line 144 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 yesno + 280,line 34 + 279,line 32 + 285 deg + 261,title TRUE +} + +proc nvss::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dnvss 1 } + 26 { ARDestroy dnvss } + 27 { ProcessCmdSet dnvss name $1 "IMGSVRApply dnvss 1" } + 28 { ProcessCmdSet dnvss name {} } + 29 { ProcessCmdSet dnvss name $2 "IMGSVRApply dnvss 1" } + 30 { ProcessCmdSet4 dnvss width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet dnvss save $2 } + 32 { ProcessCmdSet dnvss mode $2 } + 34 { ProcessCmdSet4 dnvss x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dnvss 1" } + 35 { ProcessCmdSet4 dnvss x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dnvss 1" } + 36 { ProcessCmdSet4 dnvss x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dnvss 1" } + 37 { ProcessCmdSet4 dnvss x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dnvss 1" } + 38 { IMGSVRUpdate dnvss; IMGSVRApply dnvss 1 } + 39 { IMGSVRCrosshair dnvss; IMGSVRApply dnvss 1 } + } + 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 nvss::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/nvsssendlex.tcl b/ds9/parsers/nvsssendlex.tcl new file mode 100644 index 0000000..a1f6c4b --- /dev/null +++ b/ds9/parsers/nvsssendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval nvsssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc nvsssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc nvsssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc nvsssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc nvsssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc nvsssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc nvsssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc nvsssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc nvsssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc nvsssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/nvsssendparser.tab.tcl b/ds9/parsers/nvsssendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/nvsssendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/nvsssendparser.tcl b/ds9/parsers/nvsssendparser.tcl new file mode 100644 index 0000000..940bab5 --- /dev/null +++ b/ds9/parsers/nvsssendparser.tcl @@ -0,0 +1,314 @@ +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 nvsssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc nvsssend::YYABORT {} { + return -code return 1 +} + +proc nvsssend::YYACCEPT {} { + return -code return 0 +} + +proc nvsssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc nvsssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc nvsssend::yyerror {s} { + puts stderr $s +} + +proc nvsssend::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 nvsssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set nvsssend::table { + 6:0 accept + 3:0,target 2 + 0:257 shift + 0:258 shift + 5:0,target 5 + 0:259 shift + 0:260 shift + 0:261 shift + 0:258,target 2 + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 6 + 4:0,target 3 + 0:0 reduce + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 6 + 5:0 reduce +} + +array set nvsssend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 +} + +array set nvsssend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set nvsssend::rules { + 5,line 24 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set nvsssend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0}} + 1 {{6 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {263 6}} + 5 {{5 0 1}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} +} + +array set nvsssend::token_id_table { + 264,line 26 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 nvsssend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc nvsssend::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 { ProcessSendCmdGet dnvss name } + 2 { ProcessSendCmdGet dnvss name } + 3 { ProcessSendCmdYesNo dnvss save } + 4 { ProcessSendCmdGet dnvss mode } + 5 { ProcessSendCmdGet3 dnvss width height rformat } + 6 { ProcessSendCmdGet3 dnvss x y skyformat } + } + 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 nvsssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/orientlex.tcl b/ds9/parsers/orientlex.tcl new file mode 100644 index 0000000..99a71a6 --- /dev/null +++ b/ds9/parsers/orientlex.tcl @@ -0,0 +1,330 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval orient { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc orient::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc orient::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc orient::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc orient::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc orient::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc orient::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc orient::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc orient::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc orient::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set CLOSE_ 258 +set NONE_ 259 +set OPEN_ 260 +set XY_ 261 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: xy + if {[regexp -start $index_ -indices -line -nocase -- {\A(xy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $NONE_ + } + 2 { +return $OPEN_ + } + 3 { +return $XY_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 7 { +set yylval $yytext; return $STRING_ + } + 8 { +# ignore whitespace + } + 9 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/orientparser.tab.tcl b/ds9/parsers/orientparser.tab.tcl new file mode 100644 index 0000000..1c20305 --- /dev/null +++ b/ds9/parsers/orientparser.tab.tcl @@ -0,0 +1,5 @@ +set STRING_ 257 +set CLOSE_ 258 +set NONE_ 259 +set OPEN_ 260 +set XY_ 261 diff --git a/ds9/parsers/orientparser.tcl b/ds9/parsers/orientparser.tcl new file mode 100644 index 0000000..05f797f --- /dev/null +++ b/ds9/parsers/orientparser.tcl @@ -0,0 +1,419 @@ +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 orient { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc orient::YYABORT {} { + return -code return 1 +} + +proc orient::YYACCEPT {} { + return -code return 0 +} + +proc orient::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc orient::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc orient::yyerror {s} { + puts stderr $s +} + +proc orient::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 orient::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set orient::table { + 0:258 shift + 0:259 shift + 0:260 shift + 2:257 reduce + 5:0,target 6 + 9:0 accept + 8:257,target 12 + 0:261 shift + 11:0 reduce + 0:262 goto + 4:257 reduce + 0:264 goto + 3:257,target 8 + 6:257 reduce + 0:265 goto + 8:257 reduce + 0:265,target 11 + 6:0,target 7 + 10:257,target 2 + 2:0 reduce + 6:0 reduce + 0:264,target 10 + 6:257,target 7 + 0:X shift + 0:Y shift + 7:0,target 5 + 1:257,target 9 + 10:0,target 1 + 0:y,target 4 + 10:257 reduce + 12:257 shift + 8:0,target 12 + 0:x,target 3 + 3:0 reduce + 10:263 goto + 1:0,target 9 + 11:0,target 4 + 0:262,target 9 + 4:257,target 10 + 1:257 reduce + 7:0 reduce + 3:257 reduce + 11:257,target 4 + 5:257 reduce + 13:0 reduce + 9:0,target 0 + 0:261,target 8 + 7:257 reduce + 2:0,target 11 + 10:263,target 12 + 7:257,target 5 + 0:260,target 7 + 0:259,target 6 + 2:257,target 11 + 4:0 reduce + 3:0,target 8 + 13:0,target 3 + 8:0 reduce + 0:x shift + 10:0 reduce + 0:y shift + 0:258,target 5 + 0:Y,target 2 + 5:257,target 6 + 4:0,target 10 + 11:257 reduce + 1:0 reduce + 0:X,target 1 + 12:257,target 13 + 5:0 reduce +} + +array set orient::rules { + 9,l 265 + 11,l 265 + 2,l 263 + 6,l 264 + 12,l 265 + 3,l 262 + 7,l 265 + 0,l 266 + 4,l 264 + 8,l 265 + 10,l 265 + 1,l 262 + 5,l 264 +} + +array set orient::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 3 + 10,dc 1 + 6,dc 1 + 1,dc 1 + 9,dc 1 + 4,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 0 +} + +array set orient::rules { + 2,e 1 + 7,line 28 + 10,line 31 + 4,line 23 + 1,line 19 + 9,line 30 + 12,line 33 + 6,line 25 + 3,line 20 + 8,line 29 + 11,line 32 + 5,line 24 + 2,line 19 +} + +array set orient::lr1_table { + 13,trans {} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0} {7 {0 257} 0} {8 {0 257} 0} {9 {0 257} 0} {10 {0 257} 0} {11 {0 257} 0} {12 {0 257} 0}} + 1 {{9 {0 257} 1}} + 2 {{11 {0 257} 1}} + 3 {{8 {0 257} 1}} + 0,trans {{X 1} {Y 2} {x 3} {y 4} {258 5} {259 6} {260 7} {261 8} {262 9} {264 10} {265 11}} + 4 {{10 {0 257} 1}} + 1,trans {} + 5 {{6 {0 257} 1}} + 2,trans {} + 6 {{7 {0 257} 1}} + 3,trans {} + 7 {{5 {0 257} 1}} + 4,trans {} + 8 {{12 {0 257} 1}} + 5,trans {} + 9 {{0 0 1}} + 10 {{1 0 1} {3 0 1} {2 257 0}} + 6,trans {} + 11 {{4 {0 257} 1}} + 12 {{3 0 2}} + 7,trans {} + 13 {{3 0 3}} + 8,trans {} + 10,trans {{263 12}} + 9,trans {} + 11,trans {} + 12,trans {{257 13}} +} + +array set orient::token_id_table { + 264,line 22 + 265,title {} + 261,line 14 + 257,t 0 + y,t 0 + 257,line 7 + 262,t 1 + X,line 29 + 266,t 1 + 259,title NONE + 260,title OPEN + y,title {} + 266,line 34 + error error + 264,title {} + y,line 30 + error,line 17 + 258,t 0 + 263,line 19 + X,t 0 + error,title {} + X X + Y Y + 263,t 1 + 259,line 12 + 260,line 13 + 258,title CLOSE + x,title {} + 263,title {} + 257 STRING_ + 258 CLOSE_ + 259,t 0 + 259 NONE_ + 260 OPEN_ + 260,t 0 + Y,t 0 + 261 XY_ + 265,line 27 + 262 command + 263 @PSEUDO1 + 257,title string + 264 orient + 264,t 1 + x,line 28 + 265 orientation + 266 start' + 262,line 18 + Y,title {} + 0 {$} + 0,t 0 + 262,title {} + error,t 0 + 258,line 11 + 266,title {} + Y,line 31 + x x + x,t 0 + y y + 261,t 0 + 265,t 1 + X,title {} + 261,title XY +} + +proc orient::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet current orient $1 ChangeOrient } + 5 { PanZoomDialog } + 6 { PanZoomDestroyDialog } + 7 { set _ none } + 8 { set _ x } + 9 { set _ x } + 10 { set _ y } + 11 { set _ y } + 12 { set _ xy } + } + 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 orient::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/pagesetuplex.tcl b/ds9/parsers/pagesetuplex.tcl new file mode 100644 index 0000000..fe0a59b --- /dev/null +++ b/ds9/parsers/pagesetuplex.tcl @@ -0,0 +1,426 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval pagesetup { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc pagesetup::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc pagesetup::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc pagesetup::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc pagesetup::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc pagesetup::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc pagesetup::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc pagesetup::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc pagesetup::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc pagesetup::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set ORIENT_ 260 +set SCALE_ 261 +set SIZE_ 262 +set PORTRAIT_ 263 +set LANDSCAPE_ 264 +set LETTER_ 265 +set LEGAL_ 266 +set TABLOID_ 267 +set POSTER_ 268 +set A4_ 269 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: orient + if {[regexp -start $index_ -indices -line -nocase -- {\A(orient)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: portrait + if {[regexp -start $index_ -indices -line -nocase -- {\A(portrait)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: landscape + if {[regexp -start $index_ -indices -line -nocase -- {\A(landscape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: letter + if {[regexp -start $index_ -indices -line -nocase -- {\A(letter)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: legal + if {[regexp -start $index_ -indices -line -nocase -- {\A(legal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: tabloid + if {[regexp -start $index_ -indices -line -nocase -- {\A(tabloid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: poster + if {[regexp -start $index_ -indices -line -nocase -- {\A(poster)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: a4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(a4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ORIENT_ + } + 1 { +return $SCALE_ + } + 2 { +return $SIZE_ + } + 3 { +return $PORTRAIT_ + } + 4 { +return $LANDSCAPE_ + } + 5 { +return $LETTER_ + } + 6 { +return $LEGAL_ + } + 7 { +return $TABLOID_ + } + 8 { +return $POSTER_ + } + 9 { +return $A4_ + } + 10 { +set yylval $yytext; return $INT_ + } + 11 - + 12 { +set yylval $yytext; return $REAL_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval $yytext; return $STRING_ + } + 17 { +# ignore whitespace + } + 18 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/pagesetupparser.tab.tcl b/ds9/parsers/pagesetupparser.tab.tcl new file mode 100644 index 0000000..2f60e09 --- /dev/null +++ b/ds9/parsers/pagesetupparser.tab.tcl @@ -0,0 +1,13 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set ORIENT_ 260 +set SCALE_ 261 +set SIZE_ 262 +set PORTRAIT_ 263 +set LANDSCAPE_ 264 +set LETTER_ 265 +set LEGAL_ 266 +set TABLOID_ 267 +set POSTER_ 268 +set A4_ 269 diff --git a/ds9/parsers/pagesetupparser.tcl b/ds9/parsers/pagesetupparser.tcl new file mode 100644 index 0000000..8a72956 --- /dev/null +++ b/ds9/parsers/pagesetupparser.tcl @@ -0,0 +1,491 @@ +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 pagesetup { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc pagesetup::YYABORT {} { + return -code return 1 +} + +proc pagesetup::YYACCEPT {} { + return -code return 0 +} + +proc pagesetup::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc pagesetup::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc pagesetup::yyerror {s} { + puts stderr $s +} + +proc pagesetup::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 pagesetup::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set pagesetup::table { + 15:259 reduce + 3:268,target 15 + 17:259 reduce + 0:260 shift + 2:257 shift + 5:0,target 3 + 15:0,target 14 + 9:0 reduce + 0:261 shift + 2:258 shift + 6:259,target 9 + 11:0 reduce + 0:262 shift + 18:259,target 19 + 3:267,target 14 + 15:0 reduce + 6:259 reduce + 13:259,target 12 + 8:259 reduce + 6:0,target 9 + 19:0 reduce + 16:0,target 15 + 0:271 goto + 2:270 goto + 9:259,target 1 + 0:273 goto + 3:266,target 13 + 6:0 reduce + 16:259,target 15 + 7:0,target 10 + 17:0,target 8 + 12:0 reduce + 3:265,target 12 + 10:0,target 2 + 3:275,target 17 + 11:259,target 7 + 16:0 reduce + 0:273,target 5 + 10:259 reduce + 7:259,target 10 + 12:259 reduce + 8:0,target 6 + 5:272,target 18 + 14:259 reduce + 11:0,target 7 + 0:262,target 3 + 2:270,target 11 + 16:259 reduce + 7:0 reduce + 14:259,target 13 + 18:259 shift + 13:0 reduce + 9:0,target 1 + 0:261,target 2 + 1:263 shift + 2:258,target 10 + 19:0,target 5 + 0:271,target 4 + 1:264 shift + 5:259 reduce + 12:0,target 11 + 7:259 reduce + 17:0 reduce + 1:264,target 7 + 3:265 shift + 5:259,target 4 + 9:259 reduce + 1:274,target 8 + 3:266 shift + 3:267 shift + 17:259,target 8 + 0:260,target 1 + 2:257,target 9 + 3:268 shift + 3:269 shift + 4:0 accept + 12:259,target 11 + 1:274 goto + 13:0,target 12 + 1:263,target 6 + 8:0 reduce + 5:272 goto + 10:0 reduce + 3:275 goto + 8:259,target 6 + 14:0 reduce + 3:269,target 16 + 4:0,target 0 + 14:0,target 13 + 15:259,target 14 + 11:259 reduce + 13:259 reduce + 10:259,target 2 + 5:0 reduce +} + +array set pagesetup::rules { + 9,l 274 + 11,l 275 + 15,l 275 + 2,l 270 + 6,l 273 + 12,l 275 + 3,l 271 + 7,l 273 + 13,l 275 + 0,l 276 + 4,l 272 + 8,l 273 + 10,l 274 + 14,l 275 + 1,l 270 + 5,l 271 +} + +array set pagesetup::rules { + 5,dc 3 + 0,dc 1 + 12,dc 1 + 8,dc 2 + 3,dc 1 + 15,dc 1 + 10,dc 1 + 6,dc 2 + 1,dc 1 + 13,dc 1 + 9,dc 1 + 4,dc 0 + 11,dc 1 + 7,dc 2 + 2,dc 1 + 14,dc 1 +} + +array set pagesetup::rules { + 13,line 52 + 7,line 42 + 10,line 47 + 4,line 37 + 1,line 33 + 15,line 54 + 9,line 46 + 12,line 51 + 6,line 41 + 3,line 37 + 4,e 1 + 14,line 53 + 8,line 43 + 11,line 50 + 5,line 38 + 2,line 34 +} + +array set pagesetup::lr1_table { + 13,trans {} + 17 {{8 {0 259} 2}} + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {8 {0 259} 0}} + 14,trans {} + 18 {{5 0 2}} + 1 {{6 {0 259} 1} {9 {0 259} 0} {10 {0 259} 0}} + 19 {{5 0 3}} + 15,trans {} + 2 {{7 {0 259} 1} {1 {0 259} 0} {2 {0 259} 0}} + 16,trans {} + 3 {{8 {0 259} 1} {11 {0 259} 0} {12 {0 259} 0} {13 {0 259} 0} {14 {0 259} 0} {15 {0 259} 0}} + 17,trans {} + 4 {{0 0 1}} + 0,trans {{260 1} {261 2} {262 3} {271 4} {273 5}} + 18,trans {{259 19}} + 5 {{3 0 1} {5 0 1} {4 259 0}} + 1,trans {{263 6} {264 7} {274 8}} + 19,trans {} + 2,trans {{257 9} {258 10} {270 11}} + 6 {{9 {0 259} 1}} + 3,trans {{265 12} {266 13} {267 14} {268 15} {269 16} {275 17}} + 7 {{10 {0 259} 1}} + 4,trans {} + 8 {{6 {0 259} 2}} + 5,trans {{272 18}} + 10 {{2 {0 259} 1}} + 9 {{1 {0 259} 1}} + 6,trans {} + 11 {{7 {0 259} 2}} + 7,trans {} + 12 {{11 {0 259} 1}} + 8,trans {} + 13 {{12 {0 259} 1}} + 10,trans {} + 9,trans {} + 14 {{13 {0 259} 1}} + 11,trans {} + 15 {{14 {0 259} 1}} + 12,trans {} + 16 {{15 {0 259} 1}} +} + +array set pagesetup::token_id_table { + 264,line 19 + 270,t 1 + 269,t 0 + 276,line 55 + 265,title LETTER + 274,t 1 + 261,line 15 + 257,t 0 + 270,title {} + 269,title A4 + 273,line 40 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 32 + 269,line 25 + 259,title string + 260,title ORIENT + 266,t 0 + 271,t 1 + error error + 264,title LANDSCAPE + 266,line 22 + 275,t 1 + error,line 31 + 268,title POSTER + 258,t 0 + 263,line 18 + error,title {} + 275,line 49 + 273,title {} + 263,t 0 + 259,line 10 + 260,line 14 + 258,title float + 272,line 37 + 267,t 0 + 263,title PORTRAIT + 272,t 1 + 268,line 24 + 267,title TABLOID + 257 INT_ + 276,t 1 + 258 REAL_ + 259,t 0 + 259 STRING_ + 260 ORIENT_ + 260,t 0 + 272,title {} + 261 SCALE_ + 265,line 21 + 262 SIZE_ + 263 PORTRAIT_ + 257,title integer + 264 LANDSCAPE_ + 264,t 0 + 276,title {} + 265 LETTER_ + 262,line 16 + 266 LEGAL_ + 267 TABLOID_ + 0,t 0 + 0 {$} + 262,title SIZE + 268 POSTER_ + 268,t 0 + 274,line 45 + 270 numeric + 269 A4_ + 271 command + error,t 0 + 272 @PSEUDO1 + 258,line 8 + 273,t 1 + 273 pagesetup + 266,title LEGAL + 274 orient + 275 size + 271,line 36 + 276 start' + 271,title {} + 261,t 0 + 267,line 23 + 275,title {} + 265,t 0 + 261,title SCALE +} + +proc pagesetup::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { ProcessCmdSet ps orient $2 } + 7 { ProcessCmdSet ps scale $2 } + 8 { ProcessCmdSet ps size $2 } + 9 { set _ portrait } + 10 { set _ landscape } + 11 { set _ letter } + 12 { set _ legal } + 13 { set _ tabloid } + 14 { set _ poster } + 15 { set _ a4 } + } + 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 pagesetup::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/pagesetupsendlex.tcl b/ds9/parsers/pagesetupsendlex.tcl new file mode 100644 index 0000000..76c843a --- /dev/null +++ b/ds9/parsers/pagesetupsendlex.tcl @@ -0,0 +1,278 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval pagesetupsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc pagesetupsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc pagesetupsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc pagesetupsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc pagesetupsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc pagesetupsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc pagesetupsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc pagesetupsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc pagesetupsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc pagesetupsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set ORIENT_ 257 +set SCALE_ 258 +set SIZE_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: orient + if {[regexp -start $index_ -indices -line -nocase -- {\A(orient)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ORIENT_ + } + 1 { +return $SCALE_ + } + 2 { +return $SIZE_ + } + 3 { +# ignore whitespace + } + 4 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/pagesetupsendparser.tab.tcl b/ds9/parsers/pagesetupsendparser.tab.tcl new file mode 100644 index 0000000..1615365 --- /dev/null +++ b/ds9/parsers/pagesetupsendparser.tab.tcl @@ -0,0 +1,3 @@ +set ORIENT_ 257 +set SCALE_ 258 +set SIZE_ 259 diff --git a/ds9/parsers/pagesetupsendparser.tcl b/ds9/parsers/pagesetupsendparser.tcl new file mode 100644 index 0000000..9b1f5ad --- /dev/null +++ b/ds9/parsers/pagesetupsendparser.tcl @@ -0,0 +1,276 @@ +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 pagesetupsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc pagesetupsend::YYABORT {} { + return -code return 1 +} + +proc pagesetupsend::YYACCEPT {} { + return -code return 0 +} + +proc pagesetupsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc pagesetupsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc pagesetupsend::yyerror {s} { + puts stderr $s +} + +proc pagesetupsend::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 pagesetupsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set pagesetupsend::table { + 3:0,target 3 + 0:257 shift + 0:258 shift + 0:260 goto + 0:259 shift + 0:258,target 2 + 2:0,target 2 + 4:0,target 0 + 0:257,target 1 + 1:0 reduce + 2:0 reduce + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 accept + 1:0,target 1 +} + +array set pagesetupsend::rules { + 0,l 261 + 1,l 260 + 2,l 260 + 3,l 260 +} + +array set pagesetupsend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set pagesetupsend::rules { + 2,line 16 + 1,line 15 + 3,line 17 +} + +array set pagesetupsend::lr1_table { + 4,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4}} + 4 {{0 0 1}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0}} + 1,trans {} + 1 {{1 0 1}} + 2,trans {} + 2 {{2 0 1}} + 3,trans {} + 3 {{3 0 1}} +} + +array set pagesetupsend::token_id_table { + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 9 + 261,line 18 + error,line 13 + 257 ORIENT_ + 257,t 0 + 258 SCALE_ + 258,t 0 + 260,t 1 + 260 pagesetupsend + error,title {} + 259 SIZE_ + 259,t 0 + 261,t 1 + 261 start' + 257,line 8 + 260,line 14 + 257,title ORIENT + 259,line 10 + 258,title SCALE + 260,title {} + 259,title SIZE + 261,title {} +} + +proc pagesetupsend::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 { ProcessSendCmdGet ps orient } + 2 { ProcessSendCmdGet ps scale } + 3 { ProcessSendCmdGet ps size } + } + 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 pagesetupsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/panlex.tcl b/ds9/parsers/panlex.tcl new file mode 100644 index 0000000..0b7f0f0 --- /dev/null +++ b/ds9/parsers/panlex.tcl @@ -0,0 +1,809 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval pan { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc pan::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc pan::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc pan::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc pan::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc pan::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc pan::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc pan::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc pan::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc pan::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 +set INT_ 297 +set REAL_ 298 +set SEXSTR_ 299 +set STRING_ 300 +set CLOSE_ 301 +set OPEN_ 302 +set TO_ 303 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: to + if {[regexp -start $index_ -indices -line -nocase -- {\A(to)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $OPEN_ + } + 2 { +return $TO_ + } + 3 { +return $IMAGE_ + } + 4 { +return $PHYSICAL_ + } + 5 { +return $AMPLIFIER_ + } + 6 { +return $DETECTOR_ + } + 7 { +return $WCS_ + } + 8 { +return $WCSA_ + } + 9 { +return $WCSB_ + } + 10 { +return $WCSC_ + } + 11 { +return $WCSD_ + } + 12 { +return $WCSE_ + } + 13 { +return $WCSF_ + } + 14 { +return $WCSG_ + } + 15 { +return $WCSH_ + } + 16 { +return $WCSI_ + } + 17 { +return $WCSJ_ + } + 18 { +return $WCSK_ + } + 19 { +return $WCSL_ + } + 20 { +return $WCSM_ + } + 21 { +return $WCSN_ + } + 22 { +return $WCSO_ + } + 23 { +return $WCSP_ + } + 24 { +return $WCSQ_ + } + 25 { +return $WCSR_ + } + 26 { +return $WCSS_ + } + 27 { +return $WCST_ + } + 28 { +return $WCSU_ + } + 29 { +return $WCSV_ + } + 30 { +return $WCSW_ + } + 31 { +return $WCSX_ + } + 32 { +return $WCSY_ + } + 33 { +return $WCSZ_ + } + 34 { +return $FK4_ + } + 35 { +return $FK4_ + } + 36 { +return $FK5_ + } + 37 { +return $FK5_ + } + 38 { +return $ICRS_ + } + 39 { +return $GALACTIC_ + } + 40 { +return $ECLIPTIC_ + } + 41 { +return $DEGREES_ + } + 42 { +return $SEXAGESIMAL_ + } + 43 { +set yylval $yytext; return $INT_ + } + 44 - + 45 { +set yylval $yytext; return $REAL_ + } + 46 - + 47 { +set yylval $yytext; return $SEXSTR_ + } + 48 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 49 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 50 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 51 { +set yylval $yytext; return $STRING_ + } + 52 { +# ignore whitespace + } + 53 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + + diff --git a/ds9/parsers/panparser.tab.tcl b/ds9/parsers/panparser.tab.tcl new file mode 100644 index 0000000..98d9ae1 --- /dev/null +++ b/ds9/parsers/panparser.tab.tcl @@ -0,0 +1,47 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 +set INT_ 297 +set REAL_ 298 +set SEXSTR_ 299 +set STRING_ 300 +set CLOSE_ 301 +set OPEN_ 302 +set TO_ 303 diff --git a/ds9/parsers/panparser.tcl b/ds9/parsers/panparser.tcl new file mode 100644 index 0000000..064d612 --- /dev/null +++ b/ds9/parsers/panparser.tcl @@ -0,0 +1,2424 @@ +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 pan { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc pan::YYABORT {} { + return -code return 1 +} + +proc pan::YYACCEPT {} { + return -code return 0 +} + +proc pan::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc pan::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc pan::yyerror {s} { + puts stderr $s +} + +proc pan::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 pan::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set pan::table { + 21:289 reduce + 21:290 reduce + 21:300 reduce + 31:294,target 20 + 51:296 shift + 51:306 goto + 21:291 reduce + 21:292 reduce + 21:293 reduce + 21:294 reduce + 43:296,target 32 + 2:284,target 40 + 21:295 reduce + 48:0 reduce + 9:300 reduce + 21:296 reduce + 14:274,target 29 + 25:293,target 14 + 1:258,target 39 + 64:0,target 55 + 37:295,target 26 + 9:309 goto + 53:290,target 45 + 53:289,target 44 + 53:300,target 68 + 54:273,target 28 + 33:0,target 22 + 19:292,target 8 + 20:292,target 9 + 32:294,target 21 + 21:0 reduce + 44:296,target 33 + 14:291,target 46 + 60:291,target 46 + 56:300 reduce + 0:302,target 5 + 63:0 reduce + 26:293,target 15 + 1:275,target 39 + 26:288 reduce + 26:289 reduce + 26:290 reduce + 26:300 reduce + 2:258,target 40 + 26:291 reduce + 26:292 reduce + 38:295,target 27 + 26:293 reduce + 54:290,target 45 + 54:289,target 44 + 54:300,target 63 + 26:294 reduce + 10:273,target 28 + 26:295 reduce + 26:296 reduce + 21:292,target 10 + 53:264,target 19 + 33:294,target 22 + 61:0,target 50 + 45:296,target 34 + 29:0,target 18 + 30:0,target 19 + 35:0 reduce + 1:292,target 39 + 12:298,target 2 + 27:293,target 16 + 2:275,target 40 + 14:265,target 20 + 77:0 reduce + 40:295,target 29 + 39:295,target 28 + 10:300,target 52 + 10:289,target 44 + 10:290,target 45 + 55:300,target 1 + 9:0 reduce + 22:292,target 11 + 67:292,target 47 + 53:281,target 36 + 32:288 reduce + 54:264,target 19 + 32:300 reduce + 32:289 reduce + 32:290 reduce + 34:294,target 23 + 32:291 reduce + 32:292 reduce + 32:293 reduce + 32:294 reduce + 32:295 reduce + 46:296,target 35 + 32:296 reduce + 16:291,target 5 + 2:292,target 40 + 28:293,target 17 + 14:282,target 37 + 50:0 reduce + 49:0 reduce + 57:0,target 3 + 41:295,target 30 + 56:300,target 2 + 1:266,target 39 + 26:0,target 15 + 23:292,target 12 + 54:281,target 36 + 10:264,target 19 + 35:294,target 24 + 51:288,target 43 + 67:288 shift + 47:296,target 36 + 17:291,target 6 + 67:290 shift + 67:289 shift + 67:300 reduce + 67:291 shift + 67:292 shift + 67:293 shift + 67:294 shift + 37:288 reduce + 22:0 reduce + 29:293,target 18 + 30:293,target 19 + 37:300 reduce + 37:290 reduce + 37:289 reduce + 67:296 shift + 67:306 goto + 37:291 reduce + 37:292 reduce + 0:310,target 9 + 0:299,target 3 + 37:293 reduce + 42:295,target 31 + 37:294 reduce + 1:283,target 39 + 64:0 reduce + 57:300,target 3 + 37:295 reduce + 37:296 reduce + 2:266,target 40 + 24:292,target 13 + 70:292,target 47 + 10:281,target 36 + 36:294,target 25 + 54:0,target 63 + 53:272,target 27 + 6:311,target 13 + 48:296,target 37 + 2:257 reduce + 18:291,target 7 + 23:0,target 12 + 2:258 reduce + 2:260 reduce + 2:259 reduce + 2:261 reduce + 2:262 reduce + 2:263 reduce + 31:293,target 20 + 2:264 reduce + 2:265 reduce + 2:266 reduce + 36:0 reduce + 2:267 reduce + 43:295,target 32 + 2:283,target 40 + 2:268 reduce + 13:300,target 46 + 58:300,target 4 + 2:270 reduce + 2:269 reduce + 2:271 reduce + 14:273,target 28 + 73:300 reduce + 2:272 reduce + 2:273 reduce + 78:0 reduce + 2:274 reduce + 25:292,target 14 + 2:275 reduce + 2:276 reduce + 73:295 shift + 43:300 reduce + 2:277 reduce + 1:257,target 39 + 2:278 reduce + 37:294,target 26 + 2:280 reduce + 2:279 reduce + 53:288,target 43 + 2:281 reduce + 2:282 reduce + 54:272,target 27 + 43:295 reduce + 2:283 reduce + 13:300 reduce + 43:296 reduce + 2:284 reduce + 49:296,target 38 + 2:285 reduce + 19:291,target 8 + 20:291,target 9 + 2:286 reduce + 2:287 reduce + 8:0,target 0 + 2:288 reduce + 82:0,target 58 + 2:300 reduce + 2:290 reduce + 2:289 reduce + 2:291 reduce + 32:293,target 21 + 2:292 reduce + 2:293 reduce + 51:0,target 53 + 2:294 reduce + 44:295,target 33 + 14:300,target 47 + 14:289,target 44 + 14:290,target 45 + 60:290,target 45 + 60:289,target 44 + 60:300,target 49 + 59:300,target 48 + 2:297 reduce + 2:298 reduce + 19:0,target 8 + 20:0,target 9 + 51:0 reduce + 0:301,target 4 + 26:292,target 15 + 1:274,target 39 + 2:257,target 40 + 38:294,target 27 + 54:288,target 43 + 10:272,target 27 + 78:300 reduce + 51:296,target 63 + 51:306,target 64 + 21:291,target 10 + 53:263,target 18 + 48:300 reduce + 33:293,target 22 + 3:299,target 10 + 18:288 reduce + 48:295 reduce + 45:295,target 34 + 15:300,target 62 + 18:289 reduce + 18:290 reduce + 18:300 reduce + 61:300,target 50 + 48:296 reduce + 18:291 reduce + 23:0 reduce + 18:292 reduce + 54:257 shift + 18:293 reduce + 54:258 shift + 1:291,target 39 + 5:0,target 44 + 12:307,target 54 + 12:297,target 1 + 18:294 reduce + 54:260 shift + 54:259 shift + 18:295 reduce + 27:292,target 16 + 78:0,target 77 + 54:261 shift + 2:274,target 40 + 18:296 reduce + 65:0 reduce + 54:262 shift + 54:263 shift + 14:264,target 19 + 54:264 shift + 54:265 shift + 47:0,target 36 + 40:294,target 29 + 39:294,target 28 + 10:288,target 43 + 54:266 shift + 54:267 shift + 54:268 shift + 7:307 goto + 7:297 shift + 54:270 shift + 54:269 shift + 7:298 shift + 16:0,target 5 + 54:271 shift + 52:296,target 65 + 22:291,target 11 + 67:291,target 46 + 54:272 shift + 54:273 shift + 53:280,target 35 + 53:279,target 34 + 54:274 shift + 54:275 shift + 54:263,target 18 + 54:276 shift + 34:293,target 23 + 54:277 shift + 54:278 shift + 54:280 shift + 54:279 shift + 54:281 shift + 54:282 shift + 46:295,target 35 + 16:289,target 5 + 16:290,target 5 + 16:300,target 5 + 54:283 shift + 84:300 reduce + 54:284 shift + 54:285 shift + 54:286 shift + 2:291,target 40 + 54:287 shift + 37:0 reduce + 28:292,target 17 + 54:288 shift + 14:281,target 36 + 54:290 shift + 54:289 shift + 54:300 reduce + 54:291 shift + 54:292 shift + 54:293 shift + 41:294,target 30 + 80:0 reduce + 79:0 reduce + 54:294 shift + 54:304 goto + 24:288 reduce + 54:305 goto + 1:265,target 39 + 24:289 reduce + 24:290 reduce + 24:300 reduce + 54:306 goto + 24:291 reduce + 24:292 reduce + 53:296,target 66 + 53:306,target 68 + 23:291,target 12 + 24:293 reduce + 2:0,target 40 + 24:294 reduce + 54:280,target 35 + 54:279,target 34 + 24:295 reduce + 75:0,target 62 + 10:263,target 18 + 24:296 reduce + 35:293,target 24 + 44:0,target 33 + 47:295,target 36 + 17:289,target 6 + 17:290,target 6 + 17:300,target 6 + 63:300,target 60 + 13:0,target 46 + 10:0 reduce + 29:292,target 18 + 30:292,target 19 + 0:308,target 8 + 0:298,target 2 + 52:0 reduce + 42:294,target 31 + 1:282,target 39 + 2:265,target 40 + 54:306,target 71 + 24:291,target 13 + 70:291,target 46 + 10:279,target 34 + 10:280,target 35 + 60:288 shift + 60:290 shift + 60:289 shift + 60:300 reduce + 59:300 reduce + 60:291 shift + 36:293,target 25 + 60:292 shift + 60:293 shift + 60:294 shift + 53:271,target 26 + 6:299,target 11 + 29:288 reduce + 30:288 reduce + 60:295 shift + 29:289 reduce + 29:290 reduce + 29:300 reduce + 30:289 reduce + 30:290 reduce + 30:300 reduce + 60:306 goto + 48:295,target 37 + 18:289,target 7 + 18:290,target 7 + 18:300,target 7 + 29:291 reduce + 30:291 reduce + 64:300,target 55 + 29:292 reduce + 30:292 reduce + 29:293 reduce + 30:293 reduce + 29:294 reduce + 30:294 reduce + 29:295 reduce + 30:295 reduce + 72:0,target 56 + 29:296 reduce + 30:296 reduce + 31:292,target 20 + 24:0 reduce + 1:298,target 39 + 41:0,target 30 + 2:282,target 40 + 14:272,target 27 + 66:0 reduce + 10:0,target 52 + 10:306,target 52 + 10:296,target 50 + 25:291,target 14 + 37:293,target 26 + 53:287,target 42 + 54:271,target 26 + 49:295,target 38 + 19:289,target 8 + 19:290,target 8 + 19:300,target 8 + 20:289,target 9 + 20:290,target 9 + 20:300,target 9 + 65:300,target 61 + 32:292,target 21 + 65:300 reduce + 2:298,target 40 + 35:288 reduce + 14:288,target 43 + 60:288,target 43 + 38:0 reduce + 35:300 reduce + 35:290 reduce + 35:289 reduce + 35:291 reduce + 35:292 reduce + 35:293 reduce + 35:294 reduce + 26:291,target 15 + 35:295 reduce + 1:273,target 39 + 81:0 reduce + 68:0,target 70 + 35:296 reduce + 38:293,target 27 + 54:287,target 42 + 37:0,target 26 + 10:271,target 26 + 21:289,target 10 + 21:290,target 10 + 21:300,target 10 + 66:300,target 75 + 53:262,target 17 + 33:292,target 22 + 1:300,target 39 + 1:290,target 39 + 1:289,target 39 + 53:0 reduce + 27:291,target 16 + 2:273,target 40 + 71:300 reduce + 14:263,target 18 + 40:293,target 29 + 39:293,target 28 + 10:287,target 42 + 41:288 reduce + 71:295 shift + 41:300 reduce + 41:290 reduce + 41:289 reduce + 9:309,target 15 + 41:291 reduce + 41:292 reduce + 22:289,target 11 + 22:290,target 11 + 22:300,target 11 + 67:290,target 45 + 67:289,target 44 + 67:300,target 69 + 41:293 reduce + 53:278,target 33 + 41:294 reduce + 41:295 reduce + 65:0,target 61 + 54:262,target 17 + 41:296 reduce + 34:292,target 23 + 34:0,target 23 + 0:301 shift + 16:288,target 5 + 0:302 shift + 0:303 shift + 11:299 shift + 25:0 reduce + 2:300,target 40 + 2:290,target 40 + 2:289,target 40 + 28:291,target 17 + 0:307 goto + 0:297 shift + 14:279,target 34 + 14:280,target 35 + 0:308 goto + 0:298 shift + 0:310 goto + 0:299 shift + 67:0 reduce + 41:293,target 30 + 1:264,target 39 + 53:305,target 67 + 23:289,target 12 + 23:290,target 12 + 23:300,target 12 + 68:300,target 70 + 54:278,target 33 + 10:262,target 17 + 76:300 reduce + 35:292,target 24 + 46:300 reduce + 17:288,target 6 + 14:306,target 61 + 16:288 reduce + 60:306,target 73 + 46:295 reduce + 16:289 reduce + 16:290 reduce + 16:300 reduce + 29:291,target 18 + 30:291,target 19 + 62:0,target 43 + 46:296 reduce + 16:291 reduce + 40:0 reduce + 39:0 reduce + 16:292 reduce + 0:307,target 7 + 0:297,target 1 + 16:293 reduce + 16:294 reduce + 42:293,target 31 + 1:281,target 39 + 16:295 reduce + 31:0,target 20 + 5:300 reduce + 16:296 reduce + 2:264,target 40 + 82:0 reduce + 54:305,target 70 + 24:289,target 13 + 24:290,target 13 + 24:300,target 13 + 70:290,target 45 + 70:289,target 44 + 70:300,target 65 + 69:300,target 64 + 10:278,target 33 + 36:292,target 25 + 53:270,target 25 + 53:269,target 24 + 6:298,target 2 + 18:288,target 7 + 4:300,target 45 + 31:291,target 20 + 82:300 reduce + 1:297,target 39 + 2:281,target 40 + 54:0 reduce + 52:300 reduce + 14:271,target 26 + 10:305,target 51 + 25:289,target 14 + 25:290,target 14 + 25:300,target 14 + 71:300,target 66 + 22:288 reduce + 22:289 reduce + 22:290 reduce + 22:300 reduce + 58:0,target 4 + 52:296 shift + 22:291 reduce + 22:292 reduce + 37:292,target 26 + 22:293 reduce + 53:286,target 41 + 22:294 reduce + 22:295 reduce + 27:0,target 16 + 54:270,target 25 + 54:269,target 24 + 7:298,target 2 + 22:296 reduce + 19:288,target 8 + 20:288,target 9 + 5:300,target 44 + 16:296,target 5 + 32:291,target 21 + 2:297,target 40 + 26:0 reduce + 14:287,target 42 + 68:0 reduce + 26:289,target 15 + 26:290,target 15 + 26:300,target 15 + 72:300,target 56 + 1:272,target 39 + 1:0 reduce + 38:292,target 27 + 54:286,target 41 + 10:269,target 24 + 10:270,target 25 + 57:300 reduce + 51:294,target 49 + 21:288,target 10 + 27:288 reduce + 53:261,target 16 + 17:296,target 6 + 27:289 reduce + 27:290 reduce + 27:300 reduce + 55:0,target 1 + 33:291,target 22 + 27:291 reduce + 27:292 reduce + 27:293 reduce + 27:294 reduce + 24:0,target 13 + 27:295 reduce + 27:296 reduce + 41:0 reduce + 1:288,target 39 + 27:289,target 16 + 27:290,target 16 + 27:300,target 16 + 73:300,target 51 + 2:272,target 40 + 14:262,target 17 + 83:0 reduce + 40:292,target 29 + 39:292,target 28 + 10:286,target 41 + 22:288,target 11 + 67:288,target 43 + 53:277,target 32 + 54:261,target 16 + 18:296,target 7 + 64:296,target 75 + 34:291,target 23 + 63:300 reduce + 9:0,target 41 + 13:0 reduce + 83:0,target 78 + 2:288,target 40 + 33:288 reduce + 28:289,target 17 + 28:290,target 17 + 28:300,target 17 + 74:300,target 57 + 33:300 reduce + 33:290 reduce + 33:289 reduce + 14:278,target 33 + 55:0 reduce + 52:0,target 54 + 33:291 reduce + 33:292 reduce + 33:293 reduce + 41:292,target 30 + 33:294 reduce + 33:295 reduce + 21:0,target 10 + 33:296 reduce + 1:263,target 39 + 53:294,target 49 + 23:288,target 12 + 54:277,target 32 + 10:261,target 16 + 19:296,target 8 + 20:296,target 9 + 35:291,target 24 + 14:305,target 60 + 60:295,target 72 + 27:0 reduce + 29:289,target 18 + 29:290,target 18 + 29:300,target 18 + 30:289,target 19 + 30:290,target 19 + 30:300,target 19 + 75:300,target 62 + 42:292,target 31 + 1:280,target 39 + 1:279,target 39 + 70:0 reduce + 69:0 reduce + 2:263,target 40 + 68:300 reduce + 2:0 reduce + 80:0,target 67 + 79:0,target 72 + 54:294,target 49 + 54:304,target 69 + 24:288,target 13 + 70:288,target 43 + 10:277,target 32 + 38:288 reduce + 38:300 reduce + 38:290 reduce + 38:289 reduce + 68:296 shift + 48:0,target 37 + 38:291 reduce + 9:300,target 42 + 21:296,target 10 + 38:292 reduce + 36:291,target 25 + 38:293 reduce + 38:294 reduce + 53:268,target 23 + 38:295 reduce + 6:307,target 12 + 6:297,target 1 + 17:0,target 6 + 38:296 reduce + 61:295,target 74 + 31:289,target 20 + 31:290,target 20 + 31:300,target 20 + 76:300,target 76 + 14:257 shift + 14:258 shift + 14:259 shift + 14:260 shift + 42:0 reduce + 14:261 shift + 2:280,target 40 + 2:279,target 40 + 14:262 shift + 14:263 shift + 14:264 shift + 14:269,target 24 + 14:270,target 25 + 14:265 shift + 10:294,target 49 + 14:266 shift + 84:0 reduce + 14:267 shift + 25:288,target 14 + 14:268 shift + 14:269 shift + 14:270 shift + 14:271 shift + 14:272 shift + 22:296,target 11 + 67:296,target 76 + 67:306,target 77 + 37:291,target 26 + 14:273 shift + 53:285,target 40 + 14:274 shift + 14:275 shift + 54:268,target 23 + 7:307,target 14 + 7:297,target 1 + 14:276 shift + 14:277 shift + 74:300 reduce + 14:278 shift + 14:279 shift + 14:280 shift + 76:0,target 76 + 14:281 shift + 14:282 shift + 14:283 shift + 16:295,target 5 + 44:300 reduce + 32:300,target 21 + 14:284 shift + 32:289,target 21 + 32:290,target 21 + 77:300,target 71 + 45:0,target 34 + 14:285 shift + 14:0 reduce + 14:286 shift + 14:287 shift + 14:288 shift + 44:295 reduce + 14:0,target 47 + 14:300 reduce + 14:286,target 41 + 14:289 shift + 14:290 shift + 44:296 reduce + 14:291 shift + 14:292 shift + 56:0 reduce + 14:293 shift + 14:304 goto + 14:294 shift + 14:305 goto + 26:288,target 15 + 1:271,target 39 + 14:306 goto + 23:296,target 12 + 68:296,target 78 + 38:291,target 27 + 54:285,target 40 + 10:268,target 23 + 51:293,target 48 + 3:299 shift + 17:295,target 6 + 33:300,target 22 + 33:290,target 22 + 33:289,target 22 + 78:300,target 77 + 28:0 reduce + 80:300 reduce + 79:300 reduce + 73:0,target 51 + 1:287,target 39 + 27:288,target 16 + 2:271,target 40 + 80:295 shift + 71:0 reduce + 50:300 reduce + 49:300 reduce + 42:0,target 31 + 14:261,target 16 + 24:296,target 13 + 70:306,target 80 + 40:291,target 29 + 39:291,target 28 + 10:285,target 40 + 19:288 reduce + 20:288 reduce + 49:295 reduce + 19:289 reduce + 19:290 reduce + 19:300 reduce + 20:289 reduce + 20:290 reduce + 20:300 reduce + 49:296 reduce + 19:291 reduce + 20:291 reduce + 19:292 reduce + 20:292 reduce + 19:293 reduce + 20:293 reduce + 19:294 reduce + 20:294 reduce + 53:276,target 31 + 19:295 reduce + 20:295 reduce + 19:296 reduce + 20:296 reduce + 54:260,target 58 + 54:259,target 57 + 18:295,target 7 + 34:300,target 23 + 34:290,target 23 + 34:289,target 23 + 80:300,target 67 + 79:300,target 72 + 2:287,target 40 + 43:0 reduce + 28:288,target 17 + 14:277,target 32 + 25:296,target 14 + 41:291,target 30 + 1:262,target 39 + 53:293,target 48 + 70:0,target 65 + 69:0,target 64 + 54:276,target 31 + 55:300 reduce + 19:295,target 8 + 20:295,target 9 + 38:0,target 27 + 35:300,target 24 + 35:290,target 24 + 35:289,target 24 + 81:300,target 73 + 25:288 reduce + 25:289 reduce + 25:290 reduce + 25:300 reduce + 25:291 reduce + 25:292 reduce + 25:293 reduce + 25:294 reduce + 14:304,target 59 + 14:294,target 49 + 25:295 reduce + 60:294,target 49 + 25:296 reduce + 29:288,target 18 + 30:288,target 19 + 57:0 reduce + 26:296,target 15 + 42:291,target 31 + 1:278,target 39 + 2:262,target 40 + 54:293,target 48 + 10:276,target 31 + 21:295,target 10 + 36:300,target 25 + 36:290,target 25 + 36:289,target 25 + 82:300,target 58 + 53:267,target 22 + 66:0,target 75 + 31:288,target 20 + 61:300 reduce + 35:0,target 24 + 29:0 reduce + 30:0 reduce + 27:296,target 16 + 2:278,target 40 + 31:288 reduce + 61:295 shift + 31:289 reduce + 31:290 reduce + 31:300 reduce + 14:268,target 23 + 31:291 reduce + 72:0 reduce + 31:292 reduce + 10:293,target 48 + 31:293 reduce + 31:294 reduce + 4:0 reduce + 31:295 reduce + 31:296 reduce + 22:295,target 11 + 37:300,target 26 + 37:290,target 26 + 37:289,target 26 + 83:300,target 78 + 53:284,target 39 + 54:267,target 22 + 16:294,target 5 + 32:288,target 21 + 28:296,target 17 + 14:285,target 40 + 44:0 reduce + 63:0,target 60 + 1:270,target 39 + 1:269,target 39 + 66:300 reduce + 23:295,target 12 + 32:0,target 21 + 38:300,target 27 + 38:290,target 27 + 38:289,target 27 + 84:300,target 74 + 54:284,target 39 + 36:288 reduce + 10:267,target 22 + 36:300 reduce + 36:290 reduce + 36:289 reduce + 36:291 reduce + 51:292,target 47 + 36:292 reduce + 36:293 reduce + 36:294 reduce + 36:295 reduce + 36:296 reduce + 17:294,target 6 + 33:288,target 22 + 16:0 reduce + 29:296,target 18 + 30:296,target 19 + 1:286,target 39 + 58:0 reduce + 2:270,target 40 + 2:269,target 40 + 1:257 reduce + 1:258 reduce + 14:259,target 57 + 14:260,target 58 + 1:259 reduce + 1:260 reduce + 24:295,target 13 + 70:295,target 79 + 40:300,target 29 + 40:290,target 29 + 40:289,target 29 + 39:300,target 28 + 39:290,target 28 + 39:289,target 28 + 1:261 reduce + 10:284,target 39 + 1:262 reduce + 1:263 reduce + 1:264 reduce + 1:265 reduce + 1:266 reduce + 1:267 reduce + 60:0,target 49 + 59:0,target 48 + 53:275,target 30 + 1:268 reduce + 1:269 reduce + 1:270 reduce + 54:258,target 56 + 1:271 reduce + 18:294,target 7 + 72:300 reduce + 34:288,target 23 + 1:272 reduce + 1:273 reduce + 28:0,target 17 + 1:274 reduce + 1:275 reduce + 42:288 reduce + 1:276 reduce + 31:296,target 20 + 42:300 reduce + 42:290 reduce + 42:289 reduce + 1:277 reduce + 42:291 reduce + 1:278 reduce + 42:292 reduce + 1:280 reduce + 1:279 reduce + 42:293 reduce + 1:281 reduce + 31:0 reduce + 42:294 reduce + 2:286,target 40 + 1:282 reduce + 42:295 reduce + 1:283 reduce + 42:296 reduce + 1:284 reduce + 14:276,target 31 + 1:285 reduce + 1:286 reduce + 73:0 reduce + 1:287 reduce + 25:295,target 14 + 71:295,target 81 + 41:300,target 30 + 41:290,target 30 + 41:289,target 30 + 1:288 reduce + 1:300 reduce + 1:290 reduce + 1:289 reduce + 1:291 reduce + 1:261,target 39 + 5:0 reduce + 12:307 goto + 12:297 shift + 1:292 reduce + 12:298 shift + 1:293 reduce + 53:292,target 47 + 1:294 reduce + 54:275,target 30 + 1:297 reduce + 1:298 reduce + 19:294,target 8 + 20:294,target 9 + 35:288,target 24 + 32:296,target 21 + 77:296,target 83 + 56:0,target 2 + 14:293,target 48 + 60:293,target 48 + 77:300 reduce + 45:0 reduce + 25:0,target 14 + 26:295,target 15 + 42:300,target 31 + 42:290,target 31 + 42:289,target 31 + 1:277,target 39 + 47:300 reduce + 2:261,target 40 + 77:296 shift + 54:292,target 47 + 10:275,target 30 + 17:288 reduce + 47:295 reduce + 17:289 reduce + 17:290 reduce + 17:300 reduce + 47:296 reduce + 17:291 reduce + 17:292 reduce + 21:294,target 10 + 36:288,target 25 + 17:293 reduce + 17:294 reduce + 17:295 reduce + 53:266,target 21 + 53:261 shift + 17:296 reduce + 53:262 shift + 33:296,target 22 + 53:263 shift + 53:264 shift + 53:265 shift + 53:266 shift + 53:267 shift + 53:268 shift + 6:307 goto + 6:297 shift + 17:0 reduce + 53:270 shift + 53:269 shift + 6:298 shift + 53:271 shift + 6:299 shift + 53:272 shift + 1:294,target 39 + 6:311 goto + 53:273 shift + 27:295,target 16 + 73:295,target 82 + 53:274 shift + 43:300,target 32 + 2:277,target 40 + 60:0 reduce + 59:0 reduce + 53:275 shift + 84:0,target 74 + 53:276 shift + 14:267,target 22 + 53:277 shift + 53:278 shift + 10:292,target 47 + 53:280 shift + 53:279 shift + 53:281 shift + 53:0,target 68 + 53:282 shift + 53:283 shift + 83:300 reduce + 53:284 shift + 22:294,target 11 + 67:294,target 49 + 53:285 shift + 37:288,target 26 + 22:0,target 11 + 53:286 shift + 53:283,target 38 + 53:287 shift + 54:266,target 21 + 53:288 shift + 53:290 shift + 53:289 shift + 53:300 reduce + 34:296,target 23 + 53:291 shift + 53:292 shift + 53:293 shift + 53:294 shift + 23:288 reduce + 53:305 goto + 16:293,target 5 + 23:289 reduce + 23:290 reduce + 23:300 reduce + 53:296 shift + 53:306 goto + 23:291 reduce + 23:292 reduce + 23:293 reduce + 2:294,target 40 + 23:294 reduce + 23:295 reduce + 28:295,target 17 + 32:0 reduce + 44:300,target 33 + 14:284,target 39 + 23:296 reduce + 74:0 reduce + 1:268,target 39 + 23:294,target 12 + 38:288,target 27 + 54:283,target 38 + 10:266,target 21 + 81:0,target 73 + 35:296,target 24 + 51:291,target 46 + 50:0,target 59 + 49:0,target 38 + 17:293,target 6 + 18:0,target 7 + 29:295,target 18 + 30:295,target 19 + 45:300,target 34 + 58:300 reduce + 46:0 reduce + 1:285,target 39 + 28:288 reduce + 2:268,target 40 + 28:289 reduce + 28:290 reduce + 28:300 reduce + 28:291 reduce + 14:258,target 56 + 28:292 reduce + 24:294,target 13 + 28:293 reduce + 70:294,target 49 + 40:288,target 29 + 39:288,target 28 + 10:283,target 38 + 28:294 reduce + 28:295 reduce + 28:296 reduce + 36:296,target 25 + 53:274,target 29 + 54:257,target 55 + 18:293,target 7 + 4:0,target 45 + 31:295,target 20 + 46:300,target 35 + 77:0,target 71 + 18:0 reduce + 2:285,target 40 + 46:0,target 35 + 14:275,target 30 + 61:0 reduce + 25:294,target 14 + 41:288,target 30 + 1:259,target 39 + 1:260,target 39 + 64:300 reduce + 37:296,target 26 + 53:291,target 46 + 54:274,target 29 + 34:288 reduce + 34:300 reduce + 34:290 reduce + 34:289 reduce + 64:296 shift + 34:291 reduce + 19:293,target 8 + 20:293,target 9 + 34:292 reduce + 34:293 reduce + 34:294 reduce + 34:295 reduce + 34:296 reduce + 32:295,target 21 + 47:300,target 36 + 14:292,target 47 + 60:292,target 47 + 33:0 reduce + 0:303,target 6 + 11:299,target 53 + 10:261 shift + 26:294,target 15 + 42:288,target 31 + 1:276,target 39 + 10:262 shift + 75:0 reduce + 1:0,target 39 + 10:263 shift + 2:260,target 40 + 2:259,target 40 + 10:264 shift + 74:0,target 57 + 10:265 shift + 38:296,target 27 + 10:266 shift + 54:291,target 46 + 10:267 shift + 10:268 shift + 10:274,target 29 + 43:0,target 32 + 10:269 shift + 10:270 shift + 10:271 shift + 10:272 shift + 21:293,target 10 + 10:273 shift + 10:274 shift + 10:275 shift + 53:265,target 20 + 10:276 shift + 70:288 shift + 33:295,target 22 + 10:277 shift + 70:290 shift + 70:289 shift + 70:300 reduce + 69:300 reduce + 48:300,target 37 + 10:278 shift + 70:291 shift + 10:279 shift + 10:280 shift + 70:292 shift + 10:281 shift + 70:293 shift + 10:282 shift + 70:294 shift + 40:288 reduce + 39:288 reduce + 10:283 shift + 70:295 shift + 40:300 reduce + 40:290 reduce + 40:289 reduce + 39:300 reduce + 39:290 reduce + 39:289 reduce + 10:284 shift + 70:306 goto + 40:291 reduce + 39:291 reduce + 10:285 shift + 40:292 reduce + 39:292 reduce + 10:286 shift + 40:293 reduce + 39:293 reduce + 1:293,target 39 + 10:287 shift + 47:0 reduce + 40:294 reduce + 39:294 reduce + 10:288 shift + 27:294,target 16 + 40:295 reduce + 39:295 reduce + 2:276,target 40 + 10:300 reduce + 10:289 shift + 10:290 shift + 40:296 reduce + 39:296 reduce + 10:291 shift + 10:292 shift + 14:266,target 21 + 10:293 shift + 40:296,target 29 + 39:296,target 28 + 10:291,target 46 + 10:294 shift + 10:305 goto + 10:306 goto + 10:296 shift + 22:293,target 11 + 67:293,target 48 + 53:282,target 37 + 54:265,target 20 + 34:295,target 23 + 80:295,target 84 + 71:0,target 66 + 50:300,target 59 + 49:300,target 38 + 40:0,target 29 + 39:0,target 28 + 16:292,target 5 + 19:0 reduce + 20:0 reduce + 2:293,target 40 + 28:294,target 17 + 14:283,target 38 + 75:300 reduce + 62:0 reduce + 41:296,target 30 + 1:267,target 39 + 45:300 reduce + 23:293,target 12 + 54:282,target 37 + 45:295 reduce + 10:265,target 20 + 15:300 shift + 45:296 reduce + 35:295,target 24 + 51:290,target 45 + 51:289,target 44 + 51:300,target 53 + 4:300 reduce + 17:292,target 6 + 29:294,target 18 + 30:294,target 19 + 34:0 reduce + 67:0,target 69 + 42:296,target 31 + 1:284,target 39 + 36:0,target 25 + 2:267,target 40 + 76:0 reduce + 14:257,target 55 + 24:293,target 13 + 70:293,target 48 + 8:0 accept + 10:282,target 37 + 81:300 reduce + 36:295,target 25 + 52:300,target 54 + 53:273,target 28 + 51:288 shift + 51:290 shift + 51:289 shift + 51:300 reduce + 18:292,target 7 + 51:291 shift + 51:292 shift + 51:293 shift + 51:294 shift + 21:288 reduce +} + +array set pan::rules { + 9,l 305 + 11,l 305 + 32,l 306 + 53,l 310 + 74,l 311 + 6,l 305 + 28,l 305 + 50,l 310 + 49,l 310 + 71,l 311 + 3,l 304 + 25,l 305 + 46,l 310 + 67,l 311 + 0,l 312 + 22,l 305 + 43,l 308 + 64,l 311 + 18,l 305 + 40,l 307 + 39,l 307 + 61,l 310 + 15,l 305 + 36,l 306 + 57,l 310 + 78,l 311 + 12,l 305 + 33,l 306 + 54,l 310 + 75,l 311 + 7,l 305 + 29,l 305 + 30,l 305 + 51,l 310 + 72,l 311 + 4,l 304 + 26,l 305 + 47,l 310 + 68,l 311 + 1,l 304 + 23,l 305 + 44,l 310 + 65,l 311 + 19,l 305 + 20,l 305 + 41,l 308 + 62,l 310 + 16,l 305 + 37,l 306 + 58,l 310 + 13,l 305 + 34,l 306 + 55,l 310 + 76,l 311 + 8,l 305 + 10,l 305 + 31,l 305 + 52,l 310 + 73,l 311 + 5,l 305 + 27,l 305 + 48,l 310 + 70,l 311 + 69,l 311 + 2,l 304 + 24,l 305 + 45,l 310 + 66,l 311 + 21,l 305 + 42,l 309 + 63,l 311 + 17,l 305 + 38,l 306 + 60,l 310 + 59,l 310 + 14,l 305 + 35,l 306 + 56,l 310 + 77,l 311 +} + +array set pan::rules { + 63,dc 2 + 12,dc 1 + 77,dc 4 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 4 + 70,dc 3 + 69,dc 3 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 62,dc 5 + 11,dc 1 + 76,dc 4 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 3 + 68,dc 2 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 61,dc 4 + 10,dc 1 + 75,dc 3 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 3 + 67,dc 4 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 60,dc 4 + 59,dc 3 + 74,dc 5 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 2 + 66,dc 3 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 58,dc 5 + 73,dc 4 + 22,dc 1 + 36,dc 1 + 51,dc 4 + 65,dc 3 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 3 + 57,dc 4 + 72,dc 4 + 21,dc 1 + 35,dc 1 + 50,dc 3 + 49,dc 3 + 64,dc 3 + 13,dc 1 + 78,dc 5 + 27,dc 1 + 4,dc 1 + 42,dc 0 + 56,dc 4 + 71,dc 4 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 3 +} + +array set pan::rules { + 41,line 156 + 7,line 118 + 37,line 149 + 4,line 114 + 34,line 146 + 1,line 111 + 31,line 142 + 27,line 138 + 24,line 135 + 21,line 132 + 76,line 196 + 17,line 128 + 73,line 193 + 14,line 125 + 70,line 189 + 69,line 188 + 11,line 122 + 66,line 185 + 63,line 182 + 60,line 177 + 59,line 176 + 56,line 173 + 53,line 169 + 50,line 166 + 49,line 165 + 46,line 162 + 43,line 157 + 9,line 120 + 40,line 153 + 39,line 152 + 6,line 117 + 36,line 148 + 3,line 113 + 33,line 145 + 29,line 140 + 30,line 141 + 26,line 137 + 23,line 134 + 78,line 198 + 19,line 130 + 20,line 131 + 75,line 195 + 16,line 127 + 72,line 192 + 13,line 124 + 68,line 187 + 10,line 121 + 65,line 184 + 62,line 179 + 58,line 175 + 55,line 172 + 52,line 168 + 48,line 164 + 45,line 161 + 42,line 156 + 8,line 119 + 38,line 150 + 5,line 116 + 35,line 147 + 2,line 112 + 32,line 144 + 28,line 139 + 25,line 136 + 22,line 133 + 77,line 197 + 18,line 129 + 74,line 194 + 15,line 126 + 71,line 191 + 42,e 1 + 12,line 123 + 67,line 186 + 64,line 183 + 61,line 178 + 57,line 174 + 54,line 170 + 51,line 167 + 47,line 163 + 44,line 160 +} + +array set pan::lr1_table { + 35 {{22 {0 288 289 290 291 292 293 294 296 300} 1}} + 66,trans {} + 85,trans {} + 36 {{23 {0 288 289 290 291 292 293 294 296 300} 1}} + 37 {{24 {0 288 289 290 291 292 293 294 296 300} 1}} + 38 {{25 {0 288 289 290 291 292 293 294 296 300} 1}} + 39 {{26 {0 288 289 290 291 292 293 294 296 300} 1}} + 40 {{27 {0 288 289 290 291 292 293 294 296 300} 1}} + 117,trans {} + 41 {{28 {0 288 289 290 291 292 293 294 296 300} 1}} + 42 {{29 {0 288 289 290 291 292 293 294 296 300} 1}} + 43 {{30 {0 288 289 290 291 292 293 294 296 300} 1}} + 44 {{31 {0 288 289 290 291 292 293 294 296 300} 1}} + 45 {{32 {0 296 300} 1}} + 46 {{33 {0 296 300} 1}} + 47 {{34 {0 296 300} 1}} + 48 {{35 {0 296 300} 1}} + 49 {{36 {0 296 300} 1}} + 50 {{37 {0 296 300} 1}} + 27,trans {} + 51 {{38 {0 296 300} 1}} + 46,trans {} + 52 {{59 {0 300} 3}} + 65,trans {} + 84,trans {} + 53 {{53 {0 300} 3} {55 {0 300} 3} {60 {0 300} 3} {62 {0 300} 3} {32 {0 296 300} 0} {33 {0 296 300} 0} {34 {0 296 300} 0} {35 {0 296 300} 0} {36 {0 296 300} 0} {37 {0 296 300} 0} {38 {0 296 300} 0}} + 54 {{54 {0 300} 3} {61 {0 300} 3}} + 55 {{68 {0 300} 2} {69 {0 300} 2} {70 {0 300} 2} {71 {0 300} 2} {75 {0 300} 2} {76 {0 300} 2} {77 {0 300} 2} {78 {0 300} 2} {5 {0 288 289 290 291 292 293 294 296 300} 0} {6 {0 288 289 290 291 292 293 294 296 300} 0} {7 {0 288 289 290 291 292 293 294 296 300} 0} {8 {0 288 289 290 291 292 293 294 296 300} 0} {9 {0 288 289 290 291 292 293 294 296 300} 0} {10 {0 288 289 290 291 292 293 294 296 300} 0} {11 {0 288 289 290 291 292 293 294 296 300} 0} {12 {0 288 289 290 291 292 293 294 296 300} 0} {13 {0 288 289 290 291 292 293 294 296 300} 0} {14 {0 288 289 290 291 292 293 294 296 300} 0} {15 {0 288 289 290 291 292 293 294 296 300} 0} {16 {0 288 289 290 291 292 293 294 296 300} 0} {17 {0 288 289 290 291 292 293 294 296 300} 0} {18 {0 288 289 290 291 292 293 294 296 300} 0} {19 {0 288 289 290 291 292 293 294 296 300} 0} {20 {0 288 289 290 291 292 293 294 296 300} 0} {21 {0 288 289 290 291 292 293 294 296 300} 0} {22 {0 288 289 290 291 292 293 294 296 300} 0} {23 {0 288 289 290 291 292 293 294 296 300} 0} {24 {0 288 289 290 291 292 293 294 296 300} 0} {25 {0 288 289 290 291 292 293 294 296 300} 0} {26 {0 288 289 290 291 292 293 294 296 300} 0} {27 {0 288 289 290 291 292 293 294 296 300} 0} {28 {0 288 289 290 291 292 293 294 296 300} 0} {29 {0 288 289 290 291 292 293 294 296 300} 0} {30 {0 288 289 290 291 292 293 294 296 300} 0} {31 {0 288 289 290 291 292 293 294 296 300} 0} {32 {0 296 300} 0} {33 {0 296 300} 0} {34 {0 296 300} 0} {35 {0 296 300} 0} {36 {0 296 300} 0} {37 {0 296 300} 0} {38 {0 296 300} 0}} + 56 {{63 {0 300} 2} {64 {0 300} 2} {65 {0 300} 2} {66 {0 300} 2} {67 {0 300} 2} {72 {0 300} 2} {73 {0 300} 2} {74 {0 300} 2} {1 {0 300} 0} {2 {0 300} 0} {3 {0 300} 0} {4 {0 300} 0} {5 {0 288 289 290 291 292 293 294 295 300} 0} {6 {0 288 289 290 291 292 293 294 295 300} 0} {7 {0 288 289 290 291 292 293 294 295 300} 0} {8 {0 288 289 290 291 292 293 294 295 300} 0} {9 {0 288 289 290 291 292 293 294 295 300} 0} {10 {0 288 289 290 291 292 293 294 295 300} 0} {11 {0 288 289 290 291 292 293 294 295 300} 0} {12 {0 288 289 290 291 292 293 294 295 300} 0} {13 {0 288 289 290 291 292 293 294 295 300} 0} {14 {0 288 289 290 291 292 293 294 295 300} 0} {15 {0 288 289 290 291 292 293 294 295 300} 0} {16 {0 288 289 290 291 292 293 294 295 300} 0} {17 {0 288 289 290 291 292 293 294 295 300} 0} {18 {0 288 289 290 291 292 293 294 295 300} 0} {19 {0 288 289 290 291 292 293 294 295 300} 0} {20 {0 288 289 290 291 292 293 294 295 300} 0} {21 {0 288 289 290 291 292 293 294 295 300} 0} {22 {0 288 289 290 291 292 293 294 295 300} 0} {23 {0 288 289 290 291 292 293 294 295 300} 0} {24 {0 288 289 290 291 292 293 294 295 300} 0} {25 {0 288 289 290 291 292 293 294 295 300} 0} {26 {0 288 289 290 291 292 293 294 295 300} 0} {27 {0 288 289 290 291 292 293 294 295 300} 0} {28 {0 288 289 290 291 292 293 294 295 300} 0} {29 {0 288 289 290 291 292 293 294 295 300} 0} {30 {0 288 289 290 291 292 293 294 295 300} 0} {31 {0 288 289 290 291 292 293 294 295 300} 0} {32 {0 295 300} 0} {33 {0 295 300} 0} {34 {0 295 300} 0} {35 {0 295 300} 0} {36 {0 295 300} 0} {37 {0 295 300} 0} {38 {0 295 300} 0}} + 116,trans {{295 120}} + 57 {{1 {0 300} 1}} + 58 {{2 {0 300} 1}} + 59 {{3 {0 300} 1}} + 60 {{4 {0 300} 1}} + 61 {{5 {0 288 289 290 291 292 293 294 295 300} 1}} + 62 {{6 {0 288 289 290 291 292 293 294 295 300} 1}} + 63 {{7 {0 288 289 290 291 292 293 294 295 300} 1}} + 64 {{8 {0 288 289 290 291 292 293 294 295 300} 1}} + 65 {{9 {0 288 289 290 291 292 293 294 295 300} 1}} + 66 {{10 {0 288 289 290 291 292 293 294 295 300} 1}} + 26,trans {} + 67 {{11 {0 288 289 290 291 292 293 294 295 300} 1}} + 45,trans {} + 68 {{12 {0 288 289 290 291 292 293 294 295 300} 1}} + 64,trans {} + 69 {{13 {0 288 289 290 291 292 293 294 295 300} 1}} + 70 {{14 {0 288 289 290 291 292 293 294 295 300} 1}} + 83,trans {} + 71 {{15 {0 288 289 290 291 292 293 294 295 300} 1}} + 72 {{16 {0 288 289 290 291 292 293 294 295 300} 1}} + 73 {{17 {0 288 289 290 291 292 293 294 295 300} 1}} + 115,trans {} + 74 {{18 {0 288 289 290 291 292 293 294 295 300} 1}} + 75 {{19 {0 288 289 290 291 292 293 294 295 300} 1}} + 76 {{20 {0 288 289 290 291 292 293 294 295 300} 1}} + 77 {{21 {0 288 289 290 291 292 293 294 295 300} 1}} + 78 {{22 {0 288 289 290 291 292 293 294 295 300} 1}} + 79 {{23 {0 288 289 290 291 292 293 294 295 300} 1}} + 80 {{24 {0 288 289 290 291 292 293 294 295 300} 1}} + 81 {{25 {0 288 289 290 291 292 293 294 295 300} 1}} + 82 {{26 {0 288 289 290 291 292 293 294 295 300} 1}} + 83 {{27 {0 288 289 290 291 292 293 294 295 300} 1}} + 25,trans {} + 84 {{28 {0 288 289 290 291 292 293 294 295 300} 1}} + 44,trans {} + 85 {{29 {0 288 289 290 291 292 293 294 295 300} 1}} + 63,trans {} + 86 {{30 {0 288 289 290 291 292 293 294 295 300} 1}} + 82,trans {} + 87 {{31 {0 288 289 290 291 292 293 294 295 300} 1}} + 0 {{0 0 0} {41 0 0} {43 0 0} {44 {0 300} 0} {45 {0 300} 0} {46 {0 300} 0} {47 {0 300} 0} {48 {0 300} 0} {49 {0 300} 0} {50 {0 300} 0} {51 {0 300} 0} {52 {0 300} 0} {53 {0 300} 0} {54 {0 300} 0} {55 {0 300} 0} {56 {0 300} 0} {57 {0 300} 0} {58 {0 300} 0} {59 {0 300} 0} {60 {0 300} 0} {61 {0 300} 0} {62 {0 300} 0} {39 {297 298} 0} {40 {297 298} 0}} + 88 {{32 {0 295 300} 1}} + 1 {{39 {297 298} 1}} + 89 {{33 {0 295 300} 1}} + 90 {{34 {0 295 300} 1}} + 114,trans {} + 2 {{40 {297 298} 1}} + 91 {{35 {0 295 300} 1}} + 3 {{52 {0 300} 1} {53 {0 300} 1} {54 {0 300} 1} {55 {0 300} 1} {59 {0 300} 1} {60 {0 300} 1} {61 {0 300} 1} {62 {0 300} 1}} + 92 {{36 {0 295 300} 1}} + 4 {{45 {0 300} 1}} + 93 {{37 {0 295 300} 1}} + 5 {{44 {0 300} 1}} + 94 {{38 {0 295 300} 1}} + 6 {{46 {0 300} 1} {63 {0 300} 0} {64 {0 300} 0} {65 {0 300} 0} {66 {0 300} 0} {67 {0 300} 0} {68 {0 300} 0} {69 {0 300} 0} {70 {0 300} 0} {71 {0 300} 0} {72 {0 300} 0} {73 {0 300} 0} {74 {0 300} 0} {75 {0 300} 0} {76 {0 300} 0} {77 {0 300} 0} {78 {0 300} 0} {39 {297 298} 0} {40 {297 298} 0}} + 95 {{48 {0 300} 3}} + 7 {{47 {0 300} 1} {48 {0 300} 1} {49 {0 300} 1} {50 {0 300} 1} {51 {0 300} 1} {56 {0 300} 1} {57 {0 300} 1} {58 {0 300} 1} {39 {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 285 286 287 288 289 290 291 292 293 294 300} 0} {40 {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 285 286 287 288 289 290 291 292 293 294 300} 0}} + 96 {{49 {0 300} 3} {51 {0 300} 3} {56 {0 300} 3} {58 {0 300} 3} {32 {0 295 300} 0} {33 {0 295 300} 0} {34 {0 295 300} 0} {35 {0 295 300} 0} {36 {0 295 300} 0} {37 {0 295 300} 0} {38 {0 295 300} 0}} + 8 {{0 0 1}} + 97 {{50 {0 300} 3} {57 {0 300} 3}} + 9 {{41 0 1} {43 0 1} {42 300 0}} + 98 {{43 0 3}} + 24,trans {} + 99 {{60 {0 300} 4}} + 43,trans {} + 62,trans {} + 81,trans {} + 99,trans {} + 113,trans {{296 119}} + 23,trans {} + 42,trans {} + 61,trans {} + 79,trans {} + 80,trans {} + 98,trans {} + 9,trans {{309 17}} + 112,trans {} + 22,trans {} + 41,trans {} + 59,trans {} + 60,trans {} + 78,trans {} + 97,trans {{295 110}} + 8,trans {} + 111,trans {} + 100 {{55 {0 300} 4} {62 {0 300} 4}} + 101 {{61 {0 300} 4}} + 102 {{75 {0 300} 3}} + 103 {{69 {0 300} 3} {71 {0 300} 3} {76 {0 300} 3} {78 {0 300} 3} {32 {0 296 300} 0} {33 {0 296 300} 0} {34 {0 296 300} 0} {35 {0 296 300} 0} {36 {0 296 300} 0} {37 {0 296 300} 0} {38 {0 296 300} 0}} + 104 {{70 {0 300} 3} {77 {0 300} 3}} + 105 {{64 {0 300} 3}} + 21,trans {} + 106 {{65 {0 300} 3} {67 {0 300} 3} {72 {0 300} 3} {74 {0 300} 3} {32 {0 295 300} 0} {33 {0 295 300} 0} {34 {0 295 300} 0} {35 {0 295 300} 0} {36 {0 295 300} 0} {37 {0 295 300} 0} {38 {0 295 300} 0}} + 39,trans {} + 40,trans {} + 107 {{66 {0 300} 3} {73 {0 300} 3}} + 108 {{56 {0 300} 4}} + 58,trans {} + 110 {{57 {0 300} 4}} + 109 {{51 {0 300} 4} {58 {0 300} 4}} + 77,trans {} + 111 {{62 {0 300} 5}} + 96,trans {{288 88} {289 89} {290 90} {291 91} {292 92} {293 93} {294 94} {295 108} {306 109}} + 7,trans {{297 14} {298 15} {307 16}} + 112 {{76 {0 300} 4}} + 113 {{71 {0 300} 4} {78 {0 300} 4}} + 110,trans {} + 109,trans {{295 118}} + 114 {{77 {0 300} 4}} + 115 {{72 {0 300} 4}} + 116 {{67 {0 300} 4} {74 {0 300} 4}} + 117 {{73 {0 300} 4}} + 118 {{58 {0 300} 5}} + 120 {{74 {0 300} 5}} + 119 {{78 {0 300} 5}} + 19,trans {} + 20,trans {} + 38,trans {} + 57,trans {} + 76,trans {} + 95,trans {} + 6,trans {{297 1} {298 2} {299 11} {307 12} {311 13}} + 108,trans {} + 18,trans {} + 37,trans {} + 56,trans {{257 57} {258 58} {259 59} {260 60} {261 61} {262 62} {263 63} {264 64} {265 65} {266 66} {267 67} {268 68} {269 69} {270 70} {271 71} {272 72} {273 73} {274 74} {275 75} {276 76} {277 77} {278 78} {279 79} {280 80} {281 81} {282 82} {283 83} {284 84} {285 85} {286 86} {287 87} {288 88} {289 89} {290 90} {291 91} {292 92} {293 93} {294 94} {304 105} {305 106} {306 107}} + 75,trans {} + 94,trans {} + 5,trans {} + 107,trans {{295 117}} + 17,trans {{300 98}} + 36,trans {} + 55,trans {{261 18} {262 19} {263 20} {264 21} {265 22} {266 23} {267 24} {268 25} {269 26} {270 27} {271 28} {272 29} {273 30} {274 31} {275 32} {276 33} {277 34} {278 35} {279 36} {280 37} {281 38} {282 39} {283 40} {284 41} {285 42} {286 43} {287 44} {288 45} {289 46} {290 47} {291 48} {292 49} {293 50} {294 51} {296 102} {305 103} {306 104}} + 74,trans {} + 93,trans {} + 4,trans {} + 106,trans {{288 88} {289 89} {290 90} {291 91} {292 92} {293 93} {294 94} {295 115} {306 116}} + 16,trans {{257 57} {258 58} {259 59} {260 60} {261 61} {262 62} {263 63} {264 64} {265 65} {266 66} {267 67} {268 68} {269 69} {270 70} {271 71} {272 72} {273 73} {274 74} {275 75} {276 76} {277 77} {278 78} {279 79} {280 80} {281 81} {282 82} {283 83} {284 84} {285 85} {286 86} {287 87} {288 88} {289 89} {290 90} {291 91} {292 92} {293 93} {294 94} {304 95} {305 96} {306 97}} + 35,trans {} + 54,trans {{296 101}} + 73,trans {} + 92,trans {} + 3,trans {{299 10}} + 105,trans {} + 15,trans {} + 34,trans {} + 53,trans {{288 45} {289 46} {290 47} {291 48} {292 49} {293 50} {294 51} {296 99} {306 100}} + 72,trans {} + 91,trans {} + 2,trans {} + 104,trans {{296 114}} + 14,trans {} + 33,trans {} + 52,trans {} + 71,trans {} + 90,trans {} + 89,trans {} + 1,trans {} + 103,trans {{288 45} {289 46} {290 47} {291 48} {292 49} {293 50} {294 51} {296 112} {306 113}} + 13,trans {} + 32,trans {} + 51,trans {} + 69,trans {} + 70,trans {} + 88,trans {} + 0,trans {{297 1} {298 2} {299 3} {301 4} {302 5} {303 6} {307 7} {308 8} {310 9}} + 102,trans {} + 12,trans {{297 14} {298 15} {307 56}} + 31,trans {} + 49,trans {} + 50,trans {} + 68,trans {} + 87,trans {} + 101,trans {} + 120,trans {} + 119,trans {} + 10 {{52 {0 300} 2} {53 {0 300} 2} {54 {0 300} 2} {55 {0 300} 2} {59 {0 300} 2} {60 {0 300} 2} {61 {0 300} 2} {62 {0 300} 2} {5 {0 288 289 290 291 292 293 294 296 300} 0} {6 {0 288 289 290 291 292 293 294 296 300} 0} {7 {0 288 289 290 291 292 293 294 296 300} 0} {8 {0 288 289 290 291 292 293 294 296 300} 0} {9 {0 288 289 290 291 292 293 294 296 300} 0} {10 {0 288 289 290 291 292 293 294 296 300} 0} {11 {0 288 289 290 291 292 293 294 296 300} 0} {12 {0 288 289 290 291 292 293 294 296 300} 0} {13 {0 288 289 290 291 292 293 294 296 300} 0} {14 {0 288 289 290 291 292 293 294 296 300} 0} {15 {0 288 289 290 291 292 293 294 296 300} 0} {16 {0 288 289 290 291 292 293 294 296 300} 0} {17 {0 288 289 290 291 292 293 294 296 300} 0} {18 {0 288 289 290 291 292 293 294 296 300} 0} {19 {0 288 289 290 291 292 293 294 296 300} 0} {20 {0 288 289 290 291 292 293 294 296 300} 0} {21 {0 288 289 290 291 292 293 294 296 300} 0} {22 {0 288 289 290 291 292 293 294 296 300} 0} {23 {0 288 289 290 291 292 293 294 296 300} 0} {24 {0 288 289 290 291 292 293 294 296 300} 0} {25 {0 288 289 290 291 292 293 294 296 300} 0} {26 {0 288 289 290 291 292 293 294 296 300} 0} {27 {0 288 289 290 291 292 293 294 296 300} 0} {28 {0 288 289 290 291 292 293 294 296 300} 0} {29 {0 288 289 290 291 292 293 294 296 300} 0} {30 {0 288 289 290 291 292 293 294 296 300} 0} {31 {0 288 289 290 291 292 293 294 296 300} 0} {32 {0 296 300} 0} {33 {0 296 300} 0} {34 {0 296 300} 0} {35 {0 296 300} 0} {36 {0 296 300} 0} {37 {0 296 300} 0} {38 {0 296 300} 0}} + 11 {{68 {0 300} 1} {69 {0 300} 1} {70 {0 300} 1} {71 {0 300} 1} {75 {0 300} 1} {76 {0 300} 1} {77 {0 300} 1} {78 {0 300} 1}} + 12 {{63 {0 300} 1} {64 {0 300} 1} {65 {0 300} 1} {66 {0 300} 1} {67 {0 300} 1} {72 {0 300} 1} {73 {0 300} 1} {74 {0 300} 1} {39 {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 285 286 287 288 289 290 291 292 293 294 300} 0} {40 {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 285 286 287 288 289 290 291 292 293 294 300} 0}} + 13 {{46 {0 300} 2}} + 14 {{39 {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 285 286 287 288 289 290 291 292 293 294 300} 1}} + 15 {{40 {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 285 286 287 288 289 290 291 292 293 294 300} 1}} + 11,trans {{299 55}} + 16 {{47 {0 300} 2} {48 {0 300} 2} {49 {0 300} 2} {50 {0 300} 2} {51 {0 300} 2} {56 {0 300} 2} {57 {0 300} 2} {58 {0 300} 2} {1 {0 300} 0} {2 {0 300} 0} {3 {0 300} 0} {4 {0 300} 0} {5 {0 288 289 290 291 292 293 294 295 300} 0} {6 {0 288 289 290 291 292 293 294 295 300} 0} {7 {0 288 289 290 291 292 293 294 295 300} 0} {8 {0 288 289 290 291 292 293 294 295 300} 0} {9 {0 288 289 290 291 292 293 294 295 300} 0} {10 {0 288 289 290 291 292 293 294 295 300} 0} {11 {0 288 289 290 291 292 293 294 295 300} 0} {12 {0 288 289 290 291 292 293 294 295 300} 0} {13 {0 288 289 290 291 292 293 294 295 300} 0} {14 {0 288 289 290 291 292 293 294 295 300} 0} {15 {0 288 289 290 291 292 293 294 295 300} 0} {16 {0 288 289 290 291 292 293 294 295 300} 0} {17 {0 288 289 290 291 292 293 294 295 300} 0} {18 {0 288 289 290 291 292 293 294 295 300} 0} {19 {0 288 289 290 291 292 293 294 295 300} 0} {20 {0 288 289 290 291 292 293 294 295 300} 0} {21 {0 288 289 290 291 292 293 294 295 300} 0} {22 {0 288 289 290 291 292 293 294 295 300} 0} {23 {0 288 289 290 291 292 293 294 295 300} 0} {24 {0 288 289 290 291 292 293 294 295 300} 0} {25 {0 288 289 290 291 292 293 294 295 300} 0} {26 {0 288 289 290 291 292 293 294 295 300} 0} {27 {0 288 289 290 291 292 293 294 295 300} 0} {28 {0 288 289 290 291 292 293 294 295 300} 0} {29 {0 288 289 290 291 292 293 294 295 300} 0} {30 {0 288 289 290 291 292 293 294 295 300} 0} {31 {0 288 289 290 291 292 293 294 295 300} 0} {32 {0 295 300} 0} {33 {0 295 300} 0} {34 {0 295 300} 0} {35 {0 295 300} 0} {36 {0 295 300} 0} {37 {0 295 300} 0} {38 {0 295 300} 0}} + 29,trans {} + 30,trans {} + 17 {{43 0 2}} + 48,trans {} + 18 {{5 {0 288 289 290 291 292 293 294 296 300} 1}} + 67,trans {} + 86,trans {} + 20 {{7 {0 288 289 290 291 292 293 294 296 300} 1}} + 19 {{6 {0 288 289 290 291 292 293 294 296 300} 1}} + 21 {{8 {0 288 289 290 291 292 293 294 296 300} 1}} + 22 {{9 {0 288 289 290 291 292 293 294 296 300} 1}} + 100,trans {{296 111}} + 23 {{10 {0 288 289 290 291 292 293 294 296 300} 1}} + 118,trans {} + 24 {{11 {0 288 289 290 291 292 293 294 296 300} 1}} + 25 {{12 {0 288 289 290 291 292 293 294 296 300} 1}} + 26 {{13 {0 288 289 290 291 292 293 294 296 300} 1}} + 27 {{14 {0 288 289 290 291 292 293 294 296 300} 1}} + 28 {{15 {0 288 289 290 291 292 293 294 296 300} 1}} + 30 {{17 {0 288 289 290 291 292 293 294 296 300} 1}} + 29 {{16 {0 288 289 290 291 292 293 294 296 300} 1}} + 31 {{18 {0 288 289 290 291 292 293 294 296 300} 1}} + 32 {{19 {0 288 289 290 291 292 293 294 296 300} 1}} + 10,trans {{261 18} {262 19} {263 20} {264 21} {265 22} {266 23} {267 24} {268 25} {269 26} {270 27} {271 28} {272 29} {273 30} {274 31} {275 32} {276 33} {277 34} {278 35} {279 36} {280 37} {281 38} {282 39} {283 40} {284 41} {285 42} {286 43} {287 44} {288 45} {289 46} {290 47} {291 48} {292 49} {293 50} {294 51} {296 52} {305 53} {306 54}} + 33 {{20 {0 288 289 290 291 292 293 294 296 300} 1}} + 28,trans {} + 34 {{21 {0 288 289 290 291 292 293 294 296 300} 1}} + 47,trans {} +} + +array set pan::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 44 + 302,line 61 + 288 FK4_ + 265,title WCSD + 289 B1950_ + 290 FK5_ + 300 STRING_ + 284,title WCSW + 291 J2000_ + 301 CLOSE_ + 292 ICRS_ + 302 OPEN_ + 288,line 40 + 293 GALACTIC_ + 303 TO_ + 304 coordsys + 294 ECLIPTIC_ + 305 wcssys + 295 DEGREES_ + 306 skyframe + 296 SEXAGESIMAL_ + 307 numeric + 262,t 0 + 297 INT_ + 308 command + 285,line 36 + 298 REAL_ + 310 pan + 309 @PSEUDO1 + 299 SEXSTR_ + 311 panto + 283,t 0 + 312 start' + 282,line 33 + 264,title WCSC + 283,title WCSV + 312,title {} + 278,line 29 + error,line 109 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 1 + 297,t 0 + 262,line 13 + 262,title WCSA + 0 {$} + 0,t 0 + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title sexagesimal + 258,line 8 + 273,t 0 + 304,t 1 + 294,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title float + 291,t 0 + 301,t 0 + 311,line 181 + 307,line 151 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 51 + 278,title WCSQ + 307,title {} + 297,title integer + 287,t 0 + 304,line 110 + 294,line 46 + 291,line 43 + 301,line 60 + error,title {} + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title {} + 296,title SEXAGESIMAL + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title {} + 295,title DEGREES + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 304,title {} + 294,title ECLIPTIC + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 1 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GALACTIC + 303,title TO + 271,t 0 + error error + 292,t 0 + 302,t 0 + 273,title WCSL + 292,title ICRS + 302,title OPEN + 267,t 0 + 310,line 159 + 309,line 156 + 299,line 54 + 288,t 0 + 306,line 143 + 296,line 49 + 272,title WCSK + 291,title J2000 + 293,line 45 + 301,title CLOSE + 303,line 62 + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 56 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title B1950 + 290,title FK5 + 300,title string + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title FK4 + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 199 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 155 + 276 WCSO_ + 298,line 52 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 115 + 282 WCSU_ + 295,line 48 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc pan::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ $1 } + 40 { set _ $1 } + 42 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 44 { PanZoomDialog } + 45 { PanZoomDestroyDialog } + 47 { Pan $1 $2 physical fk5 } + 48 { Pan $1 $2 $3 fk5 } + 49 { Pan $1 $2 $3 fk5 } + 50 { Pan $1 $2 wcs $3 } + 51 { Pan $1 $2 $3 $4 } + 52 { Pan $1 $2 wcs fk5 } + 53 { Pan $1 $2 $3 fk5 } + 54 { Pan $1 $2 wcs $3 } + 55 { Pan $1 $2 $3 $4 } + 56 { Pan $1 $2 $3 fk5 } + 57 { Pan $1 $2 wcs $3 } + 58 { Pan $1 $2 $3 $4 } + 59 { Pan $1 $2 wcs fk5 } + 60 { Pan $1 $2 $3 fk5 } + 61 { Pan $1 $2 wcs $3 } + 62 { Pan $1 $2 $3 $4 } + 63 { PanTo $1 $2 physical fk5 } + 64 { PanTo $1 $2 $3 fk5 } + 65 { PanTo $1 $2 $3 fk5 } + 66 { PanTo $1 $2 wcs $3 } + 67 { PanTo $1 $2 $3 $4 } + 68 { PanTo $1 $2 wcs fk5 } + 69 { PanTo $1 $2 $3 fk5 } + 70 { PanTo $1 $2 wcs $3 } + 71 { PanTo $1 $2 $3 $4 } + 72 { PanTo $1 $2 $3 fk5 } + 73 { PanTo $1 $2 wcs $3 } + 74 { PanTo $1 $2 $3 $4 } + 75 { PanTo $1 $2 wcs fk5 } + 76 { PanTo $1 $2 $3 fk5 } + 77 { PanTo $1 $2 wcs $3 } + 78 { PanTo $1 $2 $3 $4 } + } + 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 pan::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/pansendlex.tcl b/ds9/parsers/pansendlex.tcl new file mode 100644 index 0000000..de373c4 --- /dev/null +++ b/ds9/parsers/pansendlex.tcl @@ -0,0 +1,686 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval pansend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc pansend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc pansend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc pansend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc pansend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc pansend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc pansend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc pansend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc pansend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc pansend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $IMAGE_ + } + 1 { +return $PHYSICAL_ + } + 2 { +return $AMPLIFIER_ + } + 3 { +return $DETECTOR_ + } + 4 { +return $WCS_ + } + 5 { +return $WCSA_ + } + 6 { +return $WCSB_ + } + 7 { +return $WCSC_ + } + 8 { +return $WCSD_ + } + 9 { +return $WCSE_ + } + 10 { +return $WCSF_ + } + 11 { +return $WCSG_ + } + 12 { +return $WCSH_ + } + 13 { +return $WCSI_ + } + 14 { +return $WCSJ_ + } + 15 { +return $WCSK_ + } + 16 { +return $WCSL_ + } + 17 { +return $WCSM_ + } + 18 { +return $WCSN_ + } + 19 { +return $WCSO_ + } + 20 { +return $WCSP_ + } + 21 { +return $WCSQ_ + } + 22 { +return $WCSR_ + } + 23 { +return $WCSS_ + } + 24 { +return $WCST_ + } + 25 { +return $WCSU_ + } + 26 { +return $WCSV_ + } + 27 { +return $WCSW_ + } + 28 { +return $WCSX_ + } + 29 { +return $WCSY_ + } + 30 { +return $WCSZ_ + } + 31 { +return $FK4_ + } + 32 { +return $FK4_ + } + 33 { +return $FK5_ + } + 34 { +return $FK5_ + } + 35 { +return $ICRS_ + } + 36 { +return $GALACTIC_ + } + 37 { +return $ECLIPTIC_ + } + 38 { +return $DEGREES_ + } + 39 { +return $SEXAGESIMAL_ + } + 40 { +# ignore whitespace + } + 41 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + + diff --git a/ds9/parsers/pansendparser.tab.tcl b/ds9/parsers/pansendparser.tab.tcl new file mode 100644 index 0000000..7caae20 --- /dev/null +++ b/ds9/parsers/pansendparser.tab.tcl @@ -0,0 +1,40 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set FK4_ 288 +set B1950_ 289 +set FK5_ 290 +set J2000_ 291 +set ICRS_ 292 +set GALACTIC_ 293 +set ECLIPTIC_ 294 +set DEGREES_ 295 +set SEXAGESIMAL_ 296 diff --git a/ds9/parsers/pansendparser.tcl b/ds9/parsers/pansendparser.tcl new file mode 100644 index 0000000..f158e92 --- /dev/null +++ b/ds9/parsers/pansendparser.tcl @@ -0,0 +1,1422 @@ +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 pansend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc pansend::YYABORT {} { + return -code return 1 +} + +proc pansend::YYACCEPT {} { + return -code return 0 +} + +proc pansend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc pansend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc pansend::yyerror {s} { + puts stderr $s +} + +proc pansend::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 pansend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set pansend::table { + 31:294,target 31 + 21:290 reduce + 21:289 reduce + 21:291 reduce + 21:292 reduce + 14:295,target 14 + 30:290,target 30 + 30:289,target 30 + 29:290,target 29 + 29:289,target 29 + 27:0 reduce + 21:293 reduce + 9:292,target 9 + 21:294 reduce + 21:295 reduce + 13:291,target 13 + 9:288 reduce + 48:0 reduce + 21:296 reduce + 20:294,target 20 + 19:294,target 19 + 9:289 reduce + 9:290 reduce + 30:288 reduce + 29:288 reduce + 9:291 reduce + 30:290 reduce + 30:289 reduce + 29:290 reduce + 29:289 reduce + 9:292 reduce + 30:291 reduce + 29:291 reduce + 18:290,target 18 + 18:289,target 18 + 9:293 reduce + 30:292 reduce + 29:292 reduce + 25:293,target 25 + 5:295,target 5 + 9:294 reduce + 32:296,target 32 + 30:293 reduce + 29:293 reduce + 0:275,target 19 + 6:0,target 6 + 9:295 reduce + 30:294 reduce + 29:294 reduce + 9:296 reduce + 2:0 reduce + 30:295 reduce + 29:295 reduce + 24:288,target 24 + 31:292,target 31 + 30:296 reduce + 29:296 reduce + 37:295,target 37 + 24:0 reduce + 14:293,target 14 + 48:0,target 48 + 21:296,target 21 + 9:289,target 9 + 9:290,target 9 + 41:0,target 44 + 45:0 reduce + 33:0,target 33 + 13:288,target 13 + 25:0,target 25 + 20:292,target 20 + 19:292,target 19 + 0:294,target 38 + 38:295 reduce + 26:295,target 26 + 17:0,target 17 + 38:296 reduce + 10:0,target 10 + 10:296,target 10 + 25:291,target 25 + 5:293,target 5 + 0:273,target 17 + 15:295,target 15 + 31:290,target 31 + 31:289,target 31 + 17:288 reduce + 21:0 reduce + 17:290 reduce + 17:289 reduce + 17:291 reduce + 14:291,target 14 + 21:294,target 21 + 17:292 reduce + 42:0 accept + 17:293 reduce + 17:294 reduce + 20:290,target 20 + 20:289,target 20 + 19:290,target 19 + 19:289,target 19 + 17:295 reduce + 0:292,target 36 + 6:288 reduce + 26:293,target 26 + 17:296 reduce + 6:289 reduce + 6:290 reduce + 6:295,target 6 + 33:296,target 33 + 26:288 reduce + 6:291 reduce + 40:299,target 45 + 26:290 reduce + 26:289 reduce + 10:294,target 10 + 6:292 reduce + 26:291 reduce + 25:288,target 25 + 5:291,target 5 + 6:293 reduce + 26:292 reduce + 0:271,target 15 + 6:294 reduce + 38:295,target 38 + 26:293 reduce + 6:295 reduce + 26:294 reduce + 15:293,target 15 + 6:296 reduce + 26:295 reduce + 22:296,target 22 + 17:0 reduce + 26:296 reduce + 14:288,target 14 + 38:0 reduce + 21:292,target 21 + 27:295,target 27 + 11:296,target 11 + 0:289,target 33 + 0:290,target 34 + 3:0,target 3 + 26:291,target 26 + 6:293,target 6 + 35:295 reduce + 35:296 reduce + 10:292,target 10 + 16:295,target 16 + 5:288,target 5 + 0:268,target 12 + 45:0,target 45 + 45:296,target 44 + 37:0,target 37 + 15:291,target 15 + 14:0 reduce + 30:0,target 30 + 29:0,target 29 + 22:294,target 22 + 22:0,target 22 + 14:288 reduce + 35:0 reduce + 14:290 reduce + 14:289 reduce + 14:0,target 14 + 21:290,target 21 + 21:289,target 21 + 14:291 reduce + 27:293,target 27 + 14:292 reduce + 7:295,target 7 + 34:296,target 34 + 14:293 reduce + 14:294 reduce + 11:294,target 11 + 0:287,target 31 + 26:288,target 26 + 14:295 reduce + 6:291,target 6 + 14:296 reduce + 0:257 shift + 40:295,target 43 + 23:288 reduce + 10:290,target 10 + 10:289,target 10 + 0:258 shift + 23:290 reduce + 23:289 reduce + 16:293,target 16 + 0:260 shift + 0:259 shift + 23:296,target 23 + 23:291 reduce + 0:266,target 10 + 0:261 shift + 9:0 reduce + 23:292 reduce + 11:0 reduce + 0:262 shift + 23:293 reduce + 15:288,target 15 + 0:263 shift + 23:294 reduce + 22:292,target 22 + 0:264 shift + 32:0 reduce + 28:295,target 28 + 23:295 reduce + 0:265 shift + 23:296 reduce + 0:266 shift + 12:296,target 12 + 0:267 shift + 27:291,target 27 + 0:268 shift + 7:293,target 7 + 0:270 shift + 0:269 shift + 11:292,target 11 + 0:271 shift + 0:285,target 29 + 17:295,target 17 + 0:272 shift + 6:288,target 6 + 0:273 shift + 40:293,target 37 + 32:295 reduce + 0:274 shift + 32:296 reduce + 16:291,target 16 + 0:275 shift + 6:0 reduce + 23:294,target 23 + 0:264,target 8 + 0:276 shift + 41:300 goto + 0:277 shift + 0:278 shift + 28:0 reduce + 22:290,target 22 + 22:289,target 22 + 0:279 shift + 0:280 shift + 7:0,target 7 + 28:293,target 28 + 0:0,target 41 + 0:281 shift + 8:295,target 8 + 35:296,target 35 + 11:288 reduce + 0:282 shift + 41:295 shift + 12:294,target 12 + 11:290 reduce + 11:289 reduce + 0:283 shift + 41:296 shift + 27:288,target 27 + 11:291 reduce + 0:284 shift + 7:291,target 7 + 11:292 reduce + 0:285 shift + 41:295,target 43 + 11:293 reduce + 11:290,target 11 + 11:289,target 11 + 0:283,target 27 + 0:286 shift + 42:0,target 0 + 17:293,target 17 + 11:294 reduce + 0:287 shift + 34:0,target 34 + 24:296,target 24 + 11:295 reduce + 0:288 shift + 40:291,target 35 + 26:0,target 26 + 11:296 reduce + 0:289 shift + 0:290 shift + 3:0 reduce + 20:288 reduce + 19:288 reduce + 18:0,target 18 + 16:288,target 16 + 0:301 goto + 0:291 shift + 23:292,target 23 + 20:290 reduce + 20:289 reduce + 19:290 reduce + 19:289 reduce + 11:0,target 11 + 0:262,target 6 + 0:292 shift + 30:295,target 30 + 29:295,target 29 + 20:291 reduce + 19:291 reduce + 0:293 shift + 45:300,target 48 + 25:0 reduce + 20:292 reduce + 19:292 reduce + 0:294 shift + 20:293 reduce + 19:293 reduce + 13:296,target 13 + 28:291,target 28 + 20:294 reduce + 19:294 reduce + 8:293,target 8 + 46:0 reduce + 20:295 reduce + 19:295 reduce + 0:297 goto + 8:288 reduce + 20:296 reduce + 19:296 reduce + 12:292,target 12 + 0:298 goto + 8:289 reduce + 8:290 reduce + 28:288 reduce + 18:295,target 18 + 0:299 goto + 7:288,target 7 + 8:291 reduce + 28:290 reduce + 28:289 reduce + 8:292 reduce + 28:291 reduce + 0:281,target 25 + 8:293 reduce + 28:292 reduce + 17:291,target 17 + 8:294 reduce + 28:293 reduce + 24:294,target 24 + 0:0 reduce + 8:295 reduce + 40:288,target 32 + 28:294 reduce + 8:296 reduce + 28:295 reduce + 28:296 reduce + 23:290,target 23 + 23:289,target 23 + 0:260,target 4 + 0:259,target 3 + 30:293,target 30 + 29:293,target 29 + 22:0 reduce + 9:295,target 9 + 36:296,target 36 + 13:294,target 13 + 43:0 reduce + 28:288,target 28 + 0:299,target 41 + 8:291,target 8 + 12:290,target 12 + 12:289,target 12 + 37:295 reduce + 18:293,target 18 + 37:296 reduce + 25:296,target 25 + 0:278,target 22 + 17:288,target 17 + 24:292,target 24 + 31:295,target 31 + 4:0,target 4 + 18:0 reduce + 16:288 reduce + 14:296,target 14 + 0:257,target 1 + 30:291,target 30 + 29:291,target 29 + 16:290 reduce + 16:289 reduce + 9:293,target 9 + 16:291 reduce + 40:0 reduce + 39:0 reduce + 16:292 reduce + 13:292,target 13 + 46:0,target 46 + 20:295,target 20 + 19:295,target 19 + 16:293 reduce + 0:297,target 39 + 8:288,target 8 + 38:0,target 38 + 16:294 reduce + 31:0,target 31 + 16:295 reduce + 5:288 reduce + 23:0,target 23 + 18:291,target 18 + 16:296 reduce + 5:289 reduce + 5:290 reduce + 25:294,target 25 + 25:288 reduce + 15:0,target 15 + 5:291 reduce + 5:296,target 5 + 25:290 reduce + 25:289 reduce + 0:276,target 20 + 5:292 reduce + 25:291 reduce + 5:293 reduce + 25:292 reduce + 24:290,target 24 + 24:289,target 24 + 5:294 reduce + 31:293,target 31 + 25:293 reduce + 5:295 reduce + 37:296,target 37 + 25:294 reduce + 15:0 reduce + 5:296 reduce + 25:295 reduce + 14:294,target 14 + 30:288,target 30 + 29:288,target 29 + 25:296 reduce + 9:291,target 9 + 36:0 reduce + 13:290,target 13 + 13:289,target 13 + 20:293,target 20 + 19:293,target 19 + 26:296,target 26 + 18:288,target 18 + 34:295 reduce + 25:292,target 25 + 5:294,target 5 + 34:296 reduce + 32:295,target 32 + 0:274,target 18 + 15:296,target 15 + 31:291,target 31 + 12:0 reduce + 14:292,target 14 + 33:0 reduce + 21:295,target 21 + 13:288 reduce + 9:288,target 9 + 13:290 reduce + 13:289 reduce + 13:291 reduce + 20:291,target 20 + 19:291,target 19 + 13:292 reduce + 0:293,target 37 + 26:294,target 26 + 13:293 reduce + 6:296,target 6 + 13:294 reduce + 8:0,target 8 + 13:295 reduce + 10:295,target 10 + 1:0,target 1 + 25:290,target 25 + 25:289,target 25 + 13:296 reduce + 5:292,target 5 + 22:288 reduce + 0:272,target 16 + 38:296,target 38 + 22:290 reduce + 22:289 reduce + 7:0 reduce + 22:291 reduce + 15:294,target 15 + 31:288,target 31 + 22:292 reduce + 43:0,target 39 + 22:293 reduce + 35:0,target 35 + 30:0 reduce + 29:0 reduce + 22:294 reduce + 14:290,target 14 + 14:289,target 14 + 27:0,target 27 + 22:295 reduce + 21:293,target 21 + 27:296,target 27 + 22:296 reduce + 20:0,target 20 + 19:0,target 19 + 31:288 reduce + 12:0,target 12 + 31:290 reduce + 31:289 reduce + 20:288,target 20 + 19:288,target 19 + 0:301,target 42 + 0:291,target 35 + 31:291 reduce + 26:292,target 26 + 6:294,target 6 + 33:295,target 33 + 31:292 reduce + 31:293 reduce + 10:293,target 10 + 31:294 reduce + 16:296,target 16 + 5:289,target 5 + 5:290,target 5 + 31:295 reduce + 0:270,target 14 + 0:269,target 13 + 4:0 reduce + 31:296 reduce + 40:288 shift + 15:292,target 15 + 40:290 shift + 40:289 shift + 40:300 goto + 22:295,target 22 + 40:291 shift + 26:0 reduce + 40:292 shift + 40:293 shift + 21:291,target 21 + 47:0 reduce + 40:294 shift + 27:294,target 27 + 10:288 reduce + 7:296,target 7 + 40:295 shift + 10:290 reduce + 10:289 reduce + 40:296 shift + 11:295,target 11 + 10:291 reduce + 0:288,target 32 + 26:290,target 26 + 26:289,target 26 + 10:292 reduce + 6:292,target 6 + 10:293 reduce + 40:296,target 44 + 40:299 goto + 10:294 reduce + 10:291,target 10 + 16:294,target 16 + 10:295 reduce + 1:0 reduce + 10:296 reduce + 0:267,target 11 + 18:288 reduce + 45:295,target 43 + 18:290 reduce + 18:289 reduce + 15:290,target 15 + 15:289,target 15 + 23:0 reduce + 22:293,target 22 + 18:291 reduce + 28:296,target 28 + 18:292 reduce + 18:293 reduce + 44:0 reduce + 21:288,target 21 + 18:294 reduce + 5:0,target 5 + 27:292,target 27 + 18:295 reduce + 7:288 reduce + 7:294,target 7 + 34:295,target 34 + 18:296 reduce + 7:289 reduce + 7:290 reduce + 27:288 reduce + 11:293,target 11 + 0:286,target 30 + 7:291 reduce + 27:290 reduce + 27:289 reduce + 17:296,target 17 + 6:289,target 6 + 6:290,target 6 + 7:292 reduce + 27:291 reduce + 7:293 reduce + 47:0,target 47 + 40:294,target 38 + 27:292 reduce + 10:288,target 10 + 7:294 reduce + 40:0,target 43 + 39:0,target 42 + 27:293 reduce + 16:292,target 16 + 7:295 reduce + 32:0,target 32 + 27:294 reduce + 23:295,target 23 + 0:265,target 9 + 7:296 reduce + 27:295 reduce + 24:0,target 24 + 27:296 reduce + 20:0 reduce + 19:0 reduce + 16:0,target 16 + 22:291,target 22 + 28:294,target 28 + 8:296,target 8 + 41:0 reduce + 12:295,target 12 + 27:290,target 27 + 27:289,target 27 + 7:292,target 7 + 41:296,target 44 + 36:295 reduce + 11:291,target 11 + 0:284,target 28 + 36:296 reduce + 17:294,target 17 + 45:300 goto + 40:292,target 36 + 16:290,target 16 + 16:289,target 16 + 23:293,target 23 + 0:263,target 7 + 30:296,target 30 + 29:296,target 29 + 16:0 reduce + 15:288 reduce + 45:295 shift + 22:288,target 22 + 15:290 reduce + 15:289 reduce + 45:296 shift + 37:0 reduce + 28:292,target 28 + 15:291 reduce + 8:294,target 8 + 35:295,target 35 + 15:292 reduce + 15:293 reduce + 12:293,target 12 + 18:296,target 18 + 15:294 reduce + 7:289,target 7 + 7:290,target 7 + 15:295 reduce + 15:296 reduce + 11:288,target 11 + 0:282,target 26 + 24:288 reduce + 17:292,target 17 + 24:295,target 24 + 24:290 reduce + 24:289 reduce + 40:290,target 34 + 40:289,target 33 + 40:300,target 46 + 24:291 reduce + 24:292 reduce + 24:293 reduce + 23:291,target 23 + 13:0 reduce + 0:261,target 5 + 9:0,target 9 + 30:294,target 30 + 29:294,target 29 + 24:294 reduce + 9:296,target 9 + 2:0,target 2 + 24:295 reduce + 34:0 reduce + 24:296 reduce + 13:295,target 13 + 28:290,target 28 + 28:289,target 28 + 8:292,target 8 + 12:291,target 12 + 44:0,target 40 + 18:294,target 18 + 36:0,target 36 + 28:0,target 28 + 0:279,target 23 + 0:280,target 24 + 33:295 reduce + 21:0,target 21 + 17:290,target 17 + 17:289,target 17 + 33:296 reduce + 24:293,target 24 + 13:0,target 13 + 31:296,target 31 + 8:0 reduce + 10:0 reduce + 23:288,target 23 + 0:258,target 2 + 30:292,target 30 + 29:292,target 29 + 9:294,target 9 + 36:295,target 36 + 31:0 reduce + 13:293,target 13 + 12:288 reduce + 20:296,target 20 + 19:296,target 19 + 12:290 reduce + 12:289 reduce + 0:298,target 40 + 8:289,target 8 + 8:290,target 8 + 12:291 reduce + 12:292 reduce + 12:288,target 12 + 18:292,target 18 + 12:293 reduce + 25:295,target 25 + 12:294 reduce + 41:300,target 47 + 12:295 reduce + 0:277,target 21 + 12:296 reduce + 24:291,target 24 + 21:288 reduce + 5:0 reduce +} + +array set pansend::rules { + 9,l 298 + 11,l 298 + 32,l 299 + 6,l 298 + 28,l 298 + 3,l 297 + 25,l 298 + 46,l 301 + 0,l 302 + 22,l 298 + 43,l 301 + 18,l 298 + 40,l 300 + 39,l 300 + 15,l 298 + 36,l 299 + 12,l 298 + 33,l 299 + 7,l 298 + 29,l 298 + 30,l 298 + 4,l 297 + 26,l 298 + 47,l 301 + 1,l 297 + 23,l 298 + 44,l 301 + 19,l 298 + 20,l 298 + 41,l 301 + 16,l 298 + 37,l 299 + 13,l 298 + 34,l 299 + 8,l 298 + 10,l 298 + 31,l 298 + 5,l 298 + 27,l 298 + 48,l 301 + 2,l 297 + 24,l 298 + 45,l 301 + 21,l 298 + 42,l 301 + 17,l 298 + 38,l 299 + 14,l 298 + 35,l 299 +} + +array set pansend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 0 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 3 +} + +array set pansend::rules { + 41,line 147 + 7,line 108 + 37,line 139 + 4,line 104 + 34,line 136 + 1,line 101 + 31,line 132 + 27,line 128 + 24,line 125 + 21,line 122 + 17,line 118 + 14,line 115 + 11,line 112 + 46,line 152 + 43,line 149 + 9,line 110 + 40,line 143 + 39,line 142 + 6,line 107 + 36,line 138 + 3,line 103 + 33,line 135 + 29,line 130 + 30,line 131 + 26,line 127 + 23,line 124 + 19,line 120 + 20,line 121 + 16,line 117 + 13,line 114 + 10,line 111 + 48,line 154 + 45,line 151 + 42,line 148 + 8,line 109 + 38,line 140 + 5,line 106 + 35,line 137 + 2,line 102 + 32,line 134 + 28,line 129 + 25,line 126 + 22,line 123 + 18,line 119 + 15,line 116 + 12,line 113 + 47,line 153 + 44,line 150 +} + +array set pansend::lr1_table { + 35 {{35 {0 295 296} 1}} + 14,trans {} + 36 {{36 {0 295 296} 1}} + 33,trans {} + 37 {{37 {0 295 296} 1}} + 38 {{38 {0 295 296} 1}} + 39 {{42 0 1}} + 40 {{43 0 1} {45 0 1} {46 0 1} {48 0 1} {32 {0 295 296} 0} {33 {0 295 296} 0} {34 {0 295 296} 0} {35 {0 295 296} 0} {36 {0 295 296} 0} {37 {0 295 296} 0} {38 {0 295 296} 0} {39 0 0} {40 0 0}} + 18,trans {} + 41 {{44 0 1} {47 0 1} {39 0 0} {40 0 0}} + 1,trans {} + 37,trans {} + 42 {{0 0 1}} + 43 {{39 0 1}} + 44 {{40 0 1}} + 45 {{45 0 2} {48 0 2} {39 0 0} {40 0 0}} + 23,trans {} + 5,trans {} + 42,trans {} + 46 {{46 0 2}} + 47 {{47 0 2}} + 48 {{48 0 3}} + 27,trans {} + 9,trans {} + 46,trans {} + 13,trans {} + 32,trans {} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {297 39} {298 40} {299 41} {301 42}} + 36,trans {} + 22,trans {} + 4,trans {} + 41,trans {{295 43} {296 44} {300 47}} + 26,trans {} + 8,trans {} + 45,trans {{295 43} {296 44} {300 48}} + 12,trans {} + 31,trans {} + 16,trans {} + 35,trans {} + 21,trans {} + 3,trans {} + 40,trans {{288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {294 38} {295 43} {296 44} {299 45} {300 46}} + 39,trans {} + 10 {{10 {0 288 289 290 291 292 293 294 295 296} 1}} + 11 {{11 {0 288 289 290 291 292 293 294 295 296} 1}} + 25,trans {} + 7,trans {} + 12 {{12 {0 288 289 290 291 292 293 294 295 296} 1}} + 44,trans {} + 13 {{13 {0 288 289 290 291 292 293 294 295 296} 1}} + 14 {{14 {0 288 289 290 291 292 293 294 295 296} 1}} + 11,trans {} + 15 {{15 {0 288 289 290 291 292 293 294 295 296} 1}} + 30,trans {} + 29,trans {} + 16 {{16 {0 288 289 290 291 292 293 294 295 296} 1}} + 48,trans {} + 0 {{0 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 {0 288 289 290 291 292 293 294 295 296} 0} {6 {0 288 289 290 291 292 293 294 295 296} 0} {7 {0 288 289 290 291 292 293 294 295 296} 0} {8 {0 288 289 290 291 292 293 294 295 296} 0} {9 {0 288 289 290 291 292 293 294 295 296} 0} {10 {0 288 289 290 291 292 293 294 295 296} 0} {11 {0 288 289 290 291 292 293 294 295 296} 0} {12 {0 288 289 290 291 292 293 294 295 296} 0} {13 {0 288 289 290 291 292 293 294 295 296} 0} {14 {0 288 289 290 291 292 293 294 295 296} 0} {15 {0 288 289 290 291 292 293 294 295 296} 0} {16 {0 288 289 290 291 292 293 294 295 296} 0} {17 {0 288 289 290 291 292 293 294 295 296} 0} {18 {0 288 289 290 291 292 293 294 295 296} 0} {19 {0 288 289 290 291 292 293 294 295 296} 0} {20 {0 288 289 290 291 292 293 294 295 296} 0} {21 {0 288 289 290 291 292 293 294 295 296} 0} {22 {0 288 289 290 291 292 293 294 295 296} 0} {23 {0 288 289 290 291 292 293 294 295 296} 0} {24 {0 288 289 290 291 292 293 294 295 296} 0} {25 {0 288 289 290 291 292 293 294 295 296} 0} {26 {0 288 289 290 291 292 293 294 295 296} 0} {27 {0 288 289 290 291 292 293 294 295 296} 0} {28 {0 288 289 290 291 292 293 294 295 296} 0} {29 {0 288 289 290 291 292 293 294 295 296} 0} {30 {0 288 289 290 291 292 293 294 295 296} 0} {31 {0 288 289 290 291 292 293 294 295 296} 0} {32 {0 295 296} 0} {33 {0 295 296} 0} {34 {0 295 296} 0} {35 {0 295 296} 0} {36 {0 295 296} 0} {37 {0 295 296} 0} {38 {0 295 296} 0}} + 17 {{17 {0 288 289 290 291 292 293 294 295 296} 1}} + 1 {{1 0 1}} + 18 {{18 {0 288 289 290 291 292 293 294 295 296} 1}} + 15,trans {} + 2 {{2 0 1}} + 19 {{19 {0 288 289 290 291 292 293 294 295 296} 1}} + 20 {{20 {0 288 289 290 291 292 293 294 295 296} 1}} + 34,trans {} + 3 {{3 0 1}} + 21 {{21 {0 288 289 290 291 292 293 294 295 296} 1}} + 4 {{4 0 1}} + 22 {{22 {0 288 289 290 291 292 293 294 295 296} 1}} + 5 {{5 {0 288 289 290 291 292 293 294 295 296} 1}} + 23 {{23 {0 288 289 290 291 292 293 294 295 296} 1}} + 20,trans {} + 19,trans {} + 6 {{6 {0 288 289 290 291 292 293 294 295 296} 1}} + 24 {{24 {0 288 289 290 291 292 293 294 295 296} 1}} + 2,trans {} + 38,trans {} + 7 {{7 {0 288 289 290 291 292 293 294 295 296} 1}} + 25 {{25 {0 288 289 290 291 292 293 294 295 296} 1}} + 8 {{8 {0 288 289 290 291 292 293 294 295 296} 1}} + 26 {{26 {0 288 289 290 291 292 293 294 295 296} 1}} + 9 {{9 {0 288 289 290 291 292 293 294 295 296} 1}} + 27 {{27 {0 288 289 290 291 292 293 294 295 296} 1}} + 24,trans {} + 6,trans {} + 28 {{28 {0 288 289 290 291 292 293 294 295 296} 1}} + 43,trans {} + 29 {{29 {0 288 289 290 291 292 293 294 295 296} 1}} + 30 {{30 {0 288 289 290 291 292 293 294 295 296} 1}} + 31 {{31 {0 288 289 290 291 292 293 294 295 296} 1}} + 10,trans {} + 32 {{32 {0 295 296} 1}} + 28,trans {} + 33 {{33 {0 295 296} 1}} + 47,trans {} + 34 {{34 {0 295 296} 1}} +} + +array set pansend::token_id_table { + 286,t 0 + 286 WCSY_ + 280,title WCSS + 279,title WCSR + 264,line 15 + 302,line 155 + 298,title {} + 292,line 44 + 287 WCSZ_ + 270,t 0 + 269,t 0 + 288 FK4_ + 300 skyformat + 290 FK5_ + 289 B1950_ + 276,line 27 + 265,title WCSD + 301,t 1 + 301 pansend + 291,t 0 + 291 J2000_ + 284,title WCSW + 302 start' + 292 ICRS_ + 274,t 0 + 261,line 12 + 293 GALACTIC_ + 288,line 40 + 257,t 0 + 294 ECLIPTIC_ + 270,title WCSI + 269,title WCSH + 295,t 0 + 295 DEGREES_ + 288,title FK4 + 273,line 24 + 296 SEXAGESIMAL_ + 278,t 0 + 297 coordsys + 257,line 7 + 262,t 0 + 298 wcssys + 285,line 36 + 274,title WCSM + 299,t 1 + 299 skyframe + 293,title GALACTIC + 283,t 0 + 270,line 21 + 269,line 20 + 297,line 100 + 259,title AMPLIFIER + 260,title DETECTOR + 266,t 0 + 278,title WCSQ + 297,title {} + 282,line 33 + 287,t 0 + error error + 271,t 0 + 264,title WCSC + 266,line 17 + 294,line 46 + 283,title WCSV + 302,t 1 + 292,t 0 + 278,line 29 + error,line 99 + 275,t 0 + 268,title WCSG + 287,title WCSZ + 258,t 0 + 263,line 14 + 301,line 146 + error,title {} + 291,line 43 + 296,t 0 + 280,t 0 + 279,t 0 + 275,line 26 + 273,title WCSL + 302,title {} + 292,title ICRS + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 38 + 258,title PHYSICAL + 284,t 0 + 277,title WCSP + 296,title SEXAGESIMAL + 272,line 23 + 267,t 0 + 299,line 133 + 263,title WCSB + 288,t 0 + 284,line 35 + 282,title WCSU + 272,t 0 + 268,line 19 + 296,line 49 + 267,title WCSF + 293,t 0 + 286,title WCSY + 257 IMAGE_ + 281,line 32 + 276,t 0 + 258 PHYSICAL_ + 259,t 0 + 259 AMPLIFIER_ + 260 DETECTOR_ + 260,t 0 + 272,title WCSK + 261 WCS_ + 265,line 16 + 301,title {} + 297,t 1 + 293,line 45 + 291,title J2000 + 262 WCSA_ + 281,t 0 + 263 WCSB_ + 277,line 28 + 257,title IMAGE + 264 WCSC_ + 264,t 0 + 276,title WCSO + 265 WCSD_ + 295,title DEGREES + 262,line 13 + 266 WCSE_ + 300,line 141 + 290,line 42 + 289,line 41 + 285,t 0 + 267 WCSF_ + 0,t 0 + 0 {$} + 262,title WCSA + 268 WCSG_ + 268,t 0 + 281,title WCST + 274,line 25 + 270 WCSI_ + 269 WCSH_ + 299,title {} + error,t 0 + 271 WCSJ_ + 300,t 1 + 290,t 0 + 289,t 0 + 272 WCSK_ + 258,line 8 + 286,line 37 + 273,t 0 + 273 WCSL_ + 266,title WCSE + 285,title WCSX + 274 WCSM_ + 275 WCSN_ + 271,line 22 + 298,line 105 + 294,t 0 + 276 WCSO_ + 277,t 0 + 277 WCSP_ + 271,title WCSJ + 300,title {} + 290,title FK5 + 289,title B1950 + 283,line 34 + 278 WCSQ_ + 261,t 0 + 280 WCSS_ + 279 WCSR_ + 298,t 1 + 281 WCST_ + 267,line 18 + 295,line 48 + 282,t 0 + 282 WCSU_ + 275,title WCSN + 294,title ECLIPTIC + 283 WCSV_ + 265,t 0 + 284 WCSW_ + 280,line 31 + 279,line 30 + 285 WCSX_ + 261,title WCS +} + +proc pansend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 32 { set _ fk4 } + 33 { set _ fk4 } + 34 { set _ fk5 } + 35 { set _ fk5 } + 36 { set _ icrs } + 37 { set _ galactic } + 38 { set _ ecliptic } + 39 { set _ degrees } + 40 { set _ sexagesimal } + 41 { ProcessSendCmdCurrent "get cursor physical fk5 degrees" } + 42 { ProcessSendCmdCurrent "get cursor $1 fk5 degrees" } + 43 { ProcessSendCmdCurrent "get cursor $1 fk5 degrees" } + 44 { ProcessSendCmdCurrent "get cursor wcs $1 degrees" } + 45 { ProcessSendCmdCurrent "get cursor $1 $2 degrees" } + 46 { ProcessSendCmdCurrent "get cursor $1 fk5 $2" } + 47 { ProcessSendCmdCurrent "get cursor wcs $1 $2" } + 48 { ProcessSendCmdCurrent "get cursor $1 $2 $3" } + } + 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 pansend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/photolex.tcl b/ds9/parsers/photolex.tcl new file mode 100644 index 0000000..9e6621e --- /dev/null +++ b/ds9/parsers/photolex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval photo { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc photo::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc photo::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc photo::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc photo::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc photo::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc photo::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc photo::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc photo::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc photo::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 +set SLICE_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NEW_ + } + 1 { +return $SLICE_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/photoparser.tab.tcl b/ds9/parsers/photoparser.tab.tcl new file mode 100644 index 0000000..593beac --- /dev/null +++ b/ds9/parsers/photoparser.tab.tcl @@ -0,0 +1,3 @@ +set STRING_ 257 +set NEW_ 258 +set SLICE_ 259 diff --git a/ds9/parsers/photoparser.tcl b/ds9/parsers/photoparser.tcl new file mode 100644 index 0000000..5168c4a --- /dev/null +++ b/ds9/parsers/photoparser.tcl @@ -0,0 +1,314 @@ +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 photo { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc photo::YYABORT {} { + return -code return 1 +} + +proc photo::YYACCEPT {} { + return -code return 0 +} + +proc photo::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc photo::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc photo::yyerror {s} { + puts stderr $s +} + +proc photo::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 photo::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set photo::table { + 6:0 reduce + 3:0,target 0 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 2 + 2:257 reduce + 0:259 shift + 0:260 goto + 0:261 goto + 1:257,target 5 + 0:258,target 1 + 0:262 goto + 5:257 shift + 0:0,target 4 + 0:261,target 4 + 2:0,target 6 + 5:257,target 6 + 4:0,target 1 + 0:0 reduce + 6:0,target 3 + 1:0 reduce + 0:257,target 4 + 2:0 reduce + 3:0 accept + 2:257,target 6 + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 5 + 5:0 reduce + 0:262,target 5 +} + +array set photo::rules { + 0,l 263 + 1,l 260 + 2,l 261 + 3,l 261 + 4,l 262 + 5,l 262 + 6,l 262 +} + +array set photo::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 6,dc 1 + 1,dc 1 + 3,dc 2 +} + +array set photo::rules { + 5,line 26 + 2,line 21 + 4,line 25 + 6,line 27 + 1,line 18 + 3,line 22 +} + +array set photo::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0}} + 1 {{5 {0 257} 1}} + 2 {{6 {0 257} 1}} + 3 {{0 0 1}} + 4 {{1 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5}} + 5 {{2 0 1} {3 0 1}} + 1,trans {} + 2,trans {} + 6 {{3 0 2}} + 3,trans {} + 4,trans {} + 5,trans {{257 6}} + 6,trans {} +} + +array set photo::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 20 + error,line 15 + 257 STRING_ + 257,t 0 + 263,line 28 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 SLICE_ + 259,t 0 + 261,t 1 + 261 photo + 262,t 1 + 262 opts + 257,line 7 + 263,t 1 + 263 start' + 260,line 17 + 257,title string + 259,line 12 + 258,title NEW + 262,line 24 + 260,title {} + 259,title SLICE + 261,title {} +} + +proc photo::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 { + 2 { PhotoCmdLoad {} $1 } + 3 { PhotoCmdLoad $2 $1 } + 5 { CreateFrame; set _ {} } + 6 { set _ slice } + } + 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 photo::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/pixeltablelex.tcl b/ds9/parsers/pixeltablelex.tcl new file mode 100644 index 0000000..be435e3 --- /dev/null +++ b/ds9/parsers/pixeltablelex.tcl @@ -0,0 +1,374 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval pixeltable { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc pixeltable::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc pixeltable::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc pixeltable::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc pixeltable::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc pixeltable::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc pixeltable::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc pixeltable::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc pixeltable::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc pixeltable::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set CLOSE_ 264 +set OPEN_ 265 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $OPEN_ + } + 2 { +return $YES_ + } + 3 { +return $NO_ + } + 4 { +return $ON_ + } + 5 { +return $OFF_ + } + 6 { +return $TRUE_ + } + 7 { +return $FALSE_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval $yytext; return $STRING_ + } + 12 { +# ignore whitespace + } + 13 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/pixeltableparser.tab.tcl b/ds9/parsers/pixeltableparser.tab.tcl new file mode 100644 index 0000000..256442d --- /dev/null +++ b/ds9/parsers/pixeltableparser.tab.tcl @@ -0,0 +1,9 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set CLOSE_ 264 +set OPEN_ 265 diff --git a/ds9/parsers/pixeltableparser.tcl b/ds9/parsers/pixeltableparser.tcl new file mode 100644 index 0000000..a1c7c15 --- /dev/null +++ b/ds9/parsers/pixeltableparser.tcl @@ -0,0 +1,431 @@ +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 pixeltable { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc pixeltable::YYABORT {} { + return -code return 1 +} + +proc pixeltable::YYACCEPT {} { + return -code return 0 +} + +proc pixeltable::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc pixeltable::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc pixeltable::yyerror {s} { + puts stderr $s +} + +proc pixeltable::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 pixeltable::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set pixeltable::table { + 0:257 shift + 0:258 shift + 11:263,target 9 + 0:259 shift + 0:260 shift + 5:0,target 4 + 9:0 reduce + 0:266,target 9 + 0:261 shift + 11:268 goto + 11:0 reduce + 0:262 shift + 0:263 reduce + 0:264 shift + 7:263,target 13 + 0:265 shift + 2:263 reduce + 0:266 goto + 0:267 goto + 4:263 reduce + 0:265,target 8 + 2:263,target 5 + 6:263 reduce + 6:0,target 7 + 0:269 goto + 2:0 reduce + 8:263 reduce + 6:0 reduce + 0:264,target 7 + 7:0,target 13 + 0:0,target 11 + 5:263,target 4 + 10:0,target 0 + 0:263,target 11 + 12:263,target 13 + 8:0,target 12 + 3:0 reduce + 1:0,target 2 + 11:268,target 12 + 11:0,target 8 + 0:262,target 6 + 12:263 shift + 8:263,target 12 + 7:0 reduce + 3:263,target 3 + 13:0 reduce + 9:0,target 14 + 0:261,target 5 + 1:263 reduce + 2:0,target 5 + 3:263 reduce + 0:0 reduce + 5:263 reduce + 7:263 reduce + 0:259,target 3 + 0:260,target 4 + 9:263 reduce + 6:263,target 7 + 0:269,target 11 + 4:0 reduce + 3:0,target 3 + 13:0,target 10 + 1:263,target 2 + 8:0 reduce + 10:0 accept + 0:258,target 2 + 9:263,target 14 + 4:0,target 6 + 0:257,target 1 + 1:0 reduce + 0:267,target 10 + 4:263,target 6 + 11:263 reduce + 5:0 reduce +} + +array set pixeltable::rules { + 9,l 268 + 11,l 269 + 2,l 266 + 6,l 266 + 12,l 269 + 3,l 266 + 7,l 266 + 13,l 269 + 0,l 270 + 4,l 266 + 8,l 267 + 10,l 267 + 14,l 269 + 1,l 266 + 5,l 266 +} + +array set pixeltable::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 1 + 10,dc 3 + 6,dc 1 + 1,dc 0 + 13,dc 1 + 9,dc 0 + 4,dc 1 + 11,dc 0 + 7,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set pixeltable::rules { + 13,line 47 + 7,line 38 + 10,line 42 + 4,line 35 + 1,line 32 + 9,line 41 + 12,line 46 + 6,line 37 + 3,line 34 + 14,line 48 + 8,line 41 + 11,line 45 + 5,line 36 + 2,line 33 + 9,e 1 +} + +array set pixeltable::lr1_table { + 13,trans {} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 263} 0} {12 {0 263} 0} {13 {0 263} 0} {14 {0 263} 0} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0}} + 1 {{2 {0 263} 1}} + 2 {{5 {0 263} 1}} + 3 {{3 {0 263} 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {266 9} {267 10} {269 11}} + 4 {{6 {0 263} 1}} + 1,trans {} + 5 {{4 {0 263} 1}} + 2,trans {} + 6 {{7 {0 263} 1}} + 3,trans {} + 7 {{13 {0 263} 1}} + 4,trans {} + 8 {{12 {0 263} 1}} + 5,trans {} + 9 {{14 {0 263} 1}} + 10 {{0 0 1}} + 6,trans {} + 11 {{8 0 1} {10 0 1} {9 263 0}} + 12 {{10 0 2}} + 7,trans {} + 13 {{10 0 3}} + 8,trans {} + 10,trans {} + 9,trans {} + 11,trans {{268 12}} + 12,trans {{263 13}} +} + +array set pixeltable::token_id_table { + 264,line 18 + 270,t 1 + 269,t 1 + 265,title OPEN + 261,line 11 + 257,t 0 + 270,title {} + 269,title {} + 257,line 7 + 262,t 0 + 270,line 49 + 269,line 44 + 259,title ON + 260,title OFF + 266,t 1 + 264,title CLOSE + error error + 266,line 31 + 268,title {} + error,line 30 + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 267,t 1 + 263,title string + 268,line 41 + 267,title {} + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 261 TRUE_ + 265,line 19 + 262 FALSE_ + 263 STRING_ + 257,title YES + 264 CLOSE_ + 264,t 0 + 265 OPEN_ + 262,line 12 + 266 yesno + 267 command + 268,t 1 + 268 @PSEUDO1 + 262,title FALSE + 0 {$} + 0,t 0 + 270 start' + 269 pixeltable + error,t 0 + 258,line 8 + 266,title {} + 261,t 0 + 267,line 40 + 265,t 0 + 261,title TRUE +} + +proc pixeltable::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { PixelTableDialog } + 12 { PixelTableDialog } + 13 { PixelTableDestroyDialog } + 14 { PixelTableCmd $1 } + } + 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 pixeltable::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/plotlex.tcl b/ds9/parsers/plotlex.tcl new file mode 100644 index 0000000..b9b9d3e --- /dev/null +++ b/ds9/parsers/plotlex.tcl @@ -0,0 +1,1854 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval plot { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc plot::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc plot::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc plot::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc plot::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc plot::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc plot::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc plot::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc plot::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc plot::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set INT_ 275 +set REAL_ 276 +set STRING_ 277 +set A4_ 278 +set ALIGNED_ 279 +set ARROW_ 280 +set AUTO_ 281 +set AXESNUMBERS_ 282 +set AXESTITLE_ 283 +set AXIS_ 284 +set BAR_ 285 +set BARMODE_ 286 +set BOTTOM_ 287 +set CAP_ 288 +set CATROM_ 289 +set CIRCLE_ 290 +set CLEAR_ 291 +set CLOSE_ 292 +set COLOR_ 293 +set COMMAND_ 294 +set CROSS_ 295 +set CUBIC_ 296 +set DASH_ 297 +set DATA_ 298 +set DATASET_ 299 +set DESTINATION_ 300 +set DIAMOND_ 301 +set DISCRETE_ 302 +set DUP_ 303 +set DUPLICATE_ 304 +set ERROR_ 305 +set ERRORBAR_ 306 +set FAMILY_ 307 +set FILE_ 308 +set FILENAME_ 309 +set FILL_ 310 +set FILLCOLOR_ 311 +set FLAT_ 312 +set FLIP_ 313 +set FORMAT_ 314 +set GRAPH_ 315 +set GRAY_ 316 +set GRID_ 317 +set GROOVE_ 318 +set LABELS_ 319 +set LANDSCAPE_ 320 +set LEFT_ 321 +set LEGAL_ 322 +set LEGEND_ 323 +set LEGENDTITLE_ 324 +set LETTER_ 325 +set LINE_ 326 +set LINEAR_ 327 +set LIST_ 328 +set LOAD_ 329 +set LOADCONFIG_ 330 +set LOG_ 331 +set MAX_ 332 +set MIN_ 333 +set MODE_ 334 +set NAME_ 335 +set NEW_ 336 +set NUMBERS_ 337 +set ORIENT_ 338 +set ORIENTATION_ 339 +set OVERLAP_ 340 +set PAGE_ 341 +set PAGESETUP_ 342 +set PAGESIZE_ 343 +set PALETTE_ 344 +set PLUS_ 345 +set POINTER_ 346 +set PORTRAIT_ 347 +set POSITION_ 348 +set POSTER_ 349 +set PRINT_ 350 +set PRINTER_ 351 +set QUADRATIC_ 352 +set RAISED_ 353 +set RANGE_ 354 +set RELIEF_ 355 +set RGB_ 356 +set RIGHT_ 357 +set SAVE_ 358 +set SAVECONFIG_ 359 +set SCALE_ 360 +set SCATTER_ 361 +set SCROSS_ 362 +set SELECT_ 363 +set SHAPE_ 364 +set SHOW_ 365 +set SIZE_ 366 +set SLANT_ 367 +set SMOOTH_ 368 +set SOLID_ 369 +set SPLUS_ 370 +set SQUARE_ 371 +set STACKED_ 372 +set STATS_ 373 +set STATISTICS_ 374 +set STEP_ 375 +set STDIN_ 376 +set STYLE_ 377 +set SUNKEN_ 378 +set TABLOID_ 379 +set TITLE_ 380 +set TOP_ 381 +set TRIANGLE_ 382 +set TYPE_ 383 +set VIEW_ 384 +set WEIGHT_ 385 +set WIDTH_ 386 +set ZOOM_ 387 +set XY_ 388 +set XYEX_ 389 +set XYEY_ 390 +set XYEXEY_ 391 +set LINEARLINEAR_ 392 +set LOGLINEAR_ 393 +set LINEARLOG_ 394 +set LOGLOG_ 395 +set XAXIS_ 396 +set YAXIS_ 397 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: a4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(a4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: aligned + if {[regexp -start $index_ -indices -line -nocase -- {\A(aligned)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: arrow + if {[regexp -start $index_ -indices -line -nocase -- {\A(arrow)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: auto + if {[regexp -start $index_ -indices -line -nocase -- {\A(auto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: axesnumbers + if {[regexp -start $index_ -indices -line -nocase -- {\A(axesnumbers)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: axestitle + if {[regexp -start $index_ -indices -line -nocase -- {\A(axestitle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: axis + if {[regexp -start $index_ -indices -line -nocase -- {\A(axis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: bar + if {[regexp -start $index_ -indices -line -nocase -- {\A(bar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: barmode + if {[regexp -start $index_ -indices -line -nocase -- {\A(barmode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: bottom + if {[regexp -start $index_ -indices -line -nocase -- {\A(bottom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: cap + if {[regexp -start $index_ -indices -line -nocase -- {\A(cap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: catrom + if {[regexp -start $index_ -indices -line -nocase -- {\A(catrom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: circle + if {[regexp -start $index_ -indices -line -nocase -- {\A(circle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: command + if {[regexp -start $index_ -indices -line -nocase -- {\A(command)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: cross + if {[regexp -start $index_ -indices -line -nocase -- {\A(cross)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: cubic + if {[regexp -start $index_ -indices -line -nocase -- {\A(cubic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: dash + if {[regexp -start $index_ -indices -line -nocase -- {\A(dash)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: data + if {[regexp -start $index_ -indices -line -nocase -- {\A(data)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: dataset + if {[regexp -start $index_ -indices -line -nocase -- {\A(dataset)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: destination + if {[regexp -start $index_ -indices -line -nocase -- {\A(destination)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: diamond + if {[regexp -start $index_ -indices -line -nocase -- {\A(diamond)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: discrete + if {[regexp -start $index_ -indices -line -nocase -- {\A(discrete)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: dup + if {[regexp -start $index_ -indices -line -nocase -- {\A(dup)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: duplicate + if {[regexp -start $index_ -indices -line -nocase -- {\A(duplicate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: error + if {[regexp -start $index_ -indices -line -nocase -- {\A(error)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: errorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(errorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: family + if {[regexp -start $index_ -indices -line -nocase -- {\A(family)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: file + if {[regexp -start $index_ -indices -line -nocase -- {\A(file)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: fill + if {[regexp -start $index_ -indices -line -nocase -- {\A(fill)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: fillcolor + if {[regexp -start $index_ -indices -line -nocase -- {\A(fillcolor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: flat + if {[regexp -start $index_ -indices -line -nocase -- {\A(flat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: flip + if {[regexp -start $index_ -indices -line -nocase -- {\A(flip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: format + if {[regexp -start $index_ -indices -line -nocase -- {\A(format)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: graph + if {[regexp -start $index_ -indices -line -nocase -- {\A(graph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: gray + if {[regexp -start $index_ -indices -line -nocase -- {\A(gray)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: groove + if {[regexp -start $index_ -indices -line -nocase -- {\A(groove)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: labels + if {[regexp -start $index_ -indices -line -nocase -- {\A(labels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: landscape + if {[regexp -start $index_ -indices -line -nocase -- {\A(landscape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: left + if {[regexp -start $index_ -indices -line -nocase -- {\A(left)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: legal + if {[regexp -start $index_ -indices -line -nocase -- {\A(legal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: legend + if {[regexp -start $index_ -indices -line -nocase -- {\A(legend)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: legendtitle + if {[regexp -start $index_ -indices -line -nocase -- {\A(legendtitle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: letter + if {[regexp -start $index_ -indices -line -nocase -- {\A(letter)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: line + if {[regexp -start $index_ -indices -line -nocase -- {\A(line)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: linear + if {[regexp -start $index_ -indices -line -nocase -- {\A(linear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: list + if {[regexp -start $index_ -indices -line -nocase -- {\A(list)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: loadconfig + if {[regexp -start $index_ -indices -line -nocase -- {\A(loadconfig)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: log + if {[regexp -start $index_ -indices -line -nocase -- {\A(log)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: max + if {[regexp -start $index_ -indices -line -nocase -- {\A(max)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: min + if {[regexp -start $index_ -indices -line -nocase -- {\A(min)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: normal + if {[regexp -start $index_ -indices -line -nocase -- {\A(normal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: numbers + if {[regexp -start $index_ -indices -line -nocase -- {\A(numbers)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: orient + if {[regexp -start $index_ -indices -line -nocase -- {\A(orient)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: orientation + if {[regexp -start $index_ -indices -line -nocase -- {\A(orientation)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: overlap + if {[regexp -start $index_ -indices -line -nocase -- {\A(overlap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: page + if {[regexp -start $index_ -indices -line -nocase -- {\A(page)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: pagesetup + if {[regexp -start $index_ -indices -line -nocase -- {\A(pagesetup)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: pagesize + if {[regexp -start $index_ -indices -line -nocase -- {\A(pagesize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: palette + if {[regexp -start $index_ -indices -line -nocase -- {\A(palette)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: plus + if {[regexp -start $index_ -indices -line -nocase -- {\A(plus)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: pointer + if {[regexp -start $index_ -indices -line -nocase -- {\A(pointer)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: portrait + if {[regexp -start $index_ -indices -line -nocase -- {\A(portrait)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: position + if {[regexp -start $index_ -indices -line -nocase -- {\A(position)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: poster + if {[regexp -start $index_ -indices -line -nocase -- {\A(poster)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: print + if {[regexp -start $index_ -indices -line -nocase -- {\A(print)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: printer + if {[regexp -start $index_ -indices -line -nocase -- {\A(printer)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: quadratic + if {[regexp -start $index_ -indices -line -nocase -- {\A(quadratic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: raised + if {[regexp -start $index_ -indices -line -nocase -- {\A(raised)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: range + if {[regexp -start $index_ -indices -line -nocase -- {\A(range)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: relief + if {[regexp -start $index_ -indices -line -nocase -- {\A(relief)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + # rule 80: rgb + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 80 + } + # rule 81: right + if {[regexp -start $index_ -indices -line -nocase -- {\A(right)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 81 + } + # rule 82: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 82 + } + # rule 83: saveconfig + if {[regexp -start $index_ -indices -line -nocase -- {\A(saveconfig)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 83 + } + # rule 84: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 84 + } + # rule 85: scatter + if {[regexp -start $index_ -indices -line -nocase -- {\A(scatter)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 85 + } + # rule 86: scross + if {[regexp -start $index_ -indices -line -nocase -- {\A(scross)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 86 + } + # rule 87: select + if {[regexp -start $index_ -indices -line -nocase -- {\A(select)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 87 + } + # rule 88: shape + if {[regexp -start $index_ -indices -line -nocase -- {\A(shape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 88 + } + # rule 89: show + if {[regexp -start $index_ -indices -line -nocase -- {\A(show)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 89 + } + # rule 90: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 90 + } + # rule 91: slant + if {[regexp -start $index_ -indices -line -nocase -- {\A(slant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 91 + } + # rule 92: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 92 + } + # rule 93: solid + if {[regexp -start $index_ -indices -line -nocase -- {\A(solid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 93 + } + # rule 94: splus + if {[regexp -start $index_ -indices -line -nocase -- {\A(splus)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 94 + } + # rule 95: square + if {[regexp -start $index_ -indices -line -nocase -- {\A(square)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 95 + } + # rule 96: stacked + if {[regexp -start $index_ -indices -line -nocase -- {\A(stacked)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 96 + } + # rule 97: stats + if {[regexp -start $index_ -indices -line -nocase -- {\A(stats)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 97 + } + # rule 98: statistics + if {[regexp -start $index_ -indices -line -nocase -- {\A(statistics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 98 + } + # rule 99: step + if {[regexp -start $index_ -indices -line -nocase -- {\A(step)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 99 + } + # rule 100: stdin + if {[regexp -start $index_ -indices -line -nocase -- {\A(stdin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 100 + } + # rule 101: style + if {[regexp -start $index_ -indices -line -nocase -- {\A(style)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 101 + } + # rule 102: sunken + if {[regexp -start $index_ -indices -line -nocase -- {\A(sunken)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 102 + } + # rule 103: tabloid + if {[regexp -start $index_ -indices -line -nocase -- {\A(tabloid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 103 + } + # rule 104: title + if {[regexp -start $index_ -indices -line -nocase -- {\A(title)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 104 + } + # rule 105: top + if {[regexp -start $index_ -indices -line -nocase -- {\A(top)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 105 + } + # rule 106: triangle + if {[regexp -start $index_ -indices -line -nocase -- {\A(triangle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 106 + } + # rule 107: type + if {[regexp -start $index_ -indices -line -nocase -- {\A(type)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 107 + } + # rule 108: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 108 + } + # rule 109: weight + if {[regexp -start $index_ -indices -line -nocase -- {\A(weight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 109 + } + # rule 110: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 110 + } + # rule 111: zoom + if {[regexp -start $index_ -indices -line -nocase -- {\A(zoom)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 111 + } + # rule 112: xy + if {[regexp -start $index_ -indices -line -nocase -- {\A(xy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 112 + } + # rule 113: xyex + if {[regexp -start $index_ -indices -line -nocase -- {\A(xyex)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 113 + } + # rule 114: xyey + if {[regexp -start $index_ -indices -line -nocase -- {\A(xyey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 114 + } + # rule 115: xyexey + if {[regexp -start $index_ -indices -line -nocase -- {\A(xyexey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 115 + } + # rule 116: linearlinear + if {[regexp -start $index_ -indices -line -nocase -- {\A(linearlinear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 116 + } + # rule 117: loglinear + if {[regexp -start $index_ -indices -line -nocase -- {\A(loglinear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 117 + } + # rule 118: linearlog + if {[regexp -start $index_ -indices -line -nocase -- {\A(linearlog)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 118 + } + # rule 119: loglog + if {[regexp -start $index_ -indices -line -nocase -- {\A(loglog)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 119 + } + # rule 120: xaxis + if {[regexp -start $index_ -indices -line -nocase -- {\A(xaxis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 120 + } + # rule 121: yaxis + if {[regexp -start $index_ -indices -line -nocase -- {\A(yaxis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 121 + } + # rule 122: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 122 + } + # rule 123: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 123 + } + # rule 124: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 124 + } + # rule 125: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 125 + } + # rule 126: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 126 + } + # rule 127: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 127 + } + # rule 128: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 128 + } + # rule 129: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 129 + } + # rule 130: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 130 + } + # rule 131: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 131 + } + # rule 132: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 132 + } + # rule 133: times + if {[regexp -start $index_ -indices -line -nocase -- {\A(times)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 133 + } + # rule 134: helvetica + if {[regexp -start $index_ -indices -line -nocase -- {\A(helvetica)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 134 + } + # rule 135: courier + if {[regexp -start $index_ -indices -line -nocase -- {\A(courier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 135 + } + # rule 136: normal + if {[regexp -start $index_ -indices -line -nocase -- {\A(normal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 136 + } + # rule 137: bold + if {[regexp -start $index_ -indices -line -nocase -- {\A(bold)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 137 + } + # rule 138: roman + if {[regexp -start $index_ -indices -line -nocase -- {\A(roman)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 138 + } + # rule 139: italic + if {[regexp -start $index_ -indices -line -nocase -- {\A(italic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 139 + } + # rule 140: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 140 + } + # rule 141: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 141 + } + # rule 142: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 142 + } + # rule 143: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 143 + } + # rule 144: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 144 + } + # rule 145: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 145 + } + # rule 146: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 146 + } + # rule 147: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 147 + } + # rule 148: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 148 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $A4_ + } + 1 { +return $ALIGNED_ + } + 2 { +return $ARROW_ + } + 3 { +return $AUTO_ + } + 4 { +return $AXESNUMBERS_ + } + 5 { +return $AXESTITLE_ + } + 6 { +return $AXIS_ + } + 7 { +return $BAR_ + } + 8 { +return $BARMODE_ + } + 9 { +return $BOTTOM_ + } + 10 { +return $CAP_ + } + 11 { +return $CATROM_ + } + 12 { +return $CIRCLE_ + } + 13 { +return $CLEAR_ + } + 14 { +return $CLOSE_ + } + 15 { +return $COLOR_ + } + 16 { +return $COMMAND_ + } + 17 { +return $CROSS_ + } + 18 { +return $CUBIC_ + } + 19 { +return $DASH_ + } + 20 { +return $DATA_ + } + 21 { +return $DATASET_ + } + 22 { +return $DESTINATION_ + } + 23 { +return $DIAMOND_ + } + 24 { +return $DISCRETE_ + } + 25 { +return $DUP_ + } + 26 { +return $DUPLICATE_ + } + 27 { +return $ERROR_ + } + 28 { +return $ERRORBAR_ + } + 29 { +return $FAMILY_ + } + 30 { +return $FILE_ + } + 31 { +return $FILENAME_ + } + 32 { +return $FILL_ + } + 33 { +return $FILLCOLOR_ + } + 34 { +return $FLAT_ + } + 35 { +return $FLIP_ + } + 36 { +return $FONT_ + } + 37 { +return $FORMAT_ + } + 38 { +return $GRAPH_ + } + 39 { +return $GRAY_ + } + 40 { +return $GRID_ + } + 41 { +return $GROOVE_ + } + 42 { +return $LABELS_ + } + 43 { +return $LANDSCAPE_ + } + 44 { +return $LEFT_ + } + 45 { +return $LEGAL_ + } + 46 { +return $LEGEND_ + } + 47 { +return $LEGENDTITLE_ + } + 48 { +return $LETTER_ + } + 49 { +return $LINE_ + } + 50 { +return $LINEAR_ + } + 51 { +return $LIST_ + } + 52 { +return $LOAD_ + } + 53 { +return $LOADCONFIG_ + } + 54 { +return $LOG_ + } + 55 { +return $MAX_ + } + 56 { +return $MIN_ + } + 57 { +return $MODE_ + } + 58 { +return $NAME_ + } + 59 { +return $NORMAL_ + } + 60 { +return $NEW_ + } + 61 { +return $NUMBERS_ + } + 62 { +return $ORIENT_ + } + 63 { +return $ORIENTATION_ + } + 64 { +return $OVERLAP_ + } + 65 { +return $PAGE_ + } + 66 { +return $PAGESETUP_ + } + 67 { +return $PAGESIZE_ + } + 68 { +return $PALETTE_ + } + 69 { +return $PLUS_ + } + 70 { +return $POINTER_ + } + 71 { +return $PORTRAIT_ + } + 72 { +return $POSITION_ + } + 73 { +return $POSTER_ + } + 74 { +return $PRINT_ + } + 75 { +return $PRINTER_ + } + 76 { +return $QUADRATIC_ + } + 77 { +return $RAISED_ + } + 78 { +return $RANGE_ + } + 79 { +return $RELIEF_ + } + 80 { +return $RGB_ + } + 81 { +return $RIGHT_ + } + 82 { +return $SAVE_ + } + 83 { +return $SAVECONFIG_ + } + 84 { +return $SCALE_ + } + 85 { +return $SCATTER_ + } + 86 { +return $SCROSS_ + } + 87 { +return $SELECT_ + } + 88 { +return $SHAPE_ + } + 89 { +return $SHOW_ + } + 90 { +return $SIZE_ + } + 91 { +return $SLANT_ + } + 92 { +return $SMOOTH_ + } + 93 { +return $SOLID_ + } + 94 { +return $SPLUS_ + } + 95 { +return $SQUARE_ + } + 96 { +return $STACKED_ + } + 97 { +return $STATS_ + } + 98 { +return $STATISTICS_ + } + 99 { +return $STEP_ + } + 100 { +return $STDIN_ + } + 101 { +return $STYLE_ + } + 102 { +return $SUNKEN_ + } + 103 { +return $TABLOID_ + } + 104 { +return $TITLE_ + } + 105 { +return $TOP_ + } + 106 { +return $TRIANGLE_ + } + 107 { +return $TYPE_ + } + 108 { +return $VIEW_ + } + 109 { +return $WEIGHT_ + } + 110 { +return $WIDTH_ + } + 111 { +return $ZOOM_ + } + 112 { +return $XY_ + } + 113 { +return $XYEX_ + } + 114 { +return $XYEY_ + } + 115 { +return $XYEXEY_ + } + 116 { +return $LINEARLINEAR_ + } + 117 { +return $LOGLINEAR_ + } + 118 { +return $LINEARLOG_ + } + 119 { +return $LOGLOG_ + } + 120 { +return $XAXIS_ + } + 121 { +return $YAXIS_ + } + 122 { +return $YES_ + } + 123 { +return $NO_ + } + 124 { +return $ON_ + } + 125 { +return $OFF_ + } + 126 { +return $TRUE_ + } + 127 { +return $FALSE_ + } + 128 { +return $FONT_ + } + 129 { +return $FONTSIZE_ + } + 130 { +return $FONTSLANT_ + } + 131 { +return $FONTSTYLE_ + } + 132 { +return $FONTWEIGHT_ + } + 133 { +return $TIMES_ + } + 134 { +return $HELVETICA_ + } + 135 { +return $COURIER_ + } + 136 { +return $NORMAL_ + } + 137 { +return $BOLD_ + } + 138 { +return $ROMAN_ + } + 139 { +return $ITALIC_ + } + 140 { +set yylval $yytext; return $INT_ + } + 141 - + 142 { +set yylval $yytext; return $REAL_ + } + 143 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 144 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 145 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 146 { +set yylval $yytext; return $STRING_ + } + 147 { +# ignore whitespace + } + 148 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/plotparser.tab.tcl b/ds9/parsers/plotparser.tab.tcl new file mode 100644 index 0000000..37b7083 --- /dev/null +++ b/ds9/parsers/plotparser.tab.tcl @@ -0,0 +1,141 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set FONT_ 263 +set FONTSIZE_ 264 +set FONTSLANT_ 265 +set FONTSTYLE_ 266 +set FONTWEIGHT_ 267 +set TIMES_ 268 +set HELVETICA_ 269 +set COURIER_ 270 +set NORMAL_ 271 +set BOLD_ 272 +set ROMAN_ 273 +set ITALIC_ 274 +set INT_ 275 +set REAL_ 276 +set STRING_ 277 +set A4_ 278 +set ALIGNED_ 279 +set ARROW_ 280 +set AUTO_ 281 +set AXESNUMBERS_ 282 +set AXESTITLE_ 283 +set AXIS_ 284 +set BAR_ 285 +set BARMODE_ 286 +set BOTTOM_ 287 +set CAP_ 288 +set CATROM_ 289 +set CIRCLE_ 290 +set CLEAR_ 291 +set CLOSE_ 292 +set COLOR_ 293 +set COMMAND_ 294 +set CROSS_ 295 +set CUBIC_ 296 +set DASH_ 297 +set DATA_ 298 +set DATASET_ 299 +set DESTINATION_ 300 +set DIAMOND_ 301 +set DISCRETE_ 302 +set DUP_ 303 +set DUPLICATE_ 304 +set ERROR_ 305 +set ERRORBAR_ 306 +set FAMILY_ 307 +set FILE_ 308 +set FILENAME_ 309 +set FILL_ 310 +set FILLCOLOR_ 311 +set FLAT_ 312 +set FLIP_ 313 +set FORMAT_ 314 +set GRAPH_ 315 +set GRAY_ 316 +set GRID_ 317 +set GROOVE_ 318 +set LABELS_ 319 +set LANDSCAPE_ 320 +set LEFT_ 321 +set LEGAL_ 322 +set LEGEND_ 323 +set LEGENDTITLE_ 324 +set LETTER_ 325 +set LINE_ 326 +set LINEAR_ 327 +set LIST_ 328 +set LOAD_ 329 +set LOADCONFIG_ 330 +set LOG_ 331 +set MAX_ 332 +set MIN_ 333 +set MODE_ 334 +set NAME_ 335 +set NEW_ 336 +set NUMBERS_ 337 +set ORIENT_ 338 +set ORIENTATION_ 339 +set OVERLAP_ 340 +set PAGE_ 341 +set PAGESETUP_ 342 +set PAGESIZE_ 343 +set PALETTE_ 344 +set PLUS_ 345 +set POINTER_ 346 +set PORTRAIT_ 347 +set POSITION_ 348 +set POSTER_ 349 +set PRINT_ 350 +set PRINTER_ 351 +set QUADRATIC_ 352 +set RAISED_ 353 +set RANGE_ 354 +set RELIEF_ 355 +set RGB_ 356 +set RIGHT_ 357 +set SAVE_ 358 +set SAVECONFIG_ 359 +set SCALE_ 360 +set SCATTER_ 361 +set SCROSS_ 362 +set SELECT_ 363 +set SHAPE_ 364 +set SHOW_ 365 +set SIZE_ 366 +set SLANT_ 367 +set SMOOTH_ 368 +set SOLID_ 369 +set SPLUS_ 370 +set SQUARE_ 371 +set STACKED_ 372 +set STATS_ 373 +set STATISTICS_ 374 +set STEP_ 375 +set STDIN_ 376 +set STYLE_ 377 +set SUNKEN_ 378 +set TABLOID_ 379 +set TITLE_ 380 +set TOP_ 381 +set TRIANGLE_ 382 +set TYPE_ 383 +set VIEW_ 384 +set WEIGHT_ 385 +set WIDTH_ 386 +set ZOOM_ 387 +set XY_ 388 +set XYEX_ 389 +set XYEY_ 390 +set XYEXEY_ 391 +set LINEARLINEAR_ 392 +set LOGLINEAR_ 393 +set LINEARLOG_ 394 +set LOGLOG_ 395 +set XAXIS_ 396 +set YAXIS_ 397 diff --git a/ds9/parsers/plotparser.tcl b/ds9/parsers/plotparser.tcl new file mode 100644 index 0000000..8639ccd --- /dev/null +++ b/ds9/parsers/plotparser.tcl @@ -0,0 +1,5335 @@ +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 plot { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc plot::YYABORT {} { + return -code return 1 +} + +proc plot::YYACCEPT {} { + return -code return 0 +} + +proc plot::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc plot::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc plot::yyerror {s} { + puts stderr $s +} + +proc plot::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 plot::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set plot::table { + 257:0 reduce + 182:277,target 178 + 8:380,target 57 + 10:382 shift + 19:386,target 74 + 34:438 goto + 237:277,target 175 + 4:335 shift + 9:284 shift + 283:277,target 116 + 122:0,target 60 + 9:363,target 51 + 32:277,target 102 + 86:263 reduce + 77:277,target 212 + 56:257 shift + 1:311,target 33 + 9:286 shift + 172:277 reduce + 86:264 reduce + 56:258 shift + 86:265 reduce + 56:260 shift + 56:259 shift + 310:0 reduce + 309:0 reduce + 86:266 reduce + 56:261 shift + 28:285,target 105 + 86:267 reduce + 56:262 shift + 9:291 shift + 38:331,target 142 + 75:361 reduce + 9:292 shift + 9:303 shift + 9:293 shift + 9:304 shift + 39:398 goto + 40:398 goto + 135:0 reduce + 95:0,target 53 + 9:305 shift + 201:398,target 293 + 91:0 reduce + 9:306 shift + 233:260,target 117 + 233:259,target 116 + 161:379 shift + 96:333,target 55 + 9:297 shift + 112:277 reduce + 0:386,target 31 + 9:298 shift + 325:0,target 128 + 142:416,target 249 + 64:0,target 189 + 9:310 shift + 9:299 shift + 347:277 reduce + 9:311 shift + 200:262,target 119 + 177:0 reduce + 45:366 shift + 284:0,target 118 + 33:0,target 102 + 39:262,target 119 + 40:262,target 119 + 9:315 shift + 317:277 reduce + 56:277 reduce + 75:376 reduce + 253:0,target 220 + 230:0 reduce + 229:0 reduce + 96:281,target 55 + 166:351 shift + 137:277,target 87 + 4:361 reduce + 21:326 shift + 201:398 goto + 183:277,target 84 + 9:380,target 57 + 277:277 reduce + 238:277,target 176 + 26:277 reduce + 284:277,target 118 + 9:323 shift + 33:277,target 102 + 340:277,target 44 + 240:261,target 118 + 78:277,target 76 + 272:0 reduce + 21:0 reduce + 34:261,target 118 + 39:430 goto + 160:325,target 272 + 247:277 shift + 221:274,target 307 + 181:0,target 91 + 75:285,target 29 + 9:328 shift + 9:329 shift + 9:330 shift + 15:377 reduce + 86:307 reduce + 0:292,target 31 + 324:0 reduce + 150:0,target 71 + 149:0,target 80 + 92:263,target 219 + 63:0 reduce + 217:277 reduce + 202:398,target 294 + 9:334 shift + 97:333,target 235 + 4:376 reduce + 9:335 shift + 118:0,target 4 + 1:386,target 33 + 150:0 reduce + 149:0 reduce + 143:416,target 250 + 92:263 shift + 177:277 reduce + 92:264 shift + 54:289,target 184 + 15:386 reduce + 201:262,target 119 + 92:265 shift + 75:408 goto + 92:266 shift + 9:341 shift + 10:440 goto + 161:424 goto + 92:267 shift + 9:342 shift + 24:Y,target 94 + 202:0 reduce + 192:0 reduce + 141:397,target 195 + 0:361,target 5 + 97:281,target 229 + 21:413,target 82 + 184:277,target 199 + 240:277,target 1 + 239:277,target 177 + 140:261,target 118 + 117:277 reduce + 9:350 shift + 322:0,target 129 + 285:277,target 119 + 244:0 reduce + 61:0,target 34 + 34:277,target 1 + 341:277,target 41 + 80:277,target 43 + 79:277,target 216 + 35:261,target 118 + 161:325,target 272 + 147:287 shift + 21:361 shift + 281:0,target 122 + 222:274,target 311 + 9:355 shift + 19:377,target 73 + 29:0,target 1 + 151:391,target 124 + 4:407 goto + 323:277 reduce + 286:0 reduce + 147:287,target 260 + 62:277 reduce + 21:361,target 79 + 35:0 reduce + 1:292,target 33 + 9:358 shift + 45:422 goto + 249:0,target 1 + 9:359 shift + 234:276,target 327 + 32:275 shift + 203:398,target 295 + 180:260,target 117 + 180:259,target 116 + 283:277 reduce + 122:0 reduce + 9:363 shift + 32:277 reduce + 218:0,target 40 + 77:0 reduce + 9:364 shift + 29:259,target 116 + 29:260,target 117 + 9:365 shift + 10:290,target 63 + 8:328,target 40 + 223:271 shift + 202:262,target 119 + 253:277 reduce + 223:272 shift + 177:0,target 73 + 9:368 shift + 21:376 shift + 342:388 shift + 342:390 shift + 342:389 shift + 92:307 shift + 342:391 shift + 146:0,target 98 + 9:373 shift + 230:258,target 115 + 229:258,target 115 + 93:332,target 54 + 9:374 shift + 140:277,target 1 + 185:277,target 197 + 241:277,target 331 + 147:321 shift + 115:0,target 5 + 3:327,target 14 + 286:277,target 180 + 54:375,target 188 + 35:277,target 1 + 183:277 reduce + 81:277,target 28 + 9:380 shift + 79:415,target 218 + 36:261,target 118 + 0:335,target 31 + 342:388,target 121 + 258:0 reduce + 9:384 shift + 166:426 goto + 153:277 reduce + 9:386 shift + 350:0,target 49 + 349:0,target 52 + 298:391,target 124 + 235:276,target 327 + 311:0 reduce + 204:398,target 296 + 86:366 reduce + 342:418 goto + 249:398,target 336 + 123:277 reduce + 86:367 reduce + 318:0,target 148 + 337:260,target 117 + 337:259,target 116 + 9:328,target 40 + 203:262,target 119 + 136:0 reduce + 21:412 goto + 277:0,target 124 + 97:281 shift + 0:404,target 6 + 21:413 goto + 26:0,target 66 + 328:277 reduce + 67:277 reduce + 130:258,target 115 + 86:377 reduce + 178:0 reduce + 94:332,target 56 + 8:303,target 32 + 8:293,target 28 + 288:277 reduce + 186:277,target 196 + 37:277 shift + 242:277,target 209 + 215:0,target 38 + 45:339,target 159 + 287:277,target 179 + 36:277,target 1 + 243:261,target 118 + 82:277,target 37 + 228:271 shift + 86:385 reduce + 258:277 reduce + 228:272 shift + 174:0,target 191 + 1:335,target 33 + 9:419 goto + 343:388,target 121 + 147:357 shift + 3:302,target 10 + 273:0 reduce + 112:0,target 85 + 97:313 shift + 0:299,target 31 + 0:310,target 31 + 97:314 shift + 188:277 reduce + 325:0 reduce + 142:416 goto + 64:0 reduce + 204:262,target 119 + 97:317 shift + 249:262,target 119 + 38:313,target 138 + 151:0 reduce + 56:398 goto + 346:0,target 211 + 232:258,target 115 + 95:332,target 53 + 92:366 shift + 9:303,target 32 + 9:293,target 28 + 187:277,target 198 + 128:277 reduce + 92:367 shift + 72:258,target 115 + 315:0,target 143 + 243:277,target 1 + 0:368,target 31 + 46:339,target 159 + 288:277,target 160 + 203:0 reduce + 37:277,target 137 + 344:277,target 210 + 97:331 shift + 274:0,target 112 + 147:381 shift + 97:332 shift + 73:275 shift + 97:333 shift + 334:277 reduce + 160:349,target 273 + 7:405,target 22 + 243:0,target 1 + 204:257 shift + 92:377 shift + 204:258 shift + 204:260 shift + 204:259 shift + 0:326,target 3 + 304:277 reduce + 294:277 reduce + 204:261 shift + 338:276,target 327 + 204:262 shift + 1:310,target 33 + 1:299,target 33 + 287:0 reduce + 36:0 reduce + 92:385 shift + 264:277 reduce + 171:0,target 194 + 123:0 reduce + 340:0 reduce + 234:275 shift + 78:0 reduce + 234:276 shift + 140:0,target 1 + 24:429,target 98 + 166:351,target 282 + 4:361,target 27 + 21:326,target 78 + 233:258,target 115 + 96:332,target 55 + 2:277 reduce + 158:320 shift + 188:277,target 195 + 244:277,target 200 + 1:368,target 33 + 23:283,target 85 + 300:277,target 343 + 290:277,target 159 + 289:277,target 158 + 204:277 reduce + 200:261,target 118 + 194:277 reduce + 345:277,target 212 + 39:261,target 118 + 40:261,target 118 + 8:284,target 24 + 226:274,target 307 + 217:0 reduce + 166:308,target 281 + 161:349,target 273 + 141:380,target 246 + 82:0,target 37 + 13:297 reduce + 260:0 reduce + 259:0 reduce + 134:277 reduce + 339:276,target 327 + 312:0,target 145 + 240:260,target 117 + 240:259,target 116 + 77:414,target 214 + 34:259,target 116 + 34:260,target 117 + 223:400 goto + 142:y,target 96 + 240:257 shift + 221:273,target 306 + 147:431 goto + 339:275 shift + 271:0,target 111 + 240:258 shift + 104:277 reduce + 339:276 shift + 312:0 reduce + 240:260 shift + 240:259 shift + 340:277 reduce + 240:261 shift + 132:275,target 239 + 78:277 shift + 0:291,target 31 + 11:297,target 230 + 240:262 shift + 240:0,target 1 + 239:0,target 177 + 199:257 shift + 199:258 shift + 199:260 shift + 199:259 shift + 147:381,target 263 + 137:0 reduce + 97:332,target 234 + 73:275,target 208 + 310:277 reduce + 309:277 reduce + 299:277 shift + 199:261 shift + 158:347 shift + 93:0 reduce + 32:421 goto + 208:0,target 225 + 200:277,target 1 + 199:262 shift + 198:0,target 82 + 190:277,target 69 + 189:277,target 93 + 245:277,target 333 + 301:277,target 8 + 291:277,target 232 + 201:261,target 118 + 58:375,target 204 + 39:277,target 1 + 40:277,target 1 + 346:277,target 211 + 3:352,target 15 + 8:311,target 37 + 270:277 reduce + 269:277 reduce + 180:0 reduce + 18:277 reduce + 24:X,target 93 + 4:335,target 20 + 9:284,target 24 + 227:274,target 311 + 141:396,target 194 + 140:257 shift + 140:258 shift + 52:280,target 62 + 0:359,target 31 + 164:316 shift + 140:260 shift + 140:259 shift + 136:0,target 86 + 21:412,target 81 + 240:277 reduce + 239:277 reduce + 140:261 shift + 232:0 reduce + 140:262 shift + 93:314,target 54 + 7:277 reduce + 164:316,target 277 + 140:260,target 117 + 140:259,target 116 + 47:425,target 169 + 210:277 shift + 209:277 reduce + 199:277 reduce + 164:427,target 279 + 35:259,target 116 + 35:260,target 117 + 43:346 shift + 274:0 reduce + 151:390,target 123 + 151:389,target 122 + 84:263 reduce + 170:277 reduce + 169:277 reduce + 84:264 reduce + 1:291,target 33 + 5:0,target 25 + 12:297,target 231 + 93:262,target 54 + 84:265 reduce + 340:0,target 44 + 234:275,target 326 + 210:285 shift + 84:266 reduce + 78:0,target 42 + 48:312 shift + 326:0 reduce + 180:258,target 115 + 84:267 reduce + 65:0 reduce + 100:277,target 163 + 74:275,target 209 + 140:277 reduce + 29:258,target 115 + 308:0,target 144 + 201:277,target 1 + 191:277,target 70 + 47:0,target 115 + 246:277,target 334 + 302:277,target 9 + 292:277,target 236 + 228:400 goto + 202:261,target 118 + 152:0 reduce + 138:y,target 96 + 48:318 shift + 41:277,target 151 + 347:277,target 48 + 9:311,target 37 + 267:0,target 108 + 110:277 reduce + 109:277 reduce + 345:277 reduce + 1:359,target 33 + 236:0,target 166 + 230:257,target 114 + 229:257,target 114 + 204:0 reduce + 93:331,target 54 + 94:314,target 56 + 34:293,target 131 + 315:277 reduce + 3:326,target 13 + 205:0,target 99 + 199:398,target 291 + 8:386,target 59 + 36:259,target 116 + 36:260,target 117 + 0:334,target 31 + 275:277 reduce + 21:376,target 80 + 164:356 shift + 13:297,target 226 + 298:390,target 123 + 298:389,target 122 + 288:0 reduce + 133:0,target 174 + 94:262,target 56 + 28:302,target 106 + 245:277 shift + 235:275,target 326 + 54:289 shift + 101:277,target 164 + 13:377 reduce + 210:326 shift + 146:277,target 98 + 102:0,target 162 + 84:307 reduce + 337:258,target 115 + 202:277,target 1 + 192:277,target 157 + 124:0 reduce + 341:0 reduce + 247:277,target 335 + 215:277 reduce + 80:0 reduce + 79:0 reduce + 303:277,target 10 + 293:277,target 237 + 203:261,target 118 + 42:277,target 153 + 43:387 shift + 348:277,target 45 + 54:296 shift + 90:263 reduce + 89:263 reduce + 175:277 reduce + 130:257,target 114 + 90:264 reduce + 89:264 reduce + 2:0,target 24 + 13:386 reduce + 90:265 reduce + 89:265 reduce + 336:0,target 201 + 158:423 goto + 94:331,target 56 + 90:266 reduce + 89:266 reduce + 75:0,target 29 + 48:353 shift + 90:267 reduce + 89:267 reduce + 8:292,target 27 + 95:314,target 53 + 29:257 shift + 35:293,target 131 + 4:326,target 27 + 29:258 shift + 45:338,target 158 + 305:0,target 142 + 295:0,target 235 + 218:0 reduce + 29:259 shift + 29:260 shift + 243:260,target 117 + 243:259,target 116 + 29:261 shift + 9:386,target 59 + 29:262 shift + 1:334,target 33 + 264:0,target 135 + 115:277 reduce + 52:382,target 70 + 234:403 goto + 199:262,target 119 + 261:0 reduce + 145:285 shift + 14:297,target 227 + 38:354,target 143 + 233:0,target 1 + 95:262,target 53 + 144:448,target 256 + 59:275 shift + 54:327 shift + 31:275,target 126 + 321:277 reduce + 102:277,target 162 + 60:277 reduce + 48:369 shift + 0:298,target 31 + 313:0 reduce + 202:0,target 1 + 192:0,target 157 + 78:376 shift + 203:277,target 1 + 193:277,target 288 + 248:277,target 205 + 304:277,target 140 + 294:277,target 233 + 204:261,target 118 + 204:398 goto + 350:277,target 49 + 349:277,target 52 + 281:277 reduce + 249:261,target 118 + 29:277 reduce + 210:361 shift + 94:0 reduce + 54:296,target 185 + 43:428 goto + 10:280,target 62 + 48:378 shift + 130:0,target 1 + 129:0,target 67 + 251:277 reduce + 232:257,target 114 + 95:331,target 53 + 221:273 shift + 75:361,target 29 + 9:292,target 27 + 221:274 shift + 181:0 reduce + 96:314,target 55 + 72:257,target 114 + 90:307 reduce + 89:307 reduce + 46:338,target 158 + 95:257 reduce + 95:258 reduce + 339:403 goto + 95:260 reduce + 95:259 reduce + 95:261 reduce + 43:346,target 154 + 233:0 reduce + 95:262 reduce + 181:277 reduce + 210:376 shift + 54:352 shift + 15:297,target 229 + 333:0,target 215 + 96:262,target 55 + 72:0,target 1 + 145:326 shift + 275:0 reduce + 32:275,target 127 + 35:257 shift + 338:275,target 326 + 222:402,target 312 + 151:277 reduce + 103:277,target 83 + 78:413 goto + 1:298,target 33 + 35:258 shift + 302:0,target 9 + 292:0,target 236 + 164:427 goto + 148:277,target 134 + 35:259 shift + 35:260 shift + 204:277,target 1 + 194:277,target 57 + 35:261 shift + 249:277,target 1 + 35:262 shift + 305:277,target 142 + 295:277,target 235 + 84:366 reduce + 44:277,target 157 + 327:0 reduce + 261:0,target 137 + 145:285,target 257 + 121:277 reduce + 84:367 reduce + 66:0 reduce + 95:277 reduce + 8:335,target 44 + 230:0,target 1 + 229:0,target 1 + 7:405 goto + 233:257,target 114 + 153:0 reduce + 96:331,target 55 + 95:281 reduce + 240:398 goto + 0:384,target 31 + 326:277 reduce + 97:314,target 231 + 65:277 reduce + 188:0,target 195 + 168:316,target 277 + 23:282,target 84 + 200:260,target 117 + 200:259,target 116 + 84:377 reduce + 205:0 reduce + 199:398 goto + 168:427,target 285 + 53:398,target 183 + 28:352,target 110 + 39:259,target 116 + 39:260,target 117 + 40:259,target 116 + 40:260,target 117 + 286:277 reduce + 157:0,target 90 + 54:375 shift + 35:277 reduce + 226:273,target 306 + 210:412 goto + 210:413 goto + 138:X shift + 126:0,target 97 + 84:385 reduce + 0:342,target 31 + 16:297,target 228 + 256:277 reduce + 147:321,target 261 + 138:Y shift + 226:273 shift + 226:274 shift + 33:275,target 127 + 339:275,target 326 + 240:258,target 115 + 104:277,target 165 + 150:277,target 71 + 149:277,target 80 + 140:398 goto + 34:258,target 115 + 205:277,target 99 + 195:277,target 58 + 142:x,target 95 + 35:288 shift + 290:0 reduce + 289:0 reduce + 251:277,target 204 + 306:277,target 13 + 296:277,target 234 + 219:399,target 304 + 99:0,target 161 + 95:313 reduce + 91:277,target 81 + 48:441 goto + 95:314 reduce + 35:293 shift + 186:277 reduce + 4:376,target 27 + 9:335,target 44 + 140:416 goto + 139:416 goto + 125:0 reduce + 330:0,target 202 + 329:0,target 131 + 95:317 reduce + 81:0 reduce + 68:0,target 185 + 97:331,target 233 + 1:384,target 33 + 156:277 reduce + 288:0,target 160 + 201:260,target 117 + 201:259,target 116 + 24:X shift + 8:310,target 36 + 8:299,target 31 + 24:Y shift + 90:366 reduce + 89:366 reduce + 257:0,target 217 + 126:277 reduce + 90:367 reduce + 89:367 reduce + 10:382,target 70 + 34:438,target 134 + 0:358,target 31 + 232:257 shift + 95:331 reduce + 53:262,target 119 + 1:342,target 33 + 232:258 shift + 95:332 reduce + 93:313,target 54 + 232:260 shift + 232:259 shift + 140:258,target 115 + 95:333 reduce + 332:277 reduce + 232:261 shift + 71:277 reduce + 28:326,target 109 + 232:262 shift + 185:0,target 197 + 105:277,target 171 + 24:416 goto + 262:0 reduce + 202:257 shift + 151:277,target 100 + 90:377 reduce + 89:377 reduce + 78:413,target 215 + 35:258,target 115 + 206:277,target 94 + 202:258 shift + 196:277,target 289 + 0:263 reduce + 28:437,target 113 + 34:386,target 132 + 252:277,target 218 + 222:272,target 310 + 202:260 shift + 202:259 shift + 138:x shift + 8:368,target 54 + 307:277,target 14 + 302:277 reduce + 297:277,target 30 + 292:277 reduce + 202:261 shift + 154:0,target 125 + 151:388,target 121 + 138:y shift + 41:277 shift + 202:262 shift + 314:0 reduce + 93:261,target 54 + 53:0 reduce + 140:444 goto + 123:0,target 61 + 90:385 reduce + 89:385 reduce + 262:277 reduce + 180:257,target 114 + 57:417,target 197 + 38:319,target 141 + 29:257,target 114 + 140:0 reduce + 24:429 goto + 95:0 reduce + 232:277 reduce + 202:260,target 117 + 202:259,target 116 + 138:x,target 95 + 0:277 shift + 9:310,target 36 + 9:299,target 31 + 55:398,target 190 + 96:0,target 55 + 52:295,target 64 + 35:438,target 135 + 337:257 shift + 182:0 reduce + 54:442 goto + 337:258 shift + 202:277 reduce + 192:277 reduce + 1:358,target 33 + 337:260 shift + 337:259 shift + 337:261 shift + 326:0,target 18 + 84:267,target 154 + 65:0,target 183 + 0:284 reduce + 24:x shift + 30:388 shift + 337:262 shift + 94:313,target 56 + 0:285 shift + 24:y shift + 30:389 shift + 30:390 shift + 0:286 reduce + 30:391 shift + 162:277 reduce + 342:275,target 347 + 285:0,target 119 + 106:277,target 167 + 75:326,target 29 + 34:0,target 1 + 152:277,target 63 + 36:258,target 115 + 207:277,target 224 + 197:277,target 290 + 132:275 shift + 0:291 reduce + 11:297 reduce + 35:386,target 132 + 253:277,target 220 + 223:272,target 314 + 0:292 reduce + 9:368,target 54 + 308:277,target 144 + 254:0,target 219 + 0:293 reduce + 0:303 reduce + 47:277,target 115 + 276:0 reduce + 93:277,target 54 + 57:323,target 193 + 0:304 reduce + 29:398 goto + 0:305 reduce + 298:388,target 121 + 94:261,target 56 + 58:306,target 201 + 0:306 reduce + 221:401 goto + 57:434,target 198 + 0:297 reduce + 102:277 reduce + 0:298 reduce + 112:0 reduce + 0:299 reduce + 0:310 reduce + 337:277 reduce + 328:0 reduce + 76:277 shift + 67:0 reduce + 0:311 reduce + 337:257,target 114 + 182:0,target 178 + 54:442,target 189 + 203:260,target 117 + 203:259,target 116 + 0:0 reduce + 30:418 goto + 0:315 reduce + 307:277 reduce + 297:277 reduce + 154:0 reduce + 151:388 shift + 151:0,target 100 + 56:398,target 191 + 151:390 shift + 151:389 shift + 151:391 shift + 120:0,target 95 + 119:0,target 7 + 267:277 reduce + 85:267,target 152 + 55:262,target 119 + 8:291,target 26 + 19:297,target 72 + 206:0 reduce + 95:313,target 53 + 0:323 reduce + 48:441,target 175 + 145:447 goto + 343:275,target 349 + 243:258,target 115 + 107:277,target 172 + 0:350,target 31 + 0:326 shift + 237:277 reduce + 166:426,target 283 + 153:277,target 72 + 208:277,target 225 + 198:277,target 82 + 140:X shift + 139:X shift + 0:328 reduce + 5:277 reduce + 47:294,target 165 + 254:277,target 219 + 248:0 reduce + 140:Y shift + 139:Y shift + 0:330 reduce + 0:329 reduce + 310:277,target 16 + 309:277,target 15 + 299:277,target 342 + 199:261,target 118 + 158:347,target 267 + 93:0,target 54 + 32:421,target 128 + 94:277,target 56 + 207:277 reduce + 197:277 shift + 35:386 shift + 95:261,target 53 + 0:334 reduce + 323:0,target 133 + 62:0,target 188 + 0:335 reduce + 301:0 reduce + 291:0 reduce + 151:418 goto + 3:411,target 17 + 0:336 shift + 8:359,target 50 + 39:0 reduce + 40:0 reduce + 221:401,target 308 + 0:297,target 31 + 167:277 shift + 282:0,target 121 + 0:341 reduce + 204:260,target 117 + 204:259,target 116 + 126:0 reduce + 0:342 reduce + 16:297 reduce + 249:260,target 117 + 249:259,target 116 + 82:0 reduce + 251:0,target 204 + 160:278,target 270 + 142:Y,target 94 + 137:277 reduce + 35:398 goto + 43:387,target 155 + 144:395,target 255 + 243:257 shift + 226:401 goto + 343:275 shift + 243:258 shift + 107:277 reduce + 86:267,target 151 + 56:262,target 119 + 0:350 reduce + 9:291,target 26 + 243:260 shift + 243:259 shift + 96:313,target 55 + 243:261 shift + 82:277 reduce + 243:262 shift + 178:0,target 96 + 227:402,target 319 + 108:277,target 173 + 1:350,target 33 + 154:277,target 125 + 0:355 reduce + 210:277,target 76 + 209:277,target 223 + 199:277,target 1 + 313:277 reduce + 255:277,target 221 + 311:277,target 17 + 224:399,target 316 + 159:347,target 267 + 50:277,target 177 + 49:277,target 176 + 0:358 reduce + 33:421,target 129 + 95:277,target 53 + 52:280 shift + 0:359 reduce + 58:451,target 205 + 0:361 shift + 263:0 reduce + 116:0,target 3 + 96:261,target 55 + 273:277 reduce + 145:447,target 259 + 0:363 reduce + 22:277 shift + 140:x shift + 139:x shift + 0:364 reduce + 9:359,target 50 + 140:y shift + 139:y shift + 1:297,target 33 + 0:365 reduce + 46:338 shift + 315:0 reduce + 243:277 reduce + 0:368 reduce + 46:339 shift + 52:290 shift + 234:403,target 328 + 52:301 shift + 11:377 reduce + 161:278,target 270 + 10:295,target 64 + 46:343 shift + 52:293 shift + 3:375,target 16 + 0:373 reduce + 8:334,target 43 + 213:277 reduce + 0:374 reduce + 96:0 reduce + 75:376,target 29 + 52:295 shift + 35:438 goto + 320:0,target 147 + 319:0,target 149 + 87:267,target 155 + 97:313,target 230 + 87:263 reduce + 173:277 reduce + 87:264 reduce + 52:310 shift + 0:380 reduce + 11:386 reduce + 278:0,target 123 + 200:258,target 115 + 183:0 reduce + 87:265 reduce + 27:0,target 77 + 110:277,target 170 + 109:277,target 168 + 87:266 reduce + 155:277,target 126 + 87:267 reduce + 39:258,target 115 + 40:258,target 115 + 211:277,target 298 + 0:384 reduce + 256:277,target 207 + 138:Y,target 94 + 312:277,target 145 + 0:386 reduce + 96:277,target 55 + 0:341,target 31 + 113:277 shift + 348:277 reduce + 240:257,target 114 + 147:431,target 264 + 277:0 reduce + 175:0,target 92 + 0:404 goto + 26:0 reduce + 34:257,target 114 + 160:322,target 271 + 46:366 shift + 0:406 goto + 232:398 goto + 41:420 goto + 318:277 reduce + 235:403,target 329 + 57:277 shift + 0:409 goto + 330:0 reduce + 329:0 reduce + 68:0 reduce + 9:334,target 43 + 141:446,target 248 + 202:398 goto + 0:409,target 8 + 278:277 reduce + 27:277 reduce + 88:267,target 156 + 155:0 reduce + 164:356,target 278 + 201:258,target 115 + 248:277 reduce + 111:277,target 169 + 8:298,target 30 + 156:277,target 78 + 212:277,target 299 + 16:377 reduce + 347:0,target 48 + 257:277,target 217 + 227:272,target 310 + 207:0 reduce + 87:307 reduce + 8:419,target 60 + 313:277,target 11 + 93:257 reduce + 218:277 reduce + 93:258 reduce + 52:345 shift + 93:260 reduce + 93:259 reduce + 53:261,target 118 + 1:341,target 33 + 316:0,target 141 + 93:261 reduce + 55:0,target 1 + 140:257,target 114 + 93:262 reduce + 249:0 reduce + 178:277 reduce + 16:386 reduce + 337:398 goto + 275:0,target 106 + 35:257,target 114 + 161:322,target 271 + 28:436,target 112 + 222:271,target 309 + 0:315,target 31 + 302:0 reduce + 292:0 reduce + 244:0,target 200 + 148:277 reduce + 93:260,target 54 + 93:259,target 54 + 213:0,target 47 + 77:376,target 213 + 1:410,target 9 + 23:324,target 88 + 127:0 reduce + 118:277 reduce + 57:416,target 196 + 52:362 shift + 344:0 reduce + 90:267,target 150 + 89:267,target 153 + 83:0 reduce + 93:277 reduce + 57:323 shift + 172:0,target 192 + 202:258,target 115 + 0:263,target 31 + 112:277,target 85 + 93:281 reduce + 9:298,target 30 + 170:0 reduce + 169:0 reduce + 157:277,target 90 + 57:y,target 96 + 324:277 reduce + 213:277,target 47 + 63:277 reduce + 52:370 shift + 0:374,target 31 + 258:277,target 216 + 228:272,target 314 + 52:371 shift + 9:419,target 61 + 46:422 goto + 314:277,target 12 + 53:277,target 1 + 98:277,target 79 + 33:275 shift + 210:285,target 77 + 84:266,target 154 + 48:312,target 170 + 284:277 reduce + 33:277 reduce + 224:268 shift + 84:377,target 154 + 224:270 shift + 224:269 shift + 8:384,target 58 + 36:257,target 114 + 254:277 reduce + 264:0 reduce + 223:271,target 313 + 52:382 shift + 343:388 shift + 1:315,target 33 + 344:0,target 210 + 343:390 shift + 343:389 shift + 83:0,target 22 + 343:391 shift + 338:403,target 345 + 94:260,target 56 + 94:259,target 56 + 58:305,target 200 + 100:0 reduce + 316:0 reduce + 313:0,target 11 + 78:376,target 80 + 55:0 reduce + 93:313 reduce + 160:424,target 275 + 143:y,target 96 + 93:314 reduce + 8:342,target 46 + 184:277 reduce + 272:0,target 110 + 21:0,target 42 + 39:430,target 149 + 203:258,target 115 + 93:317 reduce + 1:263,target 33 + 113:277,target 236 + 214:277,target 39 + 154:277 reduce + 1:374,target 33 + 260:277,target 139 + 259:277,target 206 + 315:277,target 143 + 184:0 reduce + 99:277,target 161 + 210:0,target 42 + 209:0,target 223 + 199:0,target 1 + 87:366 reduce + 85:266,target 152 + 55:261,target 118 + 343:418 goto + 124:277 reduce + 87:367 reduce + 98:277 reduce + 85:377,target 152 + 243:257,target 114 + 226:401,target 318 + 236:0 reduce + 230:257 shift + 229:257 shift + 93:331 reduce + 9:384,target 58 + 230:258 shift + 229:258 shift + 93:332 reduce + 47:293,target 164 + 243:398 goto + 230:260 shift + 230:259 shift + 229:260 shift + 229:259 shift + 93:333 reduce + 330:277 reduce + 329:277 reduce + 230:261 shift + 229:261 shift + 199:260,target 117 + 199:259,target 116 + 137:0,target 87 + 68:277 reduce + 230:262 shift + 229:262 shift + 200:257 shift + 87:377 reduce + 339:403,target 346 + 278:0 reduce + 200:258 shift + 95:260,target 53 + 95:259,target 53 + 27:0 reduce + 200:260 shift + 200:259 shift + 300:277 shift + 290:277 reduce + 289:277 reduce + 200:261 shift + 79:376,target 217 + 8:358,target 49 + 200:262 shift + 0:306,target 31 + 161:424,target 276 + 92:267,target 223 + 9:342,target 46 + 114:0 reduce + 25:435,target 103 + 331:0 reduce + 87:385 reduce + 70:0 reduce + 69:0 reduce + 260:277 reduce + 259:277 reduce + 204:258,target 115 + 249:258,target 115 + 114:277,target 2 + 6:0,target 0 + 142:X,target 93 + 130:257 shift + 57:397,target 195 + 2:0 reduce + 341:0,target 41 + 215:277,target 38 + 130:258 shift + 80:0,target 43 + 79:0,target 50 + 261:277,target 137 + 156:0 reduce + 144:394,target 254 + 130:260 shift + 130:259 shift + 28:375,target 111 + 316:277,target 141 + 230:277 reduce + 229:277 reduce + 130:261 shift + 55:277,target 1 + 130:262 shift + 310:0,target 16 + 309:0,target 15 + 86:266,target 151 + 56:261,target 118 + 52:440 goto + 52:439 goto + 140:y,target 96 + 139:y,target 96 + 0:365,target 31 + 208:0 reduce + 200:277 reduce + 198:0 reduce + 190:277 reduce + 189:277 reduce + 86:377,target 151 + 268:0,target 104 + 143:416 goto + 17:0,target 23 + 57:396 shift + 237:0,target 175 + 142:X shift + 57:397 shift + 251:0 reduce + 160:278 shift + 142:Y shift + 96:260,target 55 + 96:259,target 55 + 38:313 shift + 206:0,target 94 + 0:323,target 31 + 38:314 shift + 130:277 reduce + 129:277 reduce + 9:358,target 49 + 45:422,target 162 + 1:306,target 33 + 303:0 reduce + 293:0 reduce + 38:317 shift + 57:416 goto + 219:270,target 303 + 219:269,target 302 + 168:356,target 278 + 57:417 goto + 38:319 shift + 100:277 reduce + 74:275 shift + 115:277,target 5 + 335:277 reduce + 134:0,target 88 + 128:0 reduce + 345:0 reduce + 216:277,target 300 + 262:277,target 136 + 317:277,target 146 + 56:277,target 1 + 103:0,target 83 + 305:277 reduce + 295:277 reduce + 87:266,target 155 + 44:277 shift + 171:0 reduce + 1:365,target 33 + 38:331 shift + 200:257,target 114 + 87:377,target 155 + 265:277 reduce + 143:445 goto + 39:257,target 114 + 40:257,target 114 + 3:0,target 35 + 138:X,target 93 + 84:385,target 154 + 57:434 goto + 337:0,target 1 + 235:275 shift + 235:276 shift + 3:277 reduce + 306:0,target 13 + 296:0,target 234 + 159:320 shift + 1:323,target 33 + 265:0 reduce + 52:371,target 69 + 46:422,target 163 + 223:400,target 315 + 160:322 shift + 205:277 reduce + 195:277 reduce + 142:x shift + 265:0,target 101 + 142:y shift + 160:325 shift + 48:378,target 174 + 101:0 reduce + 317:0 reduce + 116:277,target 3 + 56:0 reduce + 8:350,target 47 + 165:277 shift + 162:277,target 75 + 217:277,target 51 + 263:277,target 138 + 318:277,target 148 + 57:277,target 192 + 14:297 reduce + 38:354 shift + 203:0,target 1 + 3:302 shift + 135:277 reduce + 98:0 reduce + 88:266,target 156 + 52:440,target 182 + 52:439,target 181 + 3:305 shift + 201:257,target 114 + 162:0,target 75 + 88:377,target 156 + 3:306 shift + 38:360 shift + 160:379,target 274 + 8:297,target 29 + 185:0 reduce + 105:277 reduce + 341:277 reduce + 227:271,target 309 + 85:385,target 152 + 80:277 reduce + 79:277 shift + 53:260,target 117 + 53:259,target 116 + 8:263 shift + 237:0 reduce + 100:0,target 163 + 311:277 reduce + 224:399 goto + 159:347 shift + 50:277 shift + 49:277 shift + 33:421 goto + 160:349 shift + 3:306,target 12 + 38:360,target 144 + 145:326,target 258 + 280:0 reduce + 279:0 reduce + 271:277 reduce + 20:277 shift + 0:0,target 26 + 30:418,target 125 + 117:277,target 6 + 9:350,target 47 + 334:0,target 213 + 163:277,target 74 + 218:277,target 40 + 93:258,target 54 + 52:345,target 66 + 3:326 shift + 264:277,target 135 + 241:277 shift + 115:0 reduce + 3:327 shift + 332:0 reduce + 320:277,target 147 + 319:277,target 149 + 71:0 reduce + 23:323,target 87 + 303:0,target 10 + 293:0,target 237 + 38:317,target 140 + 38:383 shift + 158:423,target 268 + 90:266,target 150 + 89:266,target 153 + 48:353,target 172 + 3:0 reduce + 211:277 shift + 25:279,target 100 + 262:0,target 136 + 202:257,target 114 + 157:0 reduce + 90:377,target 150 + 89:377,target 153 + 161:379,target 274 + 8:284 shift + 9:297,target 29 + 57:x,target 95 + 85:263 reduce + 55:257 shift + 52:293,target 179 + 0:373,target 31 + 8:286 shift + 228:271,target 313 + 171:277 reduce + 86:385,target 151 + 85:264 reduce + 55:258 shift + 85:265 reduce + 55:260 shift + 55:259 shift + 210:0 reduce + 209:0 reduce + 199:0 reduce + 85:266 reduce + 55:261 shift + 85:267 reduce + 84:265,target 154 + 55:262 shift + 8:291 shift + 19:297 shift + 200:0,target 1 + 190:0,target 69 + 189:0,target 93 + 8:292 shift + 8:303 shift + 8:293 shift + 8:304 shift + 143:X shift + 8:305 shift + 252:0 reduce + 143:Y shift + 8:306 shift + 160:379 shift + 8:297 shift + 111:277 reduce + 8:298 shift + 298:275,target 340 + 8:310 shift + 8:299 shift + 346:277 reduce + 127:0,target 103 + 118:277,target 4 + 52:362,target 67 + 3:352 shift + 8:311 shift + 304:0 reduce + 294:0 reduce + 94:258,target 56 + 265:277,target 101 + 143:445,target 251 + 321:277,target 130 + 230:398 goto + 229:398 goto + 60:277,target 32 + 48:369,target 173 + 8:315 shift + 25:271 shift + 316:277 reduce + 55:277 reduce + 159:423,target 269 + 143:x,target 95 + 8:341,target 45 + 130:0 reduce + 129:0 reduce + 346:0 reduce + 203:257,target 114 + 200:398 goto + 276:277 reduce + 8:323 shift + 1:373,target 33 + 25:279 shift + 47:344,target 168 + 331:0,target 203 + 172:0 reduce + 87:385,target 155 + 70:0,target 187 + 69:0,target 182 + 246:277 shift + 85:265,target 152 + 55:260,target 117 + 55:259,target 116 + 8:328 shift + 290:0,target 159 + 289:0,target 158 + 8:329 shift + 8:330 shift + 14:377 reduce + 85:307 reduce + 10:371,target 69 + 130:398 goto + 216:277 shift + 258:0,target 216 + 3:375 shift + 8:334 shift + 8:335 shift + 224:270,target 303 + 224:269,target 302 + 199:258,target 115 + 266:0 reduce + 176:277 reduce + 141:323 shift + 120:277,target 95 + 119:277,target 7 + 14:386 reduce + 38:443 goto + 165:277,target 280 + 159:423 goto + 143:x shift + 95:258,target 53 + 8:341 shift + 266:277,target 109 + 160:424 goto + 143:y shift + 8:342 shift + 322:277,target 129 + 186:0,target 196 + 61:277,target 34 + 146:277 reduce + 102:0 reduce + 0:305,target 31 + 318:0 reduce + 92:266,target 222 + 9:341,target 45 + 10:440,target 71 + 155:0,target 126 + 204:257,target 114 + 92:377,target 227 + 249:257,target 114 + 116:277 reduce + 8:350 shift + 235:403 goto + 57:396,target 194 + 124:0,target 62 + 99:0 reduce + 91:277 reduce + 144:393,target 253 + 88:385,target 156 + 230:398,target 322 + 229:398,target 321 + 8:315,target 38 + 25:271,target 99 + 8:355 shift + 86:265,target 151 + 56:260,target 117 + 56:259,target 116 + 322:277 reduce + 186:0 reduce + 61:277 reduce + 140:x,target 95 + 139:x,target 95 + 79:376 shift + 0:364,target 31 + 8:358 shift + 3:411 goto + 8:359 shift + 31:275 shift + 282:277 reduce + 8:363 shift + 238:0 reduce + 8:364 shift + 8:263,target 23 + 8:365 shift + 327:0,target 19 + 121:277,target 59 + 84:367,target 154 + 66:0,target 184 + 222:271 shift + 10:345,target 66 + 252:277 reduce + 222:272 shift + 96:258,target 55 + 8:374,target 56 + 8:368 shift + 25:340,target 101 + 267:277,target 108 + 323:277,target 133 + 286:0,target 180 + 281:0 reduce + 222:274 shift + 62:277,target 188 + 19:377 shift + 29:0 reduce + 35:0,target 1 + 1:305,target 33 + 96:257 reduce + 8:373 shift + 158:320,target 266 + 96:258 reduce + 8:374 shift + 25:340 shift + 255:0,target 221 + 219:268,target 301 + 96:260 reduce + 96:259 reduce + 116:0 reduce + 96:261 reduce + 333:0 reduce + 96:262 reduce + 72:0 reduce + 182:277 reduce + 130:398,target 237 + 8:380 shift + 19:386 shift + 140:444,target 244 + 90:385,target 150 + 89:385,target 153 + 4:0 reduce + 9:315,target 38 + 183:0,target 84 + 87:265,target 155 + 8:384 shift + 36:257 shift + 152:277 reduce + 36:258 shift + 1:364,target 33 + 8:386 shift + 36:259 shift + 36:260 shift + 230:262,target 119 + 229:262,target 119 + 79:415 goto + 36:261 shift + 228:400,target 320 + 152:0,target 63 + 48:318,target 171 + 36:262 shift + 85:366 reduce + 57:X shift + 122:277 reduce + 85:367 reduce + 57:Y shift + 210:413,target 82 + 121:0,target 59 + 96:277 reduce + 51:275,target 178 + 9:263,target 23 + 10:362,target 67 + 122:277,target 60 + 85:367,target 152 + 57:Y,target 94 + 167:277,target 284 + 141:380 shift + 253:0 reduce + 96:281 reduce + 9:374,target 56 + 268:277,target 104 + 17:277,target 23 + 327:277 reduce + 324:277,target 127 + 66:277 reduce + 63:277,target 181 + 52:370,target 68 + 3:450 goto + 3:449 goto + 85:377 reduce + 28:306,target 108 + 159:320,target 266 + 305:0 reduce + 295:0 reduce + 210:361,target 79 + 94:0,target 56 + 43:428,target 156 + 287:277 reduce + 36:277 reduce + 0:286,target 31 + 25:372 shift + 30:391,target 124 + 324:0,target 127 + 63:0,target 181 + 227:271 shift + 85:385 reduce + 347:0 reduce + 257:277 reduce + 232:398,target 324 + 227:272 shift + 8:419 goto + 41:420,target 152 + 283:0,target 116 + 227:274 shift + 141:396 shift + 88:265,target 156 + 72:398,target 207 + 32:0,target 102 + 141:397 shift + 130:262,target 119 + 173:0 reduce + 252:0,target 218 + 143:Y,target 94 + 8:306,target 35 + 96:313 reduce + 45:343,target 160 + 96:314 reduce + 72:257 shift + 187:277 reduce + 72:258 shift + 0:355,target 31 + 342:418,target 348 + 123:277,target 61 + 86:367,target 151 + 72:260 shift + 72:259 shift + 141:417 goto + 96:317 reduce + 72:261 shift + 53:258,target 115 + 47:309,target 167 + 72:262 shift + 270:277,target 114 + 269:277,target 105 + 180:0,target 1 + 57:x shift + 18:277,target 36 + 325:277,target 128 + 157:277 reduce + 64:277,target 189 + 57:y shift + 55:398 goto + 3:305,target 11 + 267:0 reduce + 148:0,target 134 + 8:365,target 53 + 127:277 reduce + 117:0,target 6 + 103:0 reduce + 1:286,target 33 + 320:0 reduce + 319:0 reduce + 93:257,target 54 + 233:257 shift + 96:331 reduce + 92:385,target 228 + 233:258 shift + 233:398,target 325 + 96:332 reduce + 233:260 shift + 233:259 shift + 96:333 reduce + 333:277 reduce + 233:261 shift + 90:265,target 150 + 89:265,target 153 + 72:277 reduce + 233:262 shift + 23:433,target 92 + 203:257 shift + 8:323,target 39 + 232:262,target 119 + 203:258 shift + 1:263 reduce + 24:416,target 97 + 203:260 shift + 203:259 shift + 91:0,target 81 + 9:306,target 35 + 303:277 reduce + 293:277 reduce + 203:261 shift + 72:262,target 119 + 42:277 shift + 203:262 shift + 46:343,target 160 + 187:0 reduce + 321:0,target 130 + 60:0,target 32 + 1:355,target 33 + 343:418,target 350 + 124:277,target 62 + 87:367,target 155 + 263:277 reduce + 170:277,target 190 + 169:277,target 76 + 84:264,target 154 + 141:446 goto + 34:288,target 130 + 280:0,target 117 + 279:0,target 120 + 271:277,target 111 + 20:277,target 75 + 326:277,target 18 + 240:0 reduce + 239:0 reduce + 65:277,target 183 + 233:277 reduce + 248:0,target 205 + 140:Y,target 94 + 139:Y,target 94 + 0:330,target 31 + 0:329,target 31 + 9:365,target 53 + 25:435 goto + 282:0 reduce + 217:0,target 51 + 203:277 reduce + 193:277 shift + 94:257,target 56 + 1:284 reduce + 54:327,target 186 + 176:0,target 64 + 117:0 reduce + 1:286 reduce + 334:0 reduce + 163:277 reduce + 0:277,target 1 + 9:323,target 39 + 233:262,target 119 + 1:291 reduce + 5:0 reduce + 12:297 reduce + 1:292 reduce + 133:277 reduce + 1:303 reduce + 1:293 reduce + 1:304 reduce + 114:0,target 2 + 1:305 reduce + 1:306 reduce + 125:277,target 65 + 88:367,target 156 + 1:297 reduce + 338:275 shift + 222:402 goto + 171:277,target 194 + 103:277 reduce + 85:264,target 152 + 55:258,target 115 + 1:298 reduce + 338:276 shift + 1:310 reduce + 1:299 reduce + 35:288,target 130 + 272:277,target 110 + 77:277 shift + 1:311 reduce + 10:370,target 68 + 21:277,target 76 + 327:277,target 19 + 66:277,target 184 + 3:450,target 19 + 3:449,target 18 + 298:275 shift + 348:0,target 45 + 1:330,target 33 + 1:329,target 33 + 1:315 reduce + 308:277 reduce + 254:0 reduce + 224:268,target 301 + 47:277 reduce + 199:257,target 114 + 317:0,target 146 + 56:0,target 1 + 95:257,target 53 + 268:277 reduce + 180:398,target 287 + 17:277 reduce + 306:0 reduce + 296:0 reduce + 1:323 reduce + 276:0,target 107 + 0:304,target 31 + 29:398,target 120 + 92:265,target 221 + 75:408,target 210 + 238:277 reduce + 1:328 reduce + 47:300 shift + 348:0 reduce + 1:330 reduce + 1:329 reduce + 210:326,target 78 + 84:307,target 154 + 47:293 shift + 214:0,target 39 + 208:277 reduce + 198:277 reduce + 144:392,target 252 + 47:294 shift + 1:334 reduce + 174:0 reduce + 126:277,target 97 + 90:367,target 150 + 89:367,target 153 + 1:335 reduce + 172:277,target 192 + 86:264,target 151 + 56:258,target 115 + 173:0,target 193 + 53:257 shift + 273:277,target 113 + 53:258 shift + 0:363,target 31 + 22:277,target 83 + 47:309 shift + 328:277,target 132 + 67:277,target 186 + 53:260 shift + 53:259 shift + 53:261 shift + 1:341 reduce + 93:317,target 54 + 53:262 shift + 1:342 reduce + 36:398 goto + 84:366,target 154 + 268:0 reduce + 96:257,target 55 + 8:373,target 55 + 17:0 reduce + 227:402 goto + 108:277 reduce + 1:350 reduce + 4:407,target 21 + 344:277 reduce + 1:304,target 33 + 337:398,target 344 + 104:0 reduce + 2:277,target 24 + 321:0 reduce + 180:262,target 119 + 60:0 reduce + 1:355 reduce + 345:0,target 212 + 314:277 reduce + 53:277 reduce + 29:262,target 119 + 1:358 reduce + 85:307,target 152 + 1:359 reduce + 314:0,target 12 + 146:0 reduce + 53:0,target 1 + 274:277 reduce + 127:277,target 103 + 1:363 reduce + 173:277,target 193 + 87:264,target 155 + 52:310,target 180 + 1:364 reduce + 0:380,target 31 + 11:386,target 230 + 273:0,target 113 + 1:365 reduce + 274:277,target 112 + 1:363,target 33 + 330:277,target 202 + 329:277,target 131 + 230:261,target 118 + 229:261,target 118 + 188:0 reduce + 168:316 shift + 68:277,target 185 + 23:282 shift + 244:277 reduce + 1:368 reduce + 23:283 shift + 242:0,target 209 + 94:317,target 56 + 12:377 reduce + 38:383,target 145 + 210:412,target 297 + 1:373 reduce + 47:344 shift + 214:277 reduce + 85:366,target 152 + 57:X,target 93 + 1:374 reduce + 342:391,target 124 + 9:373,target 55 + 170:0,target 190 + 169:0,target 76 + 88:263 reduce + 174:277 reduce + 88:264 reduce + 1:380 reduce + 12:386 reduce + 283:0 reduce + 88:265 reduce + 72:398 goto + 28:305,target 107 + 32:0 reduce + 88:266 reduce + 3:277,target 35 + 88:267 reduce + 1:384 reduce + 337:262,target 119 + 118:0 reduce + 1:386 reduce + 0:285,target 2 + 24:y,target 96 + 30:389,target 122 + 30:390,target 123 + 335:0 reduce + 86:307,target 151 + 249:257 shift + 0:406,target 7 + 249:258 shift + 128:277,target 68 + 114:277 reduce + 92:367,target 226 + 6:0 accept + 249:260 shift + 249:259 shift + 174:277,target 191 + 88:264,target 156 + 1:380,target 33 + 12:386,target 231 + 350:277 reduce + 349:277 reduce + 249:261 shift + 230:277,target 1 + 229:277,target 1 + 130:261,target 118 + 275:277,target 106 + 249:262 shift + 331:277,target 203 + 70:277,target 187 + 69:277,target 182 + 7:0,target 20 + 23:319 shift + 143:X,target 93 + 8:305,target 34 + 233:398 goto + 95:317,target 53 + 81:0,target 28 + 320:277 reduce + 319:277 reduce + 21:285,target 77 + 23:323 shift + 213:0 reduce + 77:376 shift + 1:410 goto + 23:324 shift + 25:372,target 102 + 180:257 shift + 311:0,target 17 + 180:258 shift + 86:366,target 151 + 203:398 goto + 180:260 shift + 180:259 shift + 53:257,target 114 + 343:391,target 124 + 280:277 reduce + 279:277 reduce + 180:261 shift + 28:277 shift + 180:262 shift + 270:0,target 114 + 269:0,target 105 + 255:0 reduce + 219:268 shift + 18:0,target 36 + 219:270 shift + 219:269 shift + 168:356 shift + 210:376,target 80 + 54:352,target 187 + 249:277 reduce + 4:277,target 27 + 238:0,target 176 + 8:364,target 52 + 28:285 shift + 307:0 reduce + 297:0 reduce + 250:281 shift + 220:275 shift + 88:307 reduce + 58:302 shift + 23:337 shift + 94:257 reduce + 207:0,target 224 + 94:258 reduce + 87:307,target 155 + 338:403 goto + 94:260 reduce + 94:259 reduce + 58:305 shift + 298:388 shift + 94:261 reduce + 58:306 shift + 298:390 shift + 298:389 shift + 133:0 reduce + 130:277,target 1 + 129:277,target 67 + 94:262 reduce + 28:302 shift + 350:0 reduce + 349:0 reduce + 298:391 shift + 175:277,target 92 + 90:264,target 150 + 89:264,target 153 + 13:386,target 226 + 231:277,target 323 + 180:277 reduce + 179:277 shift + 23:432,target 91 + 276:277,target 107 + 28:305 shift + 332:277,target 208 + 232:261,target 118 + 71:277,target 222 + 28:306 shift + 135:0,target 89 + 9:305,target 34 + 175:0 reduce + 141:417,target 247 + 96:317,target 55 + 72:261,target 118 + 34:257 shift + 150:277 reduce + 149:277 reduce + 52:301,target 65 + 11:377,target 230 + 34:258 shift + 77:414 goto + 34:259 shift + 34:260 shift + 104:0,target 165 + 34:261 shift + 87:366,target 155 + 34:262 shift + 84:263,target 154 + 250:333,target 339 + 120:277 reduce + 119:277 reduce + 23:380,target 90 + 240:398,target 330 + 94:277 reduce + 34:398,target 133 + 4:0,target 27 + 298:418 goto + 140:X,target 93 + 139:X,target 93 + 94:281 reduce + 58:326 shift + 0:328,target 31 + 5:277,target 25 + 270:0 reduce + 269:0 reduce + 77:0,target 46 + 9:364,target 52 + 18:0 reduce + 325:277 reduce + 64:277 reduce + 307:0,target 14 + 297:0,target 30 + 250:281,target 337 + 220:275,target 305 + 88:307,target 156 + 58:302,target 199 + 23:337,target 89 + 28:326 shift + 47:425 goto + 322:0 reduce + 285:277 reduce + 61:0 reduce + 59:275,target 206 + 34:277 reduce + 131:277,target 238 + 266:0,target 109 + 176:277,target 64 + 141:323,target 245 + 14:386,target 227 + 38:443,target 146 + 232:277,target 1 + 277:277,target 124 + 26:277,target 66 + 333:277,target 215 + 255:277 reduce + 233:261,target 118 + 72:277,target 1 + 97:317,target 232 + 250:332 shift + 225:275 shift + 12:377,target 231 + 250:333 shift + 23:380 shift + 204:0,target 1 + 34:288 shift + 200:0 reduce + 190:0 reduce + 189:0 reduce + 88:366,target 156 + 85:263,target 152 + 55:257,target 114 + 8:286,target 25 + 140:398,target 242 + 94:313 reduce + 163:0,target 74 + 94:314 reduce + 34:293 shift + 185:277 reduce + 138:416 goto + 58:352 shift + 35:398,target 133 + 242:0 reduce + 94:317 reduce + 1:328,target 33 + 47:300,target 166 + 39:257 shift + 40:257 shift + 240:262,target 119 + 155:277 reduce + 39:258 shift + 40:258 shift + 168:427 goto + 53:398 goto + 28:352 shift + 34:262,target 119 + 39:259 shift + 39:260 shift + 40:259 shift + 40:260 shift + 101:0,target 164 + 39:261 shift + 40:261 shift + 284:0 reduce + 90:307,target 150 + 89:307,target 153 + 33:0 reduce + 39:262 shift + 40:262 shift + 88:366 reduce + 125:277 reduce + 88:367 reduce + 8:355,target 48 + 0:293,target 31 + 0:303,target 31 + 177:277,target 73 + 99:277 reduce + 92:264,target 220 + 15:386,target 229 + 233:277,target 1 + 120:0 reduce + 119:0 reduce + 336:0 reduce + 278:277,target 123 + 94:331 reduce + 75:0 reduce + 27:277,target 77 + 334:277,target 213 + 94:332 reduce + 335:0,target 214 + 94:333 reduce + 331:277 reduce + 70:277 reduce + 69:277 reduce + 7:0 reduce + 13:377,target 226 + 201:257 shift + 162:0 reduce + 88:377 reduce + 304:0,target 140 + 294:0,target 233 + 201:258 shift + 201:260 shift + 201:259 shift + 90:366,target 150 + 89:366,target 153 + 301:277 reduce + 291:277 reduce + 201:261 shift + 86:263,target 151 + 58:375 shift + 56:257,target 114 + 9:286,target 25 + 39:277 reduce + 40:277 reduce + 201:262 shift + 263:0,target 138 + 214:0 reduce + 144:392 shift + 144:393 shift + 88:385 reduce + 36:398,target 136 + 261:277 reduce + 144:394 shift + 28:375 shift + 232:0,target 1 + 144:395 shift + 140:262,target 119 + 7:277,target 21 + 10:280 shift + 256:0 reduce + 35:262,target 119 + 231:277 shift + 201:0,target 1 + 191:0,target 70 + 4:285,target 27 + 23:432 goto + 39:348,target 147 + 23:433 goto + 9:355,target 48 + 133:277,target 174 + 1:303,target 33 + 1:293,target 33 + 308:0 reduce + 201:277 reduce + 191:277 reduce + 178:277,target 96 + 16:386,target 228 + 47:0 reduce + 10:290 shift + 280:277,target 117 + 279:277,target 120 + 180:261,target 118 + 10:301 shift + 28:277,target 104 + 335:277,target 214 + 128:0,target 68 + 29:261,target 118 + 134:0 reduce + 10:301,target 65 + 161:278 shift + 8:329,target 41 + 8:330,target 42 + 10:295 shift + 14:377,target 227 + 45:366,target 161 + 131:277 shift + 87:263,target 155 + 176:0 reduce + 147:357,target 262 + 243:398,target 332 + 230:260,target 117 + 230:259,target 116 + 229:260,target 117 + 229:259,target 116 + 93:333,target 54 + 138:416,target 240 + 101:277 reduce + 58:352,target 203 + 332:0,target 208 + 249:398 goto + 71:0,target 222 + 336:277 reduce + 75:277 reduce + 36:262,target 119 + 301:0,target 8 + 291:0,target 232 + 151:418,target 265 + 0:336,target 4 + 39:0,target 1 + 40:0,target 1 + 342:390,target 123 + 342:389,target 122 + 92:307,target 224 + 306:277 reduce + 296:277 reduce + 219:399 goto + 271:0 reduce + 93:281,target 54 + 260:0,target 139 + 259:0,target 206 + 134:277,target 88 + 75:285 reduce + 180:277,target 1 + 179:277,target 286 + 180:398 goto + 281:277,target 122 + 266:277 reduce + 29:277,target 1 + 336:277,target 201 + 75:277,target 29 + 323:0 reduce + 62:0 reduce + 337:261,target 118 + 144:448 goto + 0:284,target 31 + 24:x,target 95 + 30:388,target 121 + 9:329,target 41 + 9:330,target 42 + 15:377,target 229 + 236:277 reduce + 187:0,target 198 + 4:277 reduce + 46:366,target 161 + 148:0 reduce + 92:366,target 225 + 88:263,target 156 + 161:322 shift + 156:0,target 78 + 130:260,target 117 + 130:259,target 116 + 28:436 goto + 206:277 reduce + 196:277 shift + 28:437 goto + 34:386 shift + 94:333,target 56 + 161:325 shift + 8:304,target 33 + 201:0 reduce + 191:0 reduce + 140:416,target 243 + 139:416,target 241 + 125:0,target 65 + 4:285 reduce + 39:348 shift + 10:345 shift + 243:262,target 119 + 58:451 goto + 15:297 reduce + 343:390,target 123 + 343:389,target 122 + 243:0 reduce + 136:277 reduce + 298:418,target 341 + 94:281,target 56 + 58:326,target 202 + 34:398 goto + 135:277,target 89 + 98:0,target 79 + 181:277,target 91 + 236:277,target 166 + 342:275 shift + 285:0 reduce + 282:277,target 121 + 106:277 reduce + 75:326 reduce + 8:363,target 51 + 34:0 reduce + 337:277,target 1 + 328:0,target 132 + 76:277,target 211 + 67:0,target 186 + 0:311,target 31 + 81:277 reduce + 1:284,target 33 + 16:377,target 228 + 287:0,target 179 + 121:0 reduce + 51:275 shift + 9:263 shift + 10:362 shift + 36:0,target 1 + 337:0 reduce + 23:319,target 86 + 312:277 reduce + 38:314,target 139 + 90:263,target 150 + 89:263,target 153 + 256:0,target 207 + 166:308 shift + 161:349 shift + 200:398,target 292 + 232:260,target 117 + 232:259,target 116 + 163:0 reduce + 95:333,target 53 + 272:277 reduce + 9:304,target 33 + 10:370 shift + 21:277 shift + 39:398,target 148 + 40:398,target 150 + 72:260,target 117 + 72:259,target 116 + 10:371 shift + 52:290,target 63 + 4:326 reduce + 45:338 shift + 242:277 reduce + 215:0 reduce + 184:0,target 199 + 45:339 shift + 250:332,target 338 + 225:275,target 317 + 21:285 shift + 45:343 shift + 153:0,target 72 + 95:281,target 53 + 212:277 shift + 136:277,target 86 +} + +array set plot::rules { + 9,l 399 + 164,l 435 + 216,l 447 + 49,l 415 + 50,l 415 + 136,l 431 + 92,l 419 + 178,l 439 + 231,l 450 + 22,l 404 + 108,l 423 + 64,l 419 + 151,l 433 + 203,l 443 + 193,l 441 + 36,l 411 + 123,l 427 + 78,l 419 + 165,l 436 + 217,l 447 + 51,l 415 + 137,l 431 + 93,l 419 + 180,l 439 + 179,l 439 + 232,l 451 + 23,l 406 + 109,l 423 + 110,l 424 + 65,l 419 + 152,l 433 + 204,l 443 + 194,l 441 + 37,l 412 + 124,l 427 + 79,l 419 + 80,l 419 + 166,l 436 + 218,l 448 + 10,l 399 + 52,l 415 + 138,l 431 + 94,l 419 + 181,l 440 + 233,l 451 + 24,l 406 + 111,l 424 + 66,l 419 + 153,l 433 + 205,l 443 + 195,l 442 + 38,l 412 + 125,l 428 + 81,l 419 + 167,l 437 + 220,l 448 + 219,l 448 + 11,l 400 + 53,l 416 + 139,l 431 + 140,l 432 + 95,l 419 + 182,l 440 + 234,l 451 + 25,l 406 + 112,l 424 + 67,l 419 + 0,l 452 + 154,l 433 + 206,l 443 + 196,l 442 + 39,l 412 + 40,l 412 + 126,l 428 + 82,l 419 + 168,l 437 + 221,l 448 + 12,l 400 + 54,l 416 + 141,l 432 + 96,l 419 + 183,l 440 + 235,l 451 + 26,l 406 + 113,l 424 + 68,l 419 + 1,l 398 + 155,l 433 + 207,l 443 + 197,l 442 + 41,l 413 + 127,l 429 + 83,l 419 + 170,l 437 + 169,l 437 + 222,l 449 + 13,l 401 + 100,l 420 + 55,l 416 + 142,l 432 + 97,l 419 + 184,l 440 + 236,l 451 + 27,l 407 + 114,l 424 + 69,l 419 + 70,l 419 + 2,l 398 + 156,l 433 + 208,l 444 + 198,l 442 + 42,l 413 + 128,l 429 + 84,l 419 + 171,l 437 + 223,l 449 + 14,l 401 + 101,l 420 + 56,l 416 + 143,l 432 + 98,l 419 + 185,l 440 + 237,l 451 + 28,l 406 + 115,l 425 + 71,l 419 + 3,l 398 + 157,l 434 + 210,l 445 + 209,l 444 + 199,l 442 + 43,l 413 + 129,l 429 + 130,l 429 + 85,l 419 + 172,l 437 + 224,l 449 + 15,l 402 + 102,l 421 + 57,l 417 + 144,l 432 + 99,l 419 + 186,l 440 + 30,l 406 + 29,l 408 + 116,l 425 + 72,l 419 + 4,l 398 + 158,l 434 + 211,l 445 + 44,l 413 + 131,l 429 + 86,l 419 + 173,l 437 + 225,l 449 + 16,l 402 + 103,l 421 + 58,l 417 + 145,l 432 + 187,l 440 + 31,l 409 + 117,l 425 + 73,l 419 + 5,l 398 + 160,l 434 + 159,l 434 + 212,l 445 + 45,l 414 + 132,l 429 + 87,l 419 + 174,l 438 + 226,l 450 + 17,l 402 + 104,l 422 + 59,l 418 + 60,l 418 + 146,l 432 + 188,l 440 + 32,l 406 + 118,l 425 + 74,l 419 + 6,l 398 + 161,l 435 + 213,l 446 + 46,l 414 + 133,l 429 + 88,l 419 + 175,l 438 + 227,l 450 + 18,l 403 + 105,l 422 + 61,l 418 + 147,l 432 + 200,l 443 + 190,l 441 + 189,l 440 + 33,l 410 + 119,l 425 + 120,l 425 + 75,l 419 + 7,l 398 + 162,l 435 + 214,l 446 + 47,l 414 + 134,l 430 + 89,l 419 + 90,l 419 + 176,l 438 + 228,l 450 + 20,l 404 + 19,l 403 + 106,l 422 + 62,l 418 + 148,l 432 + 201,l 443 + 191,l 441 + 34,l 406 + 121,l 426 + 76,l 419 + 8,l 399 + 163,l 435 + 215,l 446 + 48,l 414 + 135,l 430 + 91,l 419 + 177,l 438 + 230,l 450 + 229,l 450 + 21,l 405 + 107,l 422 + 63,l 419 + 149,l 432 + 150,l 433 + 202,l 443 + 192,l 441 + 35,l 411 + 122,l 426 + 77,l 419 +} + +array set plot::rules { + 122,dc 1 + 187,dc 1 + 12,dc 1 + 77,dc 1 + 114,dc 1 + 180,dc 2 + 179,dc 2 + 69,dc 2 + 70,dc 2 + 106,dc 2 + 9,dc 1 + 172,dc 1 + 62,dc 1 + 2,dc 1 + 164,dc 1 + 54,dc 1 + 156,dc 1 + 232,dc 2 + 46,dc 0 + 148,dc 3 + 224,dc 3 + 38,dc 2 + 141,dc 3 + 216,dc 1 + 31,dc 0 + 96,dc 2 + 133,dc 3 + 208,dc 2 + 198,dc 1 + 23,dc 2 + 88,dc 2 + 125,dc 1 + 201,dc 3 + 191,dc 1 + 15,dc 1 + 81,dc 2 + 117,dc 2 + 183,dc 1 + 73,dc 2 + 109,dc 1 + 110,dc 1 + 175,dc 2 + 65,dc 2 + 102,dc 0 + 5,dc 1 + 167,dc 1 + 57,dc 1 + 160,dc 2 + 159,dc 2 + 235,dc 2 + 49,dc 4 + 50,dc 0 + 152,dc 1 + 227,dc 1 + 42,dc 0 + 144,dc 3 + 220,dc 1 + 219,dc 1 + 34,dc 3 + 99,dc 2 + 136,dc 1 + 212,dc 3 + 26,dc 0 + 92,dc 2 + 128,dc 3 + 204,dc 2 + 194,dc 1 + 18,dc 1 + 84,dc 2 + 121,dc 1 + 186,dc 1 + 11,dc 1 + 76,dc 2 + 113,dc 1 + 178,dc 1 + 68,dc 2 + 105,dc 2 + 8,dc 1 + 171,dc 1 + 61,dc 1 + 1,dc 0 + 163,dc 1 + 53,dc 1 + 155,dc 1 + 231,dc 1 + 45,dc 4 + 147,dc 3 + 223,dc 3 + 37,dc 1 + 139,dc 1 + 140,dc 3 + 215,dc 2 + 30,dc 5 + 29,dc 0 + 95,dc 2 + 132,dc 3 + 207,dc 2 + 197,dc 1 + 22,dc 3 + 87,dc 2 + 124,dc 1 + 200,dc 2 + 190,dc 1 + 189,dc 1 + 14,dc 1 + 79,dc 2 + 80,dc 2 + 116,dc 2 + 182,dc 1 + 72,dc 2 + 108,dc 1 + 174,dc 1 + 64,dc 2 + 101,dc 2 + 4,dc 1 + 166,dc 2 + 56,dc 1 + 158,dc 2 + 234,dc 2 + 48,dc 4 + 151,dc 1 + 226,dc 1 + 41,dc 4 + 143,dc 3 + 218,dc 1 + 33,dc 0 + 98,dc 2 + 135,dc 2 + 211,dc 3 + 25,dc 1 + 91,dc 2 + 127,dc 3 + 203,dc 3 + 193,dc 1 + 17,dc 1 + 83,dc 2 + 119,dc 2 + 120,dc 2 + 185,dc 1 + 10,dc 1 + 75,dc 2 + 112,dc 1 + 177,dc 2 + 67,dc 2 + 104,dc 2 + 7,dc 1 + 170,dc 1 + 169,dc 1 + 59,dc 1 + 60,dc 1 + 0,dc 1 + 162,dc 1 + 237,dc 2 + 52,dc 4 + 154,dc 1 + 230,dc 1 + 229,dc 1 + 44,dc 4 + 146,dc 3 + 222,dc 2 + 36,dc 1 + 138,dc 1 + 214,dc 2 + 28,dc 3 + 94,dc 2 + 131,dc 3 + 206,dc 2 + 196,dc 1 + 21,dc 0 + 86,dc 2 + 123,dc 1 + 188,dc 1 + 13,dc 1 + 78,dc 2 + 115,dc 0 + 181,dc 1 + 71,dc 2 + 107,dc 2 + 173,dc 1 + 63,dc 2 + 100,dc 1 + 3,dc 1 + 165,dc 1 + 55,dc 1 + 157,dc 1 + 233,dc 2 + 47,dc 1 + 149,dc 3 + 150,dc 1 + 225,dc 3 + 39,dc 2 + 40,dc 2 + 142,dc 3 + 217,dc 1 + 32,dc 2 + 97,dc 2 + 134,dc 1 + 210,dc 3 + 209,dc 1 + 199,dc 1 + 24,dc 1 + 89,dc 2 + 90,dc 2 + 126,dc 1 + 202,dc 3 + 192,dc 1 + 16,dc 1 + 82,dc 2 + 118,dc 2 + 184,dc 1 + 74,dc 2 + 111,dc 1 + 176,dc 2 + 66,dc 1 + 103,dc 1 + 6,dc 1 + 168,dc 1 + 58,dc 1 + 161,dc 1 + 236,dc 2 + 51,dc 1 + 153,dc 1 + 228,dc 1 + 43,dc 1 + 145,dc 3 + 221,dc 1 + 35,dc 0 + 137,dc 1 + 213,dc 2 + 27,dc 0 + 93,dc 2 + 129,dc 3 + 130,dc 3 + 205,dc 2 + 195,dc 1 + 20,dc 1 + 19,dc 1 + 85,dc 2 +} + +array set plot::rules { + 41,line 252 + 37,line 245 + 34,line 237 + 31,line 235 + 27,line 232 + 24,line 228 + 21,line 223 + 17,line 216 + 14,line 211 + 11,line 206 + 9,line 202 + 235,line 553 + 6,line 198 + 232,line 550 + 3,line 195 + 228,line 543 + 225,line 538 + 222,line 535 + 218,line 528 + 215,line 521 + 212,line 516 + 208,line 510 + 198,line 495 + 205,line 505 + 195,line 492 + 202,line 502 + 192,line 487 + 188,line 481 + 185,line 477 + 182,line 474 + 178,line 468 + 175,line 463 + 172,line 458 + 168,line 454 + 165,line 449 + 162,line 443 + 158,line 437 + 155,line 432 + 152,line 428 + 148,line 421 + 145,line 418 + 142,line 414 + 138,line 407 + 135,line 402 + 132,line 397 + 128,line 393 + 125,line 388 + 122,line 381 + 118,line 375 + 115,line 372 + 99,line 344 + 112,line 367 + 96,line 338 + 108,line 361 + 93,line 333 + 105,line 356 + 89,line 329 + 90,line 330 + 102,line 351 + 86,line 325 + 83,line 322 + 79,line 317 + 80,line 318 + 76,line 312 + 73,line 308 + 69,line 304 + 70,line 305 + 66,line 299 + 63,line 295 + 59,line 289 + 60,line 290 + 56,line 281 + 53,line 278 + 49,line 270 + 50,line 272 + 46,line 263 + 43,line 256 + 39,line 247 + 40,line 248 + 36,line 242 + 33,line 236 + 30,line 235 + 29,line 233 + 26,line 232 + 23,line 227 + 20,line 223 + 19,line 220 + 16,line 215 + 13,line 210 + 10,line 203 + 237,line 555 + 8,line 201 + 234,line 552 + 5,line 197 + 231,line 546 + 2,line 194 + 227,line 542 + 27,e 1 + 224,line 537 + 221,line 531 + 217,line 525 + 214,line 520 + 211,line 515 + 207,line 507 + 197,line 494 + 204,line 504 + 194,line 489 + 201,line 501 + 191,line 486 + 187,line 479 + 184,line 476 + 181,line 473 + 177,line 465 + 174,line 462 + 171,line 457 + 167,line 453 + 164,line 445 + 161,line 442 + 157,line 436 + 154,line 431 + 151,line 427 + 147,line 420 + 144,line 417 + 141,line 413 + 137,line 406 + 134,line 401 + 131,line 396 + 127,line 392 + 124,line 385 + 121,line 380 + 117,line 374 + 114,line 369 + 98,line 343 + 111,line 366 + 95,line 336 + 29,e 3 + 107,line 358 + 92,line 332 + 104,line 355 + 88,line 328 + 101,line 348 + 85,line 324 + 82,line 320 + 78,line 316 + 75,line 311 + 72,line 307 + 68,line 302 + 65,line 298 + 62,line 292 + 58,line 286 + 55,line 280 + 52,line 275 + 48,line 266 + 45,line 261 + 42,line 254 + 31,e 0 + 38,line 246 + 35,line 241 + 32,line 236 + 28,line 233 + 25,line 230 + 22,line 224 + 18,line 219 + 15,line 214 + 12,line 207 + 236,line 554 + 7,line 199 + 233,line 551 + 4,line 196 + 230,line 545 + 229,line 544 + 1,line 193 + 226,line 541 + 223,line 536 + 220,line 530 + 219,line 529 + 216,line 524 + 213,line 519 + 210,line 514 + 209,line 511 + 199,line 496 + 206,line 506 + 196,line 493 + 203,line 503 + 193,line 488 + 200,line 500 + 190,line 485 + 189,line 482 + 186,line 478 + 183,line 475 + 180,line 470 + 179,line 469 + 176,line 464 + 173,line 459 + 33,e 1 + 170,line 456 + 169,line 455 + 166,line 450 + 163,line 444 + 160,line 439 + 159,line 438 + 156,line 433 + 153,line 430 + 149,line 422 + 150,line 425 + 146,line 419 + 143,line 415 + 139,line 408 + 140,line 412 + 136,line 405 + 133,line 398 + 129,line 394 + 130,line 395 + 126,line 389 + 123,line 384 + 119,line 376 + 120,line 377 + 116,line 373 + 113,line 368 + 97,line 341 + 109,line 362 + 110,line 365 + 94,line 334 + 106,line 357 + 91,line 331 + 103,line 352 + 87,line 326 + 100,line 347 + 84,line 323 + 81,line 319 + 77,line 314 + 74,line 310 + 21,e 1 + 71,line 306 + 67,line 301 + 64,line 297 + 61,line 291 + 57,line 285 + 54,line 279 + 51,line 274 + 47,line 265 + 44,line 257 +} + +array set plot::lr1_table { + 327,trans {} + 286 {{112 {0 277} 1}} + 66,trans {} + 35 {{89 {0 277} 1} {174 {0 277} 0} {175 {0 277} 0} {176 {0 277} 0} {177 {0 277} 0} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 346,trans {} + 287 {{106 {0 277} 2}} + 85,trans {} + 36 {{86 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 288 {{107 {0 277} 2}} + 37 {{87 {0 277} 1}} + 300 {{160 {0 277} 2}} + 290 {{123 {0 277} 1}} + 289 {{124 {0 277} 1}} + 38 {{98 {0 277} 1} {200 {0 277} 0} {201 {0 277} 0} {202 {0 277} 0} {203 {0 277} 0} {204 {0 277} 0} {205 {0 277} 0} {206 {0 277} 0} {207 {0 277} 0}} + 301 {{158 {0 277} 2}} + 291 {{120 {0 277} 2}} + 39 {{80 {0 277} 1} {134 {0 277} 0} {135 {0 277} 0} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 40 {{71 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 302 {{159 {0 277} 2}} + 292 {{117 {0 277} 2}} + 117,trans {} + 41 {{63 {0 277} 1} {100 {0 277} 0} {101 {0 277} 0}} + 303 {{232 {0 277} 2}} + 293 {{122 {0 277} 1}} + 136,trans {} + 42 {{72 {0 277} 1}} + 304 {{236 {0 277} 2}} + 294 {{121 {0 277} 1}} + 155,trans {} + 43 {{78 {0 277} 1} {125 {0 277} 0} {126 {0 277} 0}} + 305 {{237 {0 277} 2}} + 174,trans {} + 295 {{116 {0 277} 2}} + 44 {{90 {0 277} 1}} + 306 {{233 {0 277} 2}} + 203,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 303}} + 193,trans {} + 296 {{118 {0 277} 2}} + 45 {{75 {0 277} 1} {104 {0 277} 0} {105 {0 277} 0} {106 {0 277} 0} {107 {0 277} 0}} + 222,trans {} + 307 {{235 {0 277} 2}} + 297 {{119 {0 277} 2}} + 46 {{74 {0 277} 1} {104 {0 277} 0} {105 {0 277} 0} {106 {0 277} 0} {107 {0 277} 0}} + 241,trans {} + 308 {{234 {0 277} 2}} + 298 {{180 {0 277} 2}} + 47 {{76 {0 277} 1} {115 {0 277} 0} {116 {0 277} 0} {117 {0 277} 0} {118 {0 277} 0} {119 {0 277} 0} {120 {0 277} 0}} + 260,trans {} + 259,trans {} + 310 {{41 {0 277} 3} {44 {0 277} 3} {59 {0 277} 0} {60 {0 277} 0} {61 {0 277} 0} {62 {0 277} 0}} + 309 {{30 {0 277} 5}} + 299 {{179 {0 277} 2}} + 48 {{92 {0 277} 1} {190 {0 277} 0} {191 {0 277} 0} {192 {0 277} 0} {193 {0 277} 0} {194 {0 277} 0}} + 278,trans {} + 311 {{45 {0 277} 2} {48 {0 277} 2}} + 49 {{64 {0 277} 1}} + 50 {{73 {0 277} 1}} + 27,trans {} + 307,trans {} + 297,trans {} + 312 {{49 {0 277} 2} {52 {0 277} 2}} + 46,trans {{338 158} {339 159} {343 160} {366 161} {422 163}} + 51 {{96 {0 277} 1}} + 326,trans {} + 313 {{8 {0 277} 1}} + 65,trans {} + 52 {{91 {0 277} 1} {178 {0 277} 0} {179 {0 277} 0} {180 {0 277} 0} {181 {0 277} 0} {182 {0 277} 0} {183 {0 277} 0} {184 {0 277} 0} {185 {0 277} 0} {186 {0 277} 0} {187 {0 277} 0} {188 {0 277} 0} {189 {0 277} 0}} + 345,trans {} + 314 {{9 {0 277} 1}} + 84,trans {} + 53 {{84 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 315 {{10 {0 277} 1}} + 54 {{93 {0 277} 1} {195 {0 277} 0} {196 {0 277} 0} {197 {0 277} 0} {198 {0 277} 0} {199 {0 277} 0}} + 316 {{140 {0 277} 3}} + 55 {{69 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 317 {{142 {0 277} 3}} + 56 {{70 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 318 {{13 {0 277} 1}} + 116,trans {} + 57 {{82 {0 277} 1} {157 {0 277} 0} {158 {0 277} 0} {159 {0 277} 0} {160 {0 277} 0} {53 277 0} {54 277 0} {55 277 0} {56 277 0} {57 277 0} {58 277 0}} + 320 {{144 {0 277} 3}} + 319 {{14 {0 277} 1}} + 135,trans {} + 58 {{99 {0 277} 1} {232 {0 277} 0} {233 {0 277} 0} {234 {0 277} 0} {235 {0 277} 0} {236 {0 277} 0} {237 {0 277} 0}} + 321 {{15 {0 277} 1}} + 154,trans {} + 59 {{94 {0 277} 1}} + 60 {{32 {0 277} 2}} + 322 {{16 {0 277} 1}} + 173,trans {} + 61 {{34 {0 277} 3}} + 323 {{17 {0 277} 1}} + 202,trans {} + 192,trans {} + 62 {{188 {0 277} 1}} + 324 {{145 {0 277} 3}} + 221,trans {} + 63 {{181 {0 277} 1}} + 240,trans {} + 239,trans {{275 338} {276 339} {403 341}} + 325 {{11 {0 277} 1}} + 64 {{189 {0 277} 1}} + 258,trans {} + 326 {{12 {0 277} 1}} + 65 {{183 {0 277} 1}} + 277,trans {} + 327 {{143 {0 277} 3}} + 66 {{184 {0 277} 1}} + 26,trans {} + 306,trans {} + 296,trans {} + 328 {{141 {0 277} 3}} + 45,trans {{338 158} {339 159} {343 160} {366 161} {422 162}} + 67 {{186 {0 277} 1}} + 325,trans {} + 330 {{148 {0 277} 3}} + 329 {{146 {0 277} 3}} + 64,trans {} + 68 {{185 {0 277} 1}} + 344,trans {} + 331 {{149 {0 277} 3}} + 83,trans {} + 69 {{182 {0 277} 1}} + 70 {{187 {0 277} 1}} + 332 {{147 {0 277} 3}} + 71 {{222 {0 277} 2}} + 333 {{130 {0 277} 3}} + 72 {{224 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 334 {{129 {0 277} 3}} + 73 {{225 {0 277} 2}} + 335 {{133 {0 277} 3}} + 115,trans {} + 74 {{223 {0 277} 2}} + 336 {{127 {0 277} 3}} + 134,trans {} + 75 {{30 {0 277} 3} {29 {0 277 285 326 361 376} 0}} + 337 {{128 {0 277} 3}} + 153,trans {} + 76 {{41 {0 277} 1} {44 {0 277} 1}} + 338 {{18 {0 277} 1}} + 172,trans {} + 77 {{39 {0 277} 1} {45 {0 277} 0} {46 {0 277} 0} {47 {0 277} 0} {48 {0 277} 0}} + 340 {{132 {0 277} 3}} + 339 {{19 {0 277} 1}} + 201,trans {{277 302}} + 191,trans {} + 78 {{38 {0 277} 1} {41 {0 277} 0} {42 {0 277} 0} {43 {0 277} 0} {44 {0 277} 0}} + 341 {{131 {0 277} 3}} + 220,trans {{277 312}} + 219,trans {} + 79 {{40 {0 277} 1} {49 {0 277} 0} {50 {0 277} 0} {51 {0 277} 0} {52 {0 277} 0}} + 80 {{43 {0 277} 1}} + 342 {{202 {0 277} 3}} + 238,trans {{275 338} {276 339} {403 340}} + 81 {{28 {0 277} 3}} + 257,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 348}} + 343 {{203 {0 277} 3}} + 82 {{37 {0 277} 1}} + 276,trans {} + 344 {{208 {0 277} 2}} + 83 {{22 0 3}} + 25,trans {{271 99} {279 100} {340 101} {372 102} {435 103}} + 305,trans {} + 295,trans {} + 345 {{215 {0 277} 2}} + 44,trans {{277 157}} + 84 {{154 {263 264 265 266 267 307 366 367 377 385} 1}} + 324,trans {} + 346 {{213 {0 277} 2}} + 63,trans {} + 85 {{152 {263 264 265 266 267 307 366 367 377 385} 1}} + 343,trans {} + 347 {{214 {0 277} 2}} + 82,trans {} + 86 {{151 {263 264 265 266 267 307 366 367 377 385} 1}} + 362,trans {} + 348 {{201 {0 277} 3}} + 87 {{155 {263 264 265 266 267 307 366 367 377 385} 1}} + 350 {{212 {0 277} 2} {18 {0 277} 0} {19 {0 277} 0}} + 349 {{210 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 0 {{0 0 0} {20 0 0} {22 0 0} {23 {0 277} 0} {24 {0 277} 0} {25 {0 277} 0} {26 {0 277} 0} {28 {0 277} 0} {30 {0 277} 0} {32 {0 277} 0} {34 {0 277} 0} {31 {263 284 286 291 292 293 297 298 299 303 304 305 306 310 311 315 323 328 329 330 334 335 341 342 350 355 358 359 363 364 365 368 373 374 380 384 386} 0}} + 88 {{156 {263 264 265 266 267 307 366 367 377 385} 1}} + 351 {{211 {0 277} 2} {18 {0 277} 0} {19 {0 277} 0}} + 1 {{34 {0 277} 1} {33 {263 284 286 291 292 293 297 298 299 303 304 305 306 310 311 315 323 328 329 330 334 335 341 342 350 355 358 359 363 364 365 368 373 374 380 384 386} 0}} + 89 {{153 {263 264 265 266 267 307 366 367 377 385} 1}} + 90 {{150 {263 264 265 266 267 307 366 367 377 385} 1}} + 352 {{44 {0 277} 4}} + 114,trans {} + 2 {{24 {0 277} 1}} + 91 {{81 {0 277} 2}} + 353 {{41 {0 277} 4}} + 133,trans {} + 3 {{23 {0 277} 1} {35 {0 277} 0} {36 {0 277} 0} {222 {0 277} 0} {223 {0 277} 0} {224 {0 277} 0} {225 {0 277} 0} {226 {297 377 386} 0} {227 {297 377 386} 0} {228 {297 377 386} 0} {229 {297 377 386} 0} {230 {297 377 386} 0} {231 {297 377 386} 0}} + 92 {{140 {0 277} 1} {141 {0 277} 1} {142 {0 277} 1} {143 {0 277} 1} {144 {0 277} 1} {145 {0 277} 1} {146 {0 277} 1} {147 {0 277} 1} {148 {0 277} 1} {149 {0 277} 1}} + 354 {{45 {0 277} 3} {48 {0 277} 3} {59 {0 277} 0} {60 {0 277} 0} {61 {0 277} 0} {62 {0 277} 0}} + 152,trans {} + 4 {{28 {0 277} 1} {30 {0 277} 1} {27 {0 277 285 326 361 376} 0}} + 93 {{54 {281 313 314 317 331 332 333} 1}} + 355 {{49 {0 277} 3} {52 {0 277} 3} {59 {0 277} 0} {60 {0 277} 0} {61 {0 277} 0} {62 {0 277} 0}} + 171,trans {} + 5 {{25 {0 277} 1}} + 94 {{56 {281 313 314 317 331 332 333} 1}} + 356 {{210 {0 277} 3}} + 200,trans {{277 301}} + 190,trans {} + 189,trans {} + 6 {{0 0 1}} + 95 {{53 {281 313 314 317 331 332 333} 1}} + 357 {{212 {0 277} 3}} + 218,trans {} + 7 {{20 0 1} {22 0 1} {21 277 0}} + 96 {{55 {281 313 314 317 331 332 333} 1}} + 358 {{211 {0 277} 3}} + 237,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 337}} + 8 {{32 {0 277} 1} {63 {0 277} 0} {64 {0 277} 0} {65 {0 277} 0} {66 {0 277} 0} {67 {0 277} 0} {68 {0 277} 0} {69 {0 277} 0} {70 {0 277} 0} {71 {0 277} 0} {72 {0 277} 0} {73 {0 277} 0} {74 {0 277} 0} {75 {0 277} 0} {76 {0 277} 0} {77 {0 277} 0} {78 {0 277} 0} {79 {0 277} 0} {80 {0 277} 0} {81 {0 277} 0} {82 {0 277} 0} {83 {0 277} 0} {84 {0 277} 0} {85 {0 277} 0} {86 {0 277} 0} {87 {0 277} 0} {88 {0 277} 0} {89 {0 277} 0} {90 {0 277} 0} {91 {0 277} 0} {92 {0 277} 0} {93 {0 277} 0} {94 {0 277} 0} {95 {0 277} 0} {96 {0 277} 0} {97 {0 277} 0} {98 {0 277} 0} {99 {0 277} 0}} + 97 {{127 {0 277} 1} {128 {0 277} 1} {129 {0 277} 1} {130 {0 277} 1} {131 {0 277} 1} {132 {0 277} 1} {133 {0 277} 1}} + 360 {{45 {0 277} 4}} + 359 {{48 {0 277} 4}} + 256,trans {} + 9 {{34 {0 277} 2} {63 {0 277} 0} {64 {0 277} 0} {65 {0 277} 0} {66 {0 277} 0} {67 {0 277} 0} {68 {0 277} 0} {69 {0 277} 0} {70 {0 277} 0} {71 {0 277} 0} {72 {0 277} 0} {73 {0 277} 0} {74 {0 277} 0} {75 {0 277} 0} {76 {0 277} 0} {77 {0 277} 0} {78 {0 277} 0} {79 {0 277} 0} {80 {0 277} 0} {81 {0 277} 0} {82 {0 277} 0} {83 {0 277} 0} {84 {0 277} 0} {85 {0 277} 0} {86 {0 277} 0} {87 {0 277} 0} {88 {0 277} 0} {89 {0 277} 0} {90 {0 277} 0} {91 {0 277} 0} {92 {0 277} 0} {93 {0 277} 0} {94 {0 277} 0} {95 {0 277} 0} {96 {0 277} 0} {97 {0 277} 0} {98 {0 277} 0} {99 {0 277} 0}} + 98 {{79 {0 277} 2}} + 361 {{52 {0 277} 4}} + 275,trans {} + 24,trans {{X 93} {Y 94} {x 95} {y 96} {416 97} {429 98}} + 99 {{161 {0 277} 1}} + 362 {{49 {0 277} 4}} + 304,trans {} + 294,trans {} + 43,trans {{346 154} {387 155} {428 156}} + 323,trans {} + 62,trans {} + 342,trans {} + 81,trans {} + 361,trans {} + 99,trans {} + 113,trans {{277 240}} + 132,trans {{275 243}} + 151,trans {{388 121} {389 122} {390 123} {391 124} {418 277}} + 170,trans {} + 169,trans {} + 188,trans {} + 217,trans {} + 236,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 336}} + 255,trans {{277 347}} + 274,trans {} + 23,trans {{282 84} {283 85} {319 86} {323 87} {324 88} {337 89} {380 90} {432 91} {433 92}} + 303,trans {} + 293,trans {} + 42,trans {{277 153}} + 322,trans {} + 61,trans {} + 341,trans {} + 80,trans {} + 79,trans {{277 220} {376 221} {415 222}} + 360,trans {} + 359,trans {} + 98,trans {} + 9,trans {{263 23} {284 24} {286 25} {291 26} {292 27} {293 28} {297 29} {298 30} {299 31} {303 32} {304 33} {305 34} {306 35} {310 36} {311 37} {315 38} {323 39} {328 40} {329 41} {330 42} {334 43} {335 44} {341 45} {342 46} {350 47} {355 48} {358 49} {359 50} {363 51} {364 52} {365 53} {368 54} {373 55} {374 56} {380 57} {384 58} {386 59} {419 61}} + 112,trans {} + 131,trans {{277 242}} + 150,trans {} + 149,trans {} + 168,trans {{316 289} {356 290} {427 297}} + 187,trans {} + 216,trans {{277 311}} + 235,trans {{277 335}} + 254,trans {{277 346}} + 273,trans {} + 22,trans {{277 83}} + 302,trans {} + 292,trans {} + 41,trans {{277 151} {420 152}} + 321,trans {} + 60,trans {} + 59,trans {{275 210}} + 340,trans {} + 339,trans {} + 78,trans {{277 76} {376 80} {413 219}} + 358,trans {} + 97,trans {{281 233} {313 234} {314 235} {317 236} {331 237} {332 238} {333 239}} + 8,trans {{263 23} {284 24} {286 25} {291 26} {292 27} {293 28} {297 29} {298 30} {299 31} {303 32} {304 33} {305 34} {306 35} {310 36} {311 37} {315 38} {323 39} {328 40} {329 41} {330 42} {334 43} {335 44} {341 45} {342 46} {350 47} {355 48} {358 49} {359 50} {363 51} {364 52} {365 53} {368 54} {373 55} {374 56} {380 57} {384 58} {386 59} {419 60}} + 111,trans {} + 130,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 241}} + 129,trans {} + 148,trans {} + 100 {{163 {0 277} 1}} + 167,trans {{277 296}} + 101 {{164 {0 277} 1}} + 186,trans {} + 102 {{162 {0 277} 1}} + 215,trans {{277 310}} + 103 {{83 {0 277} 2}} + 234,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 334}} + 104 {{165 {0 277} 1}} + 253,trans {{277 345}} + 105 {{171 277 1}} + 272,trans {} + 21,trans {{277 76} {285 77} {326 78} {361 79} {376 80} {412 81} {413 82}} + 106 {{167 277 1}} + 301,trans {} + 291,trans {} + 107 {{172 277 1}} + 39,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {348 147} {398 148} {430 149}} + 40,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 150}} + 320,trans {} + 319,trans {} + 58,trans {{302 203} {305 204} {306 205} {326 206} {352 207} {375 208} {451 209}} + 108 {{173 277 1}} + 338,trans {} + 77,trans {{277 216} {376 217} {414 218}} + 109 {{168 277 1}} + 110 {{170 277 1}} + 357,trans {} + 96,trans {} + 7,trans {{405 22}} + 111 {{169 277 1}} + 112 {{85 {0 277} 2}} + 113 {{166 {0 277} 1}} + 110,trans {} + 109,trans {} + 114 {{2 {0 277} 1}} + 128,trans {} + 115 {{5 {0 277} 1}} + 147,trans {{287 272} {321 273} {357 274} {381 275} {431 276}} + 116 {{3 {0 277} 1}} + 166,trans {{308 293} {351 294} {426 295}} + 117 {{6 {0 277} 1}} + 185,trans {} + 118 {{4 {0 277} 1}} + 214,trans {{277 76} {285 77} {326 78} {361 79} {376 80} {412 309} {413 82}} + 119 {{7 {0 277} 1}} + 120 {{95 {0 277} 2}} + 233,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 333}} + 121 {{59 {0 277} 1}} + 252,trans {} + 122 {{60 {0 277} 1}} + 271,trans {} + 19,trans {{297 72} {377 73} {386 74}} + 20,trans {{277 75}} + 123 {{61 {0 277} 1}} + 300,trans {} + 290,trans {} + 289,trans {} + 124 {{62 {0 277} 1}} + 38,trans {{313 138} {314 139} {317 140} {319 141} {331 142} {354 143} {360 144} {383 145} {443 146}} + 318,trans {} + 57,trans {{X 192} {Y 193} {x 194} {y 195} {277 196} {323 197} {396 198} {397 199} {416 200} {417 201} {434 202}} + 125 {{65 {0 277} 2}} + 337,trans {} + 76,trans {{277 215}} + 126 {{97 {0 277} 2}} + 356,trans {} + 95,trans {} + 6,trans {} + 127 {{103 {0 277} 1}} + 128 {{68 {0 277} 2}} + 129 {{67 {0 277} 2}} + 130 {{175 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 108,trans {} + 131 {{176 {0 277} 1}} + 127,trans {} + 132 {{177 {0 277} 1}} + 146,trans {} + 133 {{174 {0 277} 1}} + 165,trans {{277 292}} + 134 {{88 {0 277} 2}} + 184,trans {} + 135 {{89 {0 277} 2}} + 213,trans {} + 136 {{86 {0 277} 2}} + 232,trans {{271 325} {272 326} {400 332}} + 137 {{87 {0 277} 2}} + 251,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 344}} + 138 {{202 {0 277} 1} {53 {0 257 258 259 260 261 262} 0} {54 {0 257 258 259 260 261 262} 0} {55 {0 257 258 259 260 261 262} 0} {56 {0 257 258 259 260 261 262} 0}} + 270,trans {} + 269,trans {} + 18,trans {} + 139 {{203 {0 277} 1} {53 277 0} {54 277 0} {55 277 0} {56 277 0}} + 140 {{200 {0 277} 1} {208 {0 277} 0} {209 {0 277} 0} {53 {0 257 258 259 260 261 262} 0} {54 {0 257 258 259 260 261 262} 0} {55 {0 257 258 259 260 261 262} 0} {56 {0 257 258 259 260 261 262} 0} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 288,trans {} + 37,trans {{277 137}} + 141 {{205 {0 277} 1} {213 {0 277} 0} {214 {0 277} 0} {215 {0 277} 0} {57 277 0} {58 277 0}} + 317,trans {} + 56,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 191}} + 142 {{201 {0 277} 1} {53 {0 257 258 259 260 261 262} 0} {54 {0 257 258 259 260 261 262} 0} {55 {0 257 258 259 260 261 262} 0} {56 {0 257 258 259 260 261 262} 0}} + 336,trans {} + 75,trans {{408 214}} + 143 {{204 {0 277} 1} {210 {0 277} 0} {211 {0 277} 0} {212 {0 277} 0} {53 {281 332 333} 0} {54 {281 332 333} 0} {55 {281 332 333} 0} {56 {281 332 333} 0}} + 355,trans {{275 361} {388 121} {389 122} {390 123} {391 124} {418 362}} + 94,trans {} + 5,trans {} + 144 {{207 {0 277} 1} {218 {0 277} 0} {219 {0 277} 0} {220 {0 277} 0} {221 {0 277} 0}} + 145 {{206 {0 277} 1} {216 {0 277} 0} {217 {0 277} 0}} + 146 {{98 {0 277} 2}} + 107,trans {} + 147 {{135 {0 277} 1} {136 {0 277} 0} {137 {0 277} 0} {138 {0 277} 0} {139 {0 277} 0}} + 126,trans {} + 148 {{134 {0 277} 1}} + 145,trans {{285 269} {326 270} {447 271}} + 149 {{80 {0 277} 2}} + 150 {{71 {0 277} 2}} + 164,trans {{316 289} {356 290} {427 291}} + 151 {{100 {0 277} 1} {101 {0 277} 1} {59 {0 277} 0} {60 {0 277} 0} {61 {0 277} 0} {62 {0 277} 0}} + 183,trans {} + 152 {{63 {0 277} 2}} + 212,trans {} + 153 {{72 {0 277} 2}} + 231,trans {{271 321} {272 322} {274 323} {402 331}} + 154 {{125 {0 277} 1}} + 250,trans {} + 249,trans {{277 343}} + 155 {{126 {0 277} 1}} + 268,trans {} + 156 {{78 {0 277} 2}} + 17,trans {} + 287,trans {} + 157 {{90 {0 277} 2}} + 36,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 136}} + 316,trans {} + 55,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 190}} + 158 {{104 {0 277} 1} {108 {0 277} 0} {109 {0 277} 0}} + 335,trans {} + 74,trans {{275 213}} + 160 {{106 {0 277} 1} {110 {0 277} 0} {111 {0 277} 0} {112 {0 277} 0} {113 {0 277} 0} {114 {0 277} 0}} + 159 {{105 {0 277} 1} {108 {0 277} 0} {109 {0 277} 0}} + 354,trans {{275 359} {388 121} {389 122} {390 123} {391 124} {418 360}} + 93,trans {} + 161 {{107 {0 277} 1} {110 {0 277} 0} {111 {0 277} 0} {112 {0 277} 0} {113 {0 277} 0} {114 {0 277} 0}} + 4,trans {{335 20} {407 21}} + 162 {{75 {0 277} 2}} + 163 {{74 {0 277} 2}} + 106,trans {} + 164 {{120 {0 277} 1} {123 {0 277} 0} {124 {0 277} 0}} + 125,trans {} + 165 {{117 {0 277} 1}} + 144,trans {{392 264} {393 265} {394 266} {395 267} {448 268}} + 166 {{116 {0 277} 1} {121 {0 277} 0} {122 {0 277} 0}} + 163,trans {} + 167 {{118 {0 277} 1}} + 182,trans {} + 168 {{119 {0 277} 1} {123 {0 277} 0} {124 {0 277} 0}} + 211,trans {} + 170 {{190 {0 277} 1}} + 169 {{76 {0 277} 2}} + 230,trans {{273 318} {274 319} {401 330}} + 229,trans {{275 329}} + 171 {{194 {0 277} 1}} + 248,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 342}} + 172 {{192 {0 277} 1}} + 267,trans {} + 173 {{193 {0 277} 1}} + 16,trans {} + 286,trans {} + 174 {{191 {0 277} 1}} + 35,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {288 130} {293 131} {386 132} {398 133} {438 135}} + 315,trans {} + 54,trans {{289 184} {296 185} {327 186} {352 187} {375 188} {442 189}} + 175 {{92 {0 277} 2}} + 334,trans {} + 73,trans {{275 212}} + 176 {{64 {0 277} 2}} + 353,trans {} + 92,trans {{263 223} {264 224} {265 225} {266 226} {267 227} {307 228} {366 229} {367 230} {377 231} {385 232}} + 177 {{73 {0 277} 2}} + 3,trans {{302 10} {305 11} {306 12} {326 13} {327 14} {352 15} {375 16} {411 17} {449 18} {450 19}} + 178 {{96 {0 277} 2}} + 180 {{179 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 179 {{180 {0 277} 1}} + 105,trans {} + 181 {{91 {0 277} 2}} + 124,trans {} + 182 {{178 {0 277} 1}} + 143,trans {{X 258} {Y 259} {x 260} {y 261} {416 262} {445 263}} + 183 {{84 {0 277} 2}} + 162,trans {} + 184 {{199 {0 277} 1}} + 181,trans {} + 185 {{197 {0 277} 1}} + 210,trans {} + 209,trans {} + 199,trans {} + 186 {{196 {0 277} 1}} + 228,trans {{268 313} {269 314} {270 315} {399 328}} + 187 {{198 {0 277} 1}} + 247,trans {} + 188 {{195 {0 277} 1}} + 266,trans {} + 200 {{158 {0 277} 1}} + 190 {{69 {0 277} 2}} + 189 {{93 {0 277} 2}} + 15,trans {} + 285,trans {} + 201 {{159 {0 277} 1}} + 191 {{70 {0 277} 2}} + 34,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {288 130} {293 131} {386 132} {398 133} {438 134}} + 314,trans {} + 202 {{82 {0 277} 2}} + 192 {{54 277 1}} + 53,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 183}} + 333,trans {} + 72,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 211}} + 203 {{232 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 193 {{56 277 1}} + 352,trans {} + 91,trans {} + 204 {{236 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 194 {{53 277 1}} + 2,trans {} + 205 {{237 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 195 {{55 277 1}} + 206 {{233 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 196 {{157 {0 277} 1}} + 104,trans {} + 207 {{235 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 197 {{160 {0 277} 1}} + 123,trans {} + 208 {{234 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 198 {{57 277 1}} + 142,trans {{X 244} {Y 245} {x 246} {y 247} {416 257}} + 210 {{94 {0 277} 2}} + 209 {{99 {0 277} 2}} + 199 {{58 277 1}} + 161,trans {{278 282} {322 283} {325 284} {349 285} {379 286} {424 288}} + 211 {{224 {0 277} 3}} + 180,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 299}} + 179,trans {{277 298}} + 212 {{225 {0 277} 3}} + 208,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 308}} + 198,trans {} + 213 {{223 {0 277} 3}} + 227,trans {{271 325} {272 326} {400 327}} + 214 {{30 {0 277} 4} {37 {0 277} 0} {38 {0 277} 0} {39 {0 277} 0} {40 {0 277} 0} {41 {0 277} 0} {42 {0 277} 0} {43 {0 277} 0} {44 {0 277} 0}} + 246,trans {} + 215 {{41 {0 277} 2} {44 {0 277} 2}} + 265,trans {} + 216 {{45 {0 277} 1} {48 {0 277} 1}} + 14,trans {} + 284,trans {} + 217 {{47 {0 277} 1}} + 33,trans {{275 127} {421 129}} + 313,trans {} + 218 {{39 {0 277} 2}} + 52,trans {{280 62} {290 63} {293 179} {295 64} {301 65} {310 180} {345 66} {362 67} {370 68} {371 69} {382 70} {439 181} {440 182}} + 332,trans {} + 220 {{49 {0 277} 1} {52 {0 277} 1}} + 219 {{38 {0 277} 2}} + 71,trans {} + 351,trans {{275 338} {276 339} {403 358}} + 90,trans {} + 89,trans {} + 221 {{51 {0 277} 1}} + 1,trans {{410 9}} + 222 {{40 {0 277} 2}} + 223 {{140 {0 277} 2} {8 {0 277} 0} {9 {0 277} 0} {10 {0 277} 0}} + 103,trans {} + 224 {{142 {0 277} 2}} + 122,trans {} + 225 {{144 {0 277} 2} {13 {0 277} 0} {14 {0 277} 0}} + 141,trans {{323 253} {380 254} {396 198} {397 199} {417 255} {446 256}} + 226 {{145 {0 277} 2} {15 {0 277} 0} {16 {0 277} 0} {17 {0 277} 0}} + 160,trans {{278 282} {322 283} {325 284} {349 285} {379 286} {424 287}} + 159,trans {{320 278} {347 279} {423 281}} + 227 {{143 {0 277} 2} {11 {0 277} 0} {12 {0 277} 0}} + 178,trans {} + 228 {{141 {0 277} 2} {8 {0 277} 0} {9 {0 277} 0} {10 {0 277} 0}} + 207,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 307}} + 197,trans {{277 300}} + 230 {{148 {0 277} 2} {13 {0 277} 0} {14 {0 277} 0}} + 229 {{146 {0 277} 2}} + 226,trans {{271 321} {272 322} {274 323} {402 324}} + 231 {{149 {0 277} 2} {15 {0 277} 0} {16 {0 277} 0} {17 {0 277} 0}} + 245,trans {} + 232 {{147 {0 277} 2} {11 {0 277} 0} {12 {0 277} 0}} + 264,trans {} + 233 {{130 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 13,trans {} + 283,trans {} + 234 {{129 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 32,trans {{275 127} {421 128}} + 312,trans {{277 355}} + 235 {{133 {0 277} 2}} + 51,trans {{275 178}} + 331,trans {} + 236 {{127 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 70,trans {} + 69,trans {} + 350,trans {{275 338} {276 339} {403 357}} + 349,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 356}} + 237 {{128 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 88,trans {} + 0,trans {{277 1} {285 2} {326 3} {336 4} {361 5} {404 6} {406 7} {409 8}} + 238 {{132 {0 277} 2} {18 {0 277} 0} {19 {0 277} 0}} + 240 {{166 {0 277} 2}} + 239 {{131 {0 277} 2} {18 {0 277} 0} {19 {0 277} 0}} + 241 {{175 {0 277} 2}} + 102,trans {} + 242 {{176 {0 277} 2}} + 121,trans {} + 140,trans {{X 244} {Y 245} {x 246} {y 247} {257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 250} {416 251} {444 252}} + 139,trans {{X 192} {Y 193} {x 194} {y 195} {416 249}} + 243 {{177 {0 277} 2}} + 158,trans {{320 278} {347 279} {423 280}} + 244 {{54 {0 257 258 259 260 261 262} 1}} + 177,trans {} + 245 {{56 {0 257 258 259 260 261 262} 1}} + 206,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 306}} + 196,trans {} + 246 {{53 {0 257 258 259 260 261 262} 1}} + 225,trans {{273 318} {274 319} {401 320}} + 247 {{55 {0 257 258 259 260 261 262} 1}} + 244,trans {} + 248 {{202 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 263,trans {} + 250 {{209 {0 277} 1}} + 249 {{203 {0 277} 2}} + 12,trans {} + 282,trans {} + 251 {{208 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 31,trans {{275 126}} + 311,trans {{277 354}} + 252 {{200 {0 277} 2}} + 50,trans {{277 177}} + 49,trans {{277 176}} + 330,trans {} + 329,trans {} + 253 {{215 {0 277} 1}} + 68,trans {} + 348,trans {} + 254 {{213 {0 277} 1}} + 87,trans {} + 255 {{214 {0 277} 1}} + 256 {{205 {0 277} 2}} + 257 {{201 {0 277} 2} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 101,trans {} + 258 {{54 {281 332 333} 1}} + 120,trans {} + 119,trans {} + 260 {{53 {281 332 333} 1}} + 259 {{56 {281 332 333} 1}} + 138,trans {{X 244} {Y 245} {x 246} {y 247} {416 248}} + 157,trans {} + 261 {{55 {281 332 333} 1}} + 10 {{222 {0 277} 1} {181 {0 277} 0} {182 {0 277} 0} {183 {0 277} 0} {184 {0 277} 0} {185 {0 277} 0} {186 {0 277} 0} {187 {0 277} 0} {188 {0 277} 0} {189 {0 277} 0}} + 176,trans {} + 262 {{210 {0 277} 1} {211 {0 277} 1} {212 {0 277} 1}} + 11 {{230 {297 377 386} 1}} + 205,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 305}} + 195,trans {} + 263 {{204 {0 277} 2}} + 12 {{231 {297 377 386} 1}} + 224,trans {{275 317}} + 264 {{218 {0 277} 1}} + 13 {{226 {297 377 386} 1}} + 243,trans {} + 265 {{220 {0 277} 1}} + 14 {{227 {297 377 386} 1}} + 262,trans {{281 349} {332 350} {333 351}} + 266 {{219 {0 277} 1}} + 15 {{229 {297 377 386} 1}} + 11,trans {} + 281,trans {} + 267 {{221 {0 277} 1}} + 16 {{228 {297 377 386} 1}} + 29,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 120}} + 30,trans {{388 121} {389 122} {390 123} {391 124} {418 125}} + 310,trans {{275 352} {388 121} {389 122} {390 123} {391 124} {418 353}} + 309,trans {} + 299,trans {} + 268 {{207 {0 277} 2}} + 48,trans {{312 170} {318 171} {353 172} {369 173} {378 174} {441 175}} + 17 {{23 {0 277} 2}} + 328,trans {} + 270 {{216 {0 277} 1}} + 269 {{217 {0 277} 1}} + 67,trans {} + 18 {{36 {0 277} 1}} + 347,trans {} + 271 {{206 {0 277} 2}} + 86,trans {} + 20 {{30 {0 277} 2}} + 19 {{223 {0 277} 1} {224 {0 277} 1} {225 {0 277} 1}} + 272 {{139 {0 277} 1}} + 21 {{28 {0 277} 2} {37 {0 277} 0} {38 {0 277} 0} {39 {0 277} 0} {40 {0 277} 0} {41 {0 277} 0} {42 {0 277} 0} {43 {0 277} 0} {44 {0 277} 0}} + 273 {{137 {0 277} 1}} + 22 {{22 0 2}} + 274 {{136 {0 277} 1}} + 100,trans {} + 23 {{81 {0 277} 1} {140 {0 277} 0} {141 {0 277} 0} {142 {0 277} 0} {143 {0 277} 0} {144 {0 277} 0} {145 {0 277} 0} {146 {0 277} 0} {147 {0 277} 0} {148 {0 277} 0} {149 {0 277} 0} {150 {263 264 265 266 267 307 366 367 377 385} 0} {151 {263 264 265 266 267 307 366 367 377 385} 0} {152 {263 264 265 266 267 307 366 367 377 385} 0} {153 {263 264 265 266 267 307 366 367 377 385} 0} {154 {263 264 265 266 267 307 366 367 377 385} 0} {155 {263 264 265 266 267 307 366 367 377 385} 0} {156 {263 264 265 266 267 307 366 367 377 385} 0}} + 275 {{138 {0 277} 1}} + 118,trans {} + 24 {{79 {0 277} 1} {127 {0 277} 0} {128 {0 277} 0} {129 {0 277} 0} {130 {0 277} 0} {131 {0 277} 0} {132 {0 277} 0} {133 {0 277} 0} {53 {281 313 314 317 331 332 333} 0} {54 {281 313 314 317 331 332 333} 0} {55 {281 313 314 317 331 332 333} 0} {56 {281 313 314 317 331 332 333} 0}} + 276 {{135 {0 277} 2}} + 137,trans {} + 25 {{83 {0 277} 1} {161 {0 277} 0} {162 {0 277} 0} {163 {0 277} 0} {164 {0 277} 0}} + 156,trans {} + 277 {{101 {0 277} 2}} + 26 {{66 {0 277} 1}} + 175,trans {} + 278 {{109 {0 277} 1}} + 27 {{77 {0 277} 1}} + 204,trans {{257 114} {258 115} {259 116} {260 117} {261 118} {262 119} {398 304}} + 194,trans {} + 280 {{104 {0 277} 2}} + 279 {{108 {0 277} 1}} + 28 {{85 {0 277} 1} {165 {0 277} 0} {166 {0 277} 0} {167 277 0} {168 277 0} {169 277 0} {170 277 0} {171 277 0} {172 277 0} {173 277 0}} + 223,trans {{268 313} {269 314} {270 315} {399 316}} + 281 {{105 {0 277} 2}} + 30 {{65 {0 277} 1} {59 {0 277} 0} {60 {0 277} 0} {61 {0 277} 0} {62 {0 277} 0}} + 29 {{95 {0 277} 1} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} + 242,trans {} + 282 {{114 {0 277} 1}} + 31 {{97 {0 277} 1}} + 261,trans {} + 283 {{111 {0 277} 1}} + 32 {{68 {0 277} 1} {102 {0 277} 0} {103 {0 277} 0}} + 10,trans {{280 62} {290 63} {295 64} {301 65} {345 66} {362 67} {370 68} {371 69} {382 70} {440 71}} + 280,trans {} + 279,trans {} + 284 {{110 {0 277} 1}} + 33 {{67 {0 277} 1} {102 {0 277} 0} {103 {0 277} 0}} + 28,trans {{277 104} {285 105} {302 106} {305 107} {306 108} {326 109} {352 110} {375 111} {436 112} {437 113}} + 308,trans {} + 298,trans {} + 285 {{113 {0 277} 1}} + 47,trans {{293 164} {294 165} {300 166} {309 167} {344 168} {425 169}} + 34 {{88 {0 277} 1} {174 {0 277} 0} {175 {0 277} 0} {176 {0 277} 0} {177 {0 277} 0} {1 {0 277} 0} {2 {0 277} 0} {3 {0 277} 0} {4 {0 277} 0} {5 {0 277} 0} {6 {0 277} 0} {7 {0 277} 0}} +} + +array set plot::token_id_table { + 286,t 0 + 302,line 59 + 292,line 49 + 284,title AXIS + 288,line 45 + 338,t 0 + 369,title SOLID + 370,title SPLUS + 285,line 42 + 381,t 0 + 282,line 39 + 433,t 1 + 283,title AXESTITLE + 278,line 35 + 258,t 0 + 368,title SMOOTH + 275,line 28 + 311,t 0 + 272,line 24 + 282,title AXESNUMBERS + 353,t 0 + 268,line 20 + 367,title SLANT + 265,line 17 + 395,t 0 + 405,t 1 + 262,line 13 + 447,t 1 + 0 {$} + 281,title AUTO + 258,line 9 + 273,t 0 + 366,title SIZE + 452,title {} + 325,t 0 + 280,title ARROW + 279,title ALIGNED + 367,t 0 + 365,title SHOW + 419,t 1 + 420,t 1 + 451,title {} + y,t 0 + 278,title A4 + 287,t 0 + 364,title SHAPE + 450,title {} + 449,title {} + 339,t 0 + 340,t 0 + X X + Y Y + 382,t 0 + 277,title string + 363,title SELECT + 434,t 1 + 448,title {} + 259,t 0 + 260,t 0 + 276,title float + 312,t 0 + 362,title SCROSS + 354,t 0 + 447,title {} + x x + y y + 396,t 0 + 406,t 1 + 275,title integer + 448,t 1 + 361,title SCATTER + 446,title {} + 274,t 0 + 451,line 549 + 447,line 523 + 274,title ITALIC + 326,t 0 + 359,title SAVECONFIG + 360,title SCALE + 444,line 509 + 368,t 0 + 445,title {} + 441,line 484 + 421,t 1 + 273,title ROMAN + 437,line 452 + 358,title SAVE + 434,line 435 + 444,title {} + 288,t 0 + 431,line 404 + 341,t 0 + 272,title BOLD + 427,line 383 + 357,title RIGHT + 383,t 0 + 424,line 364 + Y,title {} + 443,title {} + 421,line 350 + 435,t 1 + 271,title NORMAL + 417,line 284 + 261,t 0 + 356,title RGB + 414,line 259 + X,title {} + 313,t 0 + 442,title {} + 411,line 239 + 355,t 0 + 270,title COURIER + 269,title HELVETICA + 397,line 159 + 407,line 232 + 355,title RELIEF + 397,t 0 + 407,t 1 + 394,line 155 + 404,line 222 + 441,title {} + 450,t 1 + 449,t 1 + 391,line 151 + 401,line 209 + 275,t 0 + 268,title TIMES + 387,line 146 + 354,title RANGE + 384,line 143 + 327,t 0 + 439,title {} + 440,title {} + 381,line 140 + 369,t 0 + 370,t 0 + 267,title FONTWEIGHT + 377,line 136 + 422,t 1 + 353,title RAISED + 374,line 133 + 438,title {} + 371,line 130 + 300,t 0 + 290,t 0 + 289,t 0 + 266,title FONTSTYLE + 367,line 126 + 352,title QUADRATIC + 342,t 0 + 364,line 123 + 437,title {} + 361,line 120 + 384,t 0 + 265,title FONTSLANT + 357,line 116 + 436,t 1 + 351,title PRINTER + 354,line 113 + 262,t 0 + 436,title {} + 351,line 110 + 314,t 0 + 264,title FONTSIZE + 347,line 106 + 349,title POSTER + 350,title PRINT + 356,t 0 + 344,line 103 + 435,title {} + 341,line 100 + 398,t 1 + 408,t 1 + 263,title FONT + 337,line 96 + 451,t 1 + 348,title POSITION + 334,line 92 + 276,t 0 + 434,title {} + 331,line 89 + 328,t 0 + 262,title FALSE + 327,line 85 + 0,t 0 + error,t 0 + 371,t 0 + 347,title PORTRAIT + 324,line 82 + 433,title {} + 423,t 1 + 321,line 79 + 261,title TRUE + 317,line 75 + 346,title POINTER + 301,t 0 + 291,t 0 + 314,line 72 + 432,title {} + 311,line 68 + 343,t 0 + 297,line 54 + 259,title ON + 260,title OFF + 307,line 64 + 385,t 0 + 345,title PLUS + 304,line 61 + 294,line 51 + 431,title {} + 437,t 1 + 301,line 58 + 291,line 48 + 263,t 0 + 287,line 44 + 258,title NO + 315,t 0 + 344,title PALETTE + 284,line 41 + 429,title {} + 430,title {} + 281,line 38 + 357,t 0 + 277,line 31 + 257,title YES + 399,t 1 + 409,t 1 + 410,t 1 + 343,title PAGESIZE + 274,line 26 + 452,t 1 + 428,title {} + Y,line 280 + 271,line 95 + 277,t 0 + 267,line 19 + 329,t 0 + 330,t 0 + 342,title PAGESETUP + 264,line 16 + 427,title {} + 372,t 0 + 261,line 12 + 257,line 8 + 424,t 1 + 341,title PAGE + error error + 426,title {} + 302,t 0 + 292,t 0 + 344,t 0 + 339,title ORIENTATION + 340,title OVERLAP + 386,t 0 + 425,title {} + 438,t 1 + 264,t 0 + 338,title ORIENT + 424,title {} + 316,t 0 + 358,t 0 + 337,title NUMBERS + 411,t 1 + 423,title {} + 278,t 0 + 336,title NEW + 422,title {} + 331,t 0 + 373,t 0 + X,t 0 + 335,title NAME + 425,t 1 + 450,line 540 + 449,line 534 + 421,title {} + 446,line 518 + 303,t 0 + 293,t 0 + 257 YES_ + 443,line 499 + 258 NO_ + 259 ON_ + 260 OFF_ + 334,title MODE + 261 TRUE_ + 262 FALSE_ + 263 FONT_ + 264 FONTSIZE_ + 345,t 0 + 419,title {} + 420,title {} + 439,line 467 + 440,line 472 + 265 FONTSLANT_ + 266 FONTSTYLE_ + 267 FONTWEIGHT_ + 268 TIMES_ + 270 COURIER_ + 269 HELVETICA_ + 436,line 447 + 271 NORMAL_ + 387,t 0 + 272 BOLD_ + 273 ROMAN_ + 274 ITALIC_ + 275 INT_ + 433,line 424 + 276 REAL_ + 333,title MIN + 277 STRING_ + 439,t 1 + 440,t 1 + 278 A4_ + 280 ARROW_ + 279 ALIGNED_ + 281 AUTO_ + 418,title {} + 429,line 391 + 430,line 400 + 282 AXESNUMBERS_ + 283 AXESTITLE_ + 265,t 0 + 284 AXIS_ + 285 BAR_ + 286 BARMODE_ + 426,line 379 + 287 BOTTOM_ + 288 CAP_ + 300 DESTINATION_ + 290 CIRCLE_ + 289 CATROM_ + 317,t 0 + 301 DIAMOND_ + 291 CLEAR_ + 302 DISCRETE_ + 292 CLOSE_ + 423,line 360 + 303 DUP_ + 293 COLOR_ + 332,title MAX + 304 DUPLICATE_ + 294 COMMAND_ + 295 CROSS_ + 305 ERROR_ + 296 CUBIC_ + 306 ERRORBAR_ + 359,t 0 + 360,t 0 + 297 DASH_ + 307 FAMILY_ + 417,title {} + 419,line 294 + 420,line 346 + 298 DATA_ + 308 FILE_ + 299 DATASET_ + 309 FILENAME_ + 310 FILL_ + 311 FILLCOLOR_ + 312 FLAT_ + 313 FLIP_ + 412,t 1 + 416,line 277 + 314 FORMAT_ + 315 GRAPH_ + 316 GRAY_ + 317 GRID_ + 318 GROOVE_ + 413,line 250 + 319 LABELS_ + 320 LANDSCAPE_ + 331,title LOG + 321 LEFT_ + error,line 191 + 322 LEGAL_ + 323 LEGEND_ + 324 LEGENDTITLE_ + 399,line 200 + 409,line 235 + 410,line 236 + 416,title {} + 280,t 0 + 279,t 0 + 325 LETTER_ + 326 LINE_ + 327 LINEAR_ + 328 LIST_ + 329 LOAD_ + 330 LOADCONFIG_ + 396,line 158 + 406,line 226 + 331 LOG_ + 332 MAX_ + 332,t 0 + 333 MIN_ + 334 MODE_ + 335 NAME_ + 393,line 154 + 403,line 218 + 329,title LOAD + 330,title LOADCONFIG + 336 NEW_ + 337 NUMBERS_ + 338 ORIENT_ + 374,t 0 + 339 ORIENTATION_ + 340 OVERLAP_ + 341 PAGE_ + 389,line 149 + 390,line 150 + 400,line 205 + 415,title {} + 342 PAGESETUP_ + Y,t 0 + 343 PAGESIZE_ + 344 PALETTE_ + 345 PLUS_ + 426,t 1 + 346 POINTER_ + 386,line 145 + 347 PORTRAIT_ + 348 POSITION_ + 349 POSTER_ + 350 PRINT_ + 351 PRINTER_ + 352 QUADRATIC_ + 383,line 142 + 328,title LIST + 353 RAISED_ + 354 RANGE_ + 355 RELIEF_ + 356 RGB_ + 304,t 0 + 294,t 0 + 357 RIGHT_ + 379,line 138 + 380,line 139 + 414,title {} + 358 SAVE_ + 359 SAVECONFIG_ + 360 SCALE_ + 361 SCATTER_ + 362 SCROSS_ + 363 SELECT_ + 376,line 135 + 346,t 0 + 364 SHAPE_ + 365 SHOW_ + 366 SIZE_ + 367 SLANT_ + 368 SMOOTH_ + 373,line 132 + 327,title LINEAR + 369 SOLID_ + 370 SPLUS_ + 371 SQUARE_ + 388,t 0 + 372 STACKED_ + 373 STATS_ + 369,line 128 + 370,line 129 + 374 STATISTICS_ + 413,title {} + 375 STEP_ + 376 STDIN_ + 377 STYLE_ + 441,t 1 + 378 SUNKEN_ + 366,line 125 + 379 TABLOID_ + 380 TITLE_ + 381 TOP_ + 382 TRIANGLE_ + 266,t 0 + 383 TYPE_ + 384 VIEW_ + 363,line 122 + 385 WEIGHT_ + 326,title LINE + 386 WIDTH_ + 387 ZOOM_ + 388 XY_ + 318,t 0 + 389 XYEX_ + 390 XYEY_ + 400 fontWeight + 359,line 118 + 360,line 119 + 391 XYEXEY_ + 401 fontSlant + 412,title {} + 392 LINEARLINEAR_ + 402 fontStyle + 393 LOGLINEAR_ + 403 numeric + 394 LINEARLOG_ + error,title {} + 404 command + 395 LOGLOG_ + 405 @PSEUDO1 + 356,line 115 + 361,t 0 + 396 XAXIS_ + 406 plot + 397 YAXIS_ + 407 @PSEUDO2 + 398 yesno + 408 @PSEUDO3 + 399 font + 409 @PSEUDO4 + 410 @PSEUDO5 + 411 line + 353,line 112 + 412 new + 325,title LETTER + 413 newLine + 413,t 1 + 414 newBar + 415 newScatter + 416 xy + 349,line 108 + 350,line 109 + 411,title {} + 417 xyaxis + 418 dim + 419 plotCmd + 420 load + 421 duplicate + 422 pagesetup + 346,line 105 + 423 pageOrient + 424 pageSize + 281,t 0 + 425 print + 426 printDest + 427 printColor + 343,line 102 + 428 mode + 324,title LEGENDTITLE + 429 axis + 430 legend + 431 legendPos + 333,t 0 + 432 fontt + 433 fontType + 339,line 98 + 340,line 99 + 399,title {} + 409,title {} + 410,title {} + 434 title + 435 barmode + 436 color + 437 dummy1 + 375,t 0 + 438 errorr + 336,line 94 + 439 shape + 440 shapes + 441 relief + 442 smooth + 443 oldGraph + 444 oldGraphGrid + 445 oldGraphRange + 333,line 91 + 427,t 1 + 446 oldGraphLabels + 323,title LEGEND + 447 oldGraphType + 448 oldGraphScale + 450 dummy2 + 449 oldLine + 451 oldView + 329,line 87 + 330,line 88 + 398,title {} + 408,title {} + 452 start' + 326,line 84 + 295,t 0 + 305,t 0 + 323,line 81 + 322,title LEGAL + 347,t 0 + 319,line 77 + 320,line 78 + 397,title YAXIS + 407,title {} + 389,t 0 + 390,t 0 + 400,t 1 + y,line 279 + 316,line 74 + 442,t 1 + 313,line 70 + 321,title LEFT + 267,t 0 + 299,line 56 + 309,line 66 + 310,line 67 + 396,title XAXIS + 406,title {} + 296,line 53 + 306,line 63 + 319,t 0 + 320,t 0 + 303,line 60 + 293,line 50 + 319,title LABELS + 320,title LANDSCAPE + 362,t 0 + 300,line 57 + 290,line 47 + 289,line 46 + 395,title LOGLOG + 405,title {} + 414,t 1 + 286,line 43 + 283,line 40 + 318,title GROOVE + 282,t 0 + 280,line 37 + 279,line 36 + 394,title LINEARLOG + 404,title {} + 334,t 0 + 276,line 29 + 273,line 25 + 376,t 0 + 317,title GRID + X,line 278 + 270,line 22 + 269,line 21 + 393,title LOGLINEAR + 403,title {} + 428,t 1 + y,title {} + 266,line 18 + 263,line 71 + 316,title GRAY + 296,t 0 + 306,t 0 + 259,line 10 + 260,line 11 + 392,title LINEARLINEAR + 402,title {} + x,title {} + 348,t 0 + 391,t 0 + 401,t 1 + 315,title GRAPH + 443,t 1 + 391,title XYEXEY + 401,title {} + 268,t 0 + 314,title FORMAT + 321,t 0 + 389,title XYEX + 390,title XYEY + 400,title {} + 363,t 0 + 415,t 1 + 313,title FLIP + 388,title XY + 283,t 0 + 335,t 0 + 312,title FLAT + 387,title ZOOM + 377,t 0 + 429,t 1 + 430,t 1 + 311,title FILLCOLOR + 386,title WIDTH + 297,t 0 + 307,t 0 + 452,line 556 + 349,t 0 + 350,t 0 + 299,title DATASET + 309,title FILENAME + 310,title FILL + 448,line 527 + 385,title WEIGHT + 392,t 0 + 402,t 1 + 445,line 513 + 444,t 1 + 442,line 491 + 298,title DATA + 270,t 0 + 269,t 0 + 308,title FILE + 438,line 461 + 384,title VIEW + 322,t 0 + 435,line 441 + 364,t 0 + 432,line 410 + 297,title DASH + 307,title FAMILY + 428,line 387 + 416,t 1 + 383,title TYPE + 425,line 371 + 422,line 354 + 284,t 0 + 296,title CUBIC + 306,title ERRORBAR + 418,line 288 + 382,title TRIANGLE + 336,t 0 + 415,line 268 + 378,t 0 + 412,line 244 + 295,title CROSS + 305,title ERROR + 398,line 192 + 408,line 233 + 431,t 1 + 381,title TOP + 395,line 156 + 405,line 223 + 392,line 153 + 402,line 213 + 298,t 0 + 308,t 0 + 304,title DUPLICATE + 294,title COMMAND + 388,line 148 + 351,t 0 + 379,title TABLOID + 380,title TITLE + 385,line 144 + 393,t 0 + 403,t 1 + 382,line 141 + 303,title DUP + 293,title COLOR + 445,t 1 + 378,line 137 + 378,title SUNKEN + 271,t 0 + 375,line 134 + 323,t 0 + 372,line 131 + 302,title DISCRETE + 292,title CLOSE + 368,line 127 + 365,t 0 + 377,title STYLE + 365,line 124 + 417,t 1 + 362,line 121 + 301,title DIAMOND + 291,title CLEAR + 358,line 117 + 376,title STDIN + 285,t 0 + 355,line 114 + 337,t 0 + 352,line 111 + 300,title DESTINATION + 290,title CIRCLE + 289,title CATROM + 348,line 107 + 379,t 0 + 380,t 0 + 375,title STEP + 345,line 104 + 432,t 1 + 342,line 101 + 257,t 0 + 288,title CAP + 338,line 97 + 299,t 0 + 309,t 0 + 310,t 0 + 374,title STATISTICS + 335,line 93 + 352,t 0 + 332,line 90 + 287,title BOTTOM + 394,t 0 + 404,t 1 + 328,line 86 + 373,title STATS + 446,t 1 + 325,line 83 + 272,t 0 + 322,line 80 + 286,title BARMODE + 318,line 76 + 324,t 0 + 372,title STACKED + x,line 277 + 315,line 73 + 366,t 0 + 312,line 69 + 285,title BAR + 418,t 1 + 298,line 55 + 308,line 65 + x,t 0 + 371,title SQUARE + 295,line 52 + 305,line 62 +} + +proc plot::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ times } + 9 { set _ helvetica } + 10 { set _ courier } + 11 { set _ normal } + 12 { set _ bold } + 13 { set _ roman } + 14 { set _ italic } + 15 { set _ normal } + 16 { set _ bold } + 17 { set _ italic } + 18 { set _ $1 } + 19 { set _ $1 } + 21 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { PlotCmdNew {}; PlotCmdBar {} {} {} xy } + 25 { PlotCmdNew {}; PlotCmdScatter {} {} {} xy } + 26 { PlotCmdNew {}; PlotCmdLine {} {} {} xy } + 27 { PlotCmdNew {} } + 29 { PlotCmdNew $3 } + 31 { if {![PlotCmdCheck]} {plot::YYABORT} } + 33 { if {![PlotCmdRef $1]} {plot::YYABORT} } + 35 { PlotCmdNew {}; PlotCmdLine {} {} {} xy } + 41 { PlotCmdLine $1 $2 $3 $4 } + 42 { PlotCmdLine {} {} {} xy } + 43 { PlotCmdAnalysisPlotStdin line } + 44 { PlotCmdLine $1 $2 $3 $4 } + 45 { PlotCmdBar $1 $2 $3 $4 } + 46 { PlotCmdBar {} {} {} xy } + 47 { PlotCmdAnalysisPlotStdin bar } + 48 { PlotCmdBar $1 $2 $3 $4 } + 49 { PlotCmdScatter $1 $2 $3 $4 } + 50 { PlotCmdScatter {} {} {} xy } + 51 { PlotCmdAnalysisPlotStdin scatter } + 52 { PlotCmdScatter $1 $2 $3 $4 } + 53 { set _ x } + 54 { set _ x } + 55 { set _ y } + 56 { set _ y } + 57 { set _ x } + 58 { set _ y } + 59 { set _ xy } + 60 { set _ xyex } + 61 { set _ xyey } + 62 { set _ xyexey } + 64 { PlotCmdSave $2 } + 65 { PlotCmdData $2 } + 66 { ProcessCmdCVAR0 PlotClearData } + 69 { ProcessCmdCVAR stats $2 PlotStats } + 70 { ProcessCmdCVAR stats $2 PlotStats } + 71 { ProcessCmdCVAR list $2 PlotList } + 72 { PlotCmdLoadConfig $2 } + 73 { PlotCmdSaveConfig $2 } + 77 { ProcessCmdCVAR0 PlotDestroy } + 78 { ProcessCmdCVAR mode $2 PlotChangeMode } + 83 { PlotCmdUpdateGraph bar,mode $2 } + 84 { PlotCmdUpdateElement show $2 } + 86 { PlotCmdUpdateElement fill $2 } + 87 { PlotCmdUpdateElement fill,color $2 } + 90 { PlotCmdUpdateElement name $2 } + 92 { PlotCmdUpdateElement bar,relief $2 } + 93 { PlotCmdUpdateElement smooth $2 } + 94 { PlotCmdUpdateElement width $2 } + 95 { PlotCmdUpdateElement dash $2 } + 96 { ProcessCmdCVAR data,current $2 PlotCurrentData } + 97 { ProcessCmdCVAR data,current $2 PlotCurrentData } + 100 { PlotCmdLoad $1 xy } + 101 { PlotCmdLoad $1 $2 } + 102 { global cvarname; PlotDupData $cvarname 1 } + 103 { global cvarname; PlotDupData $cvarname $1 } + 104 { ProcessCmdSet ps orient $2 } + 105 { ProcessCmdSet ps orient $2 } + 106 { ProcessCmdSet ps size $2 } + 107 { ProcessCmdSet ps size $2 } + 108 { set _ portrait } + 109 { set _ landscape } + 110 { set _ letter } + 111 { set _ legal } + 112 { set _ tabloid } + 113 { set _ poster } + 114 { set _ a4 } + 115 { ProcessCmdCVAR0 PlotPostScript } + 116 { ProcessCmdSet ps dest $2 } + 117 { ProcessCmdSet ps cmd $2 } + 118 { ProcessCmdSet ps filename $2 } + 119 { ProcessCmdSet ps color $2 } + 120 { ProcessCmdSet ps color $2 } + 121 { set _ printer } + 122 { set _ file } + 123 { set _ rgb } + 124 { set _ gray } + 125 { set _ pointer } + 126 { set _ zoom } + 127 { PlotCmdUpdateGraph "axis,$1,grid" $3 } + 128 { PlotCmdUpdateGraph "axis,$1,log" $3 } + 129 { PlotCmdUpdateGraph "axis,$1,flip" $3 } + 130 { PlotCmdUpdateGraph "axis,$1,auto" $3 } + 131 { PlotCmdUpdateGraph "axis,$1,min" $3 } + 132 { PlotCmdUpdateGraph "axis,$1,max" $3 } + 133 { PlotCmdUpdateGraph "axis,$1,format" $3 } + 134 { PlotCmdUpdateGraph legend $1 } + 135 { PlotCmdUpdateGraph "legend,position" $2 } + 136 { set _ right } + 137 { set _ left } + 138 { set _ top } + 139 { set _ bottom } + 140 { PlotCmdUpdateGraph "$1,family" $3 } + 141 { PlotCmdUpdateGraph "$1,family" $3 } + 142 { PlotCmdUpdateGraph "$1,size" $3 } + 143 { PlotCmdUpdateGraph "$1,weight" $3 } + 144 { PlotCmdUpdateGraph "$1,slant" $3 } + 145 { PlotCmdFontStyle $1 $3 } + 146 { PlotCmdUpdateGraph "$1,size" $3 } + 147 { PlotCmdUpdateGraph "$1,weight" $3 } + 148 { PlotCmdUpdateGraph "$1,slant" $3 } + 149 { PlotCmdFontStyle $1 $3 } + 150 { set _ graph,title } + 151 { set _ axis,title } + 152 { set _ axis,title } + 153 { set _ axis,font } + 154 { set _ axis,font } + 155 { set _ legend,font } + 156 { set _ legend,title } + 157 { PlotCmdUpdateGraph graph,title $1 } + 158 { PlotCmdUpdateGraph "axis,$1,title" $2 } + 159 { PlotCmdUpdateGraph "axis,$1,title" $2 } + 160 { PlotCmdUpdateGraph legend,title $2 } + 161 { set _ normal } + 162 { set _ stacked } + 163 { set _ aligned } + 164 { set _ overlap } + 165 { PlotCmdUpdateElement color $1 } + 166 { PlotCmdUpdateElement color $2 } + 174 { PlotCmdUpdateElement error $1 } + 175 { PlotCmdUpdateElement error,cap $2 } + 176 { PlotCmdUpdateElement error,color $2 } + 177 { PlotCmdUpdateElement error,width $2 } + 178 { PlotCmdUpdateElement shape,symbol $1 } + 179 { PlotCmdUpdateElement shape,file $2 } + 180 { PlotCmdUpdateElement shape,color $2 } + 181 { set _ circle } + 182 { set _ square } + 183 { set _ diamond } + 184 { set _ plus } + 185 { set _ splus } + 186 { set _ scross } + 187 { set _ triangle } + 188 { set _ arrow } + 189 { set _ scross } + 190 { set _ flat } + 191 { set _ sunken } + 192 { set _ raised } + 193 { set _ solid } + 194 { set _ groove } + 195 { set _ step } + 196 { set _ linear } + 197 { set _ cubic } + 198 { set _ quadratic } + 199 { set _ catrom } + 201 { PlotCmdUpdateGraph "axis,$2,log" $3 } + 202 { PlotCmdUpdateGraph "axis,$2,flip" $3 } + 203 { PlotCmdUpdateGraph "axis,$3,format" $3 } + 208 { PlotCmdUpdateGraph "axis,$1,grid" $2 } + 209 { PlotCmdUpdateGraph "axis,x,grid" $1; PlotCmdUpdateGraph "axis,y,grid" $1 } + 210 { PlotCmdUpdateGraph "axis,$1,auto" $3 } + 211 { PlotCmdUpdateGraph "axis,$1,min" $3 } + 212 { PlotCmdUpdateGraph "axis,$1,max" $3 } + 213 { PlotCmdUpdateGraph graph,title $2 } + 214 { PlotCmdUpdateGraph "axis,$1,title" $2 } + 215 { PlotCmdUpdateGraph legend,title $2 } + 218 { PlotCmdUpdateGraph "axis,x,log" 0; PlotCmdUpdateGraph "axis,y,log" 0 } + 219 { PlotCmdUpdateGraph "axis,x,log" 0; PlotCmdUpdateGraph "axis,y,log" 1 } + 220 { PlotCmdUpdateGraph "axis,x,log" 1; PlotCmdUpdateGraph "axis,y,log" 0 } + 221 { PlotCmdUpdateGraph "axis,x,log" 1; PlotCmdUpdateGraph "axis,y,log" 1 } + 222 { PlotCmdUpdateElement shape,symbol $2 } + 223 { PlotCmdUpdateElement width $3 } + 224 { PlotCmdUpdateElement dash $3 } + 225 { PlotCmdUpdateElement error $3 } + 232 { PlotCmdUpdateElement show $2 } + 233 { PlotCmdUpdateElement show $2; PlotCmdUpdateElement smooth linear } + 234 { PlotCmdUpdateElement show $2; PlotCmdUpdateElement smooth step } + 235 { PlotCmdUpdateElement show $2; PlotCmdUpdateElement smooth quadratic } + 236 { PlotCmdUpdateElement error $2 } + 237 { PlotCmdUpdateElement error $2 } + } + 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 plot::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/plotsendlex.tcl b/ds9/parsers/plotsendlex.tcl new file mode 100644 index 0000000..24115dc --- /dev/null +++ b/ds9/parsers/plotsendlex.tcl @@ -0,0 +1,814 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval plotsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc plotsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc plotsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc plotsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc plotsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc plotsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc plotsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc plotsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc plotsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc plotsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set FONT_ 257 +set FONTSIZE_ 258 +set FONTSLANT_ 259 +set FONTSTYLE_ 260 +set FONTWEIGHT_ 261 +set STRING_ 262 +set AUTO_ 263 +set AXIS_ 264 +set AXESNUMBERS_ 265 +set AXESTITLE_ 266 +set BARMODE_ 267 +set CAP_ 268 +set COLOR_ 269 +set DASH_ 270 +set DATASET_ 271 +set ERROR_ 272 +set ERRORBAR_ 273 +set FAMILY_ 274 +set FILL_ 275 +set FILLCOLOR_ 276 +set FLIP_ 277 +set FORMAT_ 278 +set GRID_ 279 +set LABELS_ 280 +set LEGEND_ 281 +set LEGENDTITLE_ 282 +set LIST_ 283 +set LOG_ 284 +set MAX_ 285 +set MIN_ 286 +set MODE_ 287 +set NUMBERS_ 288 +set NAME_ 289 +set POSITION_ 290 +set RELIEF_ 291 +set SELECT_ 292 +set SHAPE_ 293 +set SHOW_ 294 +set SIZE_ 295 +set SLANT_ 296 +set SMOOTH_ 297 +set STATS_ 298 +set STATISTICS_ 299 +set STYLE_ 300 +set TITLE_ 301 +set WEIGHT_ 302 +set WIDTH_ 303 +set XAXIS_ 304 +set YAXIS_ 305 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: auto + if {[regexp -start $index_ -indices -line -nocase -- {\A(auto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: axis + if {[regexp -start $index_ -indices -line -nocase -- {\A(axis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: axesnumbers + if {[regexp -start $index_ -indices -line -nocase -- {\A(axesnumbers)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: axestitle + if {[regexp -start $index_ -indices -line -nocase -- {\A(axestitle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: barmode + if {[regexp -start $index_ -indices -line -nocase -- {\A(barmode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: cap + if {[regexp -start $index_ -indices -line -nocase -- {\A(cap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: dash + if {[regexp -start $index_ -indices -line -nocase -- {\A(dash)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: dataset + if {[regexp -start $index_ -indices -line -nocase -- {\A(dataset)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: error + if {[regexp -start $index_ -indices -line -nocase -- {\A(error)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: errorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(errorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: family + if {[regexp -start $index_ -indices -line -nocase -- {\A(family)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: fill + if {[regexp -start $index_ -indices -line -nocase -- {\A(fill)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: fillcolor + if {[regexp -start $index_ -indices -line -nocase -- {\A(fillcolor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: flip + if {[regexp -start $index_ -indices -line -nocase -- {\A(flip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: format + if {[regexp -start $index_ -indices -line -nocase -- {\A(format)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: labels + if {[regexp -start $index_ -indices -line -nocase -- {\A(labels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: legend + if {[regexp -start $index_ -indices -line -nocase -- {\A(legend)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: legendtitle + if {[regexp -start $index_ -indices -line -nocase -- {\A(legendtitle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: list + if {[regexp -start $index_ -indices -line -nocase -- {\A(list)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: log + if {[regexp -start $index_ -indices -line -nocase -- {\A(log)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: max + if {[regexp -start $index_ -indices -line -nocase -- {\A(max)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: min + if {[regexp -start $index_ -indices -line -nocase -- {\A(min)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: numbers + if {[regexp -start $index_ -indices -line -nocase -- {\A(numbers)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: position + if {[regexp -start $index_ -indices -line -nocase -- {\A(position)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: relief + if {[regexp -start $index_ -indices -line -nocase -- {\A(relief)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: select + if {[regexp -start $index_ -indices -line -nocase -- {\A(select)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: shape + if {[regexp -start $index_ -indices -line -nocase -- {\A(shape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: show + if {[regexp -start $index_ -indices -line -nocase -- {\A(show)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: slant + if {[regexp -start $index_ -indices -line -nocase -- {\A(slant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: stats + if {[regexp -start $index_ -indices -line -nocase -- {\A(stats)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: statistics + if {[regexp -start $index_ -indices -line -nocase -- {\A(statistics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: style + if {[regexp -start $index_ -indices -line -nocase -- {\A(style)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: title + if {[regexp -start $index_ -indices -line -nocase -- {\A(title)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: weight + if {[regexp -start $index_ -indices -line -nocase -- {\A(weight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: xaxis + if {[regexp -start $index_ -indices -line -nocase -- {\A(xaxis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: yaxis + if {[regexp -start $index_ -indices -line -nocase -- {\A(yaxis)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: fontsize + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontsize)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: fontslant + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontslant)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: fontstyle + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontstyle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: fontweight + if {[regexp -start $index_ -indices -line -nocase -- {\A(fontweight)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AUTO_ + } + 1 { +return $AXIS_ + } + 2 { +return $AXESNUMBERS_ + } + 3 { +return $AXESTITLE_ + } + 4 { +return $BARMODE_ + } + 5 { +return $CAP_ + } + 6 { +return $COLOR_ + } + 7 { +return $DASH_ + } + 8 { +return $DATASET_ + } + 9 { +return $ERROR_ + } + 10 { +return $ERRORBAR_ + } + 11 { +return $FAMILY_ + } + 12 { +return $FILL_ + } + 13 { +return $FILLCOLOR_ + } + 14 { +return $FLIP_ + } + 15 { +return $FORMAT_ + } + 16 { +return $GRID_ + } + 17 { +return $LABELS_ + } + 18 { +return $LEGEND_ + } + 19 { +return $LEGENDTITLE_ + } + 20 { +return $LIST_ + } + 21 { +return $LOG_ + } + 22 { +return $MAX_ + } + 23 { +return $MIN_ + } + 24 { +return $MODE_ + } + 25 { +return $NUMBERS_ + } + 26 { +return $NAME_ + } + 27 { +return $POSITION_ + } + 28 { +return $RELIEF_ + } + 29 { +return $SELECT_ + } + 30 { +return $SHAPE_ + } + 31 { +return $SHOW_ + } + 32 { +return $SIZE_ + } + 33 { +return $SLANT_ + } + 34 { +return $SMOOTH_ + } + 35 { +return $STATS_ + } + 36 { +return $STATISTICS_ + } + 37 { +return $STYLE_ + } + 38 { +return $TITLE_ + } + 39 { +return $WEIGHT_ + } + 40 { +return $WIDTH_ + } + 41 { +return $XAXIS_ + } + 42 { +return $YAXIS_ + } + 43 { +return $FONT_ + } + 44 { +return $FONTSIZE_ + } + 45 { +return $FONTSLANT_ + } + 46 { +return $FONTSTYLE_ + } + 47 { +return $FONTWEIGHT_ + } + 48 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 49 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 50 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 51 { +set yylval $yytext; return $STRING_ + } + 52 { +# ignore whitespace + } + 53 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/plotsendparser.tab.tcl b/ds9/parsers/plotsendparser.tab.tcl new file mode 100644 index 0000000..8536a85 --- /dev/null +++ b/ds9/parsers/plotsendparser.tab.tcl @@ -0,0 +1,49 @@ +set FONT_ 257 +set FONTSIZE_ 258 +set FONTSLANT_ 259 +set FONTSTYLE_ 260 +set FONTWEIGHT_ 261 +set STRING_ 262 +set AUTO_ 263 +set AXIS_ 264 +set AXESNUMBERS_ 265 +set AXESTITLE_ 266 +set BARMODE_ 267 +set CAP_ 268 +set COLOR_ 269 +set DASH_ 270 +set DATASET_ 271 +set ERROR_ 272 +set ERRORBAR_ 273 +set FAMILY_ 274 +set FILL_ 275 +set FILLCOLOR_ 276 +set FLIP_ 277 +set FORMAT_ 278 +set GRID_ 279 +set LABELS_ 280 +set LEGEND_ 281 +set LEGENDTITLE_ 282 +set LIST_ 283 +set LOG_ 284 +set MAX_ 285 +set MIN_ 286 +set MODE_ 287 +set NUMBERS_ 288 +set NAME_ 289 +set POSITION_ 290 +set RELIEF_ 291 +set SELECT_ 292 +set SHAPE_ 293 +set SHOW_ 294 +set SIZE_ 295 +set SLANT_ 296 +set SMOOTH_ 297 +set STATS_ 298 +set STATISTICS_ 299 +set STYLE_ 300 +set TITLE_ 301 +set WEIGHT_ 302 +set WIDTH_ 303 +set XAXIS_ 304 +set YAXIS_ 305 diff --git a/ds9/parsers/plotsendparser.tcl b/ds9/parsers/plotsendparser.tcl new file mode 100644 index 0000000..9aa69a6 --- /dev/null +++ b/ds9/parsers/plotsendparser.tcl @@ -0,0 +1,1557 @@ +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 plotsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc plotsend::YYABORT {} { + return -code return 1 +} + +proc plotsend::YYACCEPT {} { + return -code return 0 +} + +proc plotsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc plotsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc plotsend::yyerror {s} { + puts stderr $s +} + +proc plotsend::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 plotsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set plotsend::table { + 40:285,target 9 + 39:285,target 7 + 1:292 reduce + 1:293 reduce + 1:303 reduce + 38:274 shift + 1:294 reduce + 30:300,target 58 + 27:0 reduce + 12:317,target 49 + 33:261,target 59 + 4:272,target 11 + 1:297 reduce + 48:0 reduce + 0:306,target 2 + 1:308 goto + 1:298 reduce + 6:309,target 43 + 1:299 reduce + 3:267,target 7 + 38:260,target 64 + 38:259,target 63 + 30:300 reduce + 12:317 goto + 70:0 reduce + 69:0 reduce + 30:302 reduce + 32:296,target 55 + 0:275,target 2 + 2:0 accept + 30:295 reduce + 4:301,target 26 + 4:291,target 19 + 72:0,target 37 + 31:302,target 56 + 30:296 reduce + 64:0,target 49 + 56:0,target 10 + 38:300 shift + 35:257 reduce + 24:0 reduce + 48:0,target 25 + 35:258 reduce + 21:318 goto + 1:308,target 4 + 1:298,target 4 + 41:0,target 6 + 38:302 shift + 35:260 reduce + 35:259 reduce + 33:258,target 59 + 4:270,target 9 + 4:269,target 8 + 45:0 reduce + 35:261 reduce + 6:x,target 41 + 25:0,target 13 + 0:294,target 2 + 38:295 shift + 26:305,target 57 + 17:0,target 15 + 66:0 reduce + 38:296 shift + 38:257,target 61 + 21:275,target 53 + 10:0,target 34 + 41:285,target 6 + 0:273,target 2 + 31:300,target 56 + 34:261,target 60 + 26:281 shift + 21:0 reduce + 35:274 reduce + 42:0 reduce + 4:267,target 7 + 0:292,target 2 + 63:0 reduce + 3:257 shift + 33:296,target 59 + 1:275,target 4 + 5:301,target 36 + 32:302,target 55 + 0:271,target 2 + 38:295,target 67 + 26:304 shift + 3:264 shift + 40:278,target 9 + 39:278,target 7 + 26:305 shift + 17:0 reduce + 34:258,target 60 + 6:309 goto + 3:267 shift + 38:274,target 66 + 35:300 reduce + 32:257 reduce + 1:294,target 4 + 32:258 reduce + 26:310 goto + 26:309 goto + 6:312 goto + 3:269 shift + 3:270 shift + 35:302 reduce + 32:260 reduce + 32:259 reduce + 3:271 shift + 60:0 reduce + 59:0 reduce + 32:261 reduce + 0:289,target 2 + 3:272 shift + 3:273 shift + 76:0,target 40 + 42:285,target 8 + 35:295 reduce + 1:273,target 4 + 68:0,target 52 + 35:296 reduce + 3:275 shift + 61:0,target 44 + 26:316 goto + 5:288,target 35 + 3:276 shift + 53:0,target 70 + 32:300,target 55 + 3:311,target 28 + 45:0,target 66 + 35:261,target 57 + 37:0,target 18 + 14:0 reduce + 29:0,target 5 + 3:281 shift + 22:0,target 21 + 41:263 reduce + 14:0,target 24 + 3:283 shift + 1:292,target 4 + 32:274 reduce + 56:0 reduce + 34:296,target 60 + 0:287,target 2 + 3:287 shift + 77:0 reduce + 33:302,target 59 + 30:260,target 58 + 30:259,target 58 + 0:257 reduce + 1:271,target 4 + 3:289 shift + 3:301 shift + 3:291 shift + 3:292 shift + 41:278,target 6 + 9:0 reduce + 3:298,target 24 + 3:293 shift + 3:303 shift + 35:258,target 57 + 21:318,target 54 + 11:268 shift + 11:0 reduce + 0:262 shift + 3:294 shift + 26:X,target 39 + 11:269 shift + 0:264 reduce + 41:277 reduce + 5:265,target 30 + 3:297 shift + 41:278 reduce + 3:298 shift + 41:279 reduce + 0:267 reduce + 1:289,target 4 + 3:299 shift + 53:0 reduce + 32:300 reduce + 3:311 goto + 43:285,target 76 + 5:315,target 38 + 0:270 reduce + 0:269 reduce + 32:302 reduce + 0:271 reduce + 74:0 reduce + 41:284 reduce + 0:272 reduce + 41:285 reduce + 33:300,target 59 + 30:257,target 58 + 0:273 reduce + 4:311,target 29 + 41:286 reduce + 36:261,target 54 + 32:295 reduce + 32:296 reduce + 0:275 reduce + 0:276 reduce + 0:264,target 2 + 28:0 reduce + 7:0,target 20 + 0:281 reduce + 0:0,target 1 + 35:296,target 57 + 3:275,target 13 + 73:0,target 41 + 50:0 reduce + 49:0 reduce + 0:283 reduce + 1:287,target 4 + 65:0,target 47 + 57:0,target 11 + 34:302,target 60 + 31:260,target 56 + 31:259,target 56 + 71:0 reduce + 50:0,target 43 + 49:0,target 26 + 11:303 shift + 0:283,target 2 + 42:0,target 8 + 0:287 reduce + 42:278,target 8 + 4:298,target 24 + 36:258,target 54 + 26:0,target 61 + 0:289 reduce + 18:0,target 27 + 5:282,target 34 + 0:291 reduce + 0:301 reduce + 11:268,target 45 + 11:0,target 65 + 0:292 reduce + 0:262,target 1 + 3:294,target 22 + 30:295,target 58 + 0:293 reduce + 0:303 reduce + 25:0 reduce + 0:294 reduce + 0:306 goto + 46:0 reduce + 0:297 reduce + 0:307 goto + 3:273,target 12 + 30:274,target 58 + 26:x,target 41 + 0:298 reduce + 0:299 reduce + 67:0 reduce + 34:300,target 60 + 31:257,target 56 + 11:317 goto + 0:281,target 2 + 15:313,target 51 + 0:0 reduce + 1:264,target 4 + 6:Y,target 40 + 5:265 shift + 5:280,target 32 + 5:266 shift + 3:292,target 20 + 22:0 reduce + 36:296,target 54 + 34:257 reduce + 4:275,target 13 + 34:258 reduce + 34:260 reduce + 34:259 reduce + 0:299,target 2 + 35:302,target 57 + 34:261 reduce + 32:260,target 55 + 32:259,target 55 + 3:271,target 10 + 1:283,target 4 + 64:0 reduce + 43:278,target 73 + 12:268,target 45 + 6:X shift + 4:294,target 22 + 40:286,target 9 + 39:286,target 7 + 31:295,target 56 + 6:Y shift + 5:280 shift + 5:281 shift + 77:0,target 39 + 18:0 reduce + 5:282 shift + 0:257,target 2 + 3:289,target 18 + 70:0,target 51 + 69:0,target 53 + 43:263 shift + 62:0,target 46 + 4:273,target 12 + 54:0,target 28 + 40:0 reduce + 39:0 reduce + 34:274 reduce + 31:274,target 56 + 46:0,target 67 + 0:297,target 2 + 0:307,target 3 + 35:300,target 57 + 32:257,target 55 + 61:0 reduce + 38:261,target 65 + 5:288 shift + 1:281,target 4 + 23:0,target 30 + 15:0,target 42 + 5:301 shift + 0:276,target 2 + 4:292,target 20 + 40:284,target 9 + 39:284,target 7 + 15:0 reduce + 43:277 shift + 3:287,target 17 + 43:278 shift + 1:299,target 4 + 43:279 shift + 36:302,target 54 + 33:260,target 59 + 33:259,target 59 + 4:271,target 10 + 40:263,target 9 + 39:263,target 7 + 34:300 reduce + 31:257 reduce + 6:y,target 42 + 31:258 reduce + 57:0 reduce + 34:302 reduce + 31:260 reduce + 31:259 reduce + 43:284 shift + 38:258,target 62 + 31:261 reduce + 5:314 goto + 43:285 shift + 5:315 goto + 43:286 shift + 34:295 reduce + 41:286,target 6 + 34:296 reduce + 32:295,target 55 + 1:257,target 4 + 4:289,target 18 + 12:0 reduce + 32:274,target 55 + 6:x shift + 1:297,target 4 + 40:263 reduce + 39:263 reduce + 36:300,target 54 + 33:257,target 59 + 6:y shift + 54:0 reduce + 31:274 reduce + 0:293,target 2 + 0:303,target 2 + 26:304,target 56 + 3:264,target 6 + 8:0,target 22 + 1:276,target 4 + 75:0 reduce + 74:0,target 35 + 41:284,target 6 + 0:272,target 2 + 66:0,target 45 + 38:296,target 68 + 7:0 reduce + 58:0,target 62 + 4:287,target 17 + 51:0,target 17 + 40:279,target 9 + 39:279,target 7 + 34:260,target 60 + 34:259,target 60 + 41:263,target 6 + 29:0 reduce + 3:283,target 16 + 40:277 reduce + 39:277 reduce + 27:0,target 31 + 40:278 reduce + 39:278 reduce + 20:0,target 33 + 19:0,target 29 + 51:0 reduce + 40:279 reduce + 39:279 reduce + 12:0,target 65 + 31:300 reduce + 0:291,target 2 + 0:301,target 2 + 72:0 reduce + 42:286,target 8 + 33:295,target 59 + 31:302 reduce + 40:284 reduce + 39:284 reduce + 40:285 reduce + 39:285 reduce + 40:286 reduce + 39:286 reduce + 31:295 reduce + 0:270,target 2 + 0:269,target 2 + 31:296 reduce + 33:274,target 59 + 40:277,target 9 + 39:277,target 7 + 36:257 reduce + 36:258 reduce + 34:257,target 60 + 26:0 reduce + 36:260 reduce + 36:259 reduce + 3:281,target 15 + 36:261 reduce + 1:293,target 4 + 1:303,target 4 + 47:0 reduce + 4:264,target 6 + 68:0 reduce + 42:284,target 8 + 30:261,target 58 + 21:269,target 52 + 1:272,target 4 + 41:279,target 6 + 0:267,target 2 + 3:299,target 25 + 38:302,target 70 + 35:260,target 57 + 35:259,target 57 + 42:263,target 8 + 26:Y,target 40 + 15:290,target 50 + 4:283,target 16 + 23:0 reduce + 36:274 reduce + 5:266,target 31 + 44:0 reduce + 1:291,target 4 + 1:301,target 4 + 43:286,target 77 + 34:295,target 60 + 4:257 shift + 71:0,target 38 + 65:0 reduce + 11:303,target 47 + 63:0,target 48 + 3:257,target 5 + 55:0,target 64 + 30:258,target 58 + 1:269,target 4 + 1:270,target 4 + 47:0,target 68 + 40:0,target 9 + 39:0,target 7 + 34:274,target 60 + 41:277,target 6 + 3:297,target 23 + 4:264 shift + 38:300,target 69 + 35:257,target 57 + 24:0,target 12 + 20:0 reduce + 19:0 reduce + 16:0,target 14 + 4:281,target 15 + 4:267 shift + 36:300 reduce + 33:257 reduce + 41:0 reduce + 33:258 reduce + 26:316,target 60 + 4:270 shift + 3:276,target 14 + 4:269 shift + 36:302 reduce + 33:260 reduce + 33:259 reduce + 4:271 shift + 33:261 reduce + 4:272 shift + 62:0 reduce + 43:284,target 75 + 31:261,target 56 + 5:314,target 37 + 4:273 shift + 36:295 reduce + 36:296 reduce + 4:275 shift + 42:279,target 8 + 1:267,target 4 + 4:299,target 25 + 4:276 shift + 36:260,target 54 + 36:259,target 54 + 43:263,target 71 + 11:269,target 46 + 30:296,target 58 + 16:0 reduce + 4:281 shift + 26:X shift + 42:263 reduce + 26:Y shift + 15:290 shift + 4:283 shift + 37:0 reduce + 35:295,target 57 + 33:274 reduce + 26:y,target 42 + 12:303,target 47 + 58:0 reduce + 4:287 shift + 4:257,target 5 + 31:258,target 56 + 1:257 reduce + 4:289 shift + 35:274,target 57 + 4:301 shift + 4:291 shift + 42:277,target 8 + 4:292 shift + 4:297,target 23 + 36:257,target 54 + 4:303 shift + 4:293 shift + 12:268 shift + 5:281,target 33 + 4:294 shift + 13:0 reduce + 12:269 shift + 9:0,target 32 + 3:293,target 21 + 3:303,target 27 + 15:313 goto + 1:264 reduce + 2:0,target 0 + 42:277 reduce + 4:276,target 14 + 4:297 shift + 75:0,target 36 + 42:278 reduce + 4:298 shift + 67:0,target 50 + 42:279 reduce + 11:317,target 48 + 1:267 reduce + 4:299 shift + 60:0,target 19 + 59:0,target 63 + 33:300 reduce + 32:261,target 55 + 30:257 reduce + 3:272,target 11 + 4:311 goto + 55:0 reduce + 52:0,target 71 + 30:258 reduce + 1:269 reduce + 1:270 reduce + 44:0,target 16 + 33:302 reduce + 30:260 reduce + 30:259 reduce + 1:271 reduce + 43:279,target 74 + 42:284 reduce + 30:261 reduce + 21:269 shift + 1:272 reduce + 76:0 reduce + 42:285 reduce + 28:0,target 3 + 1:273 reduce + 42:286 reduce + 33:295 reduce + 26:281,target 55 + 21:0,target 69 + 33:296 reduce + 13:0,target 23 + 12:269,target 46 + 1:275 reduce + 31:296,target 56 + 8:0 reduce + 1:276 reduce + 38:257 shift + 21:275 shift + 10:0 reduce + 6:X,target 39 + 38:258 shift + 3:301,target 26 + 3:291,target 19 + 38:260 shift + 38:259 shift + 30:302,target 58 + 38:261 shift + 36:295,target 54 + 1:281 reduce + 0:298,target 2 + 1:283 reduce + 52:0 reduce + 32:258,target 55 + 26:310,target 59 + 26:309,target 58 + 6:312,target 44 + 3:269,target 8 + 3:270,target 9 + 30:274 reduce + 26:x shift + 36:274,target 54 + 26:y shift + 12:303 shift + 73:0 reduce + 43:277,target 72 + 1:287 reduce + 1:289 reduce + 4:303,target 27 + 1:291 reduce + 1:301 reduce + 4:293,target 21 +} + +array set plotsend::rules { + 9,l 309 + 11,l 310 + 32,l 311 + 53,l 314 + 6,l 309 + 28,l 311 + 50,l 314 + 49,l 314 + 71,l 318 + 3,l 306 + 25,l 311 + 46,l 314 + 67,l 317 + 0,l 319 + 22,l 311 + 43,l 313 + 64,l 316 + 18,l 311 + 40,l 312 + 39,l 312 + 61,l 316 + 15,l 311 + 36,l 312 + 57,l 315 + 12,l 311 + 33,l 311 + 54,l 315 + 7,l 309 + 29,l 311 + 30,l 311 + 51,l 314 + 4,l 308 + 26,l 311 + 47,l 314 + 68,l 317 + 1,l 306 + 23,l 311 + 44,l 314 + 65,l 317 + 19,l 311 + 20,l 311 + 41,l 312 + 62,l 316 + 16,l 311 + 37,l 312 + 58,l 315 + 13,l 311 + 34,l 311 + 55,l 315 + 8,l 309 + 10,l 310 + 31,l 311 + 52,l 314 + 5,l 306 + 27,l 311 + 48,l 314 + 70,l 318 + 69,l 318 + 2,l 307 + 24,l 311 + 45,l 314 + 66,l 317 + 21,l 311 + 42,l 313 + 63,l 316 + 17,l 311 + 38,l 312 + 60,l 315 + 59,l 315 + 14,l 311 + 35,l 312 + 56,l 315 +} + +array set plotsend::rules { + 63,dc 1 + 12,dc 1 + 26,dc 2 + 3,dc 2 + 41,dc 2 + 55,dc 1 + 70,dc 1 + 69,dc 0 + 18,dc 2 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 62,dc 1 + 11,dc 1 + 25,dc 2 + 2,dc 0 + 40,dc 2 + 39,dc 2 + 54,dc 1 + 68,dc 1 + 17,dc 2 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 61,dc 0 + 10,dc 1 + 24,dc 1 + 1,dc 0 + 38,dc 2 + 53,dc 2 + 67,dc 1 + 16,dc 2 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 60,dc 1 + 59,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 2 + 52,dc 2 + 66,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 1 + 22,dc 1 + 36,dc 2 + 51,dc 2 + 65,dc 0 + 14,dc 1 + 28,dc 2 + 5,dc 3 + 43,dc 1 + 57,dc 1 + 21,dc 1 + 35,dc 2 + 50,dc 2 + 49,dc 2 + 64,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 0 + 42,dc 0 + 56,dc 1 + 71,dc 1 + 19,dc 2 + 20,dc 1 + 34,dc 1 + 48,dc 2 +} + +array set plotsend::rules { + 41,line 114 + 7,line 70 + 37,line 110 + 4,line 65 + 34,line 105 + 1,line 64 + 31,line 101 + 27,line 97 + 24,line 93 + 21,line 90 + 17,line 86 + 14,line 83 + 70,line 159 + 69,line 158 + 11,line 77 + 66,line 153 + 63,line 148 + 60,line 143 + 59,line 142 + 56,line 138 + 53,line 132 + 50,line 129 + 49,line 128 + 46,line 124 + 43,line 118 + 9,line 72 + 40,line 113 + 39,line 112 + 6,line 69 + 36,line 109 + 3,line 65 + 33,line 104 + 4,e 1 + 29,line 99 + 30,line 100 + 26,line 96 + 23,line 92 + 19,line 88 + 20,line 89 + 16,line 85 + 13,line 82 + 68,line 155 + 10,line 76 + 65,line 152 + 62,line 147 + 58,line 141 + 55,line 137 + 52,line 131 + 48,line 127 + 45,line 123 + 42,line 117 + 8,line 71 + 38,line 111 + 5,line 66 + 35,line 108 + 2,line 64 + 32,line 102 + 28,line 98 + 2,e 0 + 25,line 95 + 22,line 91 + 18,line 87 + 15,line 84 + 71,line 160 + 12,line 81 + 67,line 154 + 64,line 149 + 61,line 146 + 57,line 140 + 54,line 135 + 51,line 130 + 47,line 125 + 44,line 122 +} + +array set plotsend::lr1_table { + 66,trans {} + 35 {{57 {257 258 259 260 261 274 295 296 300 302} 1}} + 14,trans {} + 36 {{54 {257 258 259 260 261 274 295 296 300 302} 1}} + 33,trans {} + 37 {{18 0 2}} + 52,trans {} + 38 {{44 0 1} {45 0 1} {46 0 1} {47 0 1} {48 0 1} {49 0 1} {50 0 1} {51 0 1} {52 0 1} {53 0 1}} + 71,trans {} + 39 {{7 {263 277 278 279 284 285 286} 1}} + 40 {{9 {263 277 278 279 284 285 286} 1}} + 18,trans {} + 1,trans {{308 4}} + 41 {{6 {263 277 278 279 284 285 286} 1}} + 37,trans {} + 42 {{8 {263 277 278 279 284 285 286} 1}} + 56,trans {} + 43 {{35 0 1} {36 0 1} {37 0 1} {38 0 1} {39 0 1} {40 0 1} {41 0 1}} + 75,trans {} + 44 {{16 0 2}} + 23,trans {} + 45 {{66 0 1}} + 5,trans {{265 30} {266 31} {280 32} {281 33} {282 34} {288 35} {301 36} {314 37} {315 38}} + 42,trans {} + 46 {{67 0 1}} + 61,trans {} + 47 {{68 0 1}} + 80,trans {} + 79,trans {} + 48 {{25 0 2}} + 27,trans {} + 50 {{43 0 1}} + 49 {{26 0 2}} + 9,trans {} + 46,trans {} + 51 {{17 0 2}} + 65,trans {} + 52 {{71 0 1}} + 53 {{70 0 1}} + 13,trans {} + 32,trans {} + 54 {{28 0 2}} + 51,trans {} + 55 {{7 0 1}} + 70,trans {} + 69,trans {} + 56 {{9 0 1}} + 57 {{6 0 1}} + 17,trans {} + 0,trans {{262 1} {306 2} {307 3}} + 36,trans {} + 58 {{8 0 1}} + 55,trans {} + 60 {{10 0 1}} + 59 {{64 0 1}} + 74,trans {} + 61 {{11 0 1}} + 62 {{62 0 1}} + 22,trans {} + 4,trans {{257 5} {264 6} {267 7} {269 8} {270 9} {271 10} {272 11} {273 12} {275 13} {276 14} {281 15} {283 16} {287 17} {289 18} {291 19} {292 20} {293 21} {294 22} {297 23} {298 24} {299 25} {301 26} {303 27} {311 29}} + 41,trans {} + 63 {{63 0 1}} + 60,trans {} + 59,trans {} + 64 {{19 0 2}} + 78,trans {} + 65 {{44 0 2}} + 66 {{46 0 2}} + 26,trans {{X 55} {Y 56} {x 57} {y 58} {281 59} {304 60} {305 61} {309 62} {310 63} {316 64}} + 8,trans {} + 45,trans {} + 67 {{48 0 2}} + 64,trans {} + 68 {{49 0 2}} + 70 {{45 0 2}} + 69 {{47 0 2}} + 12,trans {{268 45} {269 46} {303 47} {317 49}} + 71 {{50 0 2}} + 31,trans {} + 50,trans {} + 49,trans {} + 72 {{52 0 2}} + 68,trans {} + 73 {{53 0 2}} + 74 {{51 0 2}} + 16,trans {} + 75 {{38 0 2}} + 35,trans {} + 54,trans {} + 76 {{37 0 2}} + 73,trans {} + 77 {{41 0 2}} + 78 {{35 0 2}} + 21,trans {{269 52} {275 53} {318 54}} + 3,trans {{257 5} {264 6} {267 7} {269 8} {270 9} {271 10} {272 11} {273 12} {275 13} {276 14} {281 15} {283 16} {287 17} {289 18} {291 19} {292 20} {293 21} {294 22} {297 23} {298 24} {299 25} {301 26} {303 27} {311 28}} + 80 {{40 0 2}} + 79 {{36 0 2}} + 40,trans {} + 39,trans {} + 58,trans {} + 81 {{39 0 2}} + 10 {{34 0 1}} + 77,trans {} + 11 {{25 0 1} {65 0 0} {66 0 0} {67 0 0} {68 0 0}} + 25,trans {} + 7,trans {} + 12 {{26 0 1} {65 0 0} {66 0 0} {67 0 0} {68 0 0}} + 44,trans {} + 13 {{23 0 1}} + 63,trans {} + 14 {{24 0 1}} + 11,trans {{268 45} {269 46} {303 47} {317 48}} + 15 {{17 0 1} {42 0 0} {43 0 0}} + 30,trans {} + 29,trans {} + 16 {{14 0 1}} + 48,trans {} + 0 {{0 0 0} {1 0 0} {3 0 0} {5 0 0} {2 {257 264 267 269 270 271 272 273 275 276 281 283 287 289 291 292 293 294 297 298 299 301 303} 0}} + 17 {{15 0 1}} + 67,trans {} + 1 {{5 0 1} {4 {257 264 267 269 270 271 272 273 275 276 281 283 287 289 291 292 293 294 297 298 299 301 303} 0}} + 18 {{27 0 1}} + 15,trans {{290 50} {313 51}} + 2 {{0 0 1}} + 19 {{29 0 1}} + 20 {{33 0 1}} + 34,trans {} + 3 {{3 0 1} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0} {32 0 0} {33 0 0} {34 0 0}} + 21 {{28 0 1} {69 0 0} {70 0 0} {71 0 0}} + 53,trans {} + 4 {{5 0 2} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0} {32 0 0} {33 0 0} {34 0 0}} + 22 {{21 0 1}} + 72,trans {} + 5 {{18 0 1} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 {257 258 259 260 261 274 295 296 300 302} 0} {55 {257 258 259 260 261 274 295 296 300 302} 0} {56 {257 258 259 260 261 274 295 296 300 302} 0} {57 {257 258 259 260 261 274 295 296 300 302} 0} {58 {257 258 259 260 261 274 295 296 300 302} 0} {59 {257 258 259 260 261 274 295 296 300 302} 0} {60 {257 258 259 260 261 274 295 296 300 302} 0}} + 23 {{30 0 1}} + 20,trans {} + 19,trans {} + 6 {{16 0 1} {35 0 0} {36 0 0} {37 0 0} {38 0 0} {39 0 0} {40 0 0} {41 0 0} {6 {263 277 278 279 284 285 286} 0} {7 {263 277 278 279 284 285 286} 0} {8 {263 277 278 279 284 285 286} 0} {9 {263 277 278 279 284 285 286} 0}} + 2,trans {} + 24 {{12 0 1}} + 38,trans {{257 65} {258 66} {259 67} {260 68} {261 69} {274 70} {295 71} {296 72} {300 73} {302 74}} + 7 {{20 0 1}} + 25 {{13 0 1}} + 57,trans {} + 8 {{22 0 1}} + 26 {{19 0 1} {61 0 0} {62 0 0} {63 0 0} {64 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0}} + 76,trans {} + 9 {{32 0 1}} + 27 {{31 0 1}} + 24,trans {} + 6,trans {{X 39} {Y 40} {x 41} {y 42} {309 43} {312 44}} + 28 {{3 0 2}} + 43,trans {{263 75} {277 76} {278 77} {279 78} {284 79} {285 80} {286 81}} + 29 {{5 0 3}} + 30 {{58 {257 258 259 260 261 274 295 296 300 302} 1}} + 62,trans {} + 31 {{56 {257 258 259 260 261 274 295 296 300 302} 1}} + 81,trans {} + 10,trans {} + 32 {{55 {257 258 259 260 261 274 295 296 300 302} 1}} + 28,trans {} + 33 {{59 {257 258 259 260 261 274 295 296 300 302} 1}} + 47,trans {} + 34 {{60 {257 258 259 260 261 274 295 296 300 302} 1}} +} + +array set plotsend::token_id_table { + 286 MIN_ + 286,t 0 + 287 MODE_ + 292,line 46 + 302,line 56 + 288 NUMBERS_ + 317,t 1 + 265,title AXESNUMBERS + 289 NAME_ + 290 POSITION_ + 300 STYLE_ + 284,title LOG + 291 RELIEF_ + 301 TITLE_ + 313,title {} + 292 SELECT_ + 302 WEIGHT_ + 288,line 42 + 293 SHAPE_ + 303 WIDTH_ + 294 SHOW_ + 304 XAXIS_ + 305 YAXIS_ + 295 SIZE_ + 306 plotsend + 296 SLANT_ + 307 @PSEUDO1 + 262,t 0 + 297 SMOOTH_ + 308 @PSEUDO2 + 285,line 39 + 298 STATS_ + 310 xyaxis + 309 xy + 299 STATISTICS_ + 311 plotCmd + 283,t 0 + 312 axis + 313 legend + 314,t 1 + 314 fontt + 282,line 36 + 315 fontType + 316 title + 264,title AXIS + 317 errorr + 283,title LIST + 318 shape + 312,title {} + 319 start' + 278,line 32 + error,line 62 + 258,t 0 + 275,line 29 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 26 + 263,title AUTO + 282,title LEGENDTITLE + 311,title {} + 268,line 22 + 276,t 0 + Y,t 0 + 265,line 19 + 307,t 1 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title string + 281,title LEGEND + 310,title {} + 309,title {} + error,t 0 + 299,title STATISTICS + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 317,line 151 + 261,title FONTWEIGHT + 279,title GRID + 280,title LABELS + 308,title {} + 269,t 0 + 270,t 0 + 298,title STATS + 314,line 120 + 291,t 0 + 301,t 0 + 311,line 79 + y,t 0 + 307,line 64 + 266,t 0 + 260,title FONTSTYLE + 259,title FONTSLANT + 297,line 51 + 278,title FORMAT + 307,title {} + 297,title SMOOTH + 287,t 0 + 294,line 48 + 304,line 58 + 318,t 1 + X X + error,title {} + 291,line 45 + 301,line 55 + Y Y + 263,t 0 + 258,title FONTSIZE + 287,line 41 + 277,title FLIP + 284,t 0 + 306,title {} + 296,title SLANT + 315,t 1 + 284,line 38 + 281,line 35 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title FONT + 277,line 31 + 276,title FILLCOLOR + 312,t 1 + 305,title YAXIS + 295,title SIZE + 274,line 28 + Y,line 71 + 271,line 25 + x x + 277,t 0 + y y + 308,t 1 + 267,line 21 + 298,t 0 + 275,title FILL + 294,title SHOW + 304,title XAXIS + 264,line 18 + 261,line 11 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title FAMILY + 293,title SHAPE + 303,title WIDTH + 319,line 161 + error error + 271,t 0 + y,line 70 + 292,t 0 + 302,t 0 + 316,line 145 + 273,title ERRORBAR + 313,line 116 + 292,title SELECT + 302,title WEIGHT + 267,t 0 + 310,line 75 + 309,line 68 + 299,line 53 + 288,t 0 + 319,t 1 + 306,line 63 + 296,line 50 + 272,title ERROR + 291,title RELIEF + 293,line 47 + 301,title TITLE + 303,line 57 + 319,title {} + 264,t 0 + Y,title {} + 285,t 0 + 289,line 43 + 290,line 44 + 300,line 54 + 316,t 1 + 286,line 40 + 271,title DATASET + 261,t 0 + 283,line 37 + 289,title NAME + 290,title POSITION + 300,title STYLE + 318,title {} + 282,t 0 + X,title {} + 279,line 33 + 280,line 34 + 313,t 1 + 276,line 30 + 257,t 0 + 269,title COLOR + 270,title DASH + 273,line 27 + 288,title NUMBERS + 317,title {} + 278,t 0 + 310,t 1 + X,line 69 + 309,t 1 + 299,t 0 + 269,line 23 + 270,line 24 + y,title {} + 266,line 20 + 268,title CAP + 275,t 0 + 263,line 17 + 287,title MODE + 316,title {} + X,t 0 + 306,t 1 + 296,t 0 + 260,line 10 + 259,line 9 + x,title {} + 272,t 0 + 267,title BARMODE + 257 FONT_ + 286,title MIN + 293,t 0 + 303,t 0 + 315,title {} + 258 FONTSIZE_ + 318,line 157 + 260 FONTSTYLE_ + 259 FONTSLANT_ + 261 FONTWEIGHT_ + 262 STRING_ + 263 AUTO_ + x,line 68 + 264 AXIS_ + 315,line 134 + 265 AXESNUMBERS_ + 266 AXESTITLE_ + 267 BARMODE_ + 268,t 0 + 268 CAP_ + 269 COLOR_ + 270 DASH_ + 312,line 107 + 271 DATASET_ + 272 ERROR_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title AXESTITLE + 273 ERRORBAR_ + 274 FAMILY_ + 285,title MAX + 314,title {} + 275 FILL_ + 308,line 65 + 276 FILLCOLOR_ + 298,line 52 + x,t 0 + 277 FLIP_ + 278 FORMAT_ + 279 GRID_ + 280 LABELS_ + 281 LEGEND_ + 305,line 59 + 282 LEGENDTITLE_ + 295,line 49 + 265,t 0 + 283 LIST_ + 284 LOG_ + 285 MAX_ +} + +proc plotsend::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 { ProcessSendCmdGet iap windows } + 2 { if {![PlotCmdCheck]} {plot::YYABORT} } + 4 { if {![PlotCmdRef $1]} {plot::YYABORT} } + 6 { set _ x } + 7 { set _ x } + 8 { set _ y } + 9 { set _ y } + 10 { set _ x } + 11 { set _ y } + 12 { ProcessSendCmdCVAR PlotStatsGenerate } + 13 { ProcessSendCmdCVAR PlotStatsGenerate } + 14 { ProcessSendCmdCVAR PlotListGenerate } + 15 { ProcessSendCmdCVARGet mode } + 20 { ProcessSendCmdCVARGet bar,mode } + 21 { ProcessSendCmdCVARYesNo show } + 22 { ProcessSendCmdCVARGet color } + 23 { ProcessSendCmdCVARGet fill } + 24 { ProcessSendCmdCVARGet fill,color } + 27 { ProcessSendCmdCVARGet name } + 29 { ProcessSendCmdCVARGet bar,relief } + 30 { ProcessSendCmdCVARGet smooth } + 31 { ProcessSendCmdCVARGet width } + 32 { ProcessSendCmdCVARYesNo dash } + 33 { ProcessSendCmdCVARGet data,current } + 34 { ProcessSendCmdCVARGet data,current } + 35 { ProcessSendCmdCVARYesNo "axis,$1,grid" } + 36 { ProcessSendCmdCVARYesNo "axis,$1,log" } + 37 { ProcessSendCmdCVARYesNo "axis,$1,flip" } + 38 { ProcessSendCmdCVARYesNo "axis,$1,auto" } + 39 { ProcessSendCmdCVARGet "axis,$1,min" } + 40 { ProcessSendCmdCVARGet "axis,$1,max" } + 41 { ProcessSendCmdCVARGet "axis,$1,format" } + 42 { ProcessSendCmdCVARYesNo legend } + 43 { ProcessSendCmdCVARGet legend,position } + 44 { ProcessSendCmdCVARGet "$1,family" } + 45 { ProcessSendCmdCVARGet "$1,family" } + 46 { ProcessSendCmdCVARGet "$1,size" } + 47 { ProcessSendCmdCVARGet "$1,weight" } + 48 { ProcessSendCmdCVARGet "$1,slant" } + 49 { ProcessSendCmdCVARGet "$1,weight" } + 50 { ProcessSendCmdCVARGet "$1,size" } + 51 { ProcessSendCmdCVARGet "$1,weight" } + 52 { ProcessSendCmdCVARGet "$1,slant" } + 53 { ProcessSendCmdCVARGet "$1,weight" } + 54 { set _ graph,title } + 55 { set _ axis,title } + 56 { set _ axis,title } + 57 { set _ axis,font } + 58 { set _ axis,font } + 59 { set _ legend,font } + 60 { set _ legend,title } + 61 { ProcessSendCmdCVARGet graph,title } + 62 { ProcessSendCmdCVARGet "axis,$1,title" } + 63 { ProcessSendCmdCVARGet "axis,$1,title" } + 64 { ProcessSendCmdCVARGet legend,title } + 65 { ProcessSendCmdCVARYesNo error } + 66 { ProcessSendCmdCVARYesNo error,cap } + 67 { ProcessSendCmdCVARGet error,color } + 68 { ProcessSendCmdCVARGet error,width } + 69 { ProcessSendCmdCVARGet shape,symbol } + 70 { ProcessSendCmdCVARYesNo shape,fill } + 71 { ProcessSendCmdCVARGet shape,color } + } + 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 plotsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/precisionlex.tcl b/ds9/parsers/precisionlex.tcl new file mode 100644 index 0000000..bb6dcac --- /dev/null +++ b/ds9/parsers/precisionlex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval precision { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc precision::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc precision::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc precision::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc precision::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc precision::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc precision::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc precision::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc precision::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc precision::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval $yytext; return $INT_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/precisionparser.tab.tcl b/ds9/parsers/precisionparser.tab.tcl new file mode 100644 index 0000000..e736960 --- /dev/null +++ b/ds9/parsers/precisionparser.tab.tcl @@ -0,0 +1,2 @@ +set INT_ 257 +set STRING_ 258 diff --git a/ds9/parsers/precisionparser.tcl b/ds9/parsers/precisionparser.tcl new file mode 100644 index 0000000..1cdea87 --- /dev/null +++ b/ds9/parsers/precisionparser.tcl @@ -0,0 +1,311 @@ +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 precision { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc precision::YYABORT {} { + return -code return 1 +} + +proc precision::YYACCEPT {} { + return -code return 0 +} + +proc precision::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc precision::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc precision::yyerror {s} { + puts stderr $s +} + +proc precision::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 precision::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set precision::table { + 3:0,target 1 + 0:257 shift + 7:0 reduce + 6:257,target 8 + 5:258,target 7 + 1:257 shift + 0:259 goto + 10:0 reduce + 8:257,target 9 + 0:261 goto + 7:0,target 3 + 4:257 shift + 3:258 reduce + 1:257,target 4 + 10:258,target 4 + 3:260 goto + 10:0,target 4 + 6:257 shift + 5:258 shift + 0:261,target 3 + 2:0,target 0 + 8:257 shift + 3:260,target 5 + 9:257 shift + 10:258 reduce + 0:257,target 1 + 9:257,target 10 + 2:0 accept + 0:259,target 2 + 3:0 reduce + 4:257,target 6 + 3:258,target 2 +} + +array set precision::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 259 + 4,l 261 +} + +array set precision::rules { + 0,dc 1 + 2,dc 0 + 4,dc 6 + 1,dc 1 + 3,dc 3 +} + +array set precision::rules { + 2,e 1 + 2,line 16 + 4,line 20 + 1,line 16 + 3,line 17 +} + +array set precision::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0}} + 1 {{4 {0 258} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{257 1} {259 2} {261 3}} + 4 {{4 {0 258} 2}} + 1,trans {{257 4}} + 5 {{3 0 2}} + 2,trans {} + 6 {{4 {0 258} 3}} + 7 {{3 0 3}} + 3,trans {{260 5}} + 8 {{4 {0 258} 4}} + 4,trans {{257 6}} + 10 {{4 {0 258} 6}} + 9 {{4 {0 258} 5}} + 5,trans {{258 7}} + 6,trans {{257 8}} + 7,trans {} + 8,trans {{257 9}} + 10,trans {} + 9,trans {{257 10}} +} + +array set precision::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 9 + 261,line 19 + error,line 14 + 257 INT_ + 257,t 0 + 258 STRING_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 precision + 262,t 1 + 262 start' + 257,line 7 + 260,line 16 + 259,line 15 + 257,title integer + 258,title string + 262,line 21 + 260,title {} + 259,title {} + 261,title {} +} + +proc precision::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet pds9 prec,linear $1; ProcessCmdSet pds9 prec,deg $2; ProcessCmdSet pds9 prec,hms $3;ProcessCmdSet pds9 prec,dms $4; ProcessCmdSet pds9 prec,arcmin $5; ProcessCmdSet pds9 prec,arcsec $6 PrefsPrecision } + } + 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 precision::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/prefslex.tcl b/ds9/parsers/prefslex.tcl new file mode 100644 index 0000000..5e5843c --- /dev/null +++ b/ds9/parsers/prefslex.tcl @@ -0,0 +1,429 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval prefs { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc prefs::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc prefs::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc prefs::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc prefs::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc prefs::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc prefs::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc prefs::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc prefs::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc prefs::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set BGCOLOR_ 265 +set CLEAR_ 266 +set IRAFALIGN_ 267 +set NANCOLOR_ 268 +set PRECISION_ 269 +set THREADS_ 270 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: bgcolor + if {[regexp -start $index_ -indices -line -nocase -- {\A(bgcolor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: irafalign + if {[regexp -start $index_ -indices -line -nocase -- {\A(irafalign)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: nancolor + if {[regexp -start $index_ -indices -line -nocase -- {\A(nancolor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: precision + if {[regexp -start $index_ -indices -line -nocase -- {\A(precision)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: threads + if {[regexp -start $index_ -indices -line -nocase -- {\A(threads)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BGCOLOR_ + } + 1 { +return $CLEAR_ + } + 2 { +return $IRAFALIGN_ + } + 3 { +return $NANCOLOR_ + } + 4 { +return $PRECISION_ + } + 5 { +return $THREADS_ + } + 6 { +return $YES_ + } + 7 { +return $NO_ + } + 8 { +return $ON_ + } + 9 { +return $OFF_ + } + 10 { +return $TRUE_ + } + 11 { +return $FALSE_ + } + 12 { +set yylval $yytext; return $INT_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval $yytext; return $STRING_ + } + 17 { +# ignore whitespace + } + 18 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/prefsparser.tab.tcl b/ds9/parsers/prefsparser.tab.tcl new file mode 100644 index 0000000..0301bd4 --- /dev/null +++ b/ds9/parsers/prefsparser.tab.tcl @@ -0,0 +1,14 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set BGCOLOR_ 265 +set CLEAR_ 266 +set IRAFALIGN_ 267 +set NANCOLOR_ 268 +set PRECISION_ 269 +set THREADS_ 270 diff --git a/ds9/parsers/prefsparser.tcl b/ds9/parsers/prefsparser.tcl new file mode 100644 index 0000000..cc62bfd --- /dev/null +++ b/ds9/parsers/prefsparser.tcl @@ -0,0 +1,523 @@ +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 prefs { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc prefs::YYABORT {} { + return -code return 1 +} + +proc prefs::YYACCEPT {} { + return -code return 0 +} + +proc prefs::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc prefs::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc prefs::yyerror {s} { + puts stderr $s +} + +proc prefs::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 prefs::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set prefs::table { + 11:264 reduce + 13:264 reduce + 20:264,target 22 + 19:264,target 15 + 15:0,target 7 + 9:0 reduce + 0:266,target 2 + 2:264,target 11 + 15:264 reduce + 11:0 reduce + 17:264 reduce + 14:264,target 4 + 3:257,target 10 + 25:263,target 26 + 0:265 shift + 20:264 shift + 19:264 reduce + 15:0 reduce + 0:266 shift + 2:264 reduce + 0:267 shift + 0:268 shift + 0:265,target 1 + 4:264 shift + 24:263 shift + 0:269 shift + 0:270 shift + 6:263 shift + 19:0 reduce + 16:0,target 16 + 2:0 reduce + 0:272 goto + 26:264 reduce + 8:264 reduce + 0:274 goto + 17:264,target 14 + 0:274,target 8 + 12:264,target 3 + 7:0,target 0 + 23:263,target 24 + 17:0,target 14 + 12:0 reduce + 5:263,target 18 + 10:0,target 2 + 8:273 goto + 26:264,target 12 + 16:0 reduce + 8:264,target 9 + 3:264,target 1 + 26:0,target 12 + 8:0,target 8 + 3:0 reduce + 15:264,target 7 + 11:0,target 5 + 10:264 reduce + 0:272,target 7 + 12:264 reduce + 8:273,target 20 + 7:0 accept + 10:264,target 2 + 21:263,target 23 + 14:264 reduce + 3:257 shift + 3:258 shift + 16:264 reduce + 3:259 shift + 3:260 shift + 18:263 shift + 13:0 reduce + 9:0,target 13 + 3:261 shift + 19:0,target 15 + 1:264 shift + 2:0,target 11 + 3:262 shift + 21:263 shift + 12:0,target 3 + 3:264 reduce + 23:263 shift + 17:0 reduce + 1:264,target 9 + 3:262,target 15 + 5:263 shift + 25:263 shift + 13:264,target 6 + 24:263,target 25 + 22:0 reduce + 0:269,target 5 + 0:270,target 6 + 6:263,target 19 + 9:264 reduce + 3:271 goto + 3:0,target 1 + 18:263,target 21 + 13:0,target 6 + 3:261,target 14 + 26:0 reduce + 9:264,target 13 + 8:0 reduce + 3:271,target 16 + 10:0 reduce + 0:268,target 4 + 4:264,target 17 + 14:0 reduce + 16:264,target 16 + 3:259,target 12 + 3:260,target 13 + 22:0,target 10 + 14:0,target 4 + 11:264,target 5 + 0:267,target 3 + 3:258,target 11 +} + +array set prefs::rules { + 9,l 273 + 11,l 274 + 15,l 274 + 2,l 271 + 6,l 271 + 12,l 274 + 16,l 274 + 3,l 271 + 7,l 271 + 13,l 274 + 0,l 275 + 4,l 271 + 8,l 272 + 10,l 272 + 14,l 274 + 1,l 271 + 5,l 271 +} + +array set prefs::rules { + 5,dc 1 + 0,dc 1 + 12,dc 7 + 8,dc 1 + 3,dc 1 + 15,dc 2 + 10,dc 3 + 6,dc 1 + 1,dc 0 + 13,dc 2 + 9,dc 0 + 4,dc 1 + 16,dc 2 + 11,dc 1 + 7,dc 1 + 2,dc 1 + 14,dc 2 +} + +array set prefs::rules { + 13,line 53 + 7,line 44 + 10,line 48 + 4,line 41 + 1,line 38 + 15,line 55 + 9,line 47 + 12,line 52 + 6,line 43 + 3,line 40 + 14,line 54 + 8,line 47 + 11,line 51 + 5,line 42 + 2,line 39 + 9,e 1 + 16,line 56 +} + +array set prefs::lr1_table { + 14,trans {} + 1,trans {{264 9}} + 18,trans {{263 21}} + 23,trans {{263 24}} + 5,trans {{263 18}} + 9,trans {} + 13,trans {} + 0,trans {{265 1} {266 2} {267 3} {268 4} {269 5} {270 6} {272 7} {274 8}} + 17,trans {} + 4,trans {{264 17}} + 22,trans {} + 26,trans {} + 8,trans {{273 20}} + 12,trans {} + 16,trans {} + 3,trans {{257 10} {258 11} {259 12} {260 13} {261 14} {262 15} {271 16}} + 21,trans {{263 23}} + 10 {{2 {0 264} 1}} + 11 {{5 {0 264} 1}} + 25,trans {{263 26}} + 12 {{3 {0 264} 1}} + 7,trans {} + 13 {{6 {0 264} 1}} + 14 {{4 {0 264} 1}} + 15 {{7 {0 264} 1}} + 11,trans {} + 16 {{16 {0 264} 2}} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 264} 0} {12 {0 264} 0} {13 {0 264} 0} {14 {0 264} 0} {15 {0 264} 0} {16 {0 264} 0}} + 17 {{14 {0 264} 2}} + 1 {{13 {0 264} 1}} + 18 {{12 {0 264} 2}} + 2 {{11 {0 264} 1}} + 19 {{15 {0 264} 2}} + 20 {{10 0 2}} + 15,trans {} + 3 {{16 {0 264} 1} {1 {0 264} 0} {2 {0 264} 0} {3 {0 264} 0} {4 {0 264} 0} {5 {0 264} 0} {6 {0 264} 0} {7 {0 264} 0}} + 21 {{12 {0 264} 3}} + 4 {{14 {0 264} 1}} + 22 {{10 0 3}} + 5 {{12 {0 264} 1}} + 23 {{12 {0 264} 4}} + 6 {{15 {0 264} 1}} + 2,trans {} + 19,trans {} + 20,trans {{264 22}} + 24 {{12 {0 264} 5}} + 25 {{12 {0 264} 6}} + 7 {{0 0 1}} + 26 {{12 {0 264} 7}} + 8 {{8 0 1} {10 0 1} {9 264 0}} + 9 {{13 {0 264} 2}} + 24,trans {{263 25}} + 6,trans {{263 19}} + 10,trans {} +} + +array set prefs::token_id_table { + 264,line 16 + 270,t 0 + 269,t 0 + 265,title BGCOLOR + 274,t 1 + 261,line 11 + 257,t 0 + 270,title THREADS + 269,title PRECISION + 273,line 47 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 271,t 1 + error error + 264,title string + 266,line 21 + 275,t 1 + error,line 36 + 268,title NANCOLOR + 258,t 0 + 263,line 14 + error,title {} + 275,line 57 + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 272,line 46 + 267,t 0 + 263,title integer + 272,t 1 + 268,line 23 + 267,title IRAFALIGN + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title {} + 261 TRUE_ + 265,line 20 + 262 FALSE_ + 263 INT_ + 257,title YES + 264 STRING_ + 264,t 0 + 265 BGCOLOR_ + 262,line 12 + 266 CLEAR_ + 267 IRAFALIGN_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 NANCOLOR_ + 268,t 0 + 274,line 50 + 270 THREADS_ + 269 PRECISION_ + 271 yesno + error,t 0 + 272 command + 258,line 8 + 273,t 1 + 273 @PSEUDO1 + 266,title CLEAR + 274 prefs + 275 start' + 271,line 37 + 271,title {} + 261,t 0 + 267,line 22 + 275,title {} + 265,t 0 + 261,title TRUE +} + +proc prefs::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { ClearPrefs } + 12 { ProcessCmdSet pds9 prec,linear $2; ProcessCmdSet pds9 prec,deg $3; ProcessCmdSet pds9 prec,hms $4;ProcessCmdSet pds9 prec,dms $5; ProcessCmdSet pds9 prec,arcmin $6; ProcessCmdSet pds9 prec,arcsec $7 PrefsPrecision } + 13 { ProcessCmdSet pds9 bg $2 PrefsBgColor } + 14 { ProcessCmdSet pds9 nan $2 PrefsNanColor } + 15 { ProcessCmdSet ds9 threads $2 ChangeThreads } + 16 { ProcessCmdSet pds9 iraf $2 PrefsIRAFAlign } + } + 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 prefs::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/prefssendlex.tcl b/ds9/parsers/prefssendlex.tcl new file mode 100644 index 0000000..3623ba0 --- /dev/null +++ b/ds9/parsers/prefssendlex.tcl @@ -0,0 +1,300 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval prefssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc prefssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc prefssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc prefssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc prefssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc prefssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc prefssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc prefssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc prefssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc prefssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set BGCOLOR_ 257 +set IRAFALIGN_ 258 +set NANCOLOR_ 259 +set PRECISION_ 260 +set THREADS_ 261 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: bgcolor + if {[regexp -start $index_ -indices -line -nocase -- {\A(bgcolor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: irafalign + if {[regexp -start $index_ -indices -line -nocase -- {\A(irafalign)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: nancolor + if {[regexp -start $index_ -indices -line -nocase -- {\A(nancolor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: precision + if {[regexp -start $index_ -indices -line -nocase -- {\A(precision)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: threads + if {[regexp -start $index_ -indices -line -nocase -- {\A(threads)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BGCOLOR_ + } + 1 { +return $IRAFALIGN_ + } + 2 { +return $NANCOLOR_ + } + 3 { +return $PRECISION_ + } + 4 { +return $THREADS_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/prefssendparser.tab.tcl b/ds9/parsers/prefssendparser.tab.tcl new file mode 100644 index 0000000..0cd5b22 --- /dev/null +++ b/ds9/parsers/prefssendparser.tab.tcl @@ -0,0 +1,5 @@ +set BGCOLOR_ 257 +set IRAFALIGN_ 258 +set NANCOLOR_ 259 +set PRECISION_ 260 +set THREADS_ 261 diff --git a/ds9/parsers/prefssendparser.tcl b/ds9/parsers/prefssendparser.tcl new file mode 100644 index 0000000..d83232a --- /dev/null +++ b/ds9/parsers/prefssendparser.tcl @@ -0,0 +1,304 @@ +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 prefssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc prefssend::YYABORT {} { + return -code return 1 +} + +proc prefssend::YYACCEPT {} { + return -code return 0 +} + +proc prefssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc prefssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc prefssend::yyerror {s} { + puts stderr $s +} + +proc prefssend::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 prefssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set prefssend::table { + 6:0 accept + 3:0,target 3 + 0:257 shift + 0:258 shift + 5:0,target 4 + 0:260 shift + 0:259 shift + 0:261 shift + 0:258,target 2 + 0:262 goto + 0:261,target 5 + 2:0,target 5 + 4:0,target 1 + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 reduce + 1:0,target 2 + 5:0 reduce + 0:262,target 6 +} + +array set prefssend::rules { + 0,l 263 + 1,l 262 + 2,l 262 + 3,l 262 + 4,l 262 + 5,l 262 +} + +array set prefssend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set prefssend::rules { + 5,line 21 + 2,line 18 + 4,line 20 + 1,line 17 + 3,line 19 +} + +array set prefssend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0}} + 1 {{2 0 1}} + 2 {{5 0 1}} + 3 {{3 0 1}} + 4 {{1 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6}} + 5 {{4 0 1}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} +} + +array set prefssend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 9 + 261,line 12 + error,line 15 + 257 BGCOLOR_ + 257,t 0 + 263,line 22 + 258 IRAFALIGN_ + 258,t 0 + error,title {} + 260,t 0 + 260 PRECISION_ + 259 NANCOLOR_ + 259,t 0 + 261,t 0 + 261 THREADS_ + 262,t 1 + 262 prefssend + 257,line 8 + 263,t 1 + 263 start' + 260,line 11 + 257,title BGCOLOR + 259,line 10 + 258,title IRAFALIGN + 262,line 16 + 260,title PRECISION + 259,title NANCOLOR + 261,title THREADS +} + +proc prefssend::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 { ProcessSendCmdGet6 pds9 prec,linear prec,deg prec,hms prec,dms prec,arcmin prec,arcsec } + 2 { ProcessSendCmdGet pds9 bg } + 3 { ProcessSendCmdGet pds9 nan } + 4 { ProcessSendCmdGet ds9 threads } + 5 { ProcessSendCmdYesNo pds9 iraf } + } + 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 prefssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/preservelex.tcl b/ds9/parsers/preservelex.tcl new file mode 100644 index 0000000..8dcde26 --- /dev/null +++ b/ds9/parsers/preservelex.tcl @@ -0,0 +1,374 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval preserve { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc preserve::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc preserve::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc preserve::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc preserve::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc preserve::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc preserve::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc preserve::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc preserve::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc preserve::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set PAN_ 264 +set REGIONS_ 265 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: pan + if {[regexp -start $index_ -indices -line -nocase -- {\A(pan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: regions + if {[regexp -start $index_ -indices -line -nocase -- {\A(regions)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $PAN_ + } + 1 { +return $REGIONS_ + } + 2 { +return $YES_ + } + 3 { +return $NO_ + } + 4 { +return $ON_ + } + 5 { +return $OFF_ + } + 6 { +return $TRUE_ + } + 7 { +return $FALSE_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval $yytext; return $STRING_ + } + 12 { +# ignore whitespace + } + 13 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/preserveparser.tab.tcl b/ds9/parsers/preserveparser.tab.tcl new file mode 100644 index 0000000..f014928 --- /dev/null +++ b/ds9/parsers/preserveparser.tab.tcl @@ -0,0 +1,9 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set PAN_ 264 +set REGIONS_ 265 diff --git a/ds9/parsers/preserveparser.tcl b/ds9/parsers/preserveparser.tcl new file mode 100644 index 0000000..c7fd82b --- /dev/null +++ b/ds9/parsers/preserveparser.tcl @@ -0,0 +1,439 @@ +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 preserve { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc preserve::YYABORT {} { + return -code return 1 +} + +proc preserve::YYACCEPT {} { + return -code return 0 +} + +proc preserve::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc preserve::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc preserve::yyerror {s} { + puts stderr $s +} + +proc preserve::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 preserve::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set preserve::table { + 13:263 shift + 11:263,target 11 + 5:0,target 2 + 2:257 shift + 9:0 reduce + 2:258 shift + 11:0 reduce + 2:259 shift + 2:260 shift + 2:261 shift + 0:264 shift + 1:259,target 7 + 1:260,target 8 + 2:262 shift + 7:263,target 3 + 0:265 shift + 2:263 reduce + 4:263 reduce + 0:267 goto + 0:265,target 2 + 2:266 goto + 2:263,target 1 + 6:263 reduce + 6:0,target 5 + 0:269 goto + 2:0 reduce + 8:263 reduce + 1:258,target 6 + 4:268 goto + 6:0 reduce + 0:264,target 1 + 2:262,target 10 + 7:0,target 3 + 1:257,target 5 + 12:0 reduce + 5:263,target 2 + 10:0,target 7 + 2:261,target 9 + 4:268,target 13 + 12:263,target 12 + 1:266,target 11 + 8:0,target 6 + 3:0 accept + 10:263 reduce + 1:0,target 1 + 11:0,target 11 + 2:259,target 7 + 2:260,target 8 + 12:263 reduce + 8:263,target 6 + 7:0 reduce + 1:257 shift + 1:258 shift + 1:259 shift + 1:260 shift + 1:261 shift + 1:262 shift + 9:0,target 4 + 1:263 reduce + 2:258,target 6 + 2:0,target 1 + 12:0,target 12 + 10:263,target 7 + 1:266 goto + 5:263 reduce + 7:263 reduce + 2:257,target 5 + 9:263 reduce + 6:263,target 5 + 0:269,target 4 + 4:0 reduce + 3:0,target 0 + 1:263,target 1 + 8:0 reduce + 10:0 reduce + 13:263,target 14 + 2:266,target 12 + 14:0 reduce + 1:262,target 10 + 9:263,target 4 + 4:0,target 8 + 14:0,target 10 + 1:0 reduce + 4:263,target 9 + 0:267,target 3 + 11:263 reduce + 5:0 reduce + 1:261,target 9 +} + +array set preserve::rules { + 9,l 268 + 11,l 269 + 2,l 266 + 6,l 266 + 12,l 269 + 3,l 266 + 7,l 266 + 0,l 270 + 4,l 266 + 8,l 267 + 10,l 267 + 1,l 266 + 5,l 266 +} + +array set preserve::rules { + 5,dc 1 + 0,dc 1 + 12,dc 2 + 8,dc 1 + 3,dc 1 + 10,dc 3 + 6,dc 1 + 1,dc 0 + 9,dc 0 + 4,dc 1 + 11,dc 2 + 7,dc 1 + 2,dc 1 +} + +array set preserve::rules { + 7,line 38 + 10,line 42 + 4,line 35 + 1,line 32 + 9,line 41 + 12,line 46 + 6,line 37 + 3,line 34 + 8,line 41 + 11,line 45 + 5,line 36 + 2,line 33 + 9,e 1 +} + +array set preserve::lr1_table { + 13,trans {{263 14}} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 263} 0} {12 {0 263} 0}} + 14,trans {} + 1 {{11 {0 263} 1} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0}} + 2 {{12 {0 263} 1} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0}} + 3 {{0 0 1}} + 4 {{8 0 1} {10 0 1} {9 263 0}} + 0,trans {{264 1} {265 2} {267 3} {269 4}} + 1,trans {{257 5} {258 6} {259 7} {260 8} {261 9} {262 10} {266 11}} + 5 {{2 {0 263} 1}} + 2,trans {{257 5} {258 6} {259 7} {260 8} {261 9} {262 10} {266 12}} + 6 {{5 {0 263} 1}} + 3,trans {} + 7 {{3 {0 263} 1}} + 4,trans {{268 13}} + 8 {{6 {0 263} 1}} + 5,trans {} + 9 {{4 {0 263} 1}} + 10 {{7 {0 263} 1}} + 6,trans {} + 11 {{11 {0 263} 2}} + 7,trans {} + 12 {{12 {0 263} 2}} + 8,trans {} + 13 {{10 0 2}} + 14 {{10 0 3}} + 10,trans {} + 9,trans {} + 11,trans {} + 12,trans {} +} + +array set preserve::token_id_table { + 264,line 18 + 270,t 1 + 269,t 1 + 265,title REGIONS + 261,line 11 + 257,t 0 + 270,title {} + 269,title {} + 257,line 7 + 262,t 0 + 270,line 47 + 269,line 44 + 259,title ON + 260,title OFF + 266,t 1 + 264,title PAN + error error + 266,line 31 + 268,title {} + error,line 30 + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 267,t 1 + 263,title string + 268,line 41 + 267,title {} + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 261 TRUE_ + 265,line 19 + 262 FALSE_ + 263 STRING_ + 257,title YES + 264 PAN_ + 264,t 0 + 265 REGIONS_ + 262,line 12 + 266 yesno + 267 command + 268,t 1 + 268 @PSEUDO1 + 262,title FALSE + 0 {$} + 0,t 0 + 270 start' + 269 preserve + error,t 0 + 258,line 8 + 266,title {} + 261,t 0 + 267,line 40 + 265,t 0 + 261,title TRUE +} + +proc preserve::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { ProcessCmdSet panzoom preserve $2 PreservePan } + 12 { ProcessCmdSet marker preserve $2 MarkerPreserve } + } + 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 preserve::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/preservesendlex.tcl b/ds9/parsers/preservesendlex.tcl new file mode 100644 index 0000000..bdafb3e --- /dev/null +++ b/ds9/parsers/preservesendlex.tcl @@ -0,0 +1,278 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval preservesend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc preservesend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc preservesend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc preservesend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc preservesend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc preservesend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc preservesend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc preservesend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc preservesend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc preservesend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set PAN_ 257 +set REGIONS_ 258 +set SCALE_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: pan + if {[regexp -start $index_ -indices -line -nocase -- {\A(pan)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: regions + if {[regexp -start $index_ -indices -line -nocase -- {\A(regions)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $PAN_ + } + 1 { +return $REGIONS_ + } + 2 { +return $SCALE_ + } + 3 { +# ignore whitespace + } + 4 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/preservesendparser.tab.tcl b/ds9/parsers/preservesendparser.tab.tcl new file mode 100644 index 0000000..8ef0743 --- /dev/null +++ b/ds9/parsers/preservesendparser.tab.tcl @@ -0,0 +1,3 @@ +set PAN_ 257 +set REGIONS_ 258 +set SCALE_ 259 diff --git a/ds9/parsers/preservesendparser.tcl b/ds9/parsers/preservesendparser.tcl new file mode 100644 index 0000000..3898f05 --- /dev/null +++ b/ds9/parsers/preservesendparser.tcl @@ -0,0 +1,276 @@ +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 preservesend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc preservesend::YYABORT {} { + return -code return 1 +} + +proc preservesend::YYACCEPT {} { + return -code return 0 +} + +proc preservesend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc preservesend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc preservesend::yyerror {s} { + puts stderr $s +} + +proc preservesend::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 preservesend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set preservesend::table { + 3:0,target 3 + 0:257 shift + 0:258 shift + 0:260 goto + 0:259 shift + 0:258,target 2 + 2:0,target 2 + 4:0,target 0 + 0:257,target 1 + 1:0 reduce + 2:0 reduce + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 accept + 1:0,target 1 +} + +array set preservesend::rules { + 0,l 261 + 1,l 260 + 2,l 260 + 3,l 260 +} + +array set preservesend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set preservesend::rules { + 2,line 17 + 1,line 15 + 3,line 18 +} + +array set preservesend::lr1_table { + 4,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4}} + 4 {{0 0 1}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0}} + 1,trans {} + 1 {{1 0 1}} + 2,trans {} + 2 {{2 0 1}} + 3,trans {} + 3 {{3 0 1}} +} + +array set preservesend::token_id_table { + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 9 + 261,line 19 + error,line 13 + 257 PAN_ + 257,t 0 + 258 REGIONS_ + 258,t 0 + 260,t 1 + 260 preservesend + error,title {} + 259 SCALE_ + 259,t 0 + 261,t 1 + 261 start' + 257,line 8 + 260,line 14 + 257,title PAN + 259,line 10 + 258,title REGIONS + 260,title {} + 259,title SCALE + 261,title {} +} + +proc preservesend::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 { ProcessSendCmdYesNo panzoom preserve } + 2 { ProcessSendCmdYesNo marker preserve } + 3 { ProcessSendCmdTxt "no" } + } + 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 preservesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/pslex.tcl b/ds9/parsers/pslex.tcl new file mode 100644 index 0000000..f3fceb4 --- /dev/null +++ b/ds9/parsers/pslex.tcl @@ -0,0 +1,550 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval ps { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc ps::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc ps::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc ps::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc ps::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc ps::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc ps::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc ps::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc ps::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc ps::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set COLOR_ 258 +set COMMAND_ 259 +set DESTINATION_ 260 +set FILE_ 261 +set FILENAME_ 262 +set INTERPOLATE_ 263 +set LEVEL_ 264 +set PALETTE_ 265 +set PRINTER_ 266 +set RESOLUTION_ 267 +set RGB_ 268 +set CMYK_ 269 +set GRAY_ 270 +set 72_ 271 +set SCREEN_ 272 +set 96_ 273 +set 144_ 274 +set 150_ 275 +set 225_ 276 +set 300_ 277 +set 600_ 278 +set 1200_ 279 +set 53_ 280 +set 75_ 281 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: command + if {[regexp -start $index_ -indices -line -nocase -- {\A(command)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: destination + if {[regexp -start $index_ -indices -line -nocase -- {\A(destination)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: file + if {[regexp -start $index_ -indices -line -nocase -- {\A(file)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: interpolate + if {[regexp -start $index_ -indices -line -nocase -- {\A(interpolate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: level + if {[regexp -start $index_ -indices -line -nocase -- {\A(level)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: palette + if {[regexp -start $index_ -indices -line -nocase -- {\A(palette)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: printer + if {[regexp -start $index_ -indices -line -nocase -- {\A(printer)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: resolution + if {[regexp -start $index_ -indices -line -nocase -- {\A(resolution)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: rgb + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: cmyk + if {[regexp -start $index_ -indices -line -nocase -- {\A(cmyk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: gray + if {[regexp -start $index_ -indices -line -nocase -- {\A(gray)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: 72 + if {[regexp -start $index_ -indices -line -nocase -- {\A(72)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: screen + if {[regexp -start $index_ -indices -line -nocase -- {\A(screen)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: 96 + if {[regexp -start $index_ -indices -line -nocase -- {\A(96)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: 144 + if {[regexp -start $index_ -indices -line -nocase -- {\A(144)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: 150 + if {[regexp -start $index_ -indices -line -nocase -- {\A(150)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: 225 + if {[regexp -start $index_ -indices -line -nocase -- {\A(225)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: 300 + if {[regexp -start $index_ -indices -line -nocase -- {\A(300)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: 600 + if {[regexp -start $index_ -indices -line -nocase -- {\A(600)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: 1200 + if {[regexp -start $index_ -indices -line -nocase -- {\A(1200)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: 53 + if {[regexp -start $index_ -indices -line -nocase -- {\A(53)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: 75 + if {[regexp -start $index_ -indices -line -nocase -- {\A(75)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COLOR_ + } + 1 { +return $COMMAND_ + } + 2 { +return $DESTINATION_ + } + 3 { +return $FILE_ + } + 4 { +return $FILENAME_ + } + 5 { +return $INTERPOLATE_ + } + 6 { +return $LEVEL_ + } + 7 { +return $PALETTE_ + } + 8 { +return $PRINTER_ + } + 9 { +return $RESOLUTION_ + } + 10 { +return $RGB_ + } + 11 { +return $CMYK_ + } + 12 { +return $GRAY_ + } + 13 { +return $72_ + } + 14 { +return $SCREEN_ + } + 15 { +return $96_ + } + 16 { +return $144_ + } + 17 { +return $150_ + } + 18 { +return $225_ + } + 19 { +return $300_ + } + 20 { +return $600_ + } + 21 { +return $1200_ + } + 22 { +return $53_ + } + 23 { +return $75_ + } + 24 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 25 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 26 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 27 { +set yylval $yytext; return $STRING_ + } + 28 { +# ignore whitespace + } + 29 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/psparser.tab.tcl b/ds9/parsers/psparser.tab.tcl new file mode 100644 index 0000000..89b5e5d --- /dev/null +++ b/ds9/parsers/psparser.tab.tcl @@ -0,0 +1,25 @@ +set STRING_ 257 +set COLOR_ 258 +set COMMAND_ 259 +set DESTINATION_ 260 +set FILE_ 261 +set FILENAME_ 262 +set INTERPOLATE_ 263 +set LEVEL_ 264 +set PALETTE_ 265 +set PRINTER_ 266 +set RESOLUTION_ 267 +set RGB_ 268 +set CMYK_ 269 +set GRAY_ 270 +set 72_ 271 +set SCREEN_ 272 +set 96_ 273 +set 144_ 274 +set 150_ 275 +set 225_ 276 +set 300_ 277 +set 600_ 278 +set 1200_ 279 +set 53_ 280 +set 75_ 281 diff --git a/ds9/parsers/psparser.tcl b/ds9/parsers/psparser.tcl new file mode 100644 index 0000000..6bd5122 --- /dev/null +++ b/ds9/parsers/psparser.tcl @@ -0,0 +1,764 @@ +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 ps { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc ps::YYABORT {} { + return -code return 1 +} + +proc ps::YYACCEPT {} { + return -code return 0 +} + +proc ps::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc ps::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc ps::yyerror {s} { + puts stderr $s +} + +proc ps::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 ps::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set ps::table { + 17:257 reduce + 26:257,target 22 + 27:0 reduce + 26:257 reduce + 15:257,target 6 + 35:257 reduce + 24:0 reduce + 33:0,target 29 + 25:0,target 21 + 17:0,target 13 + 10:0,target 1 + 27:257,target 23 + 14:257 reduce + 21:0 reduce + 6:287 goto + 16:257,target 14 + 23:257 reduce + 3:261 shift + 17:0 reduce + 3:266 shift + 38:0 reduce + 32:257 reduce + 8:281,target 35 + 3:261,target 16 + 28:257,target 24 + 14:0 reduce + 29:0,target 25 + 30:0,target 26 + 22:0,target 20 + 11:257 reduce + 14:0,target 8 + 35:0 reduce + 17:257,target 13 + 3:285 goto + 8:278,target 32 + 0:257 reduce + 0:258 shift + 0:260 shift + 0:259 shift + 19:257 reduce + 20:257 reduce + 9:0 accept + 0:262 shift + 11:0 reduce + 0:263 shift + 0:264 shift + 0:265 shift + 32:0 reduce + 0:267 shift + 28:257 reduce + 8:276,target 30 + 1:268,target 11 + 29:257,target 25 + 30:257,target 26 + 0:264,target 6 + 6:1 shift + 37:257 shift + 6:2 shift + 6:3 shift + 8:271 shift + 18:257,target 5 + 28:0 reduce + 0:0,target 4 + 8:272 shift + 0:282 goto + 8:273 shift + 8:274 shift + 0:284 goto + 8:275 shift + 8:276 shift + 8:274,target 28 + 8:277 shift + 8:278 shift + 8:279 shift + 8:280 shift + 34:0,target 30 + 7:269,target 12 + 7:270,target 13 + 8:281 shift + 26:0,target 22 + 18:0,target 5 + 0:262,target 4 + 11:0,target 15 + 16:257 reduce + 25:0 reduce + 8:288 goto + 5:257 reduce + 25:257 reduce + 31:257,target 27 + 8:272,target 26 + 0:0 reduce + 10:283,target 37 + 0:259,target 2 + 0:260,target 3 + 19:257,target 7 + 20:257,target 18 + 22:0 reduce + 34:257 reduce + 7:286,target 24 + 6:3,target 22 + 0:257,target 4 + 18:0 reduce + 13:257 reduce + 8:288,target 36 + 38:0,target 3 + 32:257,target 28 + 31:0,target 27 + 2:257 shift + 23:0,target 9 + 15:0,target 6 + 6:1,target 20 + 22:257 reduce + 21:257,target 19 + 15:0 reduce + 36:0 reduce + 10:257,target 2 + 31:257 reduce + 3:266,target 17 + 12:0 reduce + 3:285,target 18 + 33:0 reduce + 10:257 reduce + 33:257,target 29 + 22:257,target 20 + 18:257 reduce + 35:0,target 31 + 11:257,target 15 + 29:0 reduce + 30:0 reduce + 27:0,target 23 + 19:0,target 7 + 20:0,target 18 + 12:0,target 16 + 27:257 reduce + 2:257,target 15 + 10:283 goto + 36:257 reduce + 7:268 shift + 7:269 shift + 7:270 shift + 26:0 reduce + 34:257,target 30 + 8:279,target 33 + 8:280,target 34 + 23:257,target 9 + 0:267,target 8 + 12:257,target 16 + 15:257 reduce + 23:0 reduce + 7:286 goto + 5:0,target 11 + 4:257 shift + 8:277,target 31 + 24:257 reduce + 1:270,target 13 + 1:269,target 12 + 0:265,target 7 + 32:0,target 28 + 35:257,target 31 + 24:0,target 12 + 16:0,target 14 + 19:0 reduce + 20:0 reduce + 33:257 reduce + 24:257,target 12 + 0:284,target 10 + 8:275,target 29 + 6:287,target 23 + 13:257,target 17 + 0:263,target 5 + 16:0 reduce + 12:257 reduce + 1:286,target 14 + 4:257,target 19 + 0:282,target 9 + 8:273,target 27 + 21:257 reduce + 36:257,target 10 + 7:268,target 11 + 9:0,target 0 + 13:0 reduce + 34:0 reduce + 25:257,target 21 + 1:268 shift + 29:257 reduce + 30:257 reduce + 1:270 shift + 1:269 shift + 36:0,target 10 + 8:271,target 25 + 28:0,target 24 + 14:257,target 8 + 21:0,target 19 + 13:0,target 17 + 10:0 reduce + 0:258,target 1 + 31:0 reduce + 5:257,target 11 + 1:286 goto + 37:257,target 38 + 6:2,target 21 + 5:0 reduce +} + +array set ps::rules { + 27,l 288 + 9,l 284 + 11,l 284 + 15,l 286 + 20,l 287 + 19,l 287 + 2,l 283 + 24,l 288 + 6,l 284 + 28,l 288 + 12,l 284 + 16,l 286 + 21,l 288 + 3,l 282 + 25,l 288 + 7,l 284 + 30,l 288 + 29,l 288 + 13,l 285 + 0,l 289 + 17,l 286 + 22,l 288 + 4,l 284 + 26,l 288 + 8,l 284 + 10,l 284 + 31,l 288 + 14,l 285 + 18,l 287 + 1,l 282 + 23,l 288 + 5,l 284 +} + +array set ps::rules { + 23,dc 1 + 5,dc 2 + 0,dc 1 + 17,dc 1 + 12,dc 2 + 26,dc 1 + 8,dc 2 + 21,dc 1 + 3,dc 3 + 15,dc 1 + 10,dc 2 + 30,dc 1 + 29,dc 1 + 24,dc 1 + 6,dc 2 + 18,dc 1 + 1,dc 1 + 13,dc 1 + 27,dc 1 + 9,dc 2 + 22,dc 1 + 4,dc 0 + 16,dc 1 + 11,dc 1 + 31,dc 1 + 25,dc 1 + 7,dc 2 + 20,dc 1 + 19,dc 1 + 2,dc 0 + 14,dc 1 + 28,dc 1 +} + +array set ps::rules { + 13,line 58 + 25,line 76 + 2,e 1 + 7,line 49 + 10,line 53 + 22,line 73 + 4,line 46 + 18,line 67 + 1,line 42 + 31,line 83 + 15,line 62 + 27,line 78 + 9,line 51 + 12,line 55 + 24,line 75 + 6,line 48 + 21,line 72 + 3,line 43 + 17,line 64 + 30,line 82 + 29,line 81 + 14,line 59 + 26,line 77 + 8,line 50 + 11,line 54 + 23,line 74 + 5,line 47 + 20,line 69 + 19,line 68 + 2,line 42 + 16,line 63 + 28,line 79 +} + +array set ps::lr1_table { + 35 {{31 {0 257} 1}} + 14,trans {} + 36 {{10 {0 257} 2}} + 33,trans {} + 37 {{3 0 2}} + 38 {{3 0 3}} + 18,trans {} + 1,trans {{268 11} {269 12} {270 13} {286 14}} + 37,trans {{257 38}} + 23,trans {} + 5,trans {} + 27,trans {} + 9,trans {} + 13,trans {} + 32,trans {} + 17,trans {} + 0,trans {{258 1} {259 2} {260 3} {262 4} {263 5} {264 6} {265 7} {267 8} {282 9} {284 10}} + 36,trans {} + 22,trans {} + 4,trans {{257 19}} + 26,trans {} + 8,trans {{271 25} {272 26} {273 27} {274 28} {275 29} {276 30} {277 31} {278 32} {279 33} {280 34} {281 35} {288 36}} + 12,trans {} + 31,trans {} + 16,trans {} + 35,trans {} + 21,trans {} + 3,trans {{261 16} {266 17} {285 18}} + 10 {{1 0 1} {3 0 1} {2 257 0}} + 11 {{15 {0 257} 1}} + 25,trans {} + 12 {{16 {0 257} 1}} + 7,trans {{268 11} {269 12} {270 13} {286 24}} + 13 {{17 {0 257} 1}} + 14 {{8 {0 257} 2}} + 11,trans {} + 15 {{6 {0 257} 2}} + 30,trans {} + 29,trans {} + 16 {{14 {0 257} 1}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0} {6 {0 257} 0} {7 {0 257} 0} {8 {0 257} 0} {9 {0 257} 0} {10 {0 257} 0} {11 {0 257} 0} {12 {0 257} 0}} + 17 {{13 {0 257} 1}} + 1 {{8 {0 257} 1} {15 {0 257} 0} {16 {0 257} 0} {17 {0 257} 0}} + 18 {{5 {0 257} 2}} + 15,trans {} + 2 {{6 {0 257} 1}} + 19 {{7 {0 257} 2}} + 20 {{18 {0 257} 1}} + 34,trans {} + 3 {{5 {0 257} 1} {13 {0 257} 0} {14 {0 257} 0}} + 21 {{19 {0 257} 1}} + 4 {{7 {0 257} 1}} + 22 {{20 {0 257} 1}} + 5 {{11 {0 257} 1}} + 23 {{9 {0 257} 2}} + 20,trans {} + 19,trans {} + 6 {{9 {0 257} 1} {18 {0 257} 0} {19 {0 257} 0} {20 {0 257} 0}} + 2,trans {{257 15}} + 24 {{12 {0 257} 2}} + 38,trans {} + 7 {{12 {0 257} 1} {15 {0 257} 0} {16 {0 257} 0} {17 {0 257} 0}} + 25 {{21 {0 257} 1}} + 8 {{10 {0 257} 1} {21 {0 257} 0} {22 {0 257} 0} {23 {0 257} 0} {24 {0 257} 0} {25 {0 257} 0} {26 {0 257} 0} {27 {0 257} 0} {28 {0 257} 0} {29 {0 257} 0} {30 {0 257} 0} {31 {0 257} 0}} + 26 {{22 {0 257} 1}} + 9 {{0 0 1}} + 27 {{23 {0 257} 1}} + 24,trans {} + 6,trans {{1 20} {2 21} {3 22} {287 23}} + 28 {{24 {0 257} 1}} + 29 {{25 {0 257} 1}} + 30 {{26 {0 257} 1}} + 31 {{27 {0 257} 1}} + 10,trans {{283 37}} + 32 {{28 {0 257} 1}} + 28,trans {} + 33 {{29 {0 257} 1}} + 34 {{30 {0 257} 1}} +} + +array set ps::token_id_table { + 286,t 1 + 286 color + 280,title 53 + 279,title 1200 + 264,line 17 + 1,t 0 + 287 level + 270,t 0 + 269,t 0 + 288 resolution + 289 start' + 276,line 31 + 265,title PALETTE + 284,title {} + 274,t 0 + 261,line 14 + 288,line 71 + 257,t 0 + 1,title {} + 270,title GRAY + 269,title CMYK + 288,title {} + 273,line 28 + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 57 + 274,title 144 + 1,line 66 + 283,t 1 + 270,line 24 + 269,line 23 + 259,title COMMAND + 260,title DESTINATION + 266,t 0 + 278,title 600 + 282,line 41 + 287,t 1 + 2,t 0 + error error + 271,t 0 + 264,title LEVEL + 266,line 19 + 283,title {} + 278,line 33 + error,line 40 + 275,t 0 + 268,title RGB + 287,title {} + 258,t 0 + 263,line 16 + error,title {} + 280,t 0 + 279,t 0 + 275,line 30 + 273,title 96 + 263,t 0 + 259,line 12 + 260,line 13 + 287,line 66 + 258,title COLOR + 284,t 1 + 277,title 300 + 3,line 68 + 272,line 27 + 267,t 0 + 263,title INTERPOLATE + 288,t 1 + 284,line 45 + 282,title {} + 3,t 0 + 272,t 0 + 268,line 22 + 267,title RESOLUTION + 286,title {} + 257 STRING_ + 281,line 37 + 276,t 0 + 258 COLOR_ + 259,t 0 + 259 COMMAND_ + 260 DESTINATION_ + 260,t 0 + 3,title {} + 272,title SCREEN + 261 FILE_ + 265,line 18 + 262 FILENAME_ + 281,t 0 + 263 INTERPOLATE_ + 277,line 32 + 257,title string + 264 LEVEL_ + 264,t 0 + 276,title 225 + 265 PALETTE_ + 262,line 15 + 266 PRINTER_ + 289,line 84 + 285,t 1 + 267 RESOLUTION_ + 0,t 0 + 0 {$} + 262,title FILENAME + 268 RGB_ + 268,t 0 + 1 1 + 281,title 75 + 274,line 29 + 270 GRAY_ + 269 CMYK_ + 2 2 + error,t 0 + 271 72_ + 289,t 1 + 3 3 + 272 SCREEN_ + 258,line 11 + 286,line 61 + 273,t 0 + 273 96_ + 266,title PRINTER + 285,title {} + 274 144_ + 2,line 67 + 275 150_ + 271,line 26 + 276 225_ + 2,title {} + 277,t 0 + 277 300_ + 271,title 72 + 289,title {} + 283,line 42 + 278 600_ + 261,t 0 + 280 53_ + 279 1200_ + 281 75_ + 267,line 20 + 282,t 1 + 282 command + 275,title 150 + 283 @PSEUDO1 + 265,t 0 + 284 ps + 280,line 36 + 279,line 34 + 285 dest + 261,title FILE +} + +proc ps::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { PostScript } + 5 { ProcessCmdSet ps dest $2 } + 6 { ProcessCmdSet ps cmd $2 } + 7 { ProcessCmdSet ps filename $2 } + 8 { ProcessCmdSet ps color $2 } + 9 { ProcessCmdSet ps level $2 } + 10 { ProcessCmdSet ps resolution $2 } + 12 { ProcessCmdSet ps color $2 } + 13 { set _ printer } + 14 { set _ file } + 15 { set _ rgb } + 16 { set _ cmyk } + 17 { set _ gray } + 18 { set _ 1 } + 19 { set _ 2 } + 20 { set _ 3 } + 21 { set _ 72 } + 22 { set _ Screen } + 23 { set _ 96 } + 24 { set _ 144 } + 25 { set _ 150 } + 26 { set _ 225 } + 27 { set _ 300 } + 28 { set _ 600 } + 29 { set _ 1200 } + 30 { set _ 53 } + 31 { set _ 75 } + } + 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 ps::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/pssendlex.tcl b/ds9/parsers/pssendlex.tcl new file mode 100644 index 0000000..5176987 --- /dev/null +++ b/ds9/parsers/pssendlex.tcl @@ -0,0 +1,322 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval pssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc pssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc pssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc pssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc pssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc pssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc pssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc pssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc pssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc pssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COLOR_ 257 +set COMMAND_ 258 +set DESTINATION_ 259 +set FILENAME_ 260 +set INTERPOLATE_ 261 +set LEVEL_ 262 +set RESOLUTION_ 263 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: command + if {[regexp -start $index_ -indices -line -nocase -- {\A(command)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: destination + if {[regexp -start $index_ -indices -line -nocase -- {\A(destination)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: interpolate + if {[regexp -start $index_ -indices -line -nocase -- {\A(interpolate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: level + if {[regexp -start $index_ -indices -line -nocase -- {\A(level)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: resolution + if {[regexp -start $index_ -indices -line -nocase -- {\A(resolution)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COLOR_ + } + 1 { +return $COMMAND_ + } + 2 { +return $DESTINATION_ + } + 3 { +return $FILENAME_ + } + 4 { +return $INTERPOLATE_ + } + 5 { +return $LEVEL_ + } + 6 { +return $RESOLUTION_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/pssendparser.tab.tcl b/ds9/parsers/pssendparser.tab.tcl new file mode 100644 index 0000000..d149eb9 --- /dev/null +++ b/ds9/parsers/pssendparser.tab.tcl @@ -0,0 +1,7 @@ +set COLOR_ 257 +set COMMAND_ 258 +set DESTINATION_ 259 +set FILENAME_ 260 +set INTERPOLATE_ 261 +set LEVEL_ 262 +set RESOLUTION_ 263 diff --git a/ds9/parsers/pssendparser.tcl b/ds9/parsers/pssendparser.tcl new file mode 100644 index 0000000..bcd5ac1 --- /dev/null +++ b/ds9/parsers/pssendparser.tcl @@ -0,0 +1,332 @@ +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 pssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc pssend::YYABORT {} { + return -code return 1 +} + +proc pssend::YYACCEPT {} { + return -code return 0 +} + +proc pssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc pssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc pssend::yyerror {s} { + puts stderr $s +} + +proc pssend::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 pssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set pssend::table { + 6:0 reduce + 3:0,target 1 + 0:257 shift + 7:0 reduce + 0:264,target 8 + 0:258 shift + 8:0 accept + 5:0,target 7 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 6 + 0:258,target 2 + 0:262 shift + 0:263 shift + 0:261,target 5 + 0:264 goto + 2:0,target 2 + 0:263,target 7 + 4:0,target 3 + 6:0,target 5 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 8:0,target 0 + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 4 + 5:0 reduce + 0:262,target 6 +} + +array set pssend::rules { + 0,l 265 + 1,l 264 + 2,l 264 + 3,l 264 + 4,l 264 + 5,l 264 + 6,l 264 + 7,l 264 +} + +array set pssend::rules { + 5,dc 1 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set pssend::rules { + 5,line 23 + 7,line 26 + 2,line 20 + 4,line 22 + 6,line 25 + 1,line 19 + 3,line 21 +} + +array set pssend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0}} + 1 {{4 0 1}} + 2 {{2 0 1}} + 3 {{1 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8}} + 5 {{7 0 1}} + 1,trans {} + 6 {{5 0 1}} + 2,trans {} + 3,trans {} + 7 {{6 0 1}} + 4,trans {} + 8 {{0 0 1}} + 5,trans {} + 6,trans {} + 7,trans {} + 8,trans {} +} + +array set pssend::token_id_table { + 264,line 18 + 0,t 0 + 0 {$} + 262,title LEVEL + 263,title RESOLUTION + 264,title {} + error,t 0 + error error + 265,title {} + 258,line 9 + 261,line 12 + error,line 17 + 257 COLOR_ + 257,t 0 + 263,line 14 + 258 COMMAND_ + 258,t 0 + error,title {} + 260,t 0 + 260 FILENAME_ + 259 DESTINATION_ + 259,t 0 + 265,line 27 + 261,t 0 + 261 INTERPOLATE_ + 262,t 0 + 262 LEVEL_ + 257,line 8 + 263,t 0 + 263 RESOLUTION_ + 264,t 1 + 264 pssend + 260,line 11 + 257,title COLOR + 259,line 10 + 265,t 1 + 265 start' + 258,title COMMAND + 262,line 13 + 260,title FILENAME + 259,title DESTINATION + 261,title INTERPOLATE +} + +proc pssend::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 { ProcessSendCmdGet ps dest } + 2 { ProcessSendCmdGet ps cmd } + 3 { ProcessSendCmdGet ps filename } + 4 { ProcessSendCmdGet ps color } + 5 { ProcessSendCmdGet ps level } + 6 { ProcessSendCmdGet ps resolution } + 7 { global ps; $parse(proc) $parse(id) "0\n" } + } + 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 pssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/regionlex.tcl b/ds9/parsers/regionlex.tcl new file mode 100644 index 0000000..a1087ef --- /dev/null +++ b/ds9/parsers/regionlex.tcl @@ -0,0 +1,1844 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval region { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc region::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc region::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc region::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc region::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc region::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc region::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc region::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc region::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc region::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set FK4_ 294 +set B1950_ 295 +set FK5_ 296 +set J2000_ 297 +set ICRS_ 298 +set GALACTIC_ 299 +set ECLIPTIC_ 300 +set DEGREES_ 301 +set SEXAGESIMAL_ 302 +set INT_ 303 +set REAL_ 304 +set STRING_ 305 +set ALL_ 306 +set AT_ 307 +set AUTO_ 308 +set AUTOCENTROID_ 309 +set BACK_ 310 +set BACKGROUND_ 311 +set CENTROID_ 312 +set CLOSE_ 313 +set COLOR_ 314 +set COMMAND_ 315 +set COMPOSITE_ 316 +set COPY_ 317 +set CUT_ 318 +set DELETE_ 319 +set DELETEALL_ 320 +set DELIM_ 321 +set DISSOLVE_ 322 +set EDIT_ 323 +set EPSILON_ 324 +set EXCLUDE_ 325 +set FILE_ 326 +set FIXED_ 327 +set FONT_ 328 +set FORMAT_ 329 +set FRONT_ 330 +set GETINFO_ 331 +set GROUP_ 332 +set GROUPS_ 333 +set INCLUDE_ 334 +set INVERT_ 335 +set ITERATION_ 336 +set LIST_ 337 +set LOAD_ 338 +set MOVE_ 339 +set MOVEBACK_ 340 +set MOVEFRONT_ 341 +set NEW_ 342 +set NL_ 343 +set NONE_ 344 +set PASTE_ 345 +set PROPERTY_ 346 +set RADIUS_ 347 +set ROTATE_ 348 +set SAVE_ 349 +set SAVETEMPLATE_ 350 +set SEGMENT_ 351 +set SELECT_ 352 +set SELECTALL_ 353 +set SELECTNONE_ 354 +set SHAPE_ 355 +set SHOW_ 356 +set SHOWTEXT_ 357 +set SKY_ 358 +set SKYFORMAT_ 359 +set SOURCE_ 360 +set STRIP_ 361 +set SYSTEM_ 362 +set TEMPLATE_ 363 +set UNDO_ 364 +set UPDATE_ 365 +set WIDTH_ 366 +set DS9_ 367 +set XML_ 368 +set CIAO_ 369 +set SAOTNG_ 370 +set PROS_ 371 +set SAOIMAGE_ 372 +set XY_ 373 +set CIRCLE_ 374 +set ELLIPSE_ 375 +set BOX_ 376 +set POLYGON_ 377 +set POINT_ 378 +set LINE_ 379 +set VECTOR_ 380 +set TEXT_ 381 +set RULER_ 382 +set COMPASS_ 383 +set PROJECTION_ 384 +set ANNULUS_ 385 +set ELLIPSEANNULUS_ 386 +set BOXANNULUS_ 387 +set PANDA_ 388 +set EPANDA_ 389 +set BPANDA_ 390 +set DIAMOND_ 391 +set CROSS_ 392 +set ARROW_ 393 +set BOXCIRCLE_ 394 +set MFORMAT_ 395 +set MSYSTEM_ 396 +set MSKY_ 397 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: all + if {[regexp -start $index_ -indices -line -nocase -- {\A(all)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: at + if {[regexp -start $index_ -indices -line -nocase -- {\A(at)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: auto + if {[regexp -start $index_ -indices -line -nocase -- {\A(auto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: autocentroid + if {[regexp -start $index_ -indices -line -nocase -- {\A(autocentroid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: back + if {[regexp -start $index_ -indices -line -nocase -- {\A(back)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: background + if {[regexp -start $index_ -indices -line -nocase -- {\A(background)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: centroid + if {[regexp -start $index_ -indices -line -nocase -- {\A(centroid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: command + if {[regexp -start $index_ -indices -line -nocase -- {\A(command)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: composite + if {[regexp -start $index_ -indices -line -nocase -- {\A(composite)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: copy + if {[regexp -start $index_ -indices -line -nocase -- {\A(copy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: cut + if {[regexp -start $index_ -indices -line -nocase -- {\A(cut)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: delete + if {[regexp -start $index_ -indices -line -nocase -- {\A(delete)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: deleteall + if {[regexp -start $index_ -indices -line -nocase -- {\A(deleteall)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: delim + if {[regexp -start $index_ -indices -line -nocase -- {\A(delim)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: dissolve + if {[regexp -start $index_ -indices -line -nocase -- {\A(dissolve)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: edit + if {[regexp -start $index_ -indices -line -nocase -- {\A(edit)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: epsilon + if {[regexp -start $index_ -indices -line -nocase -- {\A(epsilon)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: exclude + if {[regexp -start $index_ -indices -line -nocase -- {\A(exclude)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: file + if {[regexp -start $index_ -indices -line -nocase -- {\A(file)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: fixed + if {[regexp -start $index_ -indices -line -nocase -- {\A(fixed)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: font + if {[regexp -start $index_ -indices -line -nocase -- {\A(font)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: format + if {[regexp -start $index_ -indices -line -nocase -- {\A(format)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: front + if {[regexp -start $index_ -indices -line -nocase -- {\A(front)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: getinfo + if {[regexp -start $index_ -indices -line -nocase -- {\A(getinfo)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: group + if {[regexp -start $index_ -indices -line -nocase -- {\A(group)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: groups + if {[regexp -start $index_ -indices -line -nocase -- {\A(groups)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: include + if {[regexp -start $index_ -indices -line -nocase -- {\A(include)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: invert + if {[regexp -start $index_ -indices -line -nocase -- {\A(invert)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: iteration + if {[regexp -start $index_ -indices -line -nocase -- {\A(iteration)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: list + if {[regexp -start $index_ -indices -line -nocase -- {\A(list)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: load + if {[regexp -start $index_ -indices -line -nocase -- {\A(load)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: move + if {[regexp -start $index_ -indices -line -nocase -- {\A(move)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: moveback + if {[regexp -start $index_ -indices -line -nocase -- {\A(moveback)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: movefront + if {[regexp -start $index_ -indices -line -nocase -- {\A(movefront)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: nl + if {[regexp -start $index_ -indices -line -nocase -- {\A(nl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: paste + if {[regexp -start $index_ -indices -line -nocase -- {\A(paste)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: property + if {[regexp -start $index_ -indices -line -nocase -- {\A(property)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: radius + if {[regexp -start $index_ -indices -line -nocase -- {\A(radius)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: rotate + if {[regexp -start $index_ -indices -line -nocase -- {\A(rotate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: savetemplate + if {[regexp -start $index_ -indices -line -nocase -- {\A(savetemplate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: segment + if {[regexp -start $index_ -indices -line -nocase -- {\A(segment)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: select + if {[regexp -start $index_ -indices -line -nocase -- {\A(select)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: selectall + if {[regexp -start $index_ -indices -line -nocase -- {\A(selectall)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: selectnone + if {[regexp -start $index_ -indices -line -nocase -- {\A(selectnone)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: shape + if {[regexp -start $index_ -indices -line -nocase -- {\A(shape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: show + if {[regexp -start $index_ -indices -line -nocase -- {\A(show)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: showtext + if {[regexp -start $index_ -indices -line -nocase -- {\A(showtext)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: source + if {[regexp -start $index_ -indices -line -nocase -- {\A(source)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: strip + if {[regexp -start $index_ -indices -line -nocase -- {\A(strip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: template + if {[regexp -start $index_ -indices -line -nocase -- {\A(template)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: undo + if {[regexp -start $index_ -indices -line -nocase -- {\A(undo)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: ds9 + if {[regexp -start $index_ -indices -line -nocase -- {\A(ds9)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: xml + if {[regexp -start $index_ -indices -line -nocase -- {\A(xml)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: ciao + if {[regexp -start $index_ -indices -line -nocase -- {\A(ciao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: saotng + if {[regexp -start $index_ -indices -line -nocase -- {\A(saotng)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: pros + if {[regexp -start $index_ -indices -line -nocase -- {\A(pros)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: saoimage + if {[regexp -start $index_ -indices -line -nocase -- {\A(saoimage)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: xy + if {[regexp -start $index_ -indices -line -nocase -- {\A(xy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: circle + if {[regexp -start $index_ -indices -line -nocase -- {\A(circle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: ellipse + if {[regexp -start $index_ -indices -line -nocase -- {\A(ellipse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: box + if {[regexp -start $index_ -indices -line -nocase -- {\A(box)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: polygon + if {[regexp -start $index_ -indices -line -nocase -- {\A(polygon)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: point + if {[regexp -start $index_ -indices -line -nocase -- {\A(point)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: line + if {[regexp -start $index_ -indices -line -nocase -- {\A(line)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: vector + if {[regexp -start $index_ -indices -line -nocase -- {\A(vector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: text + if {[regexp -start $index_ -indices -line -nocase -- {\A(text)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: ruler + if {[regexp -start $index_ -indices -line -nocase -- {\A(ruler)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: compass + if {[regexp -start $index_ -indices -line -nocase -- {\A(compass)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: projection + if {[regexp -start $index_ -indices -line -nocase -- {\A(projection)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: annulus + if {[regexp -start $index_ -indices -line -nocase -- {\A(annulus)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + # rule 80: ellipseannulus + if {[regexp -start $index_ -indices -line -nocase -- {\A(ellipseannulus)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 80 + } + # rule 81: boxannulus + if {[regexp -start $index_ -indices -line -nocase -- {\A(boxannulus)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 81 + } + # rule 82: panda + if {[regexp -start $index_ -indices -line -nocase -- {\A(panda)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 82 + } + # rule 83: epanda + if {[regexp -start $index_ -indices -line -nocase -- {\A(epanda)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 83 + } + # rule 84: bpanda + if {[regexp -start $index_ -indices -line -nocase -- {\A(bpanda)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 84 + } + # rule 85: composite + if {[regexp -start $index_ -indices -line -nocase -- {\A(composite)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 85 + } + # rule 86: diamond + if {[regexp -start $index_ -indices -line -nocase -- {\A(diamond)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 86 + } + # rule 87: cross + if {[regexp -start $index_ -indices -line -nocase -- {\A(cross)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 87 + } + # rule 88: arrow + if {[regexp -start $index_ -indices -line -nocase -- {\A(arrow)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 88 + } + # rule 89: boxcircle + if {[regexp -start $index_ -indices -line -nocase -- {\A(boxcircle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 89 + } + # rule 90: -format + if {[regexp -start $index_ -indices -line -nocase -- {\A(-format)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 90 + } + # rule 91: -system + if {[regexp -start $index_ -indices -line -nocase -- {\A(-system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 91 + } + # rule 92: -sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(-sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 92 + } + # rule 93: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 93 + } + # rule 94: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 94 + } + # rule 95: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 95 + } + # rule 96: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 96 + } + # rule 97: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 97 + } + # rule 98: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 98 + } + # rule 99: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 99 + } + # rule 100: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 100 + } + # rule 101: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 101 + } + # rule 102: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 102 + } + # rule 103: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 103 + } + # rule 104: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 104 + } + # rule 105: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 105 + } + # rule 106: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 106 + } + # rule 107: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 107 + } + # rule 108: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 108 + } + # rule 109: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 109 + } + # rule 110: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 110 + } + # rule 111: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 111 + } + # rule 112: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 112 + } + # rule 113: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 113 + } + # rule 114: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 114 + } + # rule 115: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 115 + } + # rule 116: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 116 + } + # rule 117: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 117 + } + # rule 118: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 118 + } + # rule 119: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 119 + } + # rule 120: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 120 + } + # rule 121: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 121 + } + # rule 122: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 122 + } + # rule 123: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 123 + } + # rule 124: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 124 + } + # rule 125: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 125 + } + # rule 126: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 126 + } + # rule 127: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 127 + } + # rule 128: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 128 + } + # rule 129: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 129 + } + # rule 130: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 130 + } + # rule 131: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 131 + } + # rule 132: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 132 + } + # rule 133: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 133 + } + # rule 134: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 134 + } + # rule 135: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 135 + } + # rule 136: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 136 + } + # rule 137: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 137 + } + # rule 138: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 138 + } + # rule 139: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 139 + } + # rule 140: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 140 + } + # rule 141: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 141 + } + # rule 142: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 142 + } + # rule 143: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 143 + } + # rule 144: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 144 + } + # rule 145: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 145 + } + # rule 146: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 146 + } + # rule 147: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 147 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ALL_ + } + 1 { +return $AT_ + } + 2 { +return $AUTO_ + } + 3 { +return $AUTOCENTROID_ + } + 4 { +return $BACK_ + } + 5 { +return $BACKGROUND_ + } + 6 { +return $CENTROID_ + } + 7 { +return $CLOSE_ + } + 8 { +return $COLOR_ + } + 9 { +return $COMMAND_ + } + 10 { +return $COMPOSITE_ + } + 11 { +return $COPY_ + } + 12 { +return $CUT_ + } + 13 { +return $DELETE_ + } + 14 { +return $DELETEALL_ + } + 15 { +return $DELIM_ + } + 16 { +return $DISSOLVE_ + } + 17 { +return $EDIT_ + } + 18 { +return $EPSILON_ + } + 19 { +return $EXCLUDE_ + } + 20 { +return $FILE_ + } + 21 { +return $FIXED_ + } + 22 { +return $FONT_ + } + 23 { +return $FORMAT_ + } + 24 { +return $FRONT_ + } + 25 { +return $GETINFO_ + } + 26 { +return $GROUP_ + } + 27 { +return $GROUPS_ + } + 28 { +return $INCLUDE_ + } + 29 { +return $INVERT_ + } + 30 { +return $ITERATION_ + } + 31 { +return $LIST_ + } + 32 { +return $LOAD_ + } + 33 { +return $MOVE_ + } + 34 { +return $MOVEBACK_ + } + 35 { +return $MOVEFRONT_ + } + 36 { +return $NEW_ + } + 37 { +return $NL_ + } + 38 { +return $NONE_ + } + 39 { +return $PASTE_ + } + 40 { +return $PROPERTY_ + } + 41 { +return $RADIUS_ + } + 42 { +return $ROTATE_ + } + 43 { +return $SAVE_ + } + 44 { +return $SAVETEMPLATE_ + } + 45 { +return $SEGMENT_ + } + 46 { +return $SELECT_ + } + 47 { +return $SELECTALL_ + } + 48 { +return $SELECTNONE_ + } + 49 { +return $SHAPE_ + } + 50 { +return $SHOW_ + } + 51 { +return $SHOWTEXT_ + } + 52 { +return $SKY_ + } + 53 { +return $SKYFORMAT_ + } + 54 { +return $SOURCE_ + } + 55 { +return $STRIP_ + } + 56 { +return $SYSTEM_ + } + 57 { +return $TEMPLATE_ + } + 58 { +return $UNDO_ + } + 59 { +return $UPDATE_ + } + 60 { +return $WIDTH_ + } + 61 { +return $DS9_ + } + 62 { +return $XML_ + } + 63 { +return $CIAO_ + } + 64 { +return $SAOTNG_ + } + 65 { +return $PROS_ + } + 66 { +return $SAOIMAGE_ + } + 67 { +return $XY_ + } + 68 { +return $CIRCLE_ + } + 69 { +return $ELLIPSE_ + } + 70 { +return $BOX_ + } + 71 { +return $POLYGON_ + } + 72 { +return $POINT_ + } + 73 { +return $LINE_ + } + 74 { +return $VECTOR_ + } + 75 { +return $TEXT_ + } + 76 { +return $RULER_ + } + 77 { +return $COMPASS_ + } + 78 { +return $PROJECTION_ + } + 79 { +return $ANNULUS_ + } + 80 { +return $ELLIPSEANNULUS_ + } + 81 { +return $BOXANNULUS_ + } + 82 { +return $PANDA_ + } + 83 { +return $EPANDA_ + } + 84 { +return $BPANDA_ + } + 85 { +return $COMPOSITE_ + } + 86 { +return $DIAMOND_ + } + 87 { +return $CROSS_ + } + 88 { +return $ARROW_ + } + 89 { +return $BOXCIRCLE_ + } + 90 { +return $MFORMAT_ + } + 91 { +return $MSYSTEM_ + } + 92 { +return $MSKY_ + } + 93 { +return $YES_ + } + 94 { +return $NO_ + } + 95 { +return $ON_ + } + 96 { +return $OFF_ + } + 97 { +return $TRUE_ + } + 98 { +return $FALSE_ + } + 99 { +return $IMAGE_ + } + 100 { +return $PHYSICAL_ + } + 101 { +return $AMPLIFIER_ + } + 102 { +return $DETECTOR_ + } + 103 { +return $WCS_ + } + 104 { +return $WCSA_ + } + 105 { +return $WCSB_ + } + 106 { +return $WCSC_ + } + 107 { +return $WCSD_ + } + 108 { +return $WCSE_ + } + 109 { +return $WCSF_ + } + 110 { +return $WCSG_ + } + 111 { +return $WCSH_ + } + 112 { +return $WCSI_ + } + 113 { +return $WCSJ_ + } + 114 { +return $WCSK_ + } + 115 { +return $WCSL_ + } + 116 { +return $WCSM_ + } + 117 { +return $WCSN_ + } + 118 { +return $WCSO_ + } + 119 { +return $WCSP_ + } + 120 { +return $WCSQ_ + } + 121 { +return $WCSR_ + } + 122 { +return $WCSS_ + } + 123 { +return $WCST_ + } + 124 { +return $WCSU_ + } + 125 { +return $WCSV_ + } + 126 { +return $WCSW_ + } + 127 { +return $WCSX_ + } + 128 { +return $WCSY_ + } + 129 { +return $WCSZ_ + } + 130 { +return $FK4_ + } + 131 { +return $FK4_ + } + 132 { +return $FK5_ + } + 133 { +return $FK5_ + } + 134 { +return $ICRS_ + } + 135 { +return $GALACTIC_ + } + 136 { +return $ECLIPTIC_ + } + 137 { +return $DEGREES_ + } + 138 { +return $SEXAGESIMAL_ + } + 139 { +set yylval $yytext; return $INT_ + } + 140 - + 141 { +set yylval $yytext; return $REAL_ + } + 142 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 143 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 144 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 145 { +set yylval $yytext; return $STRING_ + } + 146 { +# ignore whitespace + } + 147 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/regionparser.tab.tcl b/ds9/parsers/regionparser.tab.tcl new file mode 100644 index 0000000..569ffc7 --- /dev/null +++ b/ds9/parsers/regionparser.tab.tcl @@ -0,0 +1,141 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set FK4_ 294 +set B1950_ 295 +set FK5_ 296 +set J2000_ 297 +set ICRS_ 298 +set GALACTIC_ 299 +set ECLIPTIC_ 300 +set DEGREES_ 301 +set SEXAGESIMAL_ 302 +set INT_ 303 +set REAL_ 304 +set STRING_ 305 +set ALL_ 306 +set AT_ 307 +set AUTO_ 308 +set AUTOCENTROID_ 309 +set BACK_ 310 +set BACKGROUND_ 311 +set CENTROID_ 312 +set CLOSE_ 313 +set COLOR_ 314 +set COMMAND_ 315 +set COMPOSITE_ 316 +set COPY_ 317 +set CUT_ 318 +set DELETE_ 319 +set DELETEALL_ 320 +set DELIM_ 321 +set DISSOLVE_ 322 +set EDIT_ 323 +set EPSILON_ 324 +set EXCLUDE_ 325 +set FILE_ 326 +set FIXED_ 327 +set FONT_ 328 +set FORMAT_ 329 +set FRONT_ 330 +set GETINFO_ 331 +set GROUP_ 332 +set GROUPS_ 333 +set INCLUDE_ 334 +set INVERT_ 335 +set ITERATION_ 336 +set LIST_ 337 +set LOAD_ 338 +set MOVE_ 339 +set MOVEBACK_ 340 +set MOVEFRONT_ 341 +set NEW_ 342 +set NL_ 343 +set NONE_ 344 +set PASTE_ 345 +set PROPERTY_ 346 +set RADIUS_ 347 +set ROTATE_ 348 +set SAVE_ 349 +set SAVETEMPLATE_ 350 +set SEGMENT_ 351 +set SELECT_ 352 +set SELECTALL_ 353 +set SELECTNONE_ 354 +set SHAPE_ 355 +set SHOW_ 356 +set SHOWTEXT_ 357 +set SKY_ 358 +set SKYFORMAT_ 359 +set SOURCE_ 360 +set STRIP_ 361 +set SYSTEM_ 362 +set TEMPLATE_ 363 +set UNDO_ 364 +set UPDATE_ 365 +set WIDTH_ 366 +set DS9_ 367 +set XML_ 368 +set CIAO_ 369 +set SAOTNG_ 370 +set PROS_ 371 +set SAOIMAGE_ 372 +set XY_ 373 +set CIRCLE_ 374 +set ELLIPSE_ 375 +set BOX_ 376 +set POLYGON_ 377 +set POINT_ 378 +set LINE_ 379 +set VECTOR_ 380 +set TEXT_ 381 +set RULER_ 382 +set COMPASS_ 383 +set PROJECTION_ 384 +set ANNULUS_ 385 +set ELLIPSEANNULUS_ 386 +set BOXANNULUS_ 387 +set PANDA_ 388 +set EPANDA_ 389 +set BPANDA_ 390 +set DIAMOND_ 391 +set CROSS_ 392 +set ARROW_ 393 +set BOXCIRCLE_ 394 +set MFORMAT_ 395 +set MSYSTEM_ 396 +set MSKY_ 397 diff --git a/ds9/parsers/regionparser.tcl b/ds9/parsers/regionparser.tcl new file mode 100644 index 0000000..94f8345 --- /dev/null +++ b/ds9/parsers/regionparser.tcl @@ -0,0 +1,4909 @@ +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 region { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc region::YYABORT {} { + return -code return 1 +} + +proc region::YYACCEPT {} { + return -code return 0 +} + +proc region::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc region::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc region::yyerror {s} { + puts stderr $s +} + +proc region::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 region::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set region::table { + 80:397,target 131 + 51:305 reduce + 102:296,target 12 + 0:327,target 18 + 122:0,target 32 + 4:336 shift + 39:401 goto + 40:402 goto + 21:305 shift + 43:296,target 131 + 133:396,target 43 + 114:298,target 24 + 29:268,target 103 + 231:293,target 128 + 135:0 reduce + 95:0,target 124 + 9:305 reduce + 231:400 goto + 142:305,target 125 + 112:300,target 22 + 91:0 reduce + 4:347 shift + 231:401 goto + 187:305,target 111 + 212:305 reduce + 10:398 goto + 37:305,target 1 + 127:395,target 37 + 108:297,target 18 + 83:305,target 134 + 177:0 reduce + 88:365,target 174 + 49:297,target 132 + 10:414 goto + 121:299,target 31 + 230:0 reduce + 229:0 reduce + 227:258,target 191 + 142:305 reduce + 112:300 reduce + 81:397,target 132 + 103:296,target 13 + 36:381,target 157 + 222:0,target 192 + 48:272,target 107 + 112:294 reduce + 195:280,target 48 + 195:279,target 48 + 112:305 reduce + 112:295 reduce + 181:0,target 77 + 134:396,target 44 + 115:298,target 25 + 112:296 reduce + 29:285,target 120 + 131:395 reduce + 112:297 reduce + 86:305 reduce + 222:257,target 192 + 131:396 reduce + 112:298 reduce + 131:397 reduce + 112:299 reduce + 107:0 reduce + 150:0,target 145 + 149:0,target 156 + 62:257,target 55 + 143:305,target 201 + 113:300,target 23 + 101:395 reduce + 56:305 reduce + 188:305,target 112 + 101:396 reduce + 2:258,target 56 + 21:342 shift + 43:271,target 106 + 118:0,target 28 + 101:397 reduce + 42:398,target 179 + 150:0 reduce + 149:0 reduce + 62:257 shift + 38:305,target 1 + 128:395,target 38 + 110:297,target 20 + 109:297,target 19 + 84:305,target 135 + 62:258 shift + 231:267,target 102 + 62:260 shift + 62:259 shift + 62:261 shift + 62:262 shift + 4:336,target 63 + 202:0 reduce + 192:0 reduce + 122:299,target 32 + 26:310 shift + 186:397,target 110 + 0:361,target 42 + 228:258,target 188 + 92:0,target 118 + 82:397,target 133 + 104:296,target 14 + 48:288,target 123 + 217:305 reduce + 88:340,target 174 + 88:339,target 174 + 61:0,target 65 + 195:296,target 48 + 48:399,target 187 + 223:257 reduce + 196:280,target 49 + 196:279,target 49 + 223:258 reduce + 135:396,target 45 + 116:298,target 26 + 29:0,target 98 + 30:0,target 1 + 223:260 reduce + 223:259 reduce + 177:305 reduce + 0:318,target 9 + 223:261 reduce + 223:257,target 189 + 35:0 reduce + 223:262 reduce + 4:411 goto + 43:287,target 122 + 144:305,target 127 + 117:300 reduce + 114:300,target 24 + 218:403,target 231 + 200:305,target 57 + 190:305,target 114 + 189:305,target 113 + 122:0 reduce + 199:341,target 212 + 26:330 shift + 30:259,target 57 + 30:260,target 58 + 231:284,target 119 + 39:295,target 130 + 130:395,target 40 + 129:395,target 39 + 117:294 reduce + 111:297,target 21 + 85:305,target 136 + 117:305 reduce + 117:295 reduce + 9:0 reduce + 177:0,target 47 + 117:296 reduce + 164:0 reduce + 117:297 reduce + 92:305 reduce + 42:262,target 60 + 117:298 reduce + 123:299,target 33 + 117:299 reduce + 187:397,target 111 + 146:0,target 70 + 230:258,target 56 + 229:258,target 195 + 106:395 reduce + 62:305 reduce + 216:0 reduce + 106:396 reduce + 83:397,target 134 + 115:0,target 25 + 106:397 reduce + 105:296,target 15 + 81:395 reduce + 81:396 reduce + 196:296,target 49 + 81:397 reduce + 32:305 shift + 117:298,target 27 + 51:405 goto + 37:257 shift + 224:257,target 193 + 37:258 shift + 18:257,target 55 + 37:259 shift + 37:260 shift + 48:263,target 98 + 88:314,target 174 + 37:261 shift + 195:271,target 48 + 172:378 shift + 100:305,target 10 + 37:262 shift + 145:305,target 126 + 115:300,target 25 + 50:0 accept + 29:276,target 111 + 201:305,target 128 + 191:305,target 204 + 57:0,target 3 + 41:305,target 92 + 131:395,target 41 + 112:297,target 22 + 86:305,target 137 + 228:257 reduce + 136:0 reduce + 228:258 reduce + 92:0 reduce + 0:404,target 50 + 228:260 reduce + 228:259 reduce + 183:305 reduce + 228:261 reduce + 228:262 reduce + 183:307 shift + 124:299,target 34 + 188:397,target 112 + 178:0 reduce + 153:305 reduce + 123:300 reduce + 21:420 goto + 84:397,target 135 + 215:0,target 179 + 106:296,target 16 + 123:294 reduce + 0:352,target 33 + 231:0 reduce + 123:305 reduce + 123:295 reduce + 37:261,target 59 + 174:0,target 63 + 123:296 reduce + 36:388,target 164 + 123:297 reduce + 118:298,target 28 + 97:305 reduce + 123:298 reduce + 48:279,target 114 + 48:280,target 115 + 225:257,target 194 + 123:299 reduce + 195:287,target 48 + 29:293,target 128 + 48:401,target 189 + 196:271,target 49 + 112:395 reduce + 101:305,target 11 + 67:305 reduce + 146:305,target 70 + 116:300,target 26 + 112:396 reduce + 19:368,target 81 + 202:305,target 147 + 192:305,target 108 + 112:397 reduce + 112:0,target 22 + 86:395 reduce + 0:309,target 2 + 86:396 reduce + 108:0 reduce + 86:397 reduce + 42:305,target 1 + 132:395,target 42 + 113:297,target 23 + 87:305,target 75 + 37:305 reduce + 43:278,target 113 + 43:400,target 181 + 231:275,target 110 + 151:0 reduce + 125:299,target 35 + 190:397,target 114 + 189:397,target 113 + 85:0,target 136 + 43:263 shift + 85:397,target 136 + 43:264 shift + 107:296,target 17 + 54:0,target 56 + 43:265 shift + 193:0 reduce + 43:266 shift + 147:378 reduce + 43:267 shift + 26:412 goto + 38:261,target 59 + 43:268 shift + 2:257 shift + 23:0,target 90 + 43:269 shift + 43:270 shift + 48:296,target 131 + 188:305 reduce + 120:298,target 30 + 119:298,target 29 + 2:258 shift + 43:271 shift + 2:260 shift + 2:259 shift + 43:272 shift + 226:257,target 190 + 2:261 shift + 43:273 shift + 196:287,target 49 + 2:262 shift + 43:274 shift + 80:396,target 131 + 49:401,target 190 + 43:275 shift + 158:305 reduce + 128:300 reduce + 102:305,target 12 + 102:295,target 12 + 0:326,target 17 + 43:276 shift + 117:300,target 27 + 43:277 shift + 212:0,target 185 + 193:305,target 120 + 43:278 shift + 43:279 shift + 43:280 shift + 128:294 reduce + 43:281 shift + 43:295,target 130 + 133:395,target 43 + 128:305 reduce + 128:295 reduce + 114:297,target 24 + 43:282 shift + 171:0,target 83 + 128:296 reduce + 43:283 shift + 128:297 reduce + 29:267,target 102 + 43:284 shift + 231:292,target 127 + 128:298 reduce + 123:0 reduce + 43:285 shift + 128:299 reduce + 100:397,target 10 + 43:286 shift + 140:0,target 59 + 139:0,target 88 + 126:299,target 36 + 43:287 shift + 43:288 shift + 117:395 reduce + 73:305 reduce + 43:289 shift + 43:290 shift + 43:300 shift + 117:396 reduce + 43:291 shift + 165:0 reduce + 117:397 reduce + 108:0,target 18 + 86:397,target 137 + 43:292 shift + 108:296,target 18 + 43:293 shift + 43:294 shift + 43:295 shift + 43:296 shift + 49:296,target 131 + 43:297 shift + 217:0 reduce + 121:298,target 31 + 43:298 shift + 8:0,target 96 + 43:299 shift + 234:300 shift + 227:257,target 191 + 62:398 goto + 13:305 reduce + 82:0,target 133 + 81:396,target 132 + 103:305,target 13 + 103:295,target 13 + 18:257 shift + 36:379,target 155 + 36:380,target 156 + 48:263 shift + 234:294 shift + 118:300,target 28 + 18:258 shift + 48:264 shift + 234:295 shift + 234:305 reduce + 194:305,target 122 + 51:0,target 50 + 18:259 shift + 18:260 shift + 48:265 shift + 48:271,target 106 + 234:296 shift + 2:305 reduce + 18:261 shift + 48:266 shift + 234:297 shift + 195:278,target 48 + 153:378 reduce + 18:262 shift + 44:305,target 183 + 48:267 shift + 234:298 shift + 199:365,target 216 + 134:395,target 44 + 115:297,target 25 + 90:305,target 95 + 89:305,target 173 + 29:284,target 119 + 48:268 shift + 234:299 shift + 20:0,target 66 + 48:269 shift + 48:270 shift + 194:305 reduce + 51:0 reduce + 48:271 shift + 48:272 shift + 101:397,target 11 + 48:273 shift + 127:299,target 37 + 48:274 shift + 192:397,target 108 + 48:275 shift + 164:305 reduce + 137:0 reduce + 2:257,target 55 + 43:269,target 104 + 43:270,target 105 + 48:276 shift + 93:0 reduce + 48:277 shift + 208:0,target 178 + 198:0,target 58 + 48:278 shift + 110:296,target 20 + 109:296,target 19 + 48:279 shift + 48:280 shift + 48:281 shift + 134:305 reduce + 104:300 reduce + 48:282 shift + 180:0 reduce + 179:0 reduce + 36:X shift + 48:283 shift + 48:284 shift + 122:298,target 32 + 48:285 shift + 186:396,target 110 + 104:294 reduce + 0:360,target 41 + 0:359,target 40 + 48:286 shift + 228:257,target 188 + 136:0,target 99 + 104:305 reduce + 104:295 reduce + 48:287 shift + 104:296 reduce + 48:288 shift + 232:0 reduce + 123:395 reduce + 104:297 reduce + 82:396,target 133 + 78:305 shift + 48:300 shift + 48:289 shift + 48:290 shift + 123:396 reduce + 104:305,target 14 + 104:298 reduce + 104:295,target 14 + 48:287,target 122 + 48:291 shift + 150:305,target 145 + 149:305,target 156 + 123:397 reduce + 120:300,target 30 + 119:300,target 29 + 105:0,target 15 + 104:299 reduce + 48:292 shift + 205:305,target 219 + 195:305,target 48 + 195:295,target 48 + 48:293 shift + 48:294 shift + 196:278,target 49 + 64:403,target 197 + 45:305,target 102 + 48:295 shift + 135:395,target 45 + 116:297,target 26 + 91:305,target 94 + 23:0 reduce + 48:296 shift + 0:317,target 8 + 48:297 shift + 48:298 shift + 48:299 shift + 102:397,target 12 + 18:305 reduce + 128:299,target 38 + 110:0 reduce + 109:0 reduce + 43:286,target 121 + 65:0 reduce + 12:418,target 74 + 47:373,target 86 + 199:340,target 211 + 199:339,target 210 + 30:258,target 56 + 231:283,target 118 + 37:398 goto + 39:294,target 129 + 111:296,target 21 + 7:305 reduce + 152:0 reduce + 210:303 shift + 16:0,target 91 + 42:261,target 59 + 209:305 shift + 123:298,target 33 + 187:396,target 111 + 236:0,target 172 + 230:257,target 55 + 229:257,target 195 + 204:0 reduce + 194:0 reduce + 83:396,target 134 + 105:305,target 15 + 105:295,target 15 + 36:x shift + 195:0,target 48 + 188:395 reduce + 151:305,target 138 + 121:300,target 31 + 206:305,target 181 + 199:314 shift + 196:305,target 49 + 196:295,target 49 + 188:396 reduce + 188:397 reduce + 140:305 reduce + 139:305 reduce + 110:300 reduce + 109:300 reduce + 0:334,target 23 + 199:317 shift + 164:0,target 153 + 117:297,target 27 + 92:305,target 118 + 199:318 shift + 199:319 shift + 110:294 reduce + 109:294 reduce + 133:0,target 43 + 110:305 reduce + 110:295 reduce + 109:305 reduce + 109:295 reduce + 103:397,target 13 + 37:0 reduce + 195:270,target 48 + 195:269,target 48 + 110:296 reduce + 109:296 reduce + 128:395 reduce + 110:297 reduce + 109:297 reduce + 84:305 reduce + 29:275,target 110 + 231:299,target 134 + 128:396 reduce + 110:298 reduce + 109:298 reduce + 128:397 reduce + 110:299 reduce + 109:299 reduce + 102:0,target 12 + 124:0 reduce + 199:328 shift + 112:296,target 22 + 80:0 reduce + 79:0 reduce + 54:305 reduce + 43:400 goto + 43:401 goto + 166:0 reduce + 124:298,target 34 + 2:0,target 1 + 199:314,target 205 + 188:396,target 112 + 24:305 reduce + 75:0,target 87 + 84:396,target 135 + 30:257 shift + 199:340 shift + 199:339 shift + 106:305,target 16 + 106:295,target 16 + 30:258 shift + 199:341 shift + 152:305,target 139 + 122:300,target 32 + 30:259 shift + 30:260 shift + 207:305,target 182 + 199:342 shift + 197:305,target 121 + 30:261 shift + 43:399 goto + 24:313 shift + 30:262 shift + 37:259,target 57 + 37:260,target 58 + 234:401 goto + 29:263 shift + 36:387,target 163 + 118:297,target 28 + 93:305,target 60 + 13:0,target 104 + 29:264 shift + 215:305 reduce + 199:346 shift + 29:265 shift + 48:278,target 113 + 214:348,target 227 + 10:0 reduce + 29:266 shift + 195:286,target 48 + 29:267 shift + 233:0,target 187 + 104:397,target 14 + 29:268 shift + 29:292,target 127 + 48:400,target 188 + 196:270,target 49 + 196:269,target 49 + 29:269 shift + 29:270 shift + 199:352 shift + 175:305 reduce + 19:367,target 80 + 29:271 shift + 2:398 goto + 29:272 shift + 202:0,target 147 + 192:0,target 108 + 52:0 reduce + 26:310,target 95 + 29:273 shift + 29:274 shift + 113:296,target 23 + 29:275 shift + 145:305 reduce + 115:300 reduce + 29:276 shift + 43:277,target 112 + 161:0,target 150 + 29:277 shift + 138:0 reduce + 29:278 shift + 29:279 shift + 29:280 shift + 231:274,target 109 + 125:298,target 35 + 115:294 reduce + 29:281 shift + 190:396,target 114 + 189:396,target 113 + 130:0,target 40 + 129:0,target 39 + 115:305 reduce + 115:295 reduce + 29:282 shift + 115:296 reduce + 29:283 shift + 199:365 shift + 134:395 reduce + 115:297 reduce + 90:305 reduce + 89:305 reduce + 29:284 shift + 181:0 reduce + 134:396 reduce + 115:298 reduce + 85:396,target 136 + 29:285 shift + 134:397 reduce + 115:299 reduce + 107:305,target 17 + 107:295,target 17 + 29:286 shift + 153:305,target 140 + 123:300,target 33 + 21:420,target 90 + 29:287 shift + 208:305,target 178 + 198:305,target 58 + 29:288 shift + 104:395 reduce + 60:305 reduce + 59:305 reduce + 52:408,target 192 + 29:289 shift + 29:290 shift + 29:300 shift + 38:259,target 57 + 38:260,target 58 + 104:396 reduce + 29:291 shift + 48:295,target 130 + 233:0 reduce + 120:297,target 30 + 119:297,target 29 + 104:397 reduce + 94:305,target 200 + 88:346,target 174 + 29:292 shift + 48:400 goto + 29:293 shift + 48:401 goto + 29:294 shift + 196:286,target 49 + 29:305 reduce + 29:295 shift + 30:305 reduce + 105:397,target 15 + 80:395,target 131 + 72:0,target 167 + 29:296 shift + 102:294,target 12 + 0:325,target 16 + 29:297 shift + 24:0 reduce + 29:298 shift + 203:304,target 196 + 29:299 shift + 41:0,target 92 + 43:294,target 129 + 48:399 goto + 214:323,target 223 + 170:378 reduce + 169:378 reduce + 114:296,target 24 + 221:303 shift + 111:0 reduce + 66:0 reduce + 10:0,target 1 + 29:266,target 101 + 231:291,target 126 + 10:306,target 68 + 18:398 goto + 100:396,target 10 + 126:298,target 36 + 230:0,target 1 + 229:0,target 195 + 226:257 reduce + 226:258 reduce + 153:0 reduce + 226:260 reduce + 226:259 reduce + 181:305 reduce + 226:261 reduce + 86:396,target 137 + 226:262 reduce + 188:0,target 112 + 108:305,target 18 + 108:295,target 18 + 154:305,target 141 + 124:300,target 34 + 22:420,target 91 + 209:305,target 220 + 195:0 reduce + 151:305 reduce + 121:300 reduce + 157:0,target 146 + 49:295,target 130 + 121:297,target 31 + 95:305,target 124 + 121:294 reduce + 126:0,target 36 + 121:305 reduce + 121:295 reduce + 121:296 reduce + 106:397,target 16 + 81:395,target 132 + 121:297 reduce + 103:294,target 13 + 95:305 reduce + 36:378,target 157 + 121:298 reduce + 234:299,target 134 + 121:299 reduce + 48:269,target 104 + 48:270,target 105 + 214:339,target 226 + 195:277,target 48 + 199:422 goto + 115:296,target 25 + 110:395 reduce + 109:395 reduce + 65:305 reduce + 29:283,target 118 + 38:0 reduce + 110:396 reduce + 109:396 reduce + 110:397 reduce + 109:397 reduce + 99:0,target 9 + 84:395 reduce + 84:396 reduce + 101:396,target 11 + 84:397 reduce + 21:342,target 89 + 127:298,target 37 + 125:0 reduce + 35:305 reduce + 192:396,target 108 + 81:0 reduce + 68:0,target 129 + 54:395 shift + 26:412,target 97 + 43:268,target 103 + 54:396 shift + 54:397 shift + 33:344,target 145 + 110:305,target 20 + 110:295,target 20 + 109:305,target 19 + 109:295,target 19 + 54:408 goto + 37:0,target 1 + 155:305,target 142 + 125:300,target 35 + 211:305,target 186 + 54:408,target 192 + 51:305,target 51 + 122:297,target 32 + 96:305,target 123 + 186:395,target 110 + 0:358,target 39 + 24:410 goto + 220:0 reduce + 219:0 reduce + 226:0,target 190 + 107:397,target 17 + 82:395,target 133 + 186:305 reduce + 104:294,target 14 + 48:286,target 121 + 195:304,target 48 + 195:294,target 48 + 185:0,target 85 + 33:413,target 146 + 11:0 reduce + 29:299,target 134 + 196:277,target 49 + 156:305 reduce + 126:300 reduce + 116:296,target 26 + 154:0,target 141 + 0:316,target 7 + 126:294 reduce + 102:396,target 12 + 53:0 reduce + 22:342,target 89 + 128:298,target 38 + 126:305 reduce + 126:295 reduce + 123:0,target 33 + 43:285,target 120 + 126:296 reduce + 47:372,target 85 + 126:297 reduce + 126:298 reduce + 30:257,target 55 + 231:282,target 117 + 140:0 reduce + 139:0 reduce + 126:299 reduce + 111:305,target 21 + 111:295,target 21 + 95:0 reduce + 156:305,target 143 + 126:300,target 36 + 212:305,target 185 + 115:395 reduce + 71:305 reduce + 10:398,target 70 + 115:396 reduce + 42:259,target 57 + 42:260,target 58 + 115:397 reduce + 96:0,target 123 + 52:305,target 54 + 182:0 reduce + 123:297,target 33 + 97:305,target 67 + 187:395,target 111 + 41:305 reduce + 65:0,target 64 + 108:397,target 18 + 83:395,target 134 + 29:400 goto + 105:294,target 15 + 29:401 goto + 234:0 reduce + 196:304,target 49 + 196:294,target 49 + 4:308,target 62 + 11:305 reduce + 34:0,target 71 + 0:333,target 22 + 117:296,target 27 + 232:305 reduce + 30:398 goto + 0:305 shift + 29:399 goto + 151:378 reduce + 103:396,target 13 + 223:0,target 189 + 195:268,target 48 + 29:274,target 109 + 231:298,target 133 + 202:305 reduce + 192:305 reduce + 112:0 reduce + 0:309 shift + 67:0 reduce + 0:311 shift + 182:0,target 78 + 0:312 shift + 112:305,target 22 + 112:295,target 22 + 157:305,target 146 + 127:300,target 37 + 0:314 shift + 0:0 reduce + 213:305,target 176 + 162:305 reduce + 0:315 shift + 154:0 reduce + 151:0,target 138 + 0:316 shift + 53:305,target 109 + 0:317 shift + 124:297,target 34 + 98:305,target 8 + 0:318 shift + 33:335,target 144 + 188:395,target 112 + 0:319 shift + 0:320 shift + 132:305 reduce + 120:0,target 30 + 119:0,target 29 + 102:300 reduce + 0:321 shift + 10:262,target 60 + 0:322 shift + 206:0 reduce + 196:0 reduce + 110:397,target 20 + 109:397,target 19 + 84:395,target 135 + 0:323 shift + 106:294,target 16 + 0:324 shift + 102:294 reduce + 0:325 shift + 102:305 reduce + 102:295 reduce + 0:350,target 32 + 0:326 shift + 0:349,target 31 + 102:296 reduce + 0:327 shift + 37:258,target 56 + 121:395 reduce + 102:297 reduce + 76:305 reduce + 36:386,target 162 + 121:396 reduce + 118:296,target 28 + 102:298 reduce + 0:329 shift + 121:397 reduce + 102:299 reduce + 93:0,target 60 + 0:331 shift + 48:277,target 112 + 88:328,target 174 + 0:332 shift + 17:409,target 78 + 46:303 shift + 47:415,target 186 + 195:285,target 48 + 0:333 shift + 104:396,target 14 + 0:334 shift + 29:291,target 126 + 196:268,target 49 + 62:0,target 1 + 0:337 shift + 0:338 shift + 0:339 shift + 0:340 shift + 16:305 reduce + 113:305,target 23 + 113:295,target 23 + 0:341 shift + 158:305,target 148 + 128:300,target 38 + 126:0 reduce + 43:276,target 111 + 82:0 reduce + 54:305,target 56 + 0:345 shift + 231:273,target 108 + 125:297,target 35 + 99:305,target 9 + 5:305 shift + 190:395,target 114 + 189:395,target 113 + 220:0,target 183 + 219:0,target 180 + 0:348 shift + 0:350 shift + 0:349 shift + 207:305 reduce + 197:305 reduce + 111:397,target 21 + 85:395,target 136 + 107:294,target 17 + 0:366,target 46 + 0:352 shift + 178:0,target 80 + 0:353 shift + 0:354 shift + 52:397,target 49 + 0:355 shift + 38:258,target 56 + 0:356 shift + 48:294,target 129 + 120:296,target 30 + 119:296,target 29 + 0:357 shift + 186:395 reduce + 0:358 shift + 186:396 reduce + 0:360 shift + 0:359 shift + 196:285,target 49 + 186:397 reduce + 0:361 shift + 137:305 reduce + 116:0,target 26 + 107:300 reduce + 105:396,target 15 + 0:362 shift + 0:363 shift + 0:324,target 15 + 4:411,target 65 + 0:364 shift + 203:303,target 195 + 107:294 reduce + 0:366 shift + 107:305 reduce + 107:295 reduce + 43:293,target 128 + 114:305,target 24 + 114:295,target 24 + 107:296 reduce + 54:0 reduce + 160:305,target 144 + 159:305,target 149 + 126:395 reduce + 107:297 reduce + 82:305 reduce + 215:305,target 179 + 199:346,target 214 + 126:396 reduce + 107:298 reduce + 29:265,target 100 + 231:300,target 135 + 231:290,target 125 + 231:289,target 124 + 126:397 reduce + 107:299 reduce + 90:0,target 95 + 89:0,target 173 + 10:305,target 1 + 100:395,target 10 + 55:305,target 2 + 141:0 reduce + 126:297,target 36 + 96:0 reduce + 52:305 reduce + 58:0,target 6 + 112:397,target 22 + 86:395,target 137 + 108:294,target 18 + 183:0 reduce + 22:305 shift + 27:0,target 69 + 53:397,target 109 + 98:397,target 8 + 49:294,target 129 + 121:296,target 31 + 235:0 reduce + 0:341,target 28 + 216:0,target 177 + 106:396,target 16 + 36:377,target 154 + 213:305 reduce + 234:298,target 133 + 48:268,target 103 + 175:0,target 79 + 88:319,target 174 + 0:404 goto + 195:276,target 48 + 0:395 shift + 115:305,target 25 + 115:295,target 25 + 0:396 shift + 0:406 goto + 29:282,target 117 + 173:305 reduce + 161:305,target 150 + 0:397 shift + 0:407 goto + 216:305,target 177 + 144:0,target 127 + 0:408 goto + 14:398,target 75 + 192:395 reduce + 113:0 reduce + 11:305,target 74 + 192:396 reduce + 101:395,target 11 + 68:0 reduce + 56:305,target 5 + 192:397 reduce + 127:297,target 37 + 192:395,target 108 + 143:305 shift + 113:300 reduce + 113:0,target 23 + 147:378,target 162 + 1:0 reduce + 43:267,target 102 + 155:0 reduce + 113:397,target 23 + 113:294 reduce + 110:294,target 20 + 109:294,target 19 + 113:305 reduce + 113:295 reduce + 113:296 reduce + 132:395 reduce + 113:297 reduce + 87:305 reduce + 54:397,target 49 + 132:396 reduce + 113:298 reduce + 99:397,target 9 + 207:0 reduce + 197:0 reduce + 132:397 reduce + 122:296,target 32 + 113:299 reduce + 86:0,target 137 + 0:357,target 38 + 102:395 reduce + 57:305 reduce + 17:306,target 77 + 36:394,target 170 + 107:396,target 17 + 102:396 reduce + 55:0,target 2 + 22:342 shift + 102:397 reduce + 48:285,target 120 + 195:303,target 48 + 195:293,target 48 + 24:0,target 117 + 27:305 reduce + 29:298,target 133 + 196:276,target 49 + 116:305,target 26 + 116:295,target 26 + 162:305,target 151 + 0:315,target 6 + 217:305,target 175 + 41:0 reduce + 12:305,target 72 + 102:395,target 12 + 57:305,target 3 + 167:378 reduce + 128:297,target 38 + 43:284,target 119 + 218:303 shift + 213:0,target 176 + 47:371,target 84 + 218:304 shift + 148:378,target 163 + 127:0 reduce + 14:262,target 60 + 83:0 reduce + 231:281,target 116 + 114:397,target 24 + 40:302,target 177 + 111:294,target 21 + 224:257 reduce + 224:258 reduce + 224:260 reduce + 224:259 reduce + 178:305 reduce + 42:258,target 56 + 224:261 reduce + 141:0,target 106 + 224:262 reduce + 123:296,target 33 + 118:300 reduce + 110:0,target 20 + 109:0,target 19 + 222:0 reduce + 108:396,target 18 + 196:303,target 49 + 196:293,target 49 + 118:294 reduce + 118:305 reduce + 118:295 reduce + 118:296 reduce + 0:332,target 21 + 46:303,target 185 + 118:297 reduce + 117:305,target 27 + 117:295,target 27 + 93:305 reduce + 9:0,target 97 + 13:0 reduce + 163:305,target 152 + 118:298 reduce + 118:299 reduce + 83:0,target 134 + 234:300,target 135 + 63:303 shift + 62:398,target 193 + 13:305,target 104 + 103:395,target 13 + 58:305,target 6 + 195:267,target 48 + 107:395 reduce + 100:0 reduce + 107:396 reduce + 55:0 reduce + 52:0,target 54 + 29:273,target 108 + 231:297,target 132 + 107:397 reduce + 82:395 reduce + 82:396 reduce + 115:397,target 25 + 82:397 reduce + 112:294,target 22 + 142:0 reduce + 33:306 shift + 97:0 reduce + 52:395 shift + 52:396 shift + 38:257 shift + 52:397 shift + 38:258 shift + 124:296,target 34 + 52:408 goto + 38:259 shift + 38:260 shift + 36:x,target 148 + 38:261 shift + 184:0 reduce + 10:261,target 59 + 38:262 shift + 110:396,target 20 + 109:396,target 19 + 0:348,target 30 + 236:0 reduce + 230:257 shift + 229:257 reduce + 37:257,target 55 + 230:258 shift + 229:258 reduce + 36:385,target 161 + 230:260 shift + 230:259 shift + 229:260 reduce + 229:259 reduce + 184:305 reduce + 118:305,target 28 + 118:295,target 28 + 230:261 shift + 229:261 reduce + 164:305,target 153 + 137:0,target 100 + 48:276,target 111 + 230:262 shift + 229:262 reduce + 220:305,target 183 + 219:305,target 180 + 195:284,target 48 + 14:305,target 1 + 104:395,target 14 + 60:305,target 7 + 59:305,target 4 + 27:0 reduce + 29:289,target 124 + 29:290,target 125 + 29:300,target 135 + 196:267,target 49 + 154:305 reduce + 124:300 reduce + 106:0,target 16 + 22:420 goto + 222:262,target 192 + 151:378,target 158 + 62:262,target 60 + 124:294 reduce + 116:397,target 26 + 114:0 reduce + 33:332 shift + 124:305 reduce + 124:295 reduce + 113:294,target 23 + 70:0 reduce + 69:0 reduce + 124:296 reduce + 43:275,target 110 + 124:297 reduce + 98:305 reduce + 33:335 shift + 124:298 reduce + 2:0 reduce + 199:328,target 209 + 124:299 reduce + 80:0,target 131 + 79:0,target 86 + 231:272,target 107 + 156:0 reduce + 125:296,target 35 + 113:395 reduce + 68:305 reduce + 24:410,target 93 + 113:396 reduce + 113:397 reduce + 111:396,target 21 + 33:344 shift + 208:0 reduce + 198:0 reduce + 38:305 reduce + 52:396,target 48 + 38:257,target 55 + 48:293,target 128 + 120:305,target 30 + 120:295,target 30 + 119:305,target 29 + 119:295,target 29 + 165:305,target 154 + 18:398,target 79 + 196:284,target 49 + 105:395,target 15 + 61:305,target 65 + 206:0,target 181 + 196:0,target 49 + 0:323,target 14 + 14:257 shift + 223:262,target 189 + 14:258 shift + 230:305 reduce + 14:259 shift + 14:260 shift + 14:261 shift + 42:0 reduce + 165:0,target 154 + 148:378 reduce + 117:397,target 27 + 14:262 shift + 43:292,target 127 + 114:294,target 24 + 218:403 goto + 200:305 reduce + 190:305 reduce + 189:305 reduce + 29:264,target 99 + 231:288,target 123 + 134:0,target 44 + 128:0 reduce + 39:299,target 134 + 84:0 reduce + 126:296,target 36 + 160:305 reduce + 159:305 reduce + 103:0,target 13 + 25:409,target 94 + 171:0 reduce + 112:396,target 22 + 210:303,target 221 + 130:305 reduce + 129:305 reduce + 53:396,target 109 + 195:267 reduce + 98:396,target 8 + 3:0,target 93 + 223:0 reduce + 195:268 reduce + 121:305,target 31 + 121:295,target 31 + 195:270 reduce + 195:269 reduce + 166:305,target 155 + 76:0,target 61 + 195:271 reduce + 100:305 reduce + 195:272 reduce + 0:339,target 26 + 0:340,target 27 + 16:305,target 91 + 195:273 reduce + 118:395 reduce + 106:395,target 16 + 74:305 reduce + 62:305,target 1 + 195:274 reduce + 118:396 reduce + 36:376,target 153 + 45:0,target 102 + 224:262,target 193 + 195:275 reduce + 118:397 reduce + 14:0 reduce + 234:297,target 132 + 195:276 reduce + 153:378,target 159 + 18:262,target 60 + 48:267,target 102 + 195:277 reduce + 88:318,target 174 + 195:278 reduce + 195:275,target 48 + 118:397,target 28 + 14:0,target 1 + 44:305 shift + 195:280 reduce + 195:279 reduce + 115:294,target 25 + 29:281,target 116 + 195:281 reduce + 101:0 reduce + 195:282 reduce + 56:0 reduce + 234:0,target 170 + 195:283 reduce + 195:284 reduce + 14:305 reduce + 195:285 reduce + 127:296,target 37 + 195:286 reduce + 0:408,target 53 + 195:287 reduce + 193:0,target 120 + 43:266,target 101 + 195:288 reduce + 98:0 reduce + 235:305 reduce + 195:300 reduce + 195:290 reduce + 195:289 reduce + 113:396,target 23 + 199:319,target 208 + 195:291 reduce + 3:305 reduce + 195:292 reduce + 162:0,target 151 + 195:303 reduce + 195:293 reduce + 195:304 reduce + 195:294 reduce + 185:0 reduce + 54:396,target 48 + 33:413 goto + 205:305 shift + 195:305 reduce + 195:295 reduce + 99:396,target 9 + 195:296 reduce + 131:0,target 41 + 122:305,target 32 + 122:295,target 32 + 195:297 reduce + 0:356,target 37 + 195:298 reduce + 195:299 reduce + 17:305,target 115 + 36:393,target 169 + 165:305 reduce + 107:395,target 17 + 100:0,target 10 + 48:284,target 119 + 225:262,target 194 + 195:292,target 48 + 29:297,target 132 + 196:275,target 49 + 135:305 reduce + 120:397,target 30 + 119:397,target 29 + 105:300 reduce + 116:294,target 26 + 19:373,target 86 + 28:0 reduce + 0:314,target 5 + 0:0,target 53 + 105:294 reduce + 73:0,target 166 + 36:351,target 150 + 105:305 reduce + 105:295 reduce + 128:296,target 38 + 115:0 reduce + 105:296 reduce + 43:283,target 118 + 124:395 reduce + 105:297 reduce + 80:305 reduce + 79:305 reduce + 71:0 reduce + 49:300 shift + 1:408,target 53 + 47:369,target 82 + 47:370,target 83 + 124:396 reduce + 105:298 reduce + 14:261,target 59 + 42:0,target 1 + 124:397 reduce + 105:299 reduce + 98:395 reduce + 231:280,target 115 + 231:279,target 114 + 214:423,target 230 + 114:396,target 24 + 98:396 reduce + 3:0 reduce + 40:301,target 176 + 98:397 reduce + 49:294 shift + 157:0 reduce + 49:295 shift + 11:0,target 74 + 231:401,target 235 + 49:296 shift + 49:297 shift + 42:257,target 55 + 49:298 shift + 231:0,target 169 + 123:305,target 33 + 123:295,target 33 + 49:299 shift + 20:305 reduce + 18:305,target 1 + 200:0,target 57 + 190:0,target 114 + 189:0,target 113 + 108:395,target 18 + 88:352,target 174 + 226:262,target 190 + 38:398 goto + 196:292,target 49 + 8:305 reduce + 158:0,target 148 + 121:397,target 31 + 102:299,target 12 + 0:331,target 20 + 117:294,target 27 + 211:305 reduce + 218:304,target 196 + 127:0,target 37 + 43:299,target 134 + 230:398 goto + 171:305 reduce + 2:398,target 61 + 29:272,target 107 + 231:296,target 131 + 88:421,target 199 + 190:395 reduce + 189:395 reduce + 25:306,target 77 + 190:396 reduce + 189:396 reduce + 130:0 reduce + 129:0 reduce + 115:396,target 25 + 190:397 reduce + 189:397 reduce + 85:0 reduce + 141:305 reduce + 111:300 reduce + 124:305,target 34 + 124:295,target 34 + 111:294 reduce + 70:0,target 89 + 69:0,target 130 + 111:305 reduce + 111:295 reduce + 111:296 reduce + 10:259,target 57 + 10:260,target 58 + 130:395 reduce + 129:395 reduce + 111:297 reduce + 85:305 reduce + 20:305,target 66 + 199:422,target 217 + 130:396 reduce + 129:396 reduce + 111:298 reduce + 110:395,target 20 + 109:395,target 19 + 65:305,target 64 + 38:0,target 1 + 130:397 reduce + 129:397 reduce + 111:299 reduce + 227:262,target 191 + 224:0 reduce + 100:395 reduce + 55:305 reduce + 51:405,target 191 + 122:397,target 32 + 103:299,target 13 + 100:396 reduce + 36:384,target 160 + 118:294,target 28 + 100:397 reduce + 48:275,target 110 + 227:0,target 191 + 195:283,target 48 + 25:305 reduce + 25:306 shift + 29:288,target 123 + 222:261,target 192 + 186:0,target 110 + 102:0 reduce + 0:305,target 1 + 29:399,target 136 + 62:261,target 59 + 57:0 reduce + 116:396,target 26 + 155:0,target 142 + 2:262,target 60 + 43:274,target 109 + 216:305 reduce + 144:0 reduce + 14:398 goto + 124:0,target 34 + 99:0 reduce + 231:271,target 106 + 125:305,target 35 + 125:295,target 35 + 230:398,target 233 + 222:257 reduce + 171:305,target 83 + 222:258 reduce + 222:260 reduce + 222:259 reduce + 176:305 reduce + 21:305,target 88 + 44:419 goto + 222:261 reduce + 186:0 reduce + 111:395,target 21 + 66:305,target 84 + 222:262 reduce + 0:364,target 45 + 228:262,target 188 + 183:307,target 203 + 19:367 shift + 146:305 reduce + 116:300 reduce + 97:0,target 67 + 52:395,target 47 + 19:368 shift + 123:397,target 33 + 104:299,target 14 + 19:369 shift + 19:370 shift + 48:292,target 127 + 120:294,target 30 + 119:294,target 29 + 19:371 shift + 195:299,target 48 + 19:372 shift + 116:294 reduce + 66:0,target 84 + 19:373 shift + 196:283,target 49 + 116:305 reduce + 116:295 reduce + 116:296 reduce + 135:395 reduce + 116:297 reduce + 91:305 reduce + 0:322,target 13 + 223:261,target 189 + 135:396 reduce + 116:298 reduce + 29:0 reduce + 30:0 reduce + 35:0,target 72 + 135:397 reduce + 116:299 reduce + 1:305,target 55 + 117:396,target 27 + 43:291,target 126 + 214:319,target 222 + 105:395 reduce + 61:305 reduce + 116:0 reduce + 105:396 reduce + 234:401,target 236 + 105:397 reduce + 80:395 reduce + 72:0 reduce + 29:263,target 98 + 231:287,target 122 + 80:396 reduce + 49:401 goto + 39:298,target 133 + 224:0,target 193 + 80:397 reduce + 126:305,target 36 + 126:295,target 36 + 4:0 reduce + 31:305 shift + 10:414,target 71 + 158:0 reduce + 36:316,target 149 + 183:0,target 168 + 22:305,target 88 + 112:395,target 22 + 67:305,target 107 + 230:262,target 60 + 229:262,target 195 + 152:0,target 139 + 211:0 reduce + 53:395,target 109 + 124:397,target 34 + 105:299,target 15 + 98:395,target 8 + 121:294,target 31 + 196:299,target 49 + 121:0,target 31 + 227:257 reduce + 0:338,target 25 + 227:258 reduce + 227:260 reduce + 227:259 reduce + 182:305 reduce + 36:375,target 152 + 227:261 reduce + 224:261,target 193 + 19:415 goto + 234:296,target 131 + 227:262 reduce + 2:305,target 1 + 18:261,target 59 + 48:266,target 101 + 88:317,target 174 + 195:274,target 48 + 118:396,target 28 + 152:305 reduce + 122:300 reduce + 29:279,target 114 + 29:280,target 115 + 29:401,target 138 + 122:294 reduce + 131:0 reduce + 127:305,target 37 + 127:295,target 37 + 122:305 reduce + 122:295 reduce + 173:305,target 62 + 122:296 reduce + 86:0 reduce + 0:397,target 49 + 0:407,target 52 + 122:297 reduce + 96:305 reduce + 43:265,target 100 + 122:298 reduce + 23:305,target 90 + 122:299 reduce + 113:395,target 23 + 68:305,target 129 + 199:318,target 207 + 173:0 reduce + 111:395 reduce + 66:305 reduce + 111:396 reduce + 54:395,target 47 + 125:397,target 35 + 111:397 reduce + 106:299,target 16 + 99:395,target 9 + 85:395 reduce + 122:294,target 32 + 85:396 reduce + 85:397 reduce + 0:355,target 36 + 225:0 reduce + 36:392,target 168 + 180:0,target 76 + 179:0,target 81 + 36:X,target 147 + 42:257 shift + 48:283,target 118 + 225:261,target 194 + 42:258 shift + 195:291,target 48 + 3:305,target 93 + 42:259 shift + 42:260 shift + 16:0 reduce + 29:296,target 131 + 42:261 shift + 196:274,target 49 + 120:396,target 30 + 119:396,target 29 + 42:262 shift + 19:372,target 85 + 36:316 shift + 117:0,target 27 + 103:0 reduce + 25:409 goto + 58:0 reduce + 128:305,target 38 + 128:295,target 38 + 43:282,target 117 + 203:403,target 218 + 174:305,target 63 + 1:397,target 49 + 1:407,target 54 + 47:368,target 81 + 230:305,target 1 + 187:305 reduce + 14:259,target 57 + 14:260,target 58 + 24:305,target 117 + 231:278,target 113 + 145:0 reduce + 114:395,target 24 + 70:305,target 89 + 69:305,target 130 + 39:300,target 135 + 231:400,target 234 + 157:305 reduce + 127:300 reduce + 91:0,target 94 + 4:347,target 64 + 126:397,target 36 + 107:299,target 17 + 187:0 reduce + 123:294,target 33 + 127:294 reduce + 60:0,target 7 + 59:0,target 4 + 127:305 reduce + 127:295 reduce + 127:296 reduce + 48:299,target 134 + 127:297 reduce + 64:304,target 196 + 127:298 reduce + 28:0,target 68 + 226:261,target 190 + 127:299 reduce + 196:291,target 49 + 4:305,target 119 + 121:396,target 31 + 116:395 reduce + 102:298,target 12 + 72:305 reduce + 0:329,target 19 + 116:396 reduce + 116:397 reduce + 218:303,target 195 + 217:0,target 175 + 43:298,target 133 + 214:327,target 224 + 42:305 reduce + 130:305,target 40 + 129:305,target 39 + 199:352,target 215 + 175:305,target 79 + 29:271,target 106 + 231:295,target 130 + 231:305,target 169 + 176:0,target 46 + 117:0 reduce + 73:0 reduce + 25:305,target 115 + 36:351 shift + 115:395,target 25 + 71:305,target 73 + 12:305 shift + 145:0,target 126 + 160:0 reduce + 159:0 reduce + 233:305 reduce + 127:397,target 37 + 108:299,target 18 + 124:294,target 34 + 114:0,target 24 + 1:305 reduce + 33:332,target 143 + 203:303 shift + 10:258,target 56 + 203:304 shift + 49:299,target 134 + 212:0 reduce + 193:305 reduce + 227:261,target 191 + 19:415,target 87 + 5:305,target 66 + 163:305 reduce + 122:396,target 32 + 103:298,target 13 + 87:0,target 75 + 36:383,target 159 + 48:274,target 109 + 195:282,target 48 + 56:0,target 5 + 133:305 reduce + 103:300 reduce + 29:287,target 122 + 36:374 shift + 131:305,target 41 + 36:375 shift + 222:260,target 192 + 222:259,target 192 + 176:305,target 46 + 36:376 shift + 44:419,target 184 + 45:0 reduce + 232:305,target 184 + 30:398,target 139 + 36:377 shift + 103:294 reduce + 62:260,target 58 + 62:259,target 57 + 36:378 reduce + 116:395,target 26 + 103:305 reduce + 103:295 reduce + 72:305,target 167 + 36:379 shift + 36:380 shift + 103:296 reduce + 36:381 shift + 132:0 reduce + 122:395 reduce + 103:297 reduce + 77:305 reduce + 2:261,target 59 + 36:382 shift + 43:273,target 108 + 122:396 reduce + 103:298 reduce + 87:0 reduce + 36:383 shift + 122:397 reduce + 103:299 reduce + 36:384 shift + 128:397,target 38 + 110:299,target 20 + 109:299,target 19 + 36:385 shift + 231:270,target 105 + 231:269,target 104 + 125:294,target 35 + 36:386 shift + 36:387 shift + 174:0 reduce + 36:388 shift + 12:343 shift + 36:389 shift + 36:390 shift + 40:402,target 178 + 173:0,target 62 + 36:391 shift + 0:363,target 44 + 36:392 shift + 228:261,target 188 + 17:305 reduce + 36:393 shift + 6:305,target 67 + 17:306 shift + 36:394 shift + 226:0 reduce + 142:0,target 125 + 33:306,target 142 + 123:396,target 33 + 104:298,target 14 + 48:291,target 126 + 88:342,target 174 + 195:298,target 48 + 221:303,target 232 + 111:0,target 21 + 6:305 shift + 196:282,target 49 + 15:303,target 76 + 132:305,target 42 + 102:300,target 12 + 0:321,target 12 + 223:260,target 189 + 223:259,target 189 + 208:305 reduce + 198:305 reduce + 177:305,target 47 + 233:305,target 187 + 27:305,target 69 + 36:416 goto + 117:395,target 27 + 104:0 reduce + 73:305,target 166 + 36:417 goto + 43:289,target 124 + 43:290,target 125 + 43:300,target 135 + 60:0 reduce + 59:0 reduce + 84:0,target 135 + 24:313,target 92 + 30:262,target 60 + 231:286,target 121 + 187:395 reduce + 39:297,target 132 + 187:396 reduce + 130:397,target 40 + 129:397,target 39 + 111:299,target 21 + 187:397 reduce + 146:0 reduce + 126:294,target 36 + 53:0,target 109 + 138:305 reduce + 108:300 reduce + 108:294 reduce + 230:261,target 59 + 229:261,target 195 + 188:0 reduce + 108:305 reduce + 108:295 reduce + 108:296 reduce + 7:305,target 103 + 127:395 reduce + 108:297 reduce + 83:305 reduce + 127:396 reduce + 124:396,target 34 + 108:298 reduce + 105:298,target 15 + 127:397 reduce + 108:299 reduce + 196:298,target 49 + 211:0,target 186 + 53:305 reduce + 0:337,target 24 + 133:305,target 43 + 103:300,target 13 + 36:374,target 151 + 224:260,target 193 + 224:259,target 193 + 178:305,target 80 + 234:295,target 130 + 234:305,target 170 + 18:259,target 57 + 18:260,target 58 + 48:265,target 100 + 23:305 reduce + 28:305,target 68 + 195:273,target 48 + 118:395,target 28 + 74:305,target 82 + 138:0,target 101 + 29:278,target 113 + 118:0 reduce + 29:400,target 137 + 42:398 goto + 131:397,target 41 + 112:299,target 22 + 107:0,target 17 + 74:0 reduce + 127:294,target 37 + 0:396,target 48 + 0:406,target 51 + 43:264,target 99 + 161:0 reduce + 199:317,target 206 + 7:0,target 103 + 1:395 shift + 8:305,target 96 + 1:396 shift + 47:367 shift + 203:403 goto + 174:305 reduce + 81:0,target 132 + 1:397 shift + 1:407 goto + 47:368 shift + 125:396,target 35 + 106:298,target 16 + 1:408 goto + 47:369 shift + 47:370 shift + 213:0 reduce + 47:371 shift + 0:354,target 35 + 47:372 shift + 50:0,target 0 + 12:418 goto + 47:373 shift + 144:305 reduce + 114:300 reduce + 36:391,target 167 + 63:303,target 194 + 134:305,target 44 + 104:300,target 14 + 48:282,target 117 + 225:260,target 194 + 225:259,target 194 + 214:319 shift + 214:352,target 228 + 180:305,target 76 + 179:305,target 81 + 18:0,target 1 + 235:305,target 171 + 195:300,target 48 + 195:290,target 48 + 195:289,target 48 + 114:294 reduce + 114:305 reduce + 114:295 reduce + 29:305,target 98 + 29:295,target 130 + 30:305,target 1 + 214:323 shift + 196:273,target 49 + 120:395,target 30 + 119:395,target 29 + 114:296 reduce + 75:305,target 87 + 133:395 reduce + 114:297 reduce + 19:371,target 84 + 133:396 reduce + 114:298 reduce + 0:312,target 4 + 133:397 reduce + 114:299 reduce + 214:327 shift + 207:0,target 182 + 197:0,target 121 + 132:397,target 42 + 113:299,target 23 + 128:294,target 38 + 103:395 reduce + 58:305 reduce + 43:281,target 116 + 103:396 reduce + 1:396,target 48 + 47:367,target 80 + 133:0 reduce + 103:397 reduce + 14:258,target 56 + 166:0,target 155 + 88:314 reduce + 231:277,target 112 + 214:334 shift + 28:305 reduce + 88:317 reduce + 135:0,target 45 + 88:318 reduce + 9:305,target 97 + 175:0 reduce + 88:319 reduce + 214:339 shift + 126:396,target 36 + 107:298,target 17 + 104:0,target 14 + 36:417,target 172 + 168:378 reduce + 48:298,target 133 + 227:0 reduce + 64:303,target 195 + 220:305 reduce + 219:305 reduce + 135:305,target 45 + 105:300,target 15 + 226:260,target 190 + 226:259,target 190 + 181:305,target 77 + 88:328 reduce + 17:409 goto + 47:415 goto + 236:305,target 172 + 214:348 shift + 196:300,target 49 + 196:290,target 49 + 196:289,target 49 + 10:352,target 69 + 225:257 reduce + 4:0,target 119 + 31:305,target 140 + 225:258 reduce + 121:395,target 31 + 102:297,target 12 + 76:305,target 61 + 225:260 reduce + 225:259 reduce + 214:352 shift + 180:305 reduce + 179:305 reduce + 18:0 reduce + 26:330,target 96 + 225:261 reduce + 225:262 reduce + 167:378,target 160 + 43:297,target 132 + 133:397,target 43 + 114:299,target 24 + 150:305 reduce + 149:305 reduce + 120:300 reduce + 119:300 reduce + 105:0 reduce + 88:340 reduce + 88:339 reduce + 61:0 reduce + 29:269,target 104 + 29:270,target 105 + 231:294,target 129 + 214:360 shift + 88:341 reduce + 88:342 reduce + 120:294 reduce + 119:294 reduce + 120:305 reduce + 120:295 reduce + 119:305 reduce + 119:295 reduce + 120:296 reduce + 119:296 reduce + 235:0,target 171 + 120:297 reduce + 119:297 reduce + 94:305 shift + 88:346 reduce + 120:298 reduce + 119:298 reduce + 127:396,target 37 + 120:299 reduce + 119:299 reduce + 108:298,target 18 + 64:303 shift + 204:0,target 52 + 194:0,target 122 + 64:304 shift + 200:0 reduce + 190:0 reduce + 189:0 reduce + 108:395 reduce + 88:352 reduce + 10:257,target 55 + 108:396 reduce + 49:298,target 133 + 108:397 reduce + 83:395 reduce + 163:0,target 152 + 136:305,target 99 + 106:300,target 16 + 83:396 reduce + 227:260,target 191 + 227:259,target 191 + 182:305,target 78 + 83:397 reduce + 0:345,target 29 + 34:305 reduce + 32:305,target 141 + 132:0,target 42 + 122:395,target 32 + 103:297,target 13 + 77:305,target 116 + 53:395 reduce + 36:382,target 158 + 53:396 reduce + 53:397 reduce + 48:273,target 108 + 168:378,target 161 + 195:281,target 48 + 101:0,target 11 + 134:397,target 44 + 115:299,target 25 + 88:365 reduce + 29:286,target 121 + 10:257 shift + 222:258,target 192 + 10:258 shift + 10:259 shift + 10:260 shift + 62:258,target 56 + 10:261 shift + 120:0 reduce + 119:0 reduce + 10:262 shift + 75:0 reduce + 1:0,target 55 + 2:260,target 58 + 2:259,target 57 + 43:272,target 107 + 185:305 reduce + 74:0,target 82 + 7:0 reduce + 128:396,target 38 + 110:298,target 20 + 109:298,target 19 + 231:268,target 103 + 162:0 reduce + 155:305 reduce + 125:300 reduce + 39:401,target 175 + 231:267 shift + 231:268 shift + 137:305,target 100 + 107:300,target 17 + 0:362,target 43 + 231:270 shift + 231:269 shift + 228:260,target 188 + 228:259,target 188 + 183:305,target 168 + 125:294 reduce + 231:271 shift + 125:305 reduce + 125:295 reduce + 231:272 shift + 125:296 reduce + 232:0,target 184 + 231:273 shift + 125:297 reduce + 123:395,target 33 + 104:297,target 14 + 99:305 reduce + 78:305,target 198 + 48:300,target 135 + 48:289,target 124 + 48:290,target 125 + 231:274 shift + 214:360,target 229 + 125:298 reduce + 88:341,target 174 + 231:275 shift + 195:297,target 48 + 125:299 reduce + 231:276 shift + 170:378,target 165 + 169:378,target 164 + 231:277 shift + 201:0,target 128 + 196:281,target 49 + 231:278 shift + 135:397,target 45 + 116:299,target 26 + 114:395 reduce + 70:305 reduce + 69:305 reduce + 39:300 shift + 231:280 shift + 231:279 shift + 214:423 goto + 114:396 reduce + 0:319,target 10 + 0:320,target 11 + 40:301 shift + 231:281 shift + 223:258,target 189 + 114:397 reduce + 40:302 shift + 231:282 shift + 160:0,target 144 + 159:0,target 149 + 231:283 shift + 39:294 shift + 231:284 shift + 39:295 shift + 43:288,target 123 + 231:285 shift + 39:296 shift + 231:286 shift + 128:0,target 38 + 39:297 shift + 231:287 shift + 199:342,target 213 + 30:261,target 59 + 39:298 shift + 43:399,target 180 + 231:288 shift + 231:285,target 120 + 134:0 reduce + 39:296,target 131 + 39:299 shift + 231:300 shift + 231:290 shift + 231:289 shift + 130:396,target 40 + 129:396,target 39 + 111:298,target 21 + 90:0 reduce + 89:0 reduce + 10:305 reduce + 231:291 shift + 10:306 shift + 231:292 shift + 231:293 shift + 231:294 shift + 231:295 shift + 231:305 reduce + 176:0 reduce + 231:296 shift + 138:305,target 101 + 108:300,target 18 + 88:421 goto + 231:297 shift + 230:260,target 58 + 230:259,target 57 + 229:260,target 195 + 229:259,target 195 + 184:305,target 105 + 231:298 shift + 37:398,target 173 + 231:299 shift + 34:305,target 71 + 201:305 reduce + 191:305 shift + 124:395,target 34 + 105:297,target 15 + 80:305,target 131 + 79:305,target 86 + 71:0,target 73 + 49:300,target 135 + 228:0 reduce + 196:297,target 49 + 161:305 reduce + 117:299,target 27 + 224:258,target 193 + 20:0 reduce + 234:294,target 129 + 18:258,target 56 + 48:264,target 99 + 214:334,target 225 + 195:272,target 48 + 131:305 reduce + 29:277,target 112 + 228:0,target 188 + 196:267 reduce + 106:0 reduce + 196:268 reduce + 62:0 reduce + 196:270 reduce + 196:269 reduce + 196:271 reduce + 131:396,target 41 + 112:298,target 22 + 101:305 reduce + 196:272 reduce + 187:0,target 111 + 196:273 reduce + 120:395 reduce + 119:395 reduce + 75:305 reduce + 0:395,target 47 + 196:274 reduce + 120:396 reduce + 119:396 reduce + 43:263,target 98 + 196:275 reduce + 120:397 reduce + 119:397 reduce + 196:276 reduce + 156:0,target 143 + 196:277 reduce + 140:305,target 59 + 139:305,target 88 + 110:300,target 20 + 109:300,target 19 + 196:278 reduce + 185:305,target 85 + 64:403 goto + 45:305 reduce + 196:280 reduce + 196:279 reduce + 38:398,target 174 + 201:0 reduce + 196:281 reduce + 125:0,target 35 + 35:305,target 72 + 196:282 reduce + 125:395,target 35 + 106:297,target 16 + 81:305,target 132 + 15:303 shift + 196:283 reduce + 196:284 reduce + 0:353,target 34 + 196:285 reduce + 172:378,target 202 + 37:262,target 60 + 196:286 reduce + 12:343,target 73 + 36:389,target 165 + 36:390,target 166 + 196:287 reduce + 118:299,target 28 + 196:288 reduce + 48:281,target 116 + 236:305 reduce + 225:258,target 194 + 196:300 reduce + 196:290 reduce + 196:289 reduce + 10:352 shift + 196:291 reduce + 195:288,target 48 + 98:0,target 8 + 4:305 reduce + 196:292 reduce + 29:294,target 129 + 196:303 reduce + 196:293 reduce + 196:272,target 49 + 196:304 reduce + 196:294 reduce + 4:308 shift + 19:369,target 82 + 19:370,target 83 + 34:0 reduce + 206:305 reduce + 196:305 reduce + 196:295 reduce + 67:0,target 107 + 0:311,target 3 + 196:296 reduce + 196:297 reduce + 196:298 reduce + 132:396,target 42 + 113:298,target 23 + 196:299 reduce + 121:0 reduce + 43:279,target 114 + 43:280,target 115 + 166:305 reduce + 76:0 reduce + 1:395,target 47 + 14:257,target 55 + 43:401,target 182 + 231:276,target 111 + 8:0 reduce + 141:305,target 106 + 111:300,target 21 + 186:305,target 110 + 163:0 reduce + 136:305 reduce + 106:300 reduce + 225:0,target 194 + 126:395,target 36 + 107:297,target 17 + 82:305,target 133 + 106:294 reduce + 106:305 reduce + 106:295 reduce + 36:416,target 171 + 215:0 reduce + 184:0,target 105 + 106:296 reduce + 38:262,target 60 + 125:395 reduce + 106:297 reduce + 81:305 reduce + 48:297,target 132 + 125:396 reduce + 120:299,target 30 + 119:299,target 29 + 106:298 reduce + 125:397 reduce + 106:299 reduce + 99:395 reduce + 226:258,target 190 + 153:0,target 140 + 99:396 reduce + 196:288,target 49 + 99:397 reduce +} + +array set region::rules { + 9,l 399 + 164,l 417 + 49,l 403 + 50,l 404 + 136,l 415 + 92,l 406 + 178,l 422 + 22,l 400 + 108,l 407 + 64,l 406 + 151,l 416 + 193,l 423 + 36,l 400 + 123,l 412 + 78,l 406 + 165,l 417 + 51,l 405 + 137,l 415 + 93,l 406 + 180,l 422 + 179,l 422 + 23,l 400 + 109,l 407 + 110,l 408 + 65,l 406 + 152,l 416 + 194,l 423 + 37,l 400 + 124,l 412 + 79,l 406 + 80,l 406 + 166,l 418 + 10,l 399 + 52,l 404 + 138,l 416 + 94,l 406 + 181,l 422 + 24,l 400 + 111,l 408 + 66,l 406 + 153,l 416 + 195,l 423 + 38,l 400 + 125,l 413 + 81,l 406 + 167,l 418 + 11,l 399 + 53,l 406 + 139,l 416 + 140,l 416 + 95,l 406 + 182,l 422 + 25,l 400 + 112,l 408 + 67,l 406 + 0,l 424 + 154,l 416 + 39,l 401 + 40,l 401 + 126,l 413 + 82,l 406 + 168,l 419 + 12,l 400 + 54,l 406 + 141,l 416 + 96,l 406 + 183,l 422 + 26,l 400 + 113,l 408 + 68,l 406 + 1,l 398 + 155,l 416 + 41,l 401 + 127,l 413 + 83,l 406 + 170,l 419 + 169,l 419 + 13,l 400 + 100,l 406 + 55,l 406 + 142,l 416 + 97,l 406 + 184,l 422 + 27,l 400 + 114,l 408 + 69,l 406 + 70,l 406 + 2,l 398 + 156,l 416 + 42,l 401 + 128,l 413 + 84,l 406 + 171,l 419 + 14,l 400 + 101,l 406 + 56,l 406 + 143,l 416 + 98,l 406 + 185,l 422 + 28,l 400 + 115,l 409 + 71,l 406 + 3,l 398 + 157,l 417 + 43,l 401 + 129,l 414 + 130,l 414 + 85,l 406 + 172,l 419 + 15,l 400 + 102,l 406 + 57,l 406 + 144,l 416 + 99,l 406 + 186,l 422 + 30,l 400 + 29,l 400 + 116,l 409 + 72,l 406 + 4,l 398 + 158,l 417 + 44,l 401 + 131,l 415 + 86,l 406 + 173,l 420 + 16,l 400 + 103,l 406 + 58,l 406 + 145,l 416 + 187,l 422 + 31,l 400 + 117,l 410 + 73,l 406 + 5,l 398 + 160,l 417 + 159,l 417 + 45,l 401 + 132,l 415 + 87,l 406 + 174,l 421 + 17,l 400 + 104,l 406 + 59,l 406 + 60,l 406 + 146,l 416 + 188,l 423 + 32,l 400 + 118,l 410 + 74,l 406 + 6,l 398 + 161,l 417 + 46,l 402 + 133,l 415 + 88,l 406 + 175,l 420 + 18,l 400 + 105,l 406 + 61,l 406 + 147,l 416 + 190,l 423 + 189,l 423 + 33,l 400 + 119,l 411 + 120,l 411 + 75,l 406 + 7,l 398 + 162,l 417 + 47,l 402 + 134,l 415 + 89,l 406 + 90,l 406 + 176,l 422 + 20,l 400 + 19,l 400 + 106,l 406 + 62,l 406 + 148,l 416 + 191,l 423 + 34,l 400 + 121,l 411 + 76,l 406 + 8,l 399 + 163,l 417 + 48,l 403 + 135,l 415 + 91,l 406 + 177,l 422 + 21,l 400 + 107,l 406 + 63,l 406 + 149,l 416 + 150,l 416 + 192,l 423 + 35,l 400 + 122,l 411 + 77,l 406 +} + +array set region::rules { + 122,dc 2 + 187,dc 3 + 12,dc 1 + 77,dc 2 + 114,dc 2 + 180,dc 2 + 179,dc 1 + 69,dc 1 + 70,dc 2 + 106,dc 2 + 9,dc 1 + 172,dc 6 + 62,dc 2 + 2,dc 1 + 164,dc 1 + 54,dc 1 + 156,dc 1 + 46,dc 1 + 148,dc 1 + 38,dc 1 + 141,dc 1 + 31,dc 1 + 96,dc 1 + 133,dc 1 + 23,dc 1 + 88,dc 2 + 125,dc 1 + 191,dc 1 + 15,dc 1 + 81,dc 2 + 117,dc 0 + 183,dc 2 + 73,dc 2 + 109,dc 1 + 110,dc 2 + 175,dc 3 + 65,dc 2 + 102,dc 1 + 5,dc 1 + 167,dc 1 + 57,dc 3 + 160,dc 1 + 159,dc 1 + 49,dc 1 + 50,dc 1 + 152,dc 1 + 42,dc 1 + 144,dc 1 + 34,dc 1 + 99,dc 2 + 136,dc 1 + 26,dc 1 + 92,dc 1 + 128,dc 2 + 194,dc 1 + 18,dc 1 + 84,dc 2 + 121,dc 2 + 186,dc 1 + 11,dc 1 + 76,dc 2 + 113,dc 2 + 178,dc 1 + 68,dc 1 + 105,dc 2 + 8,dc 1 + 171,dc 5 + 61,dc 2 + 1,dc 0 + 163,dc 1 + 53,dc 0 + 155,dc 1 + 45,dc 1 + 147,dc 2 + 37,dc 1 + 139,dc 1 + 140,dc 1 + 30,dc 1 + 29,dc 1 + 95,dc 2 + 132,dc 1 + 22,dc 1 + 87,dc 2 + 124,dc 1 + 190,dc 1 + 189,dc 1 + 14,dc 1 + 79,dc 2 + 80,dc 2 + 116,dc 1 + 182,dc 1 + 72,dc 1 + 108,dc 2 + 174,dc 0 + 64,dc 2 + 101,dc 2 + 4,dc 1 + 166,dc 1 + 56,dc 2 + 158,dc 1 + 48,dc 1 + 151,dc 1 + 41,dc 1 + 143,dc 1 + 33,dc 1 + 98,dc 1 + 135,dc 1 + 25,dc 1 + 91,dc 1 + 127,dc 1 + 193,dc 1 + 17,dc 1 + 83,dc 2 + 119,dc 0 + 120,dc 2 + 185,dc 1 + 10,dc 1 + 75,dc 2 + 112,dc 2 + 177,dc 1 + 67,dc 2 + 104,dc 1 + 7,dc 1 + 170,dc 5 + 169,dc 4 + 59,dc 2 + 60,dc 2 + 0,dc 1 + 162,dc 1 + 52,dc 3 + 154,dc 1 + 44,dc 1 + 146,dc 1 + 36,dc 1 + 138,dc 1 + 28,dc 1 + 94,dc 2 + 131,dc 1 + 21,dc 1 + 86,dc 2 + 123,dc 1 + 188,dc 1 + 13,dc 1 + 78,dc 2 + 115,dc 0 + 181,dc 1 + 71,dc 1 + 107,dc 2 + 173,dc 1 + 63,dc 2 + 100,dc 2 + 3,dc 1 + 165,dc 1 + 55,dc 1 + 157,dc 0 + 47,dc 1 + 149,dc 1 + 150,dc 1 + 39,dc 1 + 40,dc 1 + 142,dc 1 + 32,dc 1 + 97,dc 1 + 134,dc 1 + 24,dc 1 + 89,dc 2 + 90,dc 1 + 126,dc 1 + 192,dc 1 + 16,dc 1 + 82,dc 2 + 118,dc 1 + 184,dc 3 + 74,dc 1 + 111,dc 2 + 176,dc 1 + 66,dc 1 + 103,dc 1 + 6,dc 1 + 168,dc 1 + 58,dc 3 + 161,dc 1 + 51,dc 0 + 153,dc 1 + 43,dc 1 + 145,dc 1 + 35,dc 1 + 137,dc 1 + 27,dc 1 + 93,dc 1 + 129,dc 1 + 130,dc 1 + 195,dc 1 + 20,dc 1 + 19,dc 1 + 85,dc 2 +} + +array set region::rules { + 41,line 264 + 37,line 259 + 34,line 256 + 31,line 253 + 27,line 249 + 24,line 246 + 21,line 243 + 17,line 239 + 14,line 236 + 11,line 232 + 9,line 230 + 6,line 226 + 3,line 223 + 51,e 1 + 195,line 467 + 192,line 464 + 188,line 460 + 185,line 455 + 182,line 452 + 178,line 448 + 175,line 443 + 172,line 439 + 168,line 435 + 165,line 428 + 162,line 425 + 158,line 421 + 155,line 416 + 152,line 413 + 148,line 409 + 145,line 406 + 142,line 403 + 138,line 399 + 135,line 394 + 132,line 391 + 128,line 383 + 125,line 379 + 122,line 372 + 118,line 366 + 115,line 361 + 99,line 337 + 112,line 356 + 96,line 334 + 108,line 349 + 93,line 331 + 105,line 344 + 89,line 327 + 90,line 328 + 102,line 341 + 86,line 324 + 83,line 321 + 79,line 316 + 80,line 317 + 76,line 312 + 73,line 309 + 69,line 302 + 70,line 304 + 66,line 297 + 63,line 293 + 59,line 289 + 60,line 290 + 56,line 285 + 53,line 282 + 49,line 275 + 50,line 278 + 46,line 270 + 43,line 266 + 39,line 262 + 40,line 263 + 36,line 258 + 33,line 255 + 30,line 252 + 29,line 251 + 26,line 248 + 23,line 245 + 20,line 242 + 19,line 241 + 16,line 238 + 13,line 235 + 10,line 231 + 8,line 229 + 5,line 225 + 2,line 222 + 194,line 466 + 191,line 463 + 187,line 457 + 184,line 454 + 181,line 451 + 177,line 447 + 174,line 442 + 171,line 438 + 167,line 432 + 164,line 427 + 161,line 424 + 157,line 420 + 154,line 415 + 151,line 412 + 147,line 408 + 144,line 405 + 141,line 402 + 137,line 396 + 134,line 393 + 131,line 390 + 127,line 382 + 124,line 376 + 121,line 371 + 117,line 365 + 114,line 358 + 98,line 336 + 111,line 354 + 95,line 333 + 107,line 346 + 92,line 330 + 104,line 343 + 88,line 326 + 101,line 340 + 85,line 323 + 82,line 320 + 78,line 315 + 75,line 311 + 72,line 307 + 68,line 301 + 65,line 296 + 62,line 292 + 58,line 288 + 55,line 284 + 52,line 279 + 48,line 274 + 45,line 268 + 42,line 265 + 38,line 260 + 35,line 257 + 32,line 254 + 28,line 250 + 25,line 247 + 22,line 244 + 18,line 240 + 15,line 237 + 174,e 1 + 12,line 234 + 7,line 227 + 4,line 224 + 1,line 221 + 193,line 465 + 190,line 462 + 189,line 461 + 186,line 456 + 183,line 453 + 180,line 450 + 179,line 449 + 176,line 446 + 173,line 442 + 170,line 437 + 169,line 436 + 166,line 431 + 163,line 426 + 160,line 423 + 159,line 422 + 156,line 417 + 153,line 414 + 149,line 410 + 150,line 411 + 146,line 407 + 143,line 404 + 139,line 400 + 140,line 401 + 136,line 395 + 133,line 392 + 129,line 386 + 130,line 387 + 126,line 380 + 123,line 375 + 119,line 369 + 120,line 370 + 116,line 362 + 113,line 357 + 97,line 335 + 109,line 350 + 110,line 353 + 94,line 332 + 106,line 345 + 91,line 329 + 103,line 342 + 87,line 325 + 100,line 339 + 84,line 322 + 81,line 319 + 77,line 314 + 74,line 310 + 71,line 306 + 67,line 299 + 64,line 295 + 61,line 291 + 57,line 287 + 54,line 283 + 51,line 278 + 47,line 271 + 44,line 267 +} + +array set region::lr1_table { + 286 {{15 {0 294 295 296 297 298 299 300 305} 1}} + 66,trans {} + 35 {{72 {0 305} 1}} + 287 {{16 {0 294 295 296 297 298 299 300 305} 1}} + 85,trans {} + 36 {{83 {0 305} 1} {138 {0 305} 0} {139 {0 305} 0} {140 {0 305} 0} {141 {0 305} 0} {142 {0 305} 0} {143 {0 305} 0} {144 {0 305} 0} {145 {0 305} 0} {146 {0 305} 0} {147 {0 305} 0} {148 {0 305} 0} {149 {0 305} 0} {150 {0 305} 0} {151 {0 305} 0} {152 {0 305} 0} {153 {0 305} 0} {154 {0 305} 0} {155 {0 305} 0} {156 {0 305} 0} {157 378 0} {158 378 0} {159 378 0} {160 378 0} {161 378 0} {162 378 0} {163 378 0} {164 378 0} {165 378 0}} + 288 {{17 {0 294 295 296 297 298 299 300 305} 1}} + 37 {{62 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 300 {{29 {0 294 295 296 297 298 299 300 305} 1}} + 290 {{19 {0 294 295 296 297 298 299 300 305} 1}} + 289 {{18 {0 294 295 296 297 298 299 300 305} 1}} + 38 {{63 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 301 {{30 {0 294 295 296 297 298 299 300 305} 1}} + 291 {{20 {0 294 295 296 297 298 299 300 305} 1}} + 40 {{80 {0 305} 1} {46 {0 305} 0} {47 {0 305} 0}} + 39 {{79 {0 305} 1} {39 {0 305} 0} {40 {0 305} 0} {41 {0 305} 0} {42 {0 305} 0} {43 {0 305} 0} {44 {0 305} 0} {45 {0 305} 0}} + 302 {{31 {0 294 295 296 297 298 299 300 305} 1}} + 292 {{21 {0 294 295 296 297 298 299 300 305} 1}} + 117,trans {} + 41 {{92 {0 305} 1}} + 303 {{32 {0 294 295 296 297 298 299 300 305} 1}} + 293 {{22 {0 294 295 296 297 298 299 300 305} 1}} + 136,trans {} + 42 {{81 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 304 {{33 {0 294 295 296 297 298 299 300 305} 1}} + 294 {{23 {0 294 295 296 297 298 299 300 305} 1}} + 155,trans {} + 43 {{76 {0 305} 1} {77 {0 305} 1} {78 {0 305} 1} {8 {0 305} 0} {9 {0 305} 0} {10 {0 305} 0} {11 {0 305} 0} {12 {0 305} 0} {13 {0 305} 0} {14 {0 305} 0} {15 {0 305} 0} {16 {0 305} 0} {17 {0 305} 0} {18 {0 305} 0} {19 {0 305} 0} {20 {0 305} 0} {21 {0 305} 0} {22 {0 305} 0} {23 {0 305} 0} {24 {0 305} 0} {25 {0 305} 0} {26 {0 305} 0} {27 {0 305} 0} {28 {0 305} 0} {29 {0 305} 0} {30 {0 305} 0} {31 {0 305} 0} {32 {0 305} 0} {33 {0 305} 0} {34 {0 305} 0} {35 {0 305} 0} {36 {0 305} 0} {37 {0 305} 0} {38 {0 305} 0} {39 {0 305} 0} {40 {0 305} 0} {41 {0 305} 0} {42 {0 305} 0} {43 {0 305} 0} {44 {0 305} 0} {45 {0 305} 0}} + 305 {{34 {0 294 295 296 297 298 299 300 305} 1}} + 295 {{24 {0 294 295 296 297 298 299 300 305} 1}} + 174,trans {} + 44 {{105 {0 305} 1} {168 {0 305} 0} {169 {0 305} 0} {170 {0 305} 0} {171 {0 305} 0} {172 {0 305} 0}} + 306 {{35 {0 294 295 296 297 298 299 300 305} 1}} + 296 {{25 {0 294 295 296 297 298 299 300 305} 1}} + 203,trans {} + 193,trans {} + 45 {{102 {0 305} 1}} + 307 {{36 {0 294 295 296 297 298 299 300 305} 1}} + 297 {{26 {0 294 295 296 297 298 299 300 305} 1}} + 222,trans {} + 46 {{85 {0 305} 1}} + 308 {{37 {0 294 295 296 297 298 299 300 305} 1}} + 298 {{27 {0 294 295 296 297 298 299 300 305} 1}} + 241,trans {} + 47 {{110 {0 305 395 396 397} 1} {131 {0 305 395 396 397} 0} {132 {0 305 395 396 397} 0} {133 {0 305 395 396 397} 0} {134 {0 305 395 396 397} 0} {135 {0 305 395 396 397} 0} {136 {0 305 395 396 397} 0} {137 {0 305 395 396 397} 0}} + 310 {{170 {0 305} 5} {172 {0 305} 5} {39 {0 305} 0} {40 {0 305} 0} {41 {0 305} 0} {42 {0 305} 0} {43 {0 305} 0} {44 {0 305} 0} {45 {0 305} 0}} + 309 {{38 {0 294 295 296 297 298 299 300 305} 1}} + 299 {{28 {0 294 295 296 297 298 299 300 305} 1}} + 260,trans {} + 259,trans {{319 269} {323 270} {327 271} {334 272} {339 273} {348 274} {352 275} {360 276} {423 277}} + 48 {{111 {0 305 395 396 397} 1} {112 {0 305 395 396 397} 1} {113 {0 305 395 396 397} 1} {8 {0 305 395 396 397} 0} {9 {0 305 395 396 397} 0} {10 {0 305 395 396 397} 0} {11 {0 305 395 396 397} 0} {12 {0 305 395 396 397} 0} {13 {0 305 395 396 397} 0} {14 {0 305 395 396 397} 0} {15 {0 305 395 396 397} 0} {16 {0 305 395 396 397} 0} {17 {0 305 395 396 397} 0} {18 {0 305 395 396 397} 0} {19 {0 305 395 396 397} 0} {20 {0 305 395 396 397} 0} {21 {0 305 395 396 397} 0} {22 {0 305 395 396 397} 0} {23 {0 305 395 396 397} 0} {24 {0 305 395 396 397} 0} {25 {0 305 395 396 397} 0} {26 {0 305 395 396 397} 0} {27 {0 305 395 396 397} 0} {28 {0 305 395 396 397} 0} {29 {0 305 395 396 397} 0} {30 {0 305 395 396 397} 0} {31 {0 305 395 396 397} 0} {32 {0 305 395 396 397} 0} {33 {0 305 395 396 397} 0} {34 {0 305 395 396 397} 0} {35 {0 305 395 396 397} 0} {36 {0 305 395 396 397} 0} {37 {0 305 395 396 397} 0} {38 {0 305 395 396 397} 0} {39 {0 305 395 396 397} 0} {40 {0 305 395 396 397} 0} {41 {0 305 395 396 397} 0} {42 {0 305 395 396 397} 0} {43 {0 305 395 396 397} 0} {44 {0 305 395 396 397} 0} {45 {0 305 395 396 397} 0}} + 311 {{171 {0 305} 5}} + 278,trans {} + 49 {{114 {0 305 395 396 397} 1} {39 {0 305 395 396 397} 0} {40 {0 305 395 396 397} 0} {41 {0 305 395 396 397} 0} {42 {0 305 395 396 397} 0} {43 {0 305 395 396 397} 0} {44 {0 305 395 396 397} 0} {45 {0 305 395 396 397} 0}} + 50 {{0 0 1}} + 27,trans {} + 312 {{172 {0 305} 6}} + 307,trans {} + 297,trans {} + 46,trans {{303 185}} + 51 {{50 0 1} {52 0 1} {51 305 0}} + 65,trans {} + 52 {{54 {0 305} 1} {108 {0 305 395 396 397} 1} {110 {0 305 395 396 397} 0} {111 {0 305 395 396 397} 0} {112 {0 305 395 396 397} 0} {113 {0 305 395 396 397} 0} {114 {0 305 395 396 397} 0}} + 84,trans {} + 53 {{109 {0 305 395 396 397} 1}} + 54 {{56 {0 305} 2} {108 {0 305 395 396 397} 1} {110 {0 305 395 396 397} 0} {111 {0 305 395 396 397} 0} {112 {0 305 395 396 397} 0} {113 {0 305 395 396 397} 0} {114 {0 305 395 396 397} 0}} + 55 {{2 {0 305} 1}} + 56 {{5 {0 305} 1}} + 116,trans {} + 57 {{3 {0 305} 1}} + 135,trans {} + 58 {{6 {0 305} 1}} + 154,trans {} + 59 {{4 {0 305} 1}} + 60 {{7 {0 305} 1}} + 173,trans {} + 61 {{65 {0 305} 2}} + 202,trans {} + 192,trans {} + 62 {{120 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 221,trans {} + 63 {{122 {0 305} 1}} + 240,trans {} + 239,trans {} + 64 {{121 {0 305} 1} {48 {0 305} 0} {49 {0 305} 0}} + 258,trans {} + 65 {{64 {0 305} 2}} + 277,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 282}} + 66 {{84 {0 305} 2}} + 26,trans {{310 95} {330 96} {412 97}} + 306,trans {} + 296,trans {} + 45,trans {} + 67 {{107 {0 305} 2}} + 64,trans {{303 240} {304 241} {403 242}} + 68 {{129 {0 305} 1}} + 83,trans {} + 69 {{130 {0 305} 1}} + 70 {{89 {0 305} 2}} + 71 {{73 {0 305} 2}} + 72 {{167 {0 305} 1}} + 73 {{166 {0 305} 1}} + 115,trans {} + 74 {{82 {0 305} 2}} + 134,trans {} + 75 {{87 {0 305} 2}} + 153,trans {} + 76 {{61 {0 305} 2}} + 172,trans {{378 247}} + 77 {{116 305 1}} + 201,trans {} + 191,trans {} + 78 {{58 {0 305} 2}} + 220,trans {} + 219,trans {} + 79 {{86 {0 305} 2}} + 80 {{131 {0 305} 1}} + 238,trans {} + 81 {{132 {0 305} 1}} + 257,trans {} + 82 {{133 {0 305} 1}} + 276,trans {} + 83 {{134 {0 305} 1}} + 25,trans {{306 77} {409 94}} + 305,trans {} + 295,trans {} + 44,trans {{305 183} {419 184}} + 84 {{135 {0 305} 1}} + 63,trans {{303 239}} + 85 {{136 {0 305} 1}} + 82,trans {} + 86 {{137 {0 305} 1}} + 87 {{75 {0 305} 2}} + 0 {{0 0 0} {50 0 0} {52 0 0} {53 {0 305} 0} {54 {0 305} 0} {55 {0 305} 0} {56 {0 305} 0} {57 {0 305} 0} {58 {0 305} 0} {59 {0 305} 0} {60 {0 305} 0} {61 {0 305} 0} {62 {0 305} 0} {63 {0 305} 0} {64 {0 305} 0} {65 {0 305} 0} {66 {0 305} 0} {67 {0 305} 0} {68 {0 305} 0} {69 {0 305} 0} {70 {0 305} 0} {71 {0 305} 0} {72 {0 305} 0} {73 {0 305} 0} {74 {0 305} 0} {75 {0 305} 0} {76 {0 305} 0} {77 {0 305} 0} {78 {0 305} 0} {79 {0 305} 0} {80 {0 305} 0} {81 {0 305} 0} {82 {0 305} 0} {83 {0 305} 0} {84 {0 305} 0} {85 {0 305} 0} {86 {0 305} 0} {87 {0 305} 0} {88 {0 305} 0} {89 {0 305} 0} {90 {0 305} 0} {91 {0 305} 0} {92 {0 305} 0} {93 {0 305} 0} {94 {0 305} 0} {95 {0 305} 0} {96 {0 305} 0} {97 {0 305} 0} {98 {0 305} 0} {99 {0 305} 0} {100 {0 305} 0} {101 {0 305} 0} {102 {0 305} 0} {103 {0 305} 0} {104 {0 305} 0} {105 {0 305} 0} {106 {0 305} 0} {107 {0 305} 0} {108 {0 305 395 396 397} 0} {109 {0 305 395 396 397} 0} {110 {0 305 395 396 397} 0} {111 {0 305 395 396 397} 0} {112 {0 305 395 396 397} 0} {113 {0 305 395 396 397} 0} {114 {0 305 395 396 397} 0}} + 88 {{175 {0 305} 1} {174 {314 317 318 319 328 339 340 341 342 346 352 365} 0}} + 1 {{55 {0 305} 1} {56 {0 305} 1} {108 {0 305 395 396 397} 0} {109 {0 305 395 396 397} 0} {110 {0 305 395 396 397} 0} {111 {0 305 395 396 397} 0} {112 {0 305 395 396 397} 0} {113 {0 305 395 396 397} 0} {114 {0 305 395 396 397} 0}} + 89 {{173 {0 305} 1}} + 90 {{95 {0 305} 2}} + 114,trans {} + 2 {{65 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 91 {{94 {0 305} 2}} + 133,trans {} + 3 {{93 {0 305} 1}} + 92 {{118 {0 305} 1}} + 152,trans {} + 4 {{64 {0 305} 1} {119 {0 305} 0} {120 {0 305} 0} {121 {0 305} 0} {122 {0 305} 0}} + 93 {{60 {0 305} 2}} + 171,trans {} + 5 {{84 {0 305} 1}} + 94 {{57 {0 305} 2}} + 200,trans {} + 190,trans {} + 189,trans {} + 6 {{107 {0 305} 1}} + 95 {{124 {0 305} 1}} + 218,trans {} + 7 {{103 {0 305} 1}} + 96 {{123 {0 305} 1}} + 237,trans {} + 8 {{96 {0 305} 1}} + 97 {{67 {0 305} 2}} + 256,trans {} + 9 {{97 {0 305} 1}} + 98 {{8 {0 305} 1}} + 275,trans {} + 24,trans {{313 92} {410 93}} + 99 {{9 {0 305} 1}} + 304,trans {} + 294,trans {} + 43,trans {{263 98} {264 99} {265 100} {266 101} {267 102} {268 103} {269 104} {270 105} {271 106} {272 107} {273 108} {274 109} {275 110} {276 111} {277 112} {278 113} {279 114} {280 115} {281 116} {282 117} {283 118} {284 119} {285 120} {286 121} {287 122} {288 123} {289 124} {290 125} {291 126} {292 127} {293 128} {294 129} {295 130} {296 131} {297 132} {298 133} {299 134} {300 135} {399 180} {400 181} {401 182}} + 62,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 238}} + 81,trans {} + 99,trans {} + 113,trans {} + 132,trans {} + 151,trans {} + 170,trans {} + 169,trans {} + 188,trans {} + 217,trans {} + 236,trans {{305 249}} + 255,trans {{303 268}} + 274,trans {} + 23,trans {} + 303,trans {} + 293,trans {} + 42,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 179}} + 61,trans {} + 80,trans {} + 79,trans {} + 98,trans {} + 9,trans {} + 112,trans {} + 131,trans {} + 150,trans {} + 149,trans {} + 168,trans {} + 187,trans {} + 216,trans {} + 235,trans {} + 254,trans {{305 267}} + 273,trans {} + 22,trans {{305 88} {342 89} {420 91}} + 302,trans {} + 292,trans {} + 41,trans {} + 60,trans {} + 59,trans {} + 78,trans {{305 243}} + 97,trans {} + 8,trans {} + 111,trans {} + 130,trans {} + 129,trans {} + 148,trans {} + 100 {{10 {0 305} 1}} + 167,trans {} + 101 {{11 {0 305} 1}} + 186,trans {} + 102 {{12 {0 305} 1}} + 215,trans {} + 103 {{13 {0 305} 1}} + 234,trans {} + 104 {{14 {0 305} 1}} + 253,trans {} + 105 {{15 {0 305} 1}} + 272,trans {} + 21,trans {{305 88} {342 89} {420 90}} + 106 {{16 {0 305} 1}} + 301,trans {} + 291,trans {} + 40,trans {{301 176} {302 177} {402 178}} + 39,trans {{294 129} {295 130} {296 131} {297 132} {298 133} {299 134} {300 135} {401 175}} + 107 {{17 {0 305} 1}} + 58,trans {} + 108 {{18 {0 305} 1}} + 77,trans {} + 109 {{19 {0 305} 1}} + 110 {{20 {0 305} 1}} + 96,trans {} + 7,trans {} + 111 {{21 {0 305} 1}} + 112 {{22 {0 305} 1}} + 113 {{23 {0 305} 1}} + 110,trans {} + 109,trans {} + 114 {{24 {0 305} 1}} + 128,trans {} + 115 {{25 {0 305} 1}} + 147,trans {} + 116 {{26 {0 305} 1}} + 166,trans {} + 117 {{27 {0 305} 1}} + 185,trans {} + 118 {{28 {0 305} 1}} + 214,trans {} + 119 {{29 {0 305} 1}} + 120 {{30 {0 305} 1}} + 233,trans {} + 121 {{31 {0 305} 1}} + 252,trans {} + 122 {{32 {0 305} 1}} + 271,trans {} + 19,trans {{367 80} {368 81} {369 82} {370 83} {371 84} {372 85} {373 86} {415 87}} + 20,trans {} + 123 {{33 {0 305} 1}} + 300,trans {} + 290,trans {} + 289,trans {} + 38,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 174}} + 124 {{34 {0 305} 1}} + 57,trans {} + 125 {{35 {0 305} 1}} + 76,trans {} + 126 {{36 {0 305} 1}} + 95,trans {} + 6,trans {{305 67}} + 127 {{37 {0 305} 1}} + 128 {{38 {0 305} 1}} + 129 {{39 {0 305} 1}} + 130 {{40 {0 305} 1}} + 108,trans {} + 131 {{41 {0 305} 1}} + 127,trans {} + 132 {{42 {0 305} 1}} + 146,trans {} + 133 {{43 {0 305} 1}} + 165,trans {} + 134 {{44 {0 305} 1}} + 184,trans {} + 135 {{45 {0 305} 1}} + 213,trans {} + 136 {{99 {0 305} 2}} + 232,trans {} + 137 {{100 {0 305} 2}} + 251,trans {} + 138 {{101 {0 305} 2}} + 270,trans {} + 269,trans {} + 18,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 79}} + 139 {{88 {0 305} 2}} + 140 {{59 {0 305} 2}} + 288,trans {} + 37,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 173}} + 141 {{106 {0 305} 2}} + 56,trans {} + 142 {{125 {0 305} 1}} + 75,trans {} + 143 {{128 {0 305} 1}} + 94,trans {{305 245}} + 5,trans {{305 66}} + 144 {{127 {0 305} 1}} + 145 {{126 {0 305} 1}} + 146 {{70 {0 305} 2}} + 107,trans {} + 147 {{162 378 1}} + 126,trans {} + 148 {{163 378 1}} + 145,trans {} + 149 {{156 {0 305} 1}} + 150 {{145 {0 305} 1}} + 164,trans {} + 151 {{138 {0 305} 1} {158 378 1}} + 183,trans {{307 248}} + 152 {{139 {0 305} 1}} + 212,trans {} + 153 {{140 {0 305} 1} {159 378 1}} + 231,trans {} + 154 {{141 {0 305} 1}} + 250,trans {{305 266}} + 249,trans {} + 155 {{142 {0 305} 1}} + 268,trans {{303 281}} + 156 {{143 {0 305} 1}} + 17,trans {{306 77} {409 78}} + 287,trans {} + 36,trans {{X 147} {x 148} {316 149} {351 150} {374 151} {375 152} {376 153} {377 154} {379 155} {380 156} {381 157} {382 158} {383 159} {384 160} {385 161} {386 162} {387 163} {388 164} {389 165} {390 166} {391 167} {392 168} {393 169} {394 170} {416 171} {417 172}} + 157 {{146 {0 305} 1}} + 55,trans {} + 158 {{148 {0 305} 1}} + 74,trans {} + 160 {{144 {0 305} 1}} + 159 {{149 {0 305} 1}} + 93,trans {} + 161 {{150 {0 305} 1}} + 4,trans {{308 62} {336 63} {347 64} {411 65}} + 162 {{151 {0 305} 1}} + 163 {{152 {0 305} 1}} + 106,trans {} + 164 {{153 {0 305} 1}} + 125,trans {} + 165 {{154 {0 305} 1}} + 144,trans {} + 166 {{155 {0 305} 1}} + 163,trans {} + 167 {{160 378 1}} + 182,trans {} + 168 {{161 378 1}} + 211,trans {} + 170 {{165 378 1}} + 169 {{164 378 1}} + 230,trans {} + 229,trans {} + 171 {{83 {0 305} 2}} + 248,trans {{303 263} {304 264} {403 265}} + 172 {{147 {0 305} 1}} + 267,trans {} + 173 {{62 {0 305} 2}} + 16,trans {} + 286,trans {} + 174 {{63 {0 305} 2}} + 35,trans {} + 54,trans {{395 47} {396 48} {397 49} {408 237}} + 175 {{79 {0 305} 2}} + 73,trans {} + 176 {{46 {0 305} 1}} + 92,trans {} + 177 {{47 {0 305} 1}} + 3,trans {} + 178 {{80 {0 305} 2}} + 180 {{76 {0 305} 2}} + 179 {{81 {0 305} 2}} + 105,trans {} + 181 {{77 {0 305} 2}} + 124,trans {} + 182 {{78 {0 305} 2}} + 143,trans {{305 246}} + 183 {{168 {0 305} 1} {169 {0 305} 1} {170 {0 305} 1} {171 {0 305} 1} {172 {0 305} 1}} + 162,trans {} + 184 {{105 {0 305} 2}} + 181,trans {} + 185 {{85 {0 305} 2}} + 210,trans {} + 209,trans {} + 199,trans {} + 186 {{131 {0 305 395 396 397} 1}} + 228,trans {} + 187 {{132 {0 305 395 396 397} 1}} + 247,trans {} + 188 {{133 {0 305 395 396 397} 1}} + 266,trans {} + 200 {{14 {0 305 395 396 397} 1}} + 190 {{135 {0 305 395 396 397} 1}} + 189 {{134 {0 305 395 396 397} 1}} + 15,trans {{303 76}} + 285,trans {} + 201 {{15 {0 305 395 396 397} 1}} + 191 {{136 {0 305 395 396 397} 1}} + 34,trans {} + 53,trans {} + 202 {{16 {0 305 395 396 397} 1}} + 192 {{137 {0 305 395 396 397} 1}} + 72,trans {} + 203 {{17 {0 305 395 396 397} 1}} + 193 {{110 {0 305 395 396 397} 2}} + 91,trans {} + 204 {{18 {0 305 395 396 397} 1}} + 194 {{8 {0 305 395 396 397} 1}} + 2,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 61}} + 205 {{19 {0 305 395 396 397} 1}} + 195 {{9 {0 305 395 396 397} 1}} + 206 {{20 {0 305 395 396 397} 1}} + 196 {{10 {0 305 395 396 397} 1}} + 104,trans {} + 207 {{21 {0 305 395 396 397} 1}} + 197 {{11 {0 305 395 396 397} 1}} + 123,trans {} + 208 {{22 {0 305 395 396 397} 1}} + 198 {{12 {0 305 395 396 397} 1}} + 142,trans {} + 210 {{24 {0 305 395 396 397} 1}} + 209 {{23 {0 305 395 396 397} 1}} + 199 {{13 {0 305 395 396 397} 1}} + 161,trans {} + 211 {{25 {0 305 395 396 397} 1}} + 180,trans {} + 179,trans {} + 212 {{26 {0 305 395 396 397} 1}} + 208,trans {} + 198,trans {} + 213 {{27 {0 305 395 396 397} 1}} + 227,trans {} + 214 {{28 {0 305 395 396 397} 1}} + 246,trans {} + 215 {{29 {0 305 395 396 397} 1}} + 265,trans {{303 278} {304 279} {403 280}} + 216 {{30 {0 305 395 396 397} 1}} + 14,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 75}} + 284,trans {} + 217 {{31 {0 305 395 396 397} 1}} + 33,trans {{306 142} {332 143} {335 144} {344 145} {413 146}} + 52,trans {{395 47} {396 48} {397 49} {408 237}} + 218 {{32 {0 305 395 396 397} 1}} + 71,trans {} + 220 {{34 {0 305 395 396 397} 1}} + 219 {{33 {0 305 395 396 397} 1}} + 90,trans {} + 89,trans {} + 221 {{35 {0 305 395 396 397} 1}} + 1,trans {{395 47} {396 48} {397 49} {407 54} {408 53}} + 222 {{36 {0 305 395 396 397} 1}} + 223 {{37 {0 305 395 396 397} 1}} + 103,trans {} + 224 {{38 {0 305 395 396 397} 1}} + 122,trans {} + 225 {{39 {0 305 395 396 397} 1}} + 141,trans {} + 226 {{40 {0 305 395 396 397} 1}} + 160,trans {} + 159,trans {} + 227 {{41 {0 305 395 396 397} 1}} + 178,trans {} + 228 {{42 {0 305 395 396 397} 1}} + 207,trans {} + 197,trans {} + 230 {{44 {0 305 395 396 397} 1}} + 229 {{43 {0 305 395 396 397} 1}} + 226,trans {} + 231 {{45 {0 305 395 396 397} 1}} + 245,trans {} + 232 {{111 {0 305 395 396 397} 2}} + 264,trans {} + 233 {{112 {0 305 395 396 397} 2}} + 13,trans {} + 283,trans {} + 234 {{113 {0 305 395 396 397} 2}} + 32,trans {{305 141}} + 312,trans {} + 51,trans {{405 236}} + 235 {{114 {0 305 395 396 397} 2}} + 70,trans {} + 69,trans {} + 236 {{52 0 2}} + 88,trans {{421 244}} + 237 {{108 {0 305 395 396 397} 2}} + 0,trans {{305 1} {309 2} {311 3} {312 4} {314 5} {315 6} {316 7} {317 8} {318 9} {319 10} {320 11} {321 12} {322 13} {323 14} {324 15} {325 16} {326 17} {327 18} {329 19} {331 20} {332 21} {333 22} {334 23} {337 24} {338 25} {339 26} {340 27} {341 28} {345 29} {348 30} {349 31} {350 32} {352 33} {353 34} {354 35} {355 36} {356 37} {357 38} {358 39} {359 40} {360 41} {361 42} {362 43} {363 44} {364 45} {366 46} {395 47} {396 48} {397 49} {404 50} {406 51} {407 52} {408 53}} + 238 {{120 {0 305} 2}} + 240 {{48 {0 305} 1}} + 239 {{122 {0 305} 2}} + 102,trans {} + 241 {{49 {0 305} 1}} + 121,trans {} + 242 {{121 {0 305} 2}} + 140,trans {} + 139,trans {} + 243 {{58 {0 305} 3}} + 158,trans {} + 244 {{175 {0 305} 2} {176 {0 305} 0} {177 {0 305} 0} {178 {0 305} 0} {179 {0 305} 0} {180 {0 305} 0} {181 {0 305} 0} {182 {0 305} 0} {183 {0 305} 0} {184 {0 305} 0} {185 {0 305} 0} {186 {0 305} 0} {187 {0 305} 0}} + 177,trans {} + 245 {{57 {0 305} 3}} + 206,trans {} + 196,trans {} + 246 {{128 {0 305} 2}} + 225,trans {} + 247 {{147 {0 305} 2}} + 244,trans {{314 250} {317 251} {318 252} {319 253} {328 254} {339 255} {340 256} {341 257} {342 258} {346 259} {352 260} {365 261} {422 262}} + 248 {{169 {0 305} 2} {170 {0 305} 2} {171 {0 305} 2} {172 {0 305} 2} {48 {303 304} 0} {49 {303 304} 0}} + 263,trans {} + 250 {{180 {0 305} 1}} + 249 {{52 0 3}} + 12,trans {{305 72} {343 73} {418 74}} + 282,trans {} + 251 {{181 {0 305} 1}} + 31,trans {{305 140}} + 311,trans {} + 252 {{182 {0 305} 1}} + 50,trans {} + 49,trans {{294 225} {295 226} {296 227} {297 228} {298 229} {299 230} {300 231} {401 235}} + 253 {{178 {0 305} 1}} + 68,trans {} + 254 {{183 {0 305} 1}} + 87,trans {} + 255 {{184 {0 305} 1}} + 256 {{186 {0 305} 1}} + 257 {{185 {0 305} 1}} + 101,trans {} + 258 {{176 {0 305} 1}} + 120,trans {} + 119,trans {} + 260 {{179 {0 305} 1}} + 259 {{187 {0 305} 1} {188 {0 257 258 259 260 261 262} 0} {189 {0 257 258 259 260 261 262} 0} {190 {0 257 258 259 260 261 262} 0} {191 {0 257 258 259 260 261 262} 0} {192 {0 257 258 259 260 261 262} 0} {193 {0 257 258 259 260 261 262} 0} {194 {0 257 258 259 260 261 262} 0} {195 {0 257 258 259 260 261 262} 0}} + 138,trans {} + 261 {{177 {0 305} 1}} + 157,trans {} + 10 {{73 {0 305} 1} {89 {0 305} 1} {129 {0 305} 0} {130 {0 305} 0} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 262 {{175 {0 305} 3}} + 176,trans {} + 11 {{74 {0 305} 1}} + 263 {{48 {303 304} 1}} + 205,trans {} + 195,trans {} + 12 {{82 {0 305} 1} {166 {0 305} 0} {167 {0 305} 0}} + 264 {{49 {303 304} 1}} + 224,trans {} + 13 {{104 {0 305} 1}} + 265 {{169 {0 305} 3} {170 {0 305} 3} {171 {0 305} 3} {172 {0 305} 3} {48 {0 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 305} 0} {49 {0 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 305} 0}} + 243,trans {} + 14 {{87 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 262,trans {} + 266 {{180 {0 305} 2}} + 15 {{61 {0 305} 1}} + 11,trans {} + 281,trans {} + 267 {{183 {0 305} 2}} + 16 {{91 {0 305} 1}} + 29,trans {{263 98} {264 99} {265 100} {266 101} {267 102} {268 103} {269 104} {270 105} {271 106} {272 107} {273 108} {274 109} {275 110} {276 111} {277 112} {278 113} {279 114} {280 115} {281 116} {282 117} {283 118} {284 119} {285 120} {286 121} {287 122} {288 123} {289 124} {290 125} {291 126} {292 127} {293 128} {294 129} {295 130} {296 131} {297 132} {298 133} {299 134} {300 135} {399 136} {400 137} {401 138}} + 30,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {398 139}} + 310,trans {{294 129} {295 130} {296 131} {297 132} {298 133} {299 134} {300 135} {401 312}} + 309,trans {} + 299,trans {} + 268 {{184 {0 305} 2}} + 48,trans {{263 194} {264 195} {265 196} {266 197} {267 198} {268 199} {269 200} {270 201} {271 202} {272 203} {273 204} {274 205} {275 206} {276 207} {277 208} {278 209} {279 210} {280 211} {281 212} {282 213} {283 214} {284 215} {285 216} {286 217} {287 218} {288 219} {289 220} {290 221} {291 222} {292 223} {293 224} {294 225} {295 226} {296 227} {297 228} {298 229} {299 230} {300 231} {399 232} {400 233} {401 234}} + 17 {{58 {0 305} 1} {115 305 0} {116 305 0}} + 270 {{189 {0 257 258 259 260 261 262} 1}} + 269 {{192 {0 257 258 259 260 261 262} 1}} + 67,trans {} + 18 {{86 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 271 {{193 {0 257 258 259 260 261 262} 1}} + 86,trans {} + 20 {{66 {0 305} 1}} + 19 {{75 {0 305} 1} {131 {0 305} 0} {132 {0 305} 0} {133 {0 305} 0} {134 {0 305} 0} {135 {0 305} 0} {136 {0 305} 0} {137 {0 305} 0}} + 272 {{194 {0 257 258 259 260 261 262} 1}} + 21 {{95 {0 305} 1} {173 {0 305} 0} {175 {0 305} 0}} + 273 {{190 {0 257 258 259 260 261 262} 1}} + 22 {{94 {0 305} 1} {173 {0 305} 0} {175 {0 305} 0}} + 274 {{191 {0 257 258 259 260 261 262} 1}} + 100,trans {} + 23 {{90 {0 305} 1}} + 275 {{188 {0 257 258 259 260 261 262} 1}} + 118,trans {} + 24 {{60 {0 305} 1} {117 {0 305} 0} {118 {0 305} 0}} + 276 {{195 {0 257 258 259 260 261 262} 1}} + 137,trans {} + 25 {{57 {0 305} 1} {115 305 0} {116 305 0}} + 277 {{187 {0 305} 2} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 156,trans {} + 26 {{67 {0 305} 1} {123 {0 305} 0} {124 {0 305} 0}} + 278 {{48 {0 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 305} 1}} + 175,trans {} + 27 {{69 {0 305} 1}} + 280 {{169 {0 305} 4} {170 {0 305} 4} {171 {0 305} 4} {172 {0 305} 4} {12 {0 294 295 296 297 298 299 300 305} 0} {13 {0 294 295 296 297 298 299 300 305} 0} {14 {0 294 295 296 297 298 299 300 305} 0} {15 {0 294 295 296 297 298 299 300 305} 0} {16 {0 294 295 296 297 298 299 300 305} 0} {17 {0 294 295 296 297 298 299 300 305} 0} {18 {0 294 295 296 297 298 299 300 305} 0} {19 {0 294 295 296 297 298 299 300 305} 0} {20 {0 294 295 296 297 298 299 300 305} 0} {21 {0 294 295 296 297 298 299 300 305} 0} {22 {0 294 295 296 297 298 299 300 305} 0} {23 {0 294 295 296 297 298 299 300 305} 0} {24 {0 294 295 296 297 298 299 300 305} 0} {25 {0 294 295 296 297 298 299 300 305} 0} {26 {0 294 295 296 297 298 299 300 305} 0} {27 {0 294 295 296 297 298 299 300 305} 0} {28 {0 294 295 296 297 298 299 300 305} 0} {29 {0 294 295 296 297 298 299 300 305} 0} {30 {0 294 295 296 297 298 299 300 305} 0} {31 {0 294 295 296 297 298 299 300 305} 0} {32 {0 294 295 296 297 298 299 300 305} 0} {33 {0 294 295 296 297 298 299 300 305} 0} {34 {0 294 295 296 297 298 299 300 305} 0} {35 {0 294 295 296 297 298 299 300 305} 0} {36 {0 294 295 296 297 298 299 300 305} 0} {37 {0 294 295 296 297 298 299 300 305} 0} {38 {0 294 295 296 297 298 299 300 305} 0} {39 {0 305} 0} {40 {0 305} 0} {41 {0 305} 0} {42 {0 305} 0} {43 {0 305} 0} {44 {0 305} 0} {45 {0 305} 0}} + 279 {{49 {0 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 305} 1}} + 204,trans {} + 194,trans {} + 28 {{68 {0 305} 1}} + 281 {{184 {0 305} 3}} + 223,trans {} + 30 {{88 {0 305} 1} {1 {0 305} 0} {2 {0 305} 0} {3 {0 305} 0} {4 {0 305} 0} {5 {0 305} 0} {6 {0 305} 0} {7 {0 305} 0}} + 29 {{98 {0 305} 1} {99 {0 305} 1} {100 {0 305} 1} {101 {0 305} 1} {8 {0 305} 0} {9 {0 305} 0} {10 {0 305} 0} {11 {0 305} 0} {12 {0 305} 0} {13 {0 305} 0} {14 {0 305} 0} {15 {0 305} 0} {16 {0 305} 0} {17 {0 305} 0} {18 {0 305} 0} {19 {0 305} 0} {20 {0 305} 0} {21 {0 305} 0} {22 {0 305} 0} {23 {0 305} 0} {24 {0 305} 0} {25 {0 305} 0} {26 {0 305} 0} {27 {0 305} 0} {28 {0 305} 0} {29 {0 305} 0} {30 {0 305} 0} {31 {0 305} 0} {32 {0 305} 0} {33 {0 305} 0} {34 {0 305} 0} {35 {0 305} 0} {36 {0 305} 0} {37 {0 305} 0} {38 {0 305} 0} {39 {0 305} 0} {40 {0 305} 0} {41 {0 305} 0} {42 {0 305} 0} {43 {0 305} 0} {44 {0 305} 0} {45 {0 305} 0}} + 282 {{187 {0 305} 3}} + 242,trans {} + 31 {{59 {0 305} 1}} + 283 {{12 {0 294 295 296 297 298 299 300 305} 1}} + 261,trans {} + 32 {{106 {0 305} 1}} + 10,trans {{257 55} {258 56} {259 57} {260 58} {261 59} {262 60} {306 68} {352 69} {398 70} {414 71}} + 280,trans {{267 283} {268 284} {269 285} {270 286} {271 287} {272 288} {273 289} {274 290} {275 291} {276 292} {277 293} {278 294} {279 295} {280 296} {281 297} {282 298} {283 299} {284 300} {285 301} {286 302} {287 303} {288 304} {289 305} {290 306} {291 307} {292 308} {293 309} {294 129} {295 130} {296 131} {297 132} {298 133} {299 134} {300 135} {400 310} {401 311}} + 284 {{13 {0 294 295 296 297 298 299 300 305} 1}} + 279,trans {} + 33 {{70 {0 305} 1} {125 {0 305} 0} {126 {0 305} 0} {127 {0 305} 0} {128 {0 305} 0}} + 28,trans {} + 308,trans {} + 298,trans {} + 285 {{14 {0 294 295 296 297 298 299 300 305} 1}} + 47,trans {{367 186} {368 187} {369 188} {370 189} {371 190} {372 191} {373 192} {415 193}} + 34 {{71 {0 305} 1}} +} + +array set region::token_id_table { + 286 WCSS_ + 286,t 0 + 287 WCST_ + 292,line 44 + 302,line 56 + 415,t 1 + 288 WCSU_ + 357,line 116 + 317,t 0 + 265,title AMPLIFIER + 289 WCSV_ + 290 WCSW_ + 300 ECLIPTIC_ + 284,title WCSQ + 291 WCSX_ + 301 DEGREES_ + 423,line 459 + 313,title CLOSE + 292 WCSY_ + 302 SEXAGESIMAL_ + 338,t 0 + 332,title GROUP + 288,line 40 + 293 WCSZ_ + 303 INT_ + 351,title SEGMENT + 294 FK4_ + 304 REAL_ + 370,title SAOTNG + 369,title CIAO + 354,line 113 + 305 STRING_ + 295 B1950_ + 388,title PANDA + 360,t 0 + 359,t 0 + 306 ALL_ + 296 FK5_ + 420,line 441 + 419,line 434 + 417,title {} + 307 AT_ + 262,t 0 + 297 J2000_ + 308 AUTO_ + 285,line 37 + 298 ICRS_ + 381,t 0 + 310 BACK_ + 309 AUTOCENTROID_ + 299 GALACTIC_ + 351,line 110 + 311 BACKGROUND_ + 283,t 0 + 312 CENTROID_ + 416,line 398 + 412,t 1 + 313 CLOSE_ + 314,t 0 + 314 COLOR_ + 282,line 34 + 315 COMMAND_ + 347,line 106 + 316 COMPOSITE_ + 264,title PHYSICAL + 335,t 0 + 317 COPY_ + 283,title WCSP + 413,line 378 + 318 CUT_ + 312,title CENTROID + 331,title GETINFO + 320 DELETEALL_ + 319 DELETE_ + 278,line 30 + error,line 219 + 356,t 0 + 350,title SAVETEMPLATE + 349,title SAVE + 321 DELIM_ + 368,title XML + 344,line 103 + 322 DISSOLVE_ + 258,t 0 + 387,title BOXANNULUS + 323 EDIT_ + 416,title {} + 410,line 364 + 409,line 360 + 399,line 228 + 377,t 0 + 324 EPSILON_ + 325 EXCLUDE_ + 275,line 27 + 279,t 0 + 280,t 0 + 326 FILE_ + 408,t 1 + 398,t 1 + 341,line 100 + 327 FIXED_ + 328 FONT_ + 311,t 0 + 406,line 281 + 396,line 159 + 330 FRONT_ + 329 FORMAT_ + 331 GETINFO_ + 272,line 24 + 332,t 0 + 332 GROUP_ + 337,line 96 + 333 GROUPS_ + 263,title IMAGE + 334 INCLUDE_ + 282,title WCSO + 403,line 273 + 393,line 155 + 353,t 0 + 335 INVERT_ + 311,title BACKGROUND + 336 ITERATION_ + 330,title FRONT + 329,title FORMAT + 268,line 20 + 348,title ROTATE + 337 LIST_ + 374,t 0 + 367,title DS9 + 338 LOAD_ + 334,line 93 + 386,title ELLIPSEANNULUS + 340 MOVEBACK_ + 339 MOVE_ + 276,t 0 + 415,title {} + 400,line 233 + 390,line 151 + 389,line 150 + 341 MOVEFRONT_ + 405,t 1 + 395,t 0 + 342 NEW_ + 265,line 16 + 343 NL_ + 307,t 0 + 297,t 0 + 344 NONE_ + 331,line 90 + 345 PASTE_ + 386,line 147 + 346 PROPERTY_ + 328,t 0 + 347 RADIUS_ + 262,line 12 + 348 ROTATE_ + 0,t 0 + 0 {$} + 350,t 0 + 350 SAVETEMPLATE_ + 349,t 0 + 349 SAVE_ + 327,line 86 + 262,title FALSE + 351 SEGMENT_ + 281,title WCSN + error,t 0 + 383,line 144 + 352 SELECT_ + 310,title BACK + 309,title AUTOCENTROID + 299,title GALACTIC + 371,t 0 + 353 SELECTALL_ + 328,title FONT + 258,line 8 + 354 SELECTNONE_ + 347,title RADIUS + 273,t 0 + 366,title WIDTH + 355 SHAPE_ + 324,line 83 + 402,t 1 + 392,t 0 + 385,title ANNULUS + 356 SHOW_ + 414,title {} + 380,line 141 + 379,line 140 + 357 SHOWTEXT_ + 294,t 0 + 304,t 0 + 358 SKY_ + 423,t 1 + 360 SOURCE_ + 359 SKYFORMAT_ + 361 STRIP_ + 325,t 0 + 321,line 80 + 362 SYSTEM_ + 376,line 137 + 363 TEMPLATE_ + 364 UNDO_ + 346,t 0 + 365 UPDATE_ + 366 WIDTH_ + 317,line 76 + 261,title TRUE + 367,t 0 + 367 DS9_ + 279,title WCSL + 280,title WCSM + 373,line 133 + 368 XML_ + 308,title AUTO + 269,t 0 + 270,t 0 + 298,title ICRS + 370 SAOTNG_ + 369 CIAO_ + 327,title FIXED + 388,t 0 + 371 PROS_ + 346,title PROPERTY + 372 SAOIMAGE_ + 365,title UPDATE + 314,line 73 + 291,t 0 + 301,t 0 + 384,title PROJECTION + 373 XY_ + 420,t 1 + 419,t 1 + 413,title {} + 374 CIRCLE_ + 370,line 130 + 369,line 129 + 375 ELLIPSE_ + 322,t 0 + 376 BOX_ + 377 POLYGON_ + 311,line 70 + 378 POINT_ + 343,t 0 + 380 VECTOR_ + 379 LINE_ + 366,line 125 + 381 TEXT_ + 382 RULER_ + 364,t 0 + 383 COMPASS_ + 307,line 66 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 50 + 384 PROJECTION_ + 278,title WCSK + 385,t 0 + 385 ANNULUS_ + 363,line 122 + 307,title AT + 297,title J2000 + 386 ELLIPSEANNULUS_ + 326,title FILE + 287,t 0 + 387 BOXANNULUS_ + 345,title PASTE + 416,t 1 + 388 PANDA_ + 364,title UNDO + 294,line 47 + 304,line 59 + 400 wcssys + 390 BPANDA_ + 389 EPANDA_ + 383,title COMPASS + 318,t 0 + 412,title {} + 401 skyframe + 391 DIAMOND_ + 360,line 119 + 359,line 118 + 402 skyformat + 392 CROSS_ + 403 numeric + 393 ARROW_ + 340,t 0 + 339,t 0 + X X + 404 command + error,title {} + 394 BOXCIRCLE_ + 291,line 43 + 301,line 55 + 405 @PSEUDO1 + 395 MFORMAT_ + 406 region + 396 MSYSTEM_ + 361,t 0 + 356,line 115 + 407 props + 397 MSKY_ + 263,t 0 + 422,line 445 + 408 prop + 398 yesno + 410 list + 409 loadall + 399 coordsys + 382,t 0 + 258,title NO + 287,line 39 + 411 centroid + 277,title WCSJ + 284,t 0 + 412 move + 353,line 112 + 306,title ALL + 296,title FK5 + 413,t 1 + 413 select + 325,title EXCLUDE + 418,line 430 + 414 delete + 344,title NONE + 315,t 0 + 415 format + 363,title TEMPLATE + 284,line 36 + 416 shape + 382,title RULER + 417 point + 411,title {} + 350,line 109 + 349,line 108 + 336,t 0 + 418 delim + 420 group + 419 template + 415,line 389 + 421 @PSEUDO2 + 357,t 0 + 281,line 33 + 422 groupTag + 260,t 0 + 259,t 0 + 423 property + 346,line 105 + 424 start' + 378,t 0 + 412,line 374 + 281,t 0 + 257,title YES + 277,line 29 + 410,t 1 + 409,t 1 + 399,t 1 + 276,title WCSI + 343,line 102 + 312,t 0 + 305,title string + 295,title B1950 + 324,title EPSILON + 408,line 352 + 398,line 220 + 343,title NL + 362,title SYSTEM + 333,t 0 + 274,line 26 + 381,title TEXT + 410,title {} + 409,title {} + 399,title {} + 340,line 99 + 339,line 98 + 354,t 0 + 405,line 278 + 395,line 158 + 271,line 23 + 375,t 0 + x x + 336,line 95 + 277,t 0 + 406,t 1 + 402,line 269 + 396,t 0 + 392,line 154 + 308,t 0 + 267,line 19 + 298,t 0 + 275,title WCSH + 333,line 92 + 294,title FK4 + 304,title float + 330,t 0 + 329,t 0 + 323,title EDIT + 388,line 149 + 342,title NEW + 361,title STRIP + 264,line 15 + 380,title VECTOR + 379,title LINE + 351,t 0 + 408,title {} + 398,title {} + 330,line 89 + 329,line 88 + 385,line 146 + 372,t 0 + 261,line 11 + 274,t 0 + 403,t 1 + 393,t 0 + 326,line 85 + 305,t 0 + 295,t 0 + 382,line 143 + 424,t 1 + 257,line 7 + 326,t 0 + 274,title WCSG + 323,line 82 + 293,title WCSZ + 303,title integer + 322,title DISSOLVE + 378,line 139 + 347,t 0 + 341,title MOVEFRONT + 360,title SOURCE + 359,title SKYFORMAT + 378,title POINT + 407,title {} + 397,title MSKY + 368,t 0 + 320,line 79 + 319,line 78 + error error + 271,t 0 + 375,line 136 + 400,t 1 + 390,t 0 + 389,t 0 + 292,t 0 + 302,t 0 + 316,line 152 + 421,t 1 + 372,line 132 + 323,t 0 + 273,title WCSF + 344,t 0 + 313,line 72 + 292,title WCSY + 302,title SEXAGESIMAL + 321,title DELIM + 368,line 128 + 340,title MOVEBACK + 339,title MOVE + 365,t 0 + 358,title SKY + 377,title POLYGON + 267,t 0 + 406,title {} + 396,title MSYSTEM + 310,line 69 + 309,line 68 + 299,line 52 + 386,t 0 + 365,line 124 + 288,t 0 + 417,t 1 + 320,t 0 + 319,t 0 + 306,line 65 + 296,line 49 + 362,line 121 + 341,t 0 + 272,title WCSE + 291,title WCSX + 293,line 45 + 301,title DEGREES + 303,line 58 + 362,t 0 + 320,title DELETEALL + 319,title DELETE + 358,line 117 + 338,title LOAD + 264,t 0 + 357,title SHOWTEXT + 424,line 468 + 383,t 0 + 376,title BOX + 405,title {} + 395,title MFORMAT + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 53 + 424,title {} + 414,t 1 + 355,line 114 + 316,t 0 + 421,line 442 + 286,line 38 + 337,t 0 + 352,line 111 + 417,line 419 + 358,t 0 + 271,title WCSD + 261,t 0 + 283,line 35 + 289,title WCSV + 290,title WCSW + 300,title ECLIPTIC + 318,title CUT + 380,t 0 + 379,t 0 + 348,line 107 + 337,title LIST + 356,title SHOW + 282,t 0 + 414,line 385 + 375,title ELLIPSE + X,title {} + 411,t 1 + 404,title {} + 394,title BOXCIRCLE + 279,line 31 + 280,line 32 + 423,title {} + 313,t 0 + 345,line 104 + 411,line 368 + 334,t 0 + 276,line 28 + 355,t 0 + 342,line 101 + 257,t 0 + 407,line 348 + 397,line 160 + 269,title WCSB + 270,title WCSC + 376,t 0 + 273,line 25 + 288,title WCSU + 317,title COPY + 278,t 0 + 338,line 97 + 336,title ITERATION + 407,t 1 + 397,t 0 + 355,title SHAPE + X,line 424 + 404,line 277 + 394,line 156 + 374,title CIRCLE + 310,t 0 + 309,t 0 + 299,t 0 + 403,title {} + 393,title ARROW + 269,line 21 + 270,line 22 + 422,title {} + 335,line 94 + 331,t 0 + 401,line 261 + 391,line 153 + 352,t 0 + 266,line 17 + 332,line 91 + 373,t 0 + 387,line 148 + 268,title WCSA + 275,t 0 + 263,line 14 + 287,title WCST + X,t 0 + 404,t 1 + 394,t 0 + 316,title COMPOSITE + 335,title INVERT + 328,line 87 + 306,t 0 + 296,t 0 + 354,title SELECTNONE + 384,line 145 + 373,title XY + 402,title {} + 392,title CROSS + 327,t 0 + 260,line 10 + 259,line 9 + 421,title {} + x,title {} + 325,line 84 + 348,t 0 + 381,line 142 + 370,t 0 + 369,t 0 + 322,line 81 + 272,t 0 + 401,t 1 + 391,t 0 + 377,line 138 + 267,title WCS + 257 YES_ + 286,title WCSS + 293,t 0 + 303,t 0 + 315,title COMMAND + 258 NO_ + 422,t 1 + 334,title INCLUDE + 318,line 77 + 260 OFF_ + 259 ON_ + 353,title SELECTALL + 324,t 0 + 261 TRUE_ + 374,line 135 + 372,title SAOIMAGE + 262 FALSE_ + 401,title {} + 391,title DIAMOND + 263 IMAGE_ + 420,title {} + 419,title {} + x,line 425 + 345,t 0 + 264 PHYSICAL_ + 315,line 74 + 265 AMPLIFIER_ + 266 DETECTOR_ + 371,line 131 + 366,t 0 + 267 WCS_ + 268,t 0 + 268 WCSA_ + 269 WCSB_ + 270 WCSC_ + 387,t 0 + 312,line 71 + 271 WCSD_ + 272 WCSE_ + 289,t 0 + 290,t 0 + 300,t 0 + 367,line 127 + 266,title DETECTOR + 273 WCSF_ + 418,t 1 + 274 WCSG_ + 285,title WCSR + 321,t 0 + 314,title COLOR + 275 WCSH_ + 333,title GROUPS + 308,line 67 + 276 WCSI_ + 298,line 51 + x,t 0 + 352,title SELECT + 277 WCSJ_ + 371,title PROS + 364,line 123 + 342,t 0 + 278 WCSK_ + 400,title {} + 390,title BPANDA + 389,title EPANDA + 279 WCSL_ + 280 WCSM_ + 418,title {} + 281 WCSN_ + 363,t 0 + 305,line 61 + 282 WCSO_ + 295,line 48 + 265,t 0 + 283 WCSP_ + 361,line 120 + 284 WCSQ_ + 384,t 0 + 285 WCSR_ +} + +proc region::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ image } + 9 { set _ physical } + 10 { set _ amplifier } + 11 { set _ detector } + 12 { set _ wcs } + 13 { set _ wcsa } + 14 { set _ wcsb } + 15 { set _ wcsc } + 16 { set _ wcsd } + 17 { set _ wcse } + 18 { set _ wcsf } + 19 { set _ wcsg } + 20 { set _ wcsh } + 21 { set _ wcsi } + 22 { set _ wcsj } + 23 { set _ wcsk } + 24 { set _ wcsl } + 25 { set _ wcsm } + 26 { set _ wcsn } + 27 { set _ wcso } + 28 { set _ wcsp } + 29 { set _ wcsq } + 30 { set _ wcsr } + 31 { set _ wcss } + 32 { set _ wcst } + 33 { set _ wcsu } + 34 { set _ wcsv } + 35 { set _ wcsw } + 36 { set _ wcsx } + 37 { set _ wcsy } + 38 { set _ wcsz } + 39 { set _ fk4 } + 40 { set _ fk4 } + 41 { set _ fk5 } + 42 { set _ fk5 } + 43 { set _ icrs } + 44 { set _ galactic } + 45 { set _ ecliptic } + 46 { set _ degrees } + 47 { set _ sexagesimal } + 48 { set _ $1 } + 49 { set _ $1 } + 51 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 53 { RegionCmdLoad } + 54 { RegionCmdLoad } + 55 { RegionCmdLoadFn $1 } + 56 { RegionCmdLoadFn $1 } + 57 { RegionCmdLoadFn $3 $2 } + 58 { RegionCmdLoadFn $3 $2 } + 59 { RegionCmdSave $2 } + 61 { ProcessCmdSet pmarker epsilon $2 MarkerEpsilon } + 62 { ProcessCmdSet marker show $2 MarkerShow } + 63 { ProcessCmdSet marker show,text $2 MarkerShowText } + 65 { ProcessCmdSet marker centroid,auto $2 MarkerCentroidAuto } + 66 { MarkerInfo } + 68 { MarkerFront } + 69 { MarkerBack } + 71 { MarkerSelectAll } + 72 { MarkerUnSelectAll } + 74 { MarkerDeleteAll } + 75 { ProcessCmdSet marker format $2 } + 76 { ProcessCmdSet marker system $2 } + 77 { ProcessCmdSet marker system $2 } + 78 { ProcessCmdSet marker system wcs; ProcessCmdSet marker sky $2 } + 79 { ProcessCmdSet marker sky $2 } + 80 { ProcessCmdSet marker skyformat $2 } + 81 { ProcessCmdSet marker strip $2 } + 82 { ProcessCmdSet marker strip $2 } + 83 { ProcessCmdSet marker shape $2 } + 84 { ProcessCmdSet marker color $2 MarkerColor } + 85 { ProcessCmdSet marker width $2 MarkerWidth } + 86 { ProcessCmdSet marker fixed $2 [list MarkerProp fixed] } + 87 { ProcessCmdSet marker edit $2 [list MarkerProp edit] } + 88 { ProcessCmdSet marker rotate $2 [list MarkerProp rotate] } + 89 { ProcessCmdSet marker delete $2 [list MarkerProp delete] } + 90 { ProcessCmdSet marker include 1 [list MarkerProp include] } + 91 { ProcessCmdSet marker include 0 [list MarkerProp include] } + 92 { ProcessCmdSet marker source 1 [list MarkerProp source] } + 93 { ProcessCmdSet marker source 0 [list MarkerProp source] } + 96 { MarkerCopy } + 97 { MarkerCut } + 98 { ProcessCmdSet marker paste,system wcs MarkerPaste } + 99 { ProcessCmdSet marker paste,system $2 MarkerPaste } + 100 { ProcessCmdSet marker paste,system $2 MarkerPaste } + 101 { ProcessCmdSet marker paste,system wcs MarkerPaste } + 102 { MarkerUndo } + 103 { CompositeCreate } + 104 { CompositeDelete } + 106 { RegionCmdTemplateSave $2 } + 107 { RegionCmdCommand $2 } + 110 { ProcessCmdSet marker load,format $2 } + 111 { ProcessCmdSet marker load,system $2 } + 112 { ProcessCmdSet marker load,system $2 } + 113 { ProcessCmdSet marker load,system wcs; ProcessCmdSet marker load,sky $2 } + 114 { ProcessCmdSet marker load,sky $2 } + 115 { set _ 0 } + 116 { set _ 1 } + 117 { RegionCmdList } + 118 { SimpleTextDestroy markertxt } + 119 { MarkerCentroid } + 120 { ProcessCmdSet marker centroid,auto $2 MarkerCentroidAuto } + 121 { ProcessCmdSet marker centroid,radius $2 MarkerCentroidRadius } + 122 { ProcessCmdSet marker centroid,iteration $2 MarkerCentroidIteration } + 123 { MarkerFront } + 124 { MarkerBack } + 125 { MarkerSelectAll } + 126 { MarkerUnselectAll } + 127 { MarkerSelectInvert } + 128 { ProcessCmdSet marker tag $2; RegionCmdGroup select } + 129 { MarkerDeleteAll } + 130 { MarkerDeleteSelect } + 131 { set _ ds9 } + 132 { set _ xml } + 133 { set _ ciao } + 134 { set _ saotng } + 135 { set _ pros } + 136 { set _ saoimage } + 137 { set _ xy } + 138 { set _ circle } + 139 { set _ ellipse } + 140 { set _ box } + 141 { set _ polygon } + 142 { set _ line } + 143 { set _ vector } + 144 { set _ projection } + 145 { set _ segment } + 146 { set _ text } + 147 { set _ "$1 point" } + 148 { set _ ruler } + 149 { set _ compass } + 150 { set _ annulus } + 151 { set _ ellipseannulus } + 152 { set _ boxannulus } + 153 { set _ panda } + 154 { set _ epanda } + 155 { set _ bpanda } + 156 { set _ composite } + 157 { set _ boxcircle } + 158 { set _ circle } + 159 { set _ box } + 160 { set _ diamond } + 161 { set _ cross } + 162 { set _ x } + 163 { set _ x } + 164 { set _ arrow } + 165 { set _ boxcircle } + 166 { set _ 0 } + 167 { set _ 1 } + 168 { RegionCmdTemplate $1 } + 169 { RegionCmdTemplateAt $1 $3 $4 wcs fk5 } + 170 { RegionCmdTemplateAt $1 $3 $4 $5 fk5 } + 171 { RegionCmdTemplateAt $1 $3 $4 wcs $5 } + 172 { RegionCmdTemplateAt $1 $3 $4 $5 $6 } + 173 { RegionCmdGroupNew } + 174 { ProcessCmdSet marker tag $1 } + 176 { RegionCmdGroupNew } + 177 { RegionCmdGroupUpdate } + 178 { RegionCmdGroup delete } + 179 { RegionCmdGroup select } + 180 { RegionCmdGroup color $2 } + 181 { RegionCmdGroup copy } + 182 { RegionCmdGroup cut } + 183 { RegionCmdGroupFont $2 } + 184 { RegionCmdGroup move $2 $3 } + 185 { RegionCmdGroup {move front} } + 186 { RegionCmdGroup {move back} } + 187 { RegionCmdGroup property $2 $3 } + 188 { set _ select } + 189 { set _ edit } + 190 { set _ move } + 191 { set _ rotate } + 192 { set _ delete } + 193 { set _ fixed } + 194 { set _ include } + 195 { set _ source } + } + 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 region::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/regionsendlex.tcl b/ds9/parsers/regionsendlex.tcl new file mode 100644 index 0000000..53dcda1 --- /dev/null +++ b/ds9/parsers/regionsendlex.tcl @@ -0,0 +1,1243 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval regionsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc regionsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc regionsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc regionsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc regionsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc regionsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc regionsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc regionsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc regionsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc regionsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set FK4_ 294 +set B1950_ 295 +set FK5_ 296 +set J2000_ 297 +set ICRS_ 298 +set GALACTIC_ 299 +set ECLIPTIC_ 300 +set DEGREES_ 301 +set SEXAGESIMAL_ 302 +set INT_ 303 +set STRING_ 304 +set AUTO_ 305 +set AUTOCENTROID_ 306 +set BACKGROUND_ 307 +set CENTROID_ 308 +set COLOR_ 309 +set DELIM_ 310 +set EPSILON_ 311 +set EXCLUDE_ 312 +set FORMAT_ 313 +set GROUP_ 314 +set GROUPS_ 315 +set INCLUDE_ 316 +set ITERATION_ 317 +set NL_ 318 +set RADIUS_ 319 +set SELECTED_ 320 +set SHAPE_ 321 +set SHOW_ 322 +set SHOWTEXT_ 323 +set SKY_ 324 +set SKYFORMAT_ 325 +set SOURCE_ 326 +set STRIP_ 327 +set SYSTEM_ 328 +set WIDTH_ 329 +set DS9_ 330 +set XML_ 331 +set CIAO_ 332 +set SAOTNG_ 333 +set PROS_ 334 +set SAOIMAGE_ 335 +set XY_ 336 +set MFORMAT_ 337 +set MSYSTEM_ 338 +set MSKY_ 339 +set MSKYFORMAT_ 340 +set MSTRIP_ 341 +set MDELIM_ 342 +set MPROP_ 343 +set MGROUP_ 344 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: auto + if {[regexp -start $index_ -indices -line -nocase -- {\A(auto)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: autocentroid + if {[regexp -start $index_ -indices -line -nocase -- {\A(autocentroid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: background + if {[regexp -start $index_ -indices -line -nocase -- {\A(background)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: centroid + if {[regexp -start $index_ -indices -line -nocase -- {\A(centroid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: delim + if {[regexp -start $index_ -indices -line -nocase -- {\A(delim)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: epsilon + if {[regexp -start $index_ -indices -line -nocase -- {\A(epsilon)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: exclude + if {[regexp -start $index_ -indices -line -nocase -- {\A(exclude)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: format + if {[regexp -start $index_ -indices -line -nocase -- {\A(format)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: group + if {[regexp -start $index_ -indices -line -nocase -- {\A(group)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: groups + if {[regexp -start $index_ -indices -line -nocase -- {\A(groups)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: include + if {[regexp -start $index_ -indices -line -nocase -- {\A(include)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: iteration + if {[regexp -start $index_ -indices -line -nocase -- {\A(iteration)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: nl + if {[regexp -start $index_ -indices -line -nocase -- {\A(nl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: radius + if {[regexp -start $index_ -indices -line -nocase -- {\A(radius)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: selected + if {[regexp -start $index_ -indices -line -nocase -- {\A(selected)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: shape + if {[regexp -start $index_ -indices -line -nocase -- {\A(shape)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: show + if {[regexp -start $index_ -indices -line -nocase -- {\A(show)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: showtext + if {[regexp -start $index_ -indices -line -nocase -- {\A(showtext)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: source + if {[regexp -start $index_ -indices -line -nocase -- {\A(source)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: strip + if {[regexp -start $index_ -indices -line -nocase -- {\A(strip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: width + if {[regexp -start $index_ -indices -line -nocase -- {\A(width)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: ds9 + if {[regexp -start $index_ -indices -line -nocase -- {\A(ds9)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: xml + if {[regexp -start $index_ -indices -line -nocase -- {\A(xml)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: ciao + if {[regexp -start $index_ -indices -line -nocase -- {\A(ciao)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: saotng + if {[regexp -start $index_ -indices -line -nocase -- {\A(saotng)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: pros + if {[regexp -start $index_ -indices -line -nocase -- {\A(pros)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: saoimage + if {[regexp -start $index_ -indices -line -nocase -- {\A(saoimage)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: xy + if {[regexp -start $index_ -indices -line -nocase -- {\A(xy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: -format + if {[regexp -start $index_ -indices -line -nocase -- {\A(-format)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: -system + if {[regexp -start $index_ -indices -line -nocase -- {\A(-system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: -sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(-sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: -skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(-skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: -strip + if {[regexp -start $index_ -indices -line -nocase -- {\A(-strip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: -delim + if {[regexp -start $index_ -indices -line -nocase -- {\A(-delim)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: -prop + if {[regexp -start $index_ -indices -line -nocase -- {\A(-prop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: -group + if {[regexp -start $index_ -indices -line -nocase -- {\A(-group)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + # rule 80: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 80 + } + # rule 81: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 81 + } + # rule 82: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 82 + } + # rule 83: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 83 + } + # rule 84: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 84 + } + # rule 85: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 85 + } + # rule 86: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 86 + } + # rule 87: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 87 + } + # rule 88: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 88 + } + # rule 89: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 89 + } + # rule 90: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 90 + } + # rule 91: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 91 + } + # rule 92: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 92 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AUTO_ + } + 1 { +return $AUTOCENTROID_ + } + 2 { +return $BACKGROUND_ + } + 3 { +return $CENTROID_ + } + 4 { +return $COLOR_ + } + 5 { +return $DELIM_ + } + 6 { +return $EPSILON_ + } + 7 { +return $EXCLUDE_ + } + 8 { +return $FORMAT_ + } + 9 { +return $GROUP_ + } + 10 { +return $GROUPS_ + } + 11 { +return $INCLUDE_ + } + 12 { +return $ITERATION_ + } + 13 { +return $NL_ + } + 14 { +return $RADIUS_ + } + 15 { +return $SELECTED_ + } + 16 { +return $SHAPE_ + } + 17 { +return $SHOW_ + } + 18 { +return $SHOWTEXT_ + } + 19 { +return $SKY_ + } + 20 { +return $SKYFORMAT_ + } + 21 { +return $SOURCE_ + } + 22 { +return $STRIP_ + } + 23 { +return $SYSTEM_ + } + 24 { +return $WIDTH_ + } + 25 { +return $DS9_ + } + 26 { +return $XML_ + } + 27 { +return $CIAO_ + } + 28 { +return $SAOTNG_ + } + 29 { +return $PROS_ + } + 30 { +return $SAOIMAGE_ + } + 31 { +return $XY_ + } + 32 { +return $MFORMAT_ + } + 33 { +return $MSYSTEM_ + } + 34 { +return $MSKY_ + } + 35 { +return $MSKYFORMAT_ + } + 36 { +return $MSTRIP_ + } + 37 { +return $MDELIM_ + } + 38 { +return $MPROP_ + } + 39 { +return $MGROUP_ + } + 40 { +return $YES_ + } + 41 { +return $NO_ + } + 42 { +return $ON_ + } + 43 { +return $OFF_ + } + 44 { +return $TRUE_ + } + 45 { +return $FALSE_ + } + 46 { +return $IMAGE_ + } + 47 { +return $PHYSICAL_ + } + 48 { +return $AMPLIFIER_ + } + 49 { +return $DETECTOR_ + } + 50 { +return $WCS_ + } + 51 { +return $WCSA_ + } + 52 { +return $WCSB_ + } + 53 { +return $WCSC_ + } + 54 { +return $WCSD_ + } + 55 { +return $WCSE_ + } + 56 { +return $WCSF_ + } + 57 { +return $WCSG_ + } + 58 { +return $WCSH_ + } + 59 { +return $WCSI_ + } + 60 { +return $WCSJ_ + } + 61 { +return $WCSK_ + } + 62 { +return $WCSL_ + } + 63 { +return $WCSM_ + } + 64 { +return $WCSN_ + } + 65 { +return $WCSO_ + } + 66 { +return $WCSP_ + } + 67 { +return $WCSQ_ + } + 68 { +return $WCSR_ + } + 69 { +return $WCSS_ + } + 70 { +return $WCST_ + } + 71 { +return $WCSU_ + } + 72 { +return $WCSV_ + } + 73 { +return $WCSW_ + } + 74 { +return $WCSX_ + } + 75 { +return $WCSY_ + } + 76 { +return $WCSZ_ + } + 77 { +return $FK4_ + } + 78 { +return $FK4_ + } + 79 { +return $FK5_ + } + 80 { +return $FK5_ + } + 81 { +return $ICRS_ + } + 82 { +return $GALACTIC_ + } + 83 { +return $ECLIPTIC_ + } + 84 { +return $DEGREES_ + } + 85 { +return $SEXAGESIMAL_ + } + 86 { +set yylval $yytext; return $INT_ + } + 87 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 88 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 89 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 90 { +set yylval $yytext; return $STRING_ + } + 91 { +# ignore whitespace + } + 92 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/regionsendparser.tab.tcl b/ds9/parsers/regionsendparser.tab.tcl new file mode 100644 index 0000000..b14739d --- /dev/null +++ b/ds9/parsers/regionsendparser.tab.tcl @@ -0,0 +1,88 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set FK4_ 294 +set B1950_ 295 +set FK5_ 296 +set J2000_ 297 +set ICRS_ 298 +set GALACTIC_ 299 +set ECLIPTIC_ 300 +set DEGREES_ 301 +set SEXAGESIMAL_ 302 +set INT_ 303 +set STRING_ 304 +set AUTO_ 305 +set AUTOCENTROID_ 306 +set BACKGROUND_ 307 +set CENTROID_ 308 +set COLOR_ 309 +set DELIM_ 310 +set EPSILON_ 311 +set EXCLUDE_ 312 +set FORMAT_ 313 +set GROUP_ 314 +set GROUPS_ 315 +set INCLUDE_ 316 +set ITERATION_ 317 +set NL_ 318 +set RADIUS_ 319 +set SELECTED_ 320 +set SHAPE_ 321 +set SHOW_ 322 +set SHOWTEXT_ 323 +set SKY_ 324 +set SKYFORMAT_ 325 +set SOURCE_ 326 +set STRIP_ 327 +set SYSTEM_ 328 +set WIDTH_ 329 +set DS9_ 330 +set XML_ 331 +set CIAO_ 332 +set SAOTNG_ 333 +set PROS_ 334 +set SAOIMAGE_ 335 +set XY_ 336 +set MFORMAT_ 337 +set MSYSTEM_ 338 +set MSKY_ 339 +set MSKYFORMAT_ 340 +set MSTRIP_ 341 +set MDELIM_ 342 +set MPROP_ 343 +set MGROUP_ 344 diff --git a/ds9/parsers/regionsendparser.tcl b/ds9/parsers/regionsendparser.tcl new file mode 100644 index 0000000..ab5037a --- /dev/null +++ b/ds9/parsers/regionsendparser.tcl @@ -0,0 +1,3568 @@ +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 regionsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc regionsend::YYABORT {} { + return -code return 1 +} + +proc regionsend::YYACCEPT {} { + return -code return 0 +} + +proc regionsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc regionsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc regionsend::yyerror {s} { + puts stderr $s +} + +proc regionsend::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 regionsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set regionsend::table { + 81:312 reduce + 0:327,target 19 + 41:339,target 73 + 41:340,target 73 + 86:340,target 84 + 86:339,target 84 + 51:307 reduce + 81:316 reduce + 73:312,target 36 + 53:342,target 16 + 51:312 reduce + 48:0 reduce + 98:342,target 76 + 81:320 reduce + 26:257 shift + 70:320,target 33 + 69:320,target 32 + 26:258 shift + 51:316 reduce + 26:259 shift + 26:260 shift + 95:0,target 7 + 65:344,target 28 + 26:261 shift + 91:0 reduce + 81:338,target 44 + 26:262 shift + 51:320 reduce + 81:326 reduce + 52:316,target 15 + 97:316,target 77 + 64:0,target 27 + 47:341,target 10 + 23:284,target 66 + 93:341,target 6 + 7:312,target 91 + 51:326 reduce + 33:0,target 66 + 50:307,target 13 + 49:307,target 12 + 95:307,target 7 + 60:343,target 23 + 59:343,target 22 + 101:340,target 94 + 101:339,target 94 + 75:337,target 38 + 61:326,target 24 + 81:337 reduce + 0:344,target 29 + 81:338 reduce + 26:345,target 96 + 81:340 reduce + 81:339 reduce + 42:339,target 74 + 42:340,target 74 + 87:340,target 46 + 87:339,target 46 + 81:341 reduce + 81:342 reduce + 81:343 reduce + 51:337 reduce + 21:0 reduce + 81:344 reduce + 74:312,target 37 + 51:338 reduce + 54:342,target 17 + 51:340 reduce + 51:339 reduce + 99:342,target 87 + 51:341 reduce + 51:342 reduce + 86:307 reduce + 71:320,target 34 + 51:343 reduce + 63:0 reduce + 51:344 reduce + 66:344,target 29 + 82:338,target 45 + 86:312 reduce + 56:307 reduce + 53:316,target 16 + 98:316,target 76 + 48:341,target 11 + 94:341,target 4 + 86:316 reduce + 56:312 reduce + 26:307 reduce + 86:320 reduce + 51:307,target 14 + 96:307,target 86 + 61:343,target 24 + 31:337,target 22 + 102:340,target 78 + 102:339,target 78 + 76:337,target 39 + 56:316 reduce + 92:0,target 3 + 62:326,target 25 + 26:312 reduce + 56:320 reduce + 86:326 reduce + 43:339,target 75 + 43:340,target 75 + 88:340,target 47 + 88:339,target 47 + 61:0,target 24 + 26:316 reduce + 75:312,target 38 + 26:320 reduce + 56:326 reduce + 55:342,target 18 + 30:0,target 0 + 26:320,target 1 + 35:0 reduce + 72:320,target 35 + 86:337 reduce + 67:344,target 30 + 26:326 reduce + 37:338,target 69 + 86:338 reduce + 83:338,target 81 + 86:340 reduce + 86:339 reduce + 86:341 reduce + 77:0 reduce + 54:316,target 17 + 99:316,target 87 + 86:342 reduce + 86:343 reduce + 56:337 reduce + 50:341,target 13 + 49:341,target 12 + 95:341,target 7 + 86:344 reduce + 56:338 reduce + 9:0 reduce + 56:340 reduce + 56:339 reduce + 56:341 reduce + 56:342 reduce + 52:307,target 15 + 97:307,target 77 + 92:307 reduce + 62:343,target 25 + 56:343 reduce + 26:337 reduce + 32:337,target 79 + 103:340,target 88 + 103:339,target 88 + 77:337,target 40 + 56:344 reduce + 23:275,target 57 + 26:338 reduce + 63:326,target 26 + 26:339 reduce + 26:340 reduce + 2:344,target 93 + 26:341 reduce + 92:312 reduce + 26:342 reduce + 62:307 reduce + 26:343 reduce + 44:339,target 80 + 44:340,target 80 + 90:340,target 2 + 90:339,target 2 + 89:340,target 85 + 89:339,target 85 + 26:344 reduce + 26:345 goto + 92:316 reduce + 31:312,target 7 + 76:312,target 39 + 62:312 reduce + 11:342,target 90 + 56:342,target 19 + 32:307 reduce + 92:320 reduce + 73:320,target 36 + 62:316 reduce + 88:0,target 47 + 32:312 reduce + 68:344,target 31 + 38:338,target 70 + 84:338,target 82 + 62:320 reduce + 50:0 reduce + 49:0 reduce + 92:326 reduce + 57:0,target 20 + 55:316,target 18 + 32:316 reduce + 51:341,target 14 + 96:341,target 86 + 32:320 reduce + 92:0 reduce + 62:326 reduce + 26:0,target 1 + 53:307,target 16 + 23:292,target 74 + 98:307,target 76 + 63:343,target 26 + 104:340,target 89 + 104:339,target 89 + 78:337,target 41 + 7:320,target 91 + 18:326,target 92 + 92:337 reduce + 64:326,target 27 + 32:326 reduce + 92:338 reduce + 92:340 reduce + 92:339 reduce + 92:341 reduce + 45:339,target 8 + 45:340,target 8 + 92:342 reduce + 91:340,target 5 + 91:339,target 5 + 92:343 reduce + 62:337 reduce + 92:344 reduce + 62:338 reduce + 32:312,target 79 + 77:312,target 40 + 62:340 reduce + 62:339 reduce + 12:342,target 95 + 62:341 reduce + 57:342,target 20 + 62:342 reduce + 97:307 reduce + 62:343 reduce + 32:337 reduce + 74:320,target 37 + 62:344 reduce + 32:338 reduce + 32:339 reduce + 32:340 reduce + 70:344,target 33 + 69:344,target 32 + 32:341 reduce + 39:338,target 71 + 40:338,target 72 + 97:312 reduce + 85:338,target 83 + 32:342 reduce + 67:307 reduce + 11:316,target 90 + 0:310,target 5 + 0:309,target 4 + 32:343 reduce + 56:316,target 19 + 32:344 reduce + 97:316 reduce + 64:0 reduce + 52:341,target 15 + 22:335,target 42 + 97:341,target 77 + 67:312 reduce + 37:307 reduce + 97:320 reduce + 54:307,target 17 + 18:343,target 92 + 99:307,target 87 + 67:316 reduce + 64:343,target 27 + 85:0,target 83 + 80:337,target 43 + 79:337,target 42 + 37:312 reduce + 65:326,target 28 + 67:320 reduce + 26:258,target 91 + 97:326 reduce + 54:0,target 17 + 37:316 reduce + 46:339,target 9 + 46:340,target 9 + 92:340,target 3 + 92:339,target 3 + 23:266,target 48 + 27:353,target 99 + 37:320 reduce + 78:312,target 41 + 67:326 reduce + 58:342,target 21 + 75:320,target 38 + 97:337 reduce + 37:326 reduce + 97:338 reduce + 71:344,target 34 + 0:326,target 18 + 41:338,target 73 + 97:340 reduce + 97:339 reduce + 86:338,target 84 + 97:341 reduce + 12:316,target 95 + 97:342 reduce + 57:316,target 20 + 22:352,target 44 + 36:0 reduce + 97:343 reduce + 67:337 reduce + 97:344 reduce + 67:338 reduce + 53:341,target 16 + 98:341,target 76 + 67:340 reduce + 67:339 reduce + 67:341 reduce + 67:342 reduce + 78:0 reduce + 67:343 reduce + 55:307,target 18 + 25:302,target 88 + 37:337 reduce + 67:344 reduce + 65:343,target 28 + 37:338 reduce + 81:337,target 44 + 37:339 reduce + 37:340 reduce + 66:326,target 29 + 37:341 reduce + 37:342 reduce + 73:307 reduce + 37:343 reduce + 47:340,target 10 + 47:339,target 10 + 23:283,target 65 + 37:344 reduce + 93:340,target 6 + 93:339,target 6 + 73:312 reduce + 80:312,target 43 + 79:312,target 42 + 43:307 reduce + 60:342,target 23 + 59:342,target 22 + 101:338,target 94 + 8:0,target 55 + 73:316 reduce + 31:320,target 12 + 82:0,target 45 + 76:320,target 39 + 0:343,target 28 + 43:312 reduce + 26:344,target 1 + 73:320 reduce + 72:344,target 35 + 42:338,target 74 + 87:338,target 46 + 51:0,target 14 + 43:316 reduce + 58:316,target 21 + 54:341,target 17 + 2:307 reduce + 43:320 reduce + 99:341,target 87 + 73:326 reduce + 19:0,target 59 + 20:0,target 56 + 51:0 reduce + 11:307,target 90 + 56:307,target 19 + 2:312 reduce + 66:343,target 29 + 82:337,target 45 + 43:326 reduce + 67:326,target 30 + 93:0 reduce + 2:316 reduce + 23:299,target 81 + 48:340,target 11 + 48:339,target 11 + 94:340,target 4 + 94:339,target 4 + 73:337 reduce + 2:320 reduce + 73:338 reduce + 73:340 reduce + 73:339 reduce + 81:312,target 44 + 73:341 reduce + 73:342 reduce + 61:342,target 24 + 102:338,target 78 + 73:343 reduce + 43:337 reduce + 73:344 reduce + 2:326 reduce + 32:320,target 79 + 43:338 reduce + 77:320,target 40 + 43:339 reduce + 43:340 reduce + 104:307 reduce + 43:341 reduce + 73:344,target 36 + 2:326,target 93 + 43:338,target 75 + 43:342 reduce + 88:338,target 47 + 78:307 reduce + 43:343 reduce + 43:344 reduce + 104:312 reduce + 60:316,target 23 + 59:316,target 22 + 78:312 reduce + 55:341,target 18 + 48:307 reduce + 104:316 reduce + 2:337 reduce + 12:307,target 95 + 5:0,target 60 + 2:338 reduce + 78:316 reduce + 57:307,target 20 + 2:340 reduce + 2:339 reduce + 104:320 reduce + 78:0,target 41 + 67:343,target 30 + 48:312 reduce + 2:341 reduce + 37:337,target 69 + 83:337,target 81 + 65:0 reduce + 2:342 reduce + 18:307 reduce + 78:320 reduce + 68:326,target 31 + 2:343 reduce + 7:344,target 91 + 2:344 reduce + 24:299,target 81 + 48:316 reduce + 47:0,target 10 + 50:340,target 13 + 50:339,target 13 + 49:340,target 12 + 49:339,target 12 + 18:312 reduce + 104:326 reduce + 95:340,target 7 + 95:339,target 7 + 48:320 reduce + 7:307 reduce + 78:326 reduce + 16:0,target 57 + 82:312,target 45 + 18:316 reduce + 62:342,target 25 + 103:338,target 88 + 7:312 reduce + 23:274,target 56 + 18:320 reduce + 78:320,target 41 + 48:326 reduce + 2:343,target 93 + 74:344,target 37 + 7:316 reduce + 44:338,target 80 + 104:337 reduce + 90:338,target 2 + 89:338,target 85 + 104:338 reduce + 104:340 reduce + 104:339 reduce + 78:337 reduce + 61:316,target 24 + 7:320 reduce + 18:326 reduce + 104:341 reduce + 78:338 reduce + 11:341,target 90 + 104:342 reduce + 78:340 reduce + 78:339 reduce + 56:341,target 19 + 104:343 reduce + 78:341 reduce + 104:344 reduce + 78:342 reduce + 27:318,target 98 + 78:343 reduce + 48:337 reduce + 78:344 reduce + 58:307,target 21 + 48:338 reduce + 7:326 reduce + 37:0 reduce + 100:304,target 104 + 68:343,target 31 + 48:340 reduce + 48:339 reduce + 38:337,target 70 + 84:337,target 82 + 48:341 reduce + 70:326,target 33 + 69:326,target 32 + 48:342 reduce + 102:0,target 78 + 84:307 reduce + 48:343 reduce + 18:337 reduce + 48:344 reduce + 18:338 reduce + 80:0 reduce + 79:0 reduce + 51:340,target 14 + 51:339,target 14 + 18:339 reduce + 18:340 reduce + 96:340,target 86 + 96:339,target 86 + 18:341 reduce + 24:300 shift + 84:312 reduce + 18:342 reduce + 54:307 reduce + 18:343 reduce + 37:312,target 69 + 83:312,target 81 + 7:337 reduce + 18:344 reduce + 23:291,target 73 + 63:342,target 26 + 7:338 reduce + 2:0,target 93 + 24:294 shift + 104:338,target 89 + 84:316 reduce + 7:340 reduce + 7:339 reduce + 24:295 shift + 75:0,target 38 + 54:312 reduce + 7:341 reduce + 24:296 shift + 80:320,target 43 + 79:320,target 42 + 7:342 reduce + 24:297 shift + 84:320 reduce + 7:343 reduce + 24:298 shift + 75:344,target 38 + 7:344 reduce + 24:299 shift + 45:338,target 8 + 91:338,target 5 + 54:316 reduce + 44:0,target 80 + 62:316,target 25 + 54:320 reduce + 12:341,target 95 + 84:326 reduce + 57:341,target 20 + 13:0,target 61 + 10:0 reduce + 60:307,target 23 + 59:307,target 22 + 70:343,target 33 + 69:343,target 32 + 54:326 reduce + 39:337,target 71 + 40:337,target 72 + 85:337,target 83 + 71:326,target 34 + 0:308,target 3 + 52:0 reduce + 84:337 reduce + 52:340,target 15 + 52:339,target 15 + 22:334,target 41 + 97:340,target 77 + 97:339,target 77 + 84:338 reduce + 84:340 reduce + 84:339 reduce + 84:341 reduce + 38:312,target 70 + 94:0 reduce + 84:342 reduce + 84:312,target 82 + 18:342,target 92 + 84:343 reduce + 64:342,target 27 + 54:337 reduce + 84:344 reduce + 54:338 reduce + 54:340 reduce + 54:339 reduce + 81:320,target 44 + 54:341 reduce + 26:257,target 90 + 54:342 reduce + 31:344,target 29 + 90:307 reduce + 89:307 reduce + 76:344,target 39 + 54:343 reduce + 46:338,target 9 + 92:338,target 3 + 54:344 reduce + 23:265,target 47 + 63:316,target 26 + 90:312 reduce + 89:312 reduce + 60:307 reduce + 59:307 reduce + 58:341,target 21 + 3:317,target 34 + 29:304 shift + 90:316 reduce + 89:316 reduce + 72:0,target 35 + 61:307,target 24 + 60:312 reduce + 59:312 reduce + 71:343,target 34 + 0:325,target 17 + 24:348 goto + 41:337,target 73 + 90:320 reduce + 89:320 reduce + 86:337,target 84 + 26:326,target 1 + 72:326,target 35 + 60:316 reduce + 59:316 reduce + 41:0,target 73 + 53:340,target 16 + 53:339,target 16 + 98:340,target 76 + 98:339,target 76 + 60:320 reduce + 59:320 reduce + 90:326 reduce + 89:326 reduce + 66:0 reduce + 10:0,target 65 + 39:312,target 71 + 40:312,target 72 + 85:312,target 83 + 25:301,target 87 + 65:342,target 28 + 60:326 reduce + 59:326 reduce + 82:320,target 45 + 32:344,target 79 + 77:344,target 40 + 47:338,target 10 + 23:282,target 64 + 93:338,target 6 + 90:337 reduce + 89:337 reduce + 18:316,target 92 + 90:338 reduce + 89:338 reduce + 64:316,target 27 + 90:340 reduce + 90:339 reduce + 89:340 reduce + 89:339 reduce + 90:341 reduce + 89:341 reduce + 60:341,target 23 + 59:341,target 22 + 101:337,target 94 + 90:342 reduce + 89:342 reduce + 90:343 reduce + 89:343 reduce + 60:337 reduce + 59:337 reduce + 90:344 reduce + 89:344 reduce + 60:338 reduce + 59:338 reduce + 0:342,target 27 + 62:307,target 25 + 60:340 reduce + 60:339 reduce + 59:340 reduce + 59:339 reduce + 26:343,target 1 + 72:343,target 35 + 60:341 reduce + 59:341 reduce + 42:337,target 74 + 87:337,target 46 + 60:342 reduce + 59:342 reduce + 95:307 reduce + 73:326,target 36 + 60:343 reduce + 59:343 reduce + 60:344 reduce + 59:344 reduce + 54:340,target 17 + 54:339,target 17 + 38:0 reduce + 99:340,target 87 + 99:339,target 87 + 95:312 reduce + 99:0,target 87 + 65:307 reduce + 41:312,target 73 + 86:312,target 84 + 95:316 reduce + 66:342,target 29 + 81:0 reduce + 68:0,target 31 + 65:312 reduce + 37:320,target 69 + 95:320 reduce + 83:320,target 81 + 23:298,target 80 + 78:344,target 41 + 65:316 reduce + 48:338,target 11 + 7:326,target 91 + 37:0,target 69 + 94:338,target 4 + 3:351,target 36 + 65:320 reduce + 65:316,target 28 + 95:326 reduce + 61:341,target 24 + 102:337,target 78 + 65:326 reduce + 63:307,target 26 + 73:343,target 36 + 43:337,target 75 + 88:337,target 47 + 74:326,target 37 + 11:0 reduce + 101:312,target 94 + 95:337 reduce + 95:338 reduce + 55:340,target 18 + 55:339,target 18 + 95:340 reduce + 95:339 reduce + 0:316,target 11 + 95:341 reduce + 95:342 reduce + 42:312,target 74 + 95:343 reduce + 87:312,target 46 + 65:337 reduce + 53:0 reduce + 95:344 reduce + 67:342,target 30 + 65:338 reduce + 65:340 reduce + 65:339 reduce + 65:341 reduce + 38:320,target 70 + 84:320,target 82 + 65:342 reduce + 7:343,target 91 + 24:298,target 80 + 65:343 reduce + 95:0 reduce + 80:344,target 43 + 79:344,target 42 + 65:344 reduce + 50:338,target 13 + 49:338,target 12 + 95:338,target 7 + 66:316,target 29 + 96:0,target 86 + 71:307 reduce + 62:341,target 25 + 103:337,target 88 + 23:273,target 55 + 71:312 reduce + 65:0,target 28 + 2:342,target 93 + 18:307,target 92 + 64:307,target 27 + 41:307 reduce + 74:343,target 37 + 44:337,target 80 + 90:337,target 2 + 89:337,target 85 + 75:326,target 38 + 71:316 reduce + 34:0,target 68 + 41:312 reduce + 102:312,target 78 + 11:340,target 90 + 11:339,target 90 + 11:307 reduce + 71:320 reduce + 56:340,target 19 + 56:339,target 19 + 41:316 reduce + 11:312 reduce + 43:312,target 75 + 88:312,target 47 + 0:306 shift + 100:303,target 103 + 68:342,target 31 + 0:307 shift + 41:320 reduce + 71:326 reduce + 0:308 shift + 11:316 reduce + 0:310 shift + 0:309 shift + 39:320,target 71 + 40:320,target 72 + 85:320,target 83 + 67:0 reduce + 0:311 shift + 0:312 shift + 81:344,target 44 + 51:338,target 14 + 11:320 reduce + 0:313 shift + 96:338,target 86 + 0:0 reduce + 0:314 shift + 41:326 reduce + 0:315 shift + 67:316,target 30 + 0:316 shift + 23:289,target 71 + 23:290,target 72 + 23:300,target 82 + 63:341,target 26 + 104:337,target 89 + 71:337 reduce + 11:326 reduce + 0:320 shift + 71:338 reduce + 0:321 shift + 71:340 reduce + 71:339 reduce + 0:322 shift + 71:341 reduce + 65:307,target 28 + 0:323 shift + 75:343,target 38 + 71:342 reduce + 0:324 shift + 45:337,target 8 + 91:337,target 5 + 71:343 reduce + 0:325 shift + 31:326,target 18 + 41:337 reduce + 76:326,target 39 + 71:344 reduce + 0:326 shift + 0:350,target 30 + 41:338 reduce + 0:327 shift + 41:339 reduce + 41:340 reduce + 103:312,target 88 + 102:307 reduce + 12:339,target 95 + 0:328 shift + 12:340,target 95 + 41:341 reduce + 57:340,target 20 + 57:339,target 20 + 0:329 shift + 41:342 reduce + 93:0,target 6 + 76:307 reduce + 11:337 reduce + 2:316,target 93 + 41:343 reduce + 11:338 reduce + 41:344 reduce + 102:312 reduce + 11:340 reduce + 11:339 reduce + 44:312,target 80 + 90:312,target 2 + 89:312,target 85 + 11:341 reduce + 76:312 reduce + 70:342,target 33 + 69:342,target 32 + 62:0,target 25 + 11:342 reduce + 11:343 reduce + 39:0 reduce + 40:0 reduce + 46:307 reduce + 102:316 reduce + 11:344 reduce + 0:307,target 2 + 0:337 shift + 41:320,target 73 + 86:320,target 84 + 0:338 shift + 76:316 reduce + 0:339 shift + 0:340 shift + 31:0,target 49 + 102:320 reduce + 82:344,target 45 + 52:338,target 15 + 0:341 shift + 22:333,target 40 + 46:312 reduce + 97:338,target 77 + 0:342 shift + 82:0 reduce + 76:320 reduce + 0:343 shift + 68:316,target 31 + 0:344 shift + 18:341,target 92 + 24:300,target 82 + 46:316 reduce + 64:341,target 27 + 102:326 reduce + 46:320 reduce + 76:326 reduce + 0:350 goto + 66:307,target 29 + 31:343,target 28 + 76:343,target 39 + 46:337,target 9 + 92:337,target 3 + 32:326,target 79 + 77:326,target 40 + 0:354 goto + 23:264,target 46 + 0:355 goto + 46:326 reduce + 104:312,target 89 + 58:340,target 21 + 58:339,target 21 + 102:337 reduce + 102:338 reduce + 102:340 reduce + 102:339 reduce + 101:320,target 94 + 76:337 reduce + 45:312,target 8 + 102:341 reduce + 91:312,target 5 + 76:338 reduce + 12:0 reduce + 102:342 reduce + 76:340 reduce + 76:339 reduce + 71:342,target 34 + 0:324,target 16 + 102:343 reduce + 76:341 reduce + 102:344 reduce + 76:342 reduce + 42:320,target 74 + 87:320,target 46 + 76:343 reduce + 46:337 reduce + 76:344 reduce + 37:344,target 69 + 46:338 reduce + 83:344,target 81 + 54:0 reduce + 53:338,target 16 + 46:339 reduce + 46:340 reduce + 98:338,target 76 + 46:341 reduce + 46:342 reduce + 90:0,target 2 + 89:0,target 85 + 82:307 reduce + 70:316,target 33 + 69:316,target 32 + 46:343 reduce + 46:344 reduce + 65:341,target 28 + 96:0 reduce + 82:312 reduce + 58:0,target 21 + 52:307 reduce + 67:307,target 30 + 32:343,target 79 + 77:343,target 40 + 47:337,target 10 + 23:281,target 63 + 93:337,target 6 + 82:316 reduce + 78:326,target 41 + 52:312 reduce + 82:320 reduce + 60:340,target 23 + 60:339,target 23 + 59:340,target 22 + 59:339,target 22 + 52:316 reduce + 102:320,target 78 + 0:341,target 26 + 46:312,target 9 + 92:312,target 3 + 52:320 reduce + 26:342,target 1 + 82:326 reduce + 72:342,target 35 + 2:307,target 93 + 43:320,target 75 + 88:320,target 47 + 26:0 reduce + 38:344,target 70 + 84:344,target 82 + 54:338,target 17 + 52:326 reduce + 99:338,target 87 + 71:316,target 34 + 68:0 reduce + 82:337 reduce + 66:341,target 29 + 82:338 reduce + 82:340 reduce + 82:339 reduce + 1:0 reduce + 82:341 reduce + 22:330 shift + 23:297,target 79 + 82:342 reduce + 68:307,target 31 + 22:331 shift + 82:343 reduce + 78:343,target 41 + 52:337 reduce + 48:337,target 11 + 22:332 shift + 94:337,target 4 + 82:344 reduce + 52:338 reduce + 22:333 shift + 80:326,target 43 + 79:326,target 42 + 52:340 reduce + 52:339 reduce + 22:334 shift + 52:341 reduce + 22:335 shift + 52:342 reduce + 22:336 shift + 87:307 reduce + 86:0,target 84 + 61:340,target 24 + 61:339,target 24 + 52:343 reduce + 52:344 reduce + 103:320,target 88 + 47:312,target 10 + 93:312,target 6 + 87:312 reduce + 55:0,target 18 + 73:342,target 36 + 57:307 reduce + 27:304 shift + 44:320,target 80 + 90:320,target 2 + 89:320,target 85 + 87:316 reduce + 57:312 reduce + 39:344,target 71 + 40:344,target 72 + 85:344,target 83 + 55:338,target 18 + 87:320 reduce + 0:315,target 10 + 26:316,target 1 + 41:0 reduce + 72:316,target 35 + 57:316 reduce + 22:352 goto + 67:341,target 30 + 57:320 reduce + 87:326 reduce + 83:0 reduce + 7:342,target 91 + 24:297,target 79 + 70:307,target 33 + 69:307,target 32 + 80:343,target 43 + 79:343,target 42 + 50:337,target 13 + 49:337,target 12 + 27:318 shift + 95:337,target 7 + 81:326,target 44 + 57:326 reduce + 62:340,target 25 + 62:339,target 25 + 23:272,target 54 + 87:337 reduce + 104:320,target 89 + 87:338 reduce + 48:312,target 11 + 2:341,target 93 + 94:312,target 4 + 87:340 reduce + 87:339 reduce + 87:341 reduce + 74:342,target 37 + 87:342 reduce + 87:343 reduce + 57:337 reduce + 45:320,target 8 + 91:320,target 5 + 87:344 reduce + 57:338 reduce + 25:349,target 89 + 57:340 reduce + 57:339 reduce + 11:338,target 90 + 41:344,target 73 + 86:344,target 84 + 57:341 reduce + 56:338,target 19 + 9:0,target 64 + 13:0 reduce + 57:342 reduce + 93:307 reduce + 83:0,target 81 + 57:343 reduce + 73:316,target 36 + 57:344 reduce + 68:341,target 31 + 93:312 reduce + 55:0 reduce + 52:0,target 15 + 63:307 reduce + 71:307,target 34 + 93:316 reduce + 81:343,target 44 + 51:337,target 14 + 21:0,target 63 + 96:337,target 86 + 63:312 reduce + 97:0 reduce + 82:326,target 45 + 93:320 reduce + 23:288,target 70 + 63:340,target 26 + 63:339,target 26 + 63:316 reduce + 7:316,target 91 + 27:353 goto + 63:320 reduce + 50:312,target 13 + 49:312,target 12 + 95:312,target 7 + 93:326 reduce + 101:344,target 94 + 75:342,target 38 + 46:320,target 9 + 92:320,target 3 + 63:326 reduce + 12:338,target 95 + 42:344,target 74 + 87:344,target 46 + 57:338,target 20 + 74:316,target 37 + 93:337 reduce + 93:338 reduce + 70:341,target 33 + 69:341,target 32 + 93:340 reduce + 93:339 reduce + 93:341 reduce + 0:306,target 1 + 93:342 reduce + 26:307,target 1 + 93:343 reduce + 72:307,target 35 + 63:337 reduce + 93:344 reduce + 82:343,target 45 + 70:0 reduce + 69:0 reduce + 63:338 reduce + 52:337,target 15 + 22:332,target 39 + 97:337,target 77 + 63:340 reduce + 63:339 reduce + 37:326,target 69 + 83:326,target 81 + 63:341 reduce + 6:0,target 50 + 63:342 reduce + 2:0 reduce + 98:307 reduce + 80:0,target 43 + 79:0,target 42 + 63:343 reduce + 18:339,target 92 + 18:340,target 92 + 64:340,target 27 + 64:339,target 27 + 63:344 reduce + 98:312 reduce + 51:312,target 14 + 48:0,target 11 + 96:312,target 86 + 68:307 reduce + 31:342,target 27 + 102:344,target 78 + 76:342,target 39 + 98:316 reduce + 47:320,target 10 + 17:0,target 58 + 23:263,target 45 + 93:320,target 6 + 68:312 reduce + 38:307 reduce + 43:344,target 75 + 98:320 reduce + 88:344,target 47 + 58:338,target 21 + 68:316 reduce + 75:316,target 38 + 38:312 reduce + 71:341,target 34 + 68:320 reduce + 0:323,target 15 + 98:326 reduce + 38:316 reduce + 42:0 reduce + 73:307,target 36 + 37:343,target 69 + 83:343,target 81 + 53:337,target 16 + 38:320 reduce + 98:337,target 76 + 68:326 reduce + 38:326,target 70 + 84:326,target 82 + 84:0 reduce + 65:340,target 28 + 65:339,target 28 + 98:337 reduce + 38:326 reduce + 103:0,target 88 + 98:338 reduce + 98:340 reduce + 98:339 reduce + 52:312,target 15 + 98:341 reduce + 97:312,target 77 + 32:342,target 79 + 103:344,target 88 + 98:342 reduce + 77:342,target 40 + 23:279,target 61 + 23:280,target 62 + 98:343 reduce + 68:337 reduce + 98:344 reduce + 68:338 reduce + 48:320,target 11 + 7:307,target 91 + 94:320,target 4 + 68:340 reduce + 68:339 reduce + 68:341 reduce + 44:344,target 80 + 100:303 shift + 90:344,target 2 + 89:344,target 85 + 68:342 reduce + 60:338,target 23 + 59:338,target 22 + 100:304 shift + 76:0,target 39 + 68:343 reduce + 38:337 reduce + 68:344 reduce + 31:316,target 11 + 38:338 reduce + 76:316,target 39 + 0:340,target 25 + 0:339,target 24 + 38:339 reduce + 38:340 reduce + 26:341,target 1 + 38:341 reduce + 72:341,target 35 + 38:342 reduce + 45:0,target 8 + 74:307 reduce + 14:0 reduce + 38:343 reduce + 38:344 reduce + 23:348,target 85 + 74:307,target 37 + 14:0,target 51 + 38:343,target 70 + 84:343,target 82 + 74:312 reduce + 54:337,target 17 + 101:0 reduce + 99:337,target 87 + 39:326,target 71 + 40:326,target 72 + 44:307 reduce + 85:326,target 83 + 56:0 reduce + 74:316 reduce + 66:340,target 29 + 66:339,target 29 + 44:312 reduce + 74:320 reduce + 98:0 reduce + 53:312,target 16 + 23:296,target 78 + 98:312,target 76 + 44:316 reduce + 104:344,target 89 + 78:342,target 41 + 3:305 shift + 50:320,target 13 + 49:320,target 12 + 44:320 reduce + 95:320,target 7 + 74:326 reduce + 45:344,target 8 + 91:344,target 5 + 61:338,target 24 + 32:316,target 79 + 77:316,target 40 + 44:326 reduce + 73:341,target 36 + 3:317 shift + 74:337 reduce + 3:319 shift + 24:348,target 86 + 75:307,target 38 + 74:338 reduce + 39:343,target 71 + 40:343,target 72 + 85:343,target 83 + 74:340 reduce + 74:339 reduce + 55:337,target 18 + 74:341 reduce + 0:0,target 48 + 0:314,target 9 + 41:326,target 73 + 86:326,target 84 + 74:342 reduce + 74:343 reduce + 73:0,target 36 + 44:337 reduce + 74:344 reduce + 44:338 reduce + 67:340,target 30 + 67:339,target 30 + 44:339 reduce + 44:340 reduce + 71:0 reduce + 44:341 reduce + 42:0,target 74 + 44:342 reduce + 80:307 reduce + 79:307 reduce + 54:312,target 17 + 7:341,target 91 + 24:296,target 78 + 44:343 reduce + 99:312,target 87 + 44:344 reduce + 80:342,target 43 + 79:342,target 42 + 11:0,target 90 + 80:312 reduce + 79:312 reduce + 51:320,target 14 + 96:320,target 86 + 50:307 reduce + 49:307 reduce + 46:344,target 9 + 92:344,target 3 + 62:338,target 25 + 80:316 reduce + 79:316 reduce + 23:271,target 53 + 50:312 reduce + 49:312 reduce + 78:316,target 41 + 2:340,target 93 + 2:339,target 93 + 80:320 reduce + 79:320 reduce + 74:341,target 37 + 50:316 reduce + 49:316 reduce + 101:326,target 94 + 31:307,target 2 + 76:307,target 39 + 50:320 reduce + 49:320 reduce + 11:337,target 90 + 41:343,target 73 + 86:343,target 84 + 80:326 reduce + 79:326 reduce + 56:337,target 19 + 3:351 goto + 42:326,target 74 + 87:326,target 46 + 43:0 reduce + 68:340,target 31 + 68:339,target 31 + 50:326 reduce + 49:326 reduce + 55:312,target 18 + 85:0 reduce + 81:342,target 44 + 80:337 reduce + 79:337 reduce + 80:338 reduce + 79:338 reduce + 80:340 reduce + 80:339 reduce + 79:340 reduce + 79:339 reduce + 52:320,target 15 + 97:320,target 77 + 80:341 reduce + 79:341 reduce + 80:342 reduce + 79:342 reduce + 47:344,target 10 + 23:287,target 69 + 93:344,target 6 + 80:343 reduce + 79:343 reduce + 70:0,target 33 + 69:0,target 32 + 63:338,target 26 + 50:337 reduce + 49:337 reduce + 80:344 reduce + 79:344 reduce + 50:338 reduce + 49:338 reduce + 50:340 reduce + 50:339 reduce + 49:340 reduce + 49:339 reduce + 80:316,target 43 + 79:316,target 42 + 50:341 reduce + 49:341 reduce + 50:342 reduce + 49:342 reduce + 38:0,target 70 + 101:343,target 94 + 85:307 reduce + 75:341,target 38 + 50:343 reduce + 49:343 reduce + 50:344 reduce + 49:344 reduce + 102:326,target 78 + 32:307,target 79 + 85:312 reduce + 77:307,target 40 + 12:337,target 95 + 25:301 shift + 42:343,target 74 + 87:343,target 46 + 57:337,target 20 + 55:307 reduce + 25:302 shift + 43:326,target 75 + 88:326,target 47 + 15:0 reduce + 85:316 reduce + 55:312 reduce + 70:340,target 33 + 70:339,target 33 + 69:340,target 32 + 69:339,target 32 + 85:320 reduce + 102:0 reduce + 11:312,target 90 + 57:0 reduce + 56:312,target 19 + 55:316 reduce + 82:342,target 45 + 22:331,target 38 + 55:320 reduce + 85:326 reduce + 53:320,target 16 + 98:320,target 76 + 99:0 reduce + 48:344,target 11 + 18:338,target 92 + 94:344,target 4 + 64:338,target 27 + 55:326 reduce + 81:316,target 44 + 31:341,target 26 + 102:343,target 78 + 76:341,target 39 + 103:326,target 88 + 85:337 reduce + 97:0,target 77 + 85:338 reduce + 85:340 reduce + 85:339 reduce + 78:307,target 41 + 43:343,target 75 + 88:343,target 47 + 85:341 reduce + 58:337,target 21 + 85:342 reduce + 44:326,target 80 + 90:326,target 2 + 89:326,target 85 + 85:343 reduce + 66:0,target 29 + 55:337 reduce + 85:344 reduce + 55:338 reduce + 55:340 reduce + 55:339 reduce + 71:340,target 34 + 71:339,target 34 + 55:341 reduce + 0:322,target 14 + 55:342 reduce + 30:0 accept + 35:0,target 67 + 91:307 reduce + 55:343 reduce + 12:312,target 95 + 57:312,target 20 + 55:344 reduce + 37:342,target 69 + 83:342,target 81 + 91:312 reduce + 72:0 reduce + 61:307 reduce + 54:320,target 17 + 99:320,target 87 + 50:344,target 13 + 49:344,target 12 + 95:344,target 7 + 91:316 reduce + 65:338,target 28 + 4:0 reduce + 61:312 reduce + 31:307 shift + 91:320 reduce + 82:316,target 45 + 25:349 goto + 32:341,target 79 + 103:343,target 88 + 77:341,target 40 + 61:316 reduce + 23:278,target 60 + 31:312 shift + 104:326,target 89 + 61:320 reduce + 91:326 reduce + 80:307,target 43 + 79:307,target 42 + 44:343,target 80 + 90:343,target 2 + 89:343,target 85 + 60:337,target 23 + 59:337,target 22 + 31:316 shift + 45:326,target 8 + 91:326,target 5 + 0:338,target 23 + 31:320 shift + 61:326 reduce + 26:339,target 1 + 26:340,target 1 + 72:340,target 35 + 72:339,target 35 + 58:312,target 21 + 23:347,target 84 + 91:337 reduce + 31:326 shift + 38:342,target 70 + 94:0,target 4 + 91:338 reduce + 84:342,target 82 + 44:0 reduce + 91:340 reduce + 91:339 reduce + 91:341 reduce + 55:320,target 18 + 91:342 reduce + 91:343 reduce + 63:0,target 26 + 61:337 reduce + 51:344,target 14 + 96:344,target 86 + 91:344 reduce + 66:338,target 29 + 61:338 reduce + 86:0 reduce + 61:340 reduce + 61:339 reduce + 61:341 reduce + 37:316,target 69 + 83:316,target 81 + 61:342 reduce + 23:295,target 77 + 32:0,target 79 + 96:307 reduce + 61:343 reduce + 31:337 shift + 104:343,target 89 + 78:341,target 41 + 61:344 reduce + 31:338 shift + 31:339 shift + 31:340 shift + 31:341 shift + 96:312 reduce + 31:342 shift + 81:307,target 44 + 66:307 reduce + 31:343 shift + 45:343,target 8 + 91:343,target 5 + 61:337,target 24 + 31:344 shift + 0:355,target 32 + 46:326,target 9 + 96:316 reduce + 92:326,target 3 + 66:312 reduce + 96:320 reduce + 73:340,target 36 + 73:339,target 36 + 66:316 reduce + 3:305,target 33 + 60:312,target 23 + 59:312,target 22 + 16:0 reduce + 39:342,target 71 + 40:342,target 72 + 85:342,target 83 + 66:320 reduce + 31:355 goto + 96:326 reduce + 11:320,target 90 + 0:313,target 8 + 56:320,target 19 + 103:0 reduce + 58:0 reduce + 52:344,target 15 + 97:344,target 77 + 67:338,target 30 + 66:326 reduce + 38:316,target 70 + 84:316,target 82 + 7:340,target 91 + 7:339,target 91 + 24:295,target 77 + 80:341,target 43 + 79:341,target 42 + 96:337 reduce + 96:338 reduce + 91:0,target 5 + 26:262,target 95 + 96:340 reduce + 96:339 reduce + 96:341 reduce + 82:307,target 45 + 46:343,target 9 + 96:342 reduce + 92:343,target 3 + 62:337,target 25 + 96:343 reduce + 66:337 reduce + 60:0,target 23 + 59:0,target 22 + 47:326,target 10 + 23:269,target 51 + 23:270,target 52 + 96:344 reduce + 93:326,target 6 + 66:338 reduce + 66:340 reduce + 66:339 reduce + 2:338,target 93 + 66:341 reduce + 74:340,target 37 + 74:339,target 37 + 66:342 reduce + 66:343 reduce + 66:344 reduce + 61:312,target 24 + 0:329,target 21 + 41:342,target 73 + 86:342,target 84 + 72:307 reduce + 12:320,target 95 + 57:320,target 20 + 31:0 reduce + 53:344,target 16 + 98:344,target 76 + 72:312 reduce + 68:338,target 31 + 42:307 reduce + 39:316,target 71 + 40:316,target 72 + 85:316,target 83 + 73:0 reduce + 72:316 reduce + 81:341,target 44 + 42:312 reduce + 12:307 reduce + 5:0 reduce + 72:320 reduce + 37:307,target 69 + 83:307,target 81 + 47:343,target 10 + 23:286,target 68 + 42:316 reduce + 93:343,target 6 + 63:337,target 26 + 12:312 reduce + 48:326,target 11 + 94:326,target 4 + 42:320 reduce + 72:326 reduce + 12:316 reduce + 101:342,target 94 + 75:340,target 38 + 75:339,target 38 + 12:320 reduce + 62:312,target 25 + 42:326 reduce + 87:0,target 46 + 42:342,target 74 + 87:342,target 46 + 58:320,target 21 + 72:337 reduce + 56:0,target 19 + 12:326 reduce + 72:338 reduce + 54:344,target 17 + 99:344,target 87 + 72:340 reduce + 72:339 reduce + 70:338,target 33 + 69:338,target 32 + 72:341 reduce + 45:0 reduce + 72:342 reduce + 41:316,target 73 + 86:316,target 84 + 72:343 reduce + 42:337 reduce + 72:344 reduce + 42:338 reduce + 82:341,target 45 + 22:330,target 37 + 42:339 reduce + 42:340 reduce + 103:307 reduce + 42:341 reduce + 87:0 reduce + 42:342 reduce + 77:307 reduce + 12:337 reduce + 38:307,target 70 + 42:343 reduce + 84:307,target 82 + 48:343,target 11 + 12:338 reduce + 18:337,target 92 + 42:344 reduce + 103:312 reduce + 94:343,target 4 + 64:337,target 27 + 12:340 reduce + 12:339 reduce + 50:326,target 13 + 49:326,target 12 + 12:341 reduce + 95:326,target 7 + 77:312 reduce + 12:342 reduce + 12:343 reduce + 47:307 reduce + 103:316 reduce + 12:344 reduce + 31:339,target 24 + 31:340,target 25 + 102:342,target 78 + 76:340,target 39 + 76:339,target 39 + 77:316 reduce + 103:320 reduce + 47:312 reduce + 63:312,target 26 + 77:320 reduce + 43:342,target 75 + 88:342,target 47 + 47:316 reduce + 60:320,target 23 + 59:320,target 22 + 103:326 reduce + 101:316,target 94 + 55:344,target 18 + 47:320 reduce + 17:0 reduce + 23:263 shift + 77:326 reduce + 71:338,target 34 + 0:321,target 13 + 23:264 shift + 23:265 shift + 23:266 shift + 42:316,target 74 + 87:316,target 46 + 23:267 shift + 104:0 reduce + 23:268 shift + 37:341,target 69 + 83:341,target 81 + 60:0 reduce + 59:0 reduce + 47:326 reduce + 23:269 shift + 23:270 shift + 84:0,target 82 + 23:271 shift + 23:272 shift + 103:337 reduce + 23:273 shift + 39:307,target 71 + 40:307,target 72 + 103:338 reduce + 85:307,target 83 + 50:343,target 13 + 49:343,target 12 + 23:274 shift + 103:340 reduce + 103:339 reduce + 95:343,target 7 + 77:337 reduce + 65:337,target 28 + 53:0,target 16 + 23:275 shift + 103:341 reduce + 77:338 reduce + 51:326,target 14 + 23:276 shift + 103:342 reduce + 96:326,target 86 + 77:340 reduce + 77:339 reduce + 23:277 shift + 103:343 reduce + 77:341 reduce + 23:278 shift + 103:344 reduce + 77:342 reduce + 23:279 shift + 23:280 shift + 32:339,target 79 + 32:340,target 79 + 103:342,target 88 + 77:343 reduce + 77:340,target 40 + 77:339,target 40 + 47:337 reduce + 23:277,target 59 + 23:281 shift + 77:344 reduce + 47:338 reduce + 23:282 shift + 47:340 reduce + 47:339 reduce + 18:312,target 92 + 23:283 shift + 64:312,target 27 + 47:341 reduce + 23:284 shift + 47:342 reduce + 23:285 shift + 44:342,target 80 + 90:342,target 2 + 89:342,target 85 + 83:307 reduce + 47:343 reduce + 23:286 shift + 47:344 reduce + 23:287 shift + 61:320,target 24 + 23:288 shift + 102:316,target 78 + 11:344,target 90 + 0:337,target 22 + 23:289 shift + 23:290 shift + 23:300 shift + 83:312 reduce + 56:344,target 19 + 23:291 shift + 26:338,target 1 + 72:338,target 35 + 53:307 reduce + 23:292 shift + 23:293 shift + 23:294 shift + 43:316,target 75 + 88:316,target 47 + 83:316 reduce + 23:346,target 83 + 23:295 shift + 32:0 reduce + 53:312 reduce + 23:296 shift + 38:341,target 70 + 84:341,target 82 + 23:297 shift + 83:320 reduce + 23:298 shift + 23:299 shift + 53:316 reduce + 41:307,target 73 + 86:307,target 84 + 74:0 reduce + 51:343,target 14 + 96:343,target 86 + 66:337,target 29 + 53:320 reduce + 52:326,target 15 + 97:326,target 77 + 83:326 reduce + 6:0 reduce + 23:294,target 76 + 104:342,target 89 + 78:340,target 41 + 78:339,target 41 + 7:0,target 91 + 53:326 reduce + 81:0,target 44 + 65:312,target 28 + 45:342,target 8 + 91:342,target 5 + 0:354,target 31 + 83:337 reduce + 62:320,target 25 + 50:0,target 13 + 49:0,target 12 + 103:316,target 88 + 83:338 reduce + 12:344,target 95 + 83:340 reduce + 83:339 reduce + 57:344,target 20 + 83:341 reduce + 73:338,target 36 + 83:342 reduce + 18:0,target 92 + 83:343 reduce + 53:337 reduce + 44:316,target 80 + 90:316,target 2 + 89:316,target 85 + 83:344 reduce + 53:338 reduce + 101:307,target 94 + 53:340 reduce + 53:339 reduce + 39:341,target 71 + 40:341,target 72 + 85:341,target 83 + 53:341 reduce + 53:342 reduce + 0:312,target 7 + 88:307 reduce + 53:343 reduce + 46:0 reduce + 53:344 reduce + 42:307,target 74 + 87:307,target 46 + 52:343,target 15 + 97:343,target 77 + 67:337,target 30 + 88:312 reduce + 53:326,target 16 + 98:326,target 76 + 58:307 reduce + 88:0 reduce + 7:338,target 91 + 24:294,target 76 + 28:304 shift + 88:316 reduce + 80:340,target 43 + 80:339,target 43 + 79:340,target 42 + 79:339,target 42 + 23:346 goto + 58:312 reduce + 23:347 goto + 23:348 goto + 26:261,target 94 + 88:320 reduce + 66:312,target 29 + 46:342,target 9 + 92:342,target 3 + 58:316 reduce + 104:0,target 89 + 23:268,target 50 + 63:320,target 26 + 104:316,target 89 + 58:320 reduce + 2:337,target 93 + 88:326 reduce + 58:344,target 21 + 74:338,target 37 + 45:316,target 8 + 91:316,target 5 + 4:0,target 62 + 102:307,target 78 + 58:326 reduce + 0:328,target 20 + 41:341,target 73 + 86:341,target 84 + 77:0,target 40 + 18:0 reduce + 43:307,target 75 + 88:337 reduce + 88:307,target 47 + 53:343,target 16 + 46:0,target 9 + 98:343,target 76 + 88:338 reduce + 68:337,target 31 + 88:340 reduce + 88:339 reduce + 61:0 reduce + 54:326,target 17 + 99:326,target 87 + 88:341 reduce + 88:342 reduce + 15:0,target 52 + 88:343 reduce + 58:337 reduce + 88:344 reduce + 81:340,target 44 + 81:339,target 44 + 58:338 reduce + 58:340 reduce + 58:339 reduce + 58:341 reduce + 67:312,target 30 + 58:342 reduce + 94:307 reduce + 58:343 reduce + 47:342,target 10 + 23:285,target 67 + 93:342,target 6 + 58:344 reduce + 18:320,target 92 + 64:320,target 27 + 94:312 reduce + 64:307 reduce + 60:344,target 23 + 59:344,target 22 + 101:341,target 94 + 75:338,target 38 + 94:316 reduce + 46:316,target 9 + 92:316,target 3 + 64:312 reduce + 103:307,target 88 + 42:341,target 74 + 94:320 reduce + 87:341,target 46 + 2:312,target 93 + 64:316 reduce + 101:0,target 94 + 44:307,target 80 + 90:307,target 2 + 89:307,target 85 + 54:343,target 17 + 33:0 reduce + 99:343,target 87 + 70:337,target 33 + 69:337,target 32 + 64:320 reduce + 94:326 reduce + 55:326,target 18 + 82:340,target 45 + 82:339,target 45 + 75:0 reduce + 1:0,target 54 + 64:326 reduce + 74:0,target 37 + 68:312,target 31 + 7:0 reduce + 48:342,target 11 + 94:342,target 4 + 94:337 reduce + 43:0,target 75 + 94:338 reduce + 65:320,target 28 + 94:340 reduce + 94:339 reduce + 94:341 reduce + 61:344,target 24 + 31:338,target 23 + 102:341,target 78 + 94:342 reduce + 76:338,target 39 + 12:0,target 95 + 94:343 reduce + 64:337 reduce + 94:344 reduce + 64:338 reduce + 47:316,target 10 + 93:316,target 6 + 64:340 reduce + 64:339 reduce + 104:307,target 89 + 64:341 reduce + 43:341,target 75 + 88:341,target 47 + 64:342 reduce + 99:307 reduce + 64:343 reduce + 64:344 reduce + 45:307,target 8 + 91:307,target 5 + 55:343,target 18 + 99:312 reduce + 71:337,target 34 + 11:326,target 90 + 0:320,target 12 + 70:307 reduce + 69:307 reduce + 56:326,target 19 + 27:304,target 97 + 47:0 reduce + 99:316 reduce + 37:339,target 69 + 37:340,target 69 + 83:340,target 81 + 83:339,target 81 + 70:312 reduce + 69:312 reduce + 39:307 reduce + 40:307 reduce + 99:320 reduce + 70:312,target 33 + 69:312,target 32 + 90:0 reduce + 89:0 reduce + 70:316 reduce + 69:316 reduce + 50:342,target 13 + 49:342,target 12 + 95:342,target 7 + 39:312 reduce + 40:312 reduce + 70:320 reduce + 69:320 reduce + 66:320,target 29 + 31:355,target 102 + 99:326 reduce + 62:344,target 25 + 32:338,target 79 + 39:316 reduce + 40:316 reduce + 103:341,target 88 + 77:338,target 40 + 23:276,target 58 + 48:316,target 11 + 39:320 reduce + 40:320 reduce + 94:316,target 4 + 70:326 reduce + 69:326 reduce + 71:0,target 34 + 44:341,target 80 + 90:341,target 2 + 89:341,target 85 + 99:337 reduce + 11:343,target 90 + 39:0,target 71 + 39:326 reduce + 40:0,target 72 + 40:326 reduce + 46:307,target 9 + 99:338 reduce + 92:307,target 3 + 56:343,target 19 + 26:337,target 1 + 99:340 reduce + 99:339 reduce + 72:337,target 35 + 12:326,target 95 + 99:341 reduce + 57:326,target 20 + 19:0 reduce + 20:0 reduce + 99:342 reduce + 99:343 reduce + 70:337 reduce + 69:337 reduce + 28:304,target 100 + 99:344 reduce + 70:338 reduce + 69:338 reduce + 38:339,target 70 + 38:340,target 70 + 84:340,target 82 + 84:339,target 82 + 70:340 reduce + 70:339 reduce + 69:340 reduce + 69:339 reduce + 70:341 reduce + 69:341 reduce + 70:342 reduce + 69:342 reduce + 62:0 reduce + 71:312,target 34 + 70:343 reduce + 69:343 reduce + 39:337 reduce + 40:337 reduce + 70:344 reduce + 69:344 reduce + 51:342,target 14 + 39:338 reduce + 40:338 reduce + 96:342,target 86 + 39:339 reduce + 39:340 reduce + 40:339 reduce + 40:340 reduce + 101:307 reduce + 39:341 reduce + 40:341 reduce + 67:320,target 30 + 39:342 reduce + 40:342 reduce + 75:307 reduce + 23:293,target 75 + 39:343 reduce + 40:343 reduce + 63:344,target 26 + 39:344 reduce + 40:344 reduce + 104:341,target 89 + 101:312 reduce + 78:338,target 41 + 75:312 reduce + 50:316,target 13 + 49:316,target 12 + 95:316,target 7 + 45:307 reduce + 101:316 reduce + 45:341,target 8 + 91:341,target 5 + 75:316 reduce + 101:320 reduce + 45:312 reduce + 47:307,target 10 + 12:343,target 95 + 93:307,target 6 + 75:320 reduce + 57:343,target 20 + 73:337,target 36 + 2:320,target 93 + 58:326,target 21 + 45:316 reduce + 98:0,target 76 + 101:326 reduce + 29:304,target 101 + 39:339,target 71 + 39:340,target 71 + 40:339,target 72 + 40:340,target 72 + 45:320 reduce + 85:340,target 83 + 85:339,target 83 + 75:326 reduce + 34:0 reduce + 67:0,target 30 + 0:311,target 6 + 26:312,target 1 + 72:312,target 35 + 52:342,target 15 + 22:336,target 43 + 97:342,target 77 + 36:0,target 53 + 45:326 reduce + 76:0 reduce + 68:320,target 31 + 101:337 reduce + 7:337,target 91 + 18:344,target 92 + 101:338 reduce + 64:344,target 27 + 8:0 reduce + 101:340 reduce + 101:339 reduce + 80:338,target 43 + 79:338,target 42 + 75:337 reduce + 101:341 reduce + 75:338 reduce + 101:342 reduce + 75:340 reduce + 75:339 reduce + 51:316,target 14 + 26:259,target 92 + 26:260,target 93 + 101:343 reduce + 96:316,target 86 + 75:341 reduce + 101:344 reduce + 75:342 reduce + 46:341,target 9 + 92:341,target 3 + 75:343 reduce + 45:337 reduce + 75:344 reduce + 23:267,target 49 + 45:338 reduce + 45:339 reduce + 45:340 reduce + 48:307,target 11 + 45:341 reduce + 94:307,target 4 + 58:343,target 21 + 45:342 reduce + 81:307 reduce + 74:337,target 37 + 3:319,target 35 + 45:343 reduce + 60:326,target 23 + 59:326,target 22 + 45:344 reduce +} + +array set regionsend::rules { + 9,l 346 + 11,l 346 + 32,l 347 + 53,l 350 + 74,l 352 + 95,l 355 + 6,l 345 + 28,l 347 + 50,l 350 + 49,l 350 + 71,l 352 + 92,l 355 + 3,l 345 + 25,l 347 + 46,l 349 + 67,l 351 + 0,l 356 + 88,l 355 + 22,l 347 + 43,l 348 + 64,l 350 + 85,l 355 + 18,l 347 + 40,l 348 + 39,l 348 + 61,l 350 + 82,l 355 + 15,l 347 + 36,l 347 + 57,l 350 + 78,l 354 + 12,l 347 + 33,l 347 + 54,l 350 + 75,l 352 + 7,l 345 + 29,l 347 + 30,l 347 + 51,l 350 + 72,l 352 + 93,l 355 + 4,l 345 + 26,l 347 + 47,l 349 + 68,l 351 + 90,l 355 + 89,l 355 + 1,l 345 + 23,l 347 + 44,l 348 + 65,l 350 + 86,l 355 + 19,l 347 + 20,l 347 + 41,l 348 + 62,l 350 + 83,l 355 + 16,l 347 + 37,l 347 + 58,l 350 + 80,l 355 + 79,l 354 + 13,l 347 + 34,l 347 + 55,l 350 + 76,l 353 + 8,l 346 + 10,l 346 + 31,l 347 + 52,l 350 + 73,l 352 + 94,l 355 + 5,l 345 + 27,l 347 + 48,l 350 + 70,l 352 + 69,l 352 + 91,l 355 + 2,l 345 + 24,l 347 + 45,l 348 + 66,l 351 + 87,l 355 + 21,l 347 + 42,l 348 + 63,l 350 + 84,l 355 + 17,l 347 + 38,l 347 + 60,l 350 + 59,l 350 + 81,l 355 + 14,l 347 + 35,l 347 + 56,l 350 + 77,l 353 +} + +array set regionsend::rules { + 63,dc 1 + 12,dc 1 + 77,dc 1 + 26,dc 1 + 92,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 70,dc 1 + 69,dc 1 + 18,dc 1 + 84,dc 2 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 1 + 11,dc 1 + 76,dc 1 + 25,dc 1 + 91,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 1 + 68,dc 1 + 17,dc 1 + 83,dc 2 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 61,dc 1 + 10,dc 1 + 75,dc 1 + 24,dc 1 + 90,dc 1 + 89,dc 3 + 1,dc 0 + 38,dc 1 + 53,dc 2 + 67,dc 1 + 16,dc 1 + 82,dc 2 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 60,dc 1 + 59,dc 1 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 88,dc 3 + 37,dc 1 + 52,dc 1 + 66,dc 1 + 15,dc 1 + 81,dc 2 + 29,dc 1 + 30,dc 1 + 95,dc 1 + 6,dc 1 + 44,dc 1 + 58,dc 1 + 73,dc 1 + 22,dc 1 + 87,dc 2 + 36,dc 1 + 51,dc 1 + 65,dc 1 + 14,dc 1 + 80,dc 2 + 79,dc 1 + 28,dc 1 + 94,dc 2 + 5,dc 1 + 43,dc 1 + 57,dc 1 + 72,dc 1 + 21,dc 1 + 86,dc 2 + 35,dc 1 + 50,dc 1 + 49,dc 1 + 64,dc 1 + 13,dc 1 + 78,dc 2 + 27,dc 1 + 93,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 1 + 71,dc 1 + 19,dc 1 + 20,dc 1 + 85,dc 2 + 34,dc 1 + 48,dc 0 +} + +array set regionsend::rules { + 41,line 206 + 7,line 169 + 37,line 201 + 93,line 277 + 4,line 166 + 34,line 198 + 90,line 274 + 89,line 273 + 1,line 163 + 31,line 195 + 86,line 270 + 27,line 191 + 83,line 266 + 24,line 188 + 80,line 262 + 79,line 259 + 21,line 185 + 76,line 254 + 17,line 181 + 73,line 249 + 14,line 178 + 70,line 246 + 69,line 245 + 11,line 174 + 66,line 240 + 63,line 235 + 60,line 232 + 59,line 231 + 56,line 227 + 53,line 224 + 50,line 220 + 49,line 219 + 46,line 212 + 43,line 208 + 9,line 172 + 40,line 205 + 39,line 204 + 95,line 279 + 6,line 168 + 36,line 200 + 92,line 276 + 3,line 165 + 33,line 197 + 88,line 272 + 29,line 193 + 30,line 194 + 85,line 268 + 26,line 190 + 82,line 265 + 23,line 187 + 78,line 258 + 19,line 183 + 20,line 184 + 75,line 251 + 16,line 180 + 72,line 248 + 13,line 177 + 68,line 242 + 10,line 173 + 65,line 237 + 62,line 234 + 58,line 229 + 55,line 226 + 52,line 222 + 48,line 217 + 45,line 210 + 42,line 207 + 8,line 171 + 38,line 202 + 94,line 278 + 5,line 167 + 35,line 199 + 91,line 275 + 2,line 164 + 32,line 196 + 87,line 271 + 28,line 192 + 84,line 267 + 25,line 189 + 81,line 263 + 22,line 186 + 77,line 255 + 18,line 182 + 74,line 250 + 15,line 179 + 71,line 247 + 12,line 176 + 67,line 241 + 64,line 236 + 61,line 233 + 57,line 228 + 54,line 225 + 51,line 221 + 47,line 213 + 44,line 209 +} + +array set regionsend::lr1_table { + 35 {{67 0 1}} + 66,trans {} + 36 {{53 0 2}} + 85,trans {} + 37 {{69 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 38 {{70 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 39 {{71 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 40 {{72 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 41 {{73 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 42 {{74 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 43 {{75 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 44 {{80 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 45 {{8 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 46 {{9 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 47 {{10 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 48 {{11 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 49 {{12 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 50 {{13 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 27,trans {{304 97} {318 98} {353 99}} + 51 {{14 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 46,trans {} + 52 {{15 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 65,trans {} + 53 {{16 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 84,trans {} + 54 {{17 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 55 {{18 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 56 {{19 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 57 {{20 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 58 {{21 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 59 {{22 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 60 {{23 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 61 {{24 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 62 {{25 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 63 {{26 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 64 {{27 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 65 {{28 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 66 {{29 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 26,trans {{257 90} {258 91} {259 92} {260 93} {261 94} {262 95} {345 96}} + 67 {{30 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 45,trans {} + 68 {{31 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 64,trans {} + 69 {{32 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 70 {{33 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 83,trans {} + 71 {{34 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 72 {{35 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 73 {{36 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 74 {{37 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 75 {{38 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 76 {{39 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 77 {{40 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 78 {{41 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 79 {{42 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 80 {{43 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 81 {{44 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 82 {{45 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 83 {{81 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 25,trans {{301 87} {302 88} {349 89}} + 84 {{82 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 44,trans {} + 85 {{83 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 63,trans {} + 86 {{84 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 82,trans {} + 87 {{46 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 0 {{0 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {53 0 0} {54 0 0} {55 0 0} {56 0 0} {57 0 0} {58 0 0} {59 0 0} {60 0 0} {61 0 0} {62 0 0} {63 0 0} {64 0 0} {65 0 0} {78 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {79 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {80 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {81 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {82 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {83 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {84 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {85 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {86 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {87 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {88 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {89 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {90 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {91 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {92 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {93 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {94 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {95 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 88 {{47 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 1 {{54 0 1}} + 89 {{85 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 90 {{2 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 2 {{93 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 91 {{5 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 3 {{53 0 1} {66 0 0} {67 0 0} {68 0 0}} + 92 {{3 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 4 {{62 0 1}} + 93 {{6 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 5 {{60 0 1}} + 94 {{4 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 6 {{50 0 1}} + 95 {{7 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 7 {{91 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 96 {{86 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 8 {{55 0 1}} + 97 {{77 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 9 {{64 0 1}} + 98 {{76 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 24,trans {{294 76} {295 77} {296 78} {297 79} {298 80} {299 81} {300 82} {348 86}} + 99 {{87 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 43,trans {} + 62,trans {} + 81,trans {} + 99,trans {} + 23,trans {{263 45} {264 46} {265 47} {266 48} {267 49} {268 50} {269 51} {270 52} {271 53} {272 54} {273 55} {274 56} {275 57} {276 58} {277 59} {278 60} {279 61} {280 62} {281 63} {282 64} {283 65} {284 66} {285 67} {286 68} {287 69} {288 70} {289 71} {290 72} {291 73} {292 74} {293 75} {294 76} {295 77} {296 78} {297 79} {298 80} {299 81} {300 82} {346 83} {347 84} {348 85}} + 42,trans {} + 61,trans {} + 79,trans {} + 80,trans {} + 98,trans {} + 9,trans {} + 22,trans {{330 37} {331 38} {332 39} {333 40} {334 41} {335 42} {336 43} {352 44}} + 41,trans {} + 59,trans {} + 60,trans {} + 78,trans {} + 97,trans {} + 8,trans {} + 100 {{88 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2} {89 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 101 {{94 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 102 {{78 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 2}} + 103 {{88 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 3}} + 104 {{89 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 3}} + 21,trans {} + 39,trans {} + 40,trans {} + 58,trans {} + 77,trans {} + 96,trans {} + 7,trans {} + 19,trans {} + 20,trans {} + 38,trans {} + 57,trans {} + 76,trans {} + 95,trans {} + 6,trans {} + 18,trans {} + 37,trans {} + 56,trans {} + 75,trans {} + 94,trans {} + 5,trans {} + 17,trans {} + 36,trans {} + 55,trans {} + 74,trans {} + 93,trans {} + 4,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 73,trans {} + 92,trans {} + 3,trans {{305 33} {317 34} {319 35} {351 36}} + 15,trans {} + 34,trans {} + 53,trans {} + 72,trans {} + 91,trans {} + 2,trans {} + 104,trans {} + 14,trans {} + 33,trans {} + 52,trans {} + 71,trans {} + 90,trans {} + 89,trans {} + 1,trans {} + 103,trans {} + 13,trans {} + 32,trans {} + 51,trans {} + 69,trans {} + 70,trans {} + 0,trans {{306 1} {307 2} {308 3} {309 4} {310 5} {311 6} {312 7} {313 8} {314 9} {315 10} {316 11} {320 12} {321 13} {322 14} {323 15} {324 16} {325 17} {326 18} {327 19} {328 20} {329 21} {337 22} {338 23} {339 24} {340 25} {341 26} {342 27} {343 28} {344 29} {350 30} {354 31} {355 32}} + 88,trans {} + 102,trans {} + 12,trans {} + 31,trans {{307 2} {312 7} {316 11} {320 12} {326 18} {337 22} {338 23} {339 24} {340 25} {341 26} {342 27} {343 28} {344 29} {355 102}} + 49,trans {} + 50,trans {} + 68,trans {} + 87,trans {} + 101,trans {} + 10 {{65 0 1}} + 11 {{90 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 12 {{95 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 13 {{61 0 1}} + 14 {{51 0 1}} + 15 {{52 0 1}} + 11,trans {} + 16 {{57 0 1}} + 29,trans {{304 101}} + 30,trans {} + 17 {{58 0 1}} + 48,trans {} + 18 {{92 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 67,trans {} + 20 {{56 0 1}} + 19 {{59 0 1}} + 86,trans {} + 21 {{63 0 1}} + 22 {{80 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {69 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {70 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {71 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {72 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {73 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {74 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {75 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 100,trans {{303 103} {304 104}} + 23 {{81 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {82 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {83 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {8 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {9 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {10 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {11 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {12 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {13 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {14 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {15 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {16 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {17 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {18 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {19 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {20 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {21 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {22 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {23 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {24 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {25 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {26 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {27 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {28 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {29 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {30 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {31 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {32 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {33 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {34 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {35 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {36 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {37 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {38 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {39 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {40 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {41 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {42 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {43 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {44 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {45 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 24 {{84 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {39 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {40 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {41 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {42 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {43 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {44 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {45 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 25 {{85 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {46 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {47 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 26 {{86 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {1 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {2 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {3 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {4 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {5 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {6 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {7 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 27 {{87 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {76 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {77 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 28 {{88 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {89 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 30 {{0 0 1}} + 29 {{94 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 31 {{49 0 1} {78 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1} {80 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {81 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {82 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {83 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {84 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {85 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {86 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {87 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {88 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {89 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {90 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {91 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {92 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {93 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {94 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0} {95 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 0}} + 10,trans {} + 32 {{79 {0 307 312 316 320 326 337 338 339 340 341 342 343 344} 1}} + 33 {{66 0 1}} + 28,trans {{304 100}} + 34 {{68 0 1}} + 47,trans {} +} + +array set regionsend::token_id_table { + 286 WCSS_ + 286,t 0 + 287 WCST_ + 292,line 44 + 302,line 56 + 288 WCSU_ + 317,t 0 + 265,title AMPLIFIER + 289 WCSV_ + 290 WCSW_ + 300 ECLIPTIC_ + 284,title WCSQ + 291 WCSX_ + 301 DEGREES_ + 313,title FORMAT + 292 WCSY_ + 302 SEXAGESIMAL_ + 338,t 0 + 332,title CIAO + 288,line 40 + 293 WCSZ_ + 303 INT_ + 351,title {} + 294 FK4_ + 304 STRING_ + 354,line 257 + 305 AUTO_ + 295 B1950_ + 306 AUTOCENTROID_ + 296 FK5_ + 307 BACKGROUND_ + 262,t 0 + 297 J2000_ + 308 CENTROID_ + 285,line 37 + 298 ICRS_ + 310 DELIM_ + 309 COLOR_ + 299 GALACTIC_ + 351,line 239 + 311 EPSILON_ + 283,t 0 + 312 EXCLUDE_ + 313 FORMAT_ + 314,t 0 + 314 GROUP_ + 282,line 34 + 315 GROUPS_ + 347,line 175 + 316 INCLUDE_ + 264,title PHYSICAL + 335,t 0 + 317 ITERATION_ + 283,title WCSP + 318 NL_ + 312,title EXCLUDE + 331,title XML + 320 SELECTED_ + 319 RADIUS_ + 278,line 30 + 356,t 1 + 350,title {} + 349,title {} + error,line 161 + 321 SHAPE_ + 344,line 105 + 322 SHOW_ + 258,t 0 + 323 SHOWTEXT_ + 324 SKY_ + 325 SKYFORMAT_ + 275,line 27 + 279,t 0 + 280,t 0 + 326 SOURCE_ + 341,line 102 + 327 STRIP_ + 328 SYSTEM_ + 311,t 0 + 330 DS9_ + 329 WIDTH_ + 331 XML_ + 272,line 24 + 332,t 0 + 332 CIAO_ + 337,line 98 + 333 SAOTNG_ + 263,title IMAGE + 334 PROS_ + 282,title WCSO + 353,t 1 + 335 SAOIMAGE_ + 311,title EPSILON + 336 XY_ + 330,title DS9 + 329,title WIDTH + 268,line 20 + 348,title {} + 337 MFORMAT_ + 338 MSYSTEM_ + 334,line 94 + 340 MSKYFORMAT_ + 339 MSKY_ + 276,t 0 + 341 MSTRIP_ + 342 MDELIM_ + 265,line 16 + 343 MPROP_ + 307,t 0 + 297,t 0 + 344 MGROUP_ + 331,line 91 + 345 yesno + 346 coordsys + 328,t 0 + 347 wcssys + 262,line 12 + 348 skyframe + 350,t 1 + 350 regionsend + 349,t 1 + 349 skyformat + 0,t 0 + 0 {$} + 327,line 86 + 262,title FALSE + 351 centroid + 281,title WCSN + 352 format + error,t 0 + 310,title DELIM + 309,title COLOR + 299,title GALACTIC + 353 delim + 328,title SYSTEM + 258,line 8 + 354 props + 347,title {} + 273,t 0 + 355 prop + 324,line 83 + 356 start' + 294,t 0 + 304,t 0 + 325,t 0 + 321,line 80 + 346,t 1 + 317,line 76 + 261,title TRUE + 279,title WCSL + 280,title WCSM + 308,title CENTROID + 269,t 0 + 270,t 0 + 298,title ICRS + 327,title STRIP + 346,title {} + 314,line 73 + 291,t 0 + 301,t 0 + 322,t 0 + 311,line 70 + 343,t 0 + 307,line 66 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 50 + 278,title WCSK + 307,title BACKGROUND + 297,title J2000 + 326,title SOURCE + 287,t 0 + 345,title {} + 294,line 47 + 304,line 60 + 318,t 0 + 340,t 0 + 339,t 0 + error,title {} + 291,line 43 + 301,line 55 + 356,line 280 + 263,t 0 + 258,title NO + 287,line 39 + 277,title WCSJ + 284,t 0 + 353,line 253 + 306,title AUTOCENTROID + 296,title FK5 + 325,title SKYFORMAT + 344,title MGROUP + 315,t 0 + 284,line 36 + 350,line 216 + 349,line 211 + 336,t 0 + 281,line 33 + 260,t 0 + 259,t 0 + 346,line 170 + 281,t 0 + 257,title YES + 277,line 29 + 276,title WCSI + 343,line 104 + 312,t 0 + 305,title AUTO + 295,title B1950 + 324,title SKY + 343,title MPROP + 333,t 0 + 274,line 26 + 340,line 101 + 339,line 100 + 354,t 1 + 271,line 23 + 336,line 96 + 277,t 0 + 308,t 0 + 267,line 19 + 298,t 0 + 275,title WCSH + 333,line 93 + 294,title FK4 + 304,title string + 330,t 0 + 329,t 0 + 323,title SHOWTEXT + 342,title MDELIM + 264,line 15 + 351,t 1 + 330,line 90 + 329,line 88 + 261,line 11 + 274,t 0 + 326,line 85 + 305,t 0 + 295,t 0 + 257,line 7 + 326,t 0 + 274,title WCSG + 323,line 82 + 293,title WCSZ + 303,title integer + 322,title SHOW + 347,t 1 + 341,title MSTRIP + 320,line 79 + 319,line 78 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 75 + 323,t 0 + 273,title WCSF + 344,t 0 + 313,line 72 + 292,title WCSY + 302,title SEXAGESIMAL + 321,title SHAPE + 340,title MSKYFORMAT + 339,title MSKY + 267,t 0 + 310,line 69 + 309,line 68 + 299,line 52 + 288,t 0 + 320,t 0 + 319,t 0 + 306,line 65 + 296,line 49 + 341,t 0 + 272,title WCSE + 291,title WCSX + 293,line 45 + 301,title DEGREES + 303,line 58 + 320,title SELECTED + 319,title RADIUS + 338,title MSYSTEM + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 53 + 355,line 261 + 316,t 0 + 286,line 38 + 337,t 0 + 352,line 244 + 271,title WCSD + 261,t 0 + 283,line 35 + 289,title WCSV + 290,title WCSW + 300,title ECLIPTIC + 318,title NL + 348,line 203 + 337,title MFORMAT + 356,title {} + 282,t 0 + 279,line 31 + 280,line 32 + 313,t 0 + 345,line 162 + 334,t 0 + 276,line 28 + 355,t 1 + 342,line 103 + 257,t 0 + 269,title WCSB + 270,title WCSC + 273,line 25 + 288,title WCSU + 317,title ITERATION + 278,t 0 + 338,line 99 + 336,title XY + 355,title {} + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 21 + 270,line 22 + 335,line 95 + 331,t 0 + 352,t 1 + 266,line 17 + 332,line 92 + 268,title WCSA + 275,t 0 + 263,line 14 + 287,title WCST + 316,title INCLUDE + 335,title SAOIMAGE + 328,line 87 + 306,t 0 + 296,t 0 + 354,title {} + 327,t 0 + 260,line 10 + 259,line 9 + 325,line 84 + 348,t 1 + 322,line 81 + 272,t 0 + 267,title WCS + 257 YES_ + 286,title WCSS + 293,t 0 + 303,t 0 + 315,title GROUPS + 258 NO_ + 334,title PROS + 318,line 77 + 260 OFF_ + 259 ON_ + 353,title {} + 324,t 0 + 261 TRUE_ + 262 FALSE_ + 263 IMAGE_ + 345,t 1 + 264 PHYSICAL_ + 315,line 74 + 265 AMPLIFIER_ + 266 DETECTOR_ + 267 WCS_ + 268,t 0 + 268 WCSA_ + 269 WCSB_ + 270 WCSC_ + 312,line 71 + 271 WCSD_ + 272 WCSE_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title DETECTOR + 273 WCSF_ + 274 WCSG_ + 285,title WCSR + 321,t 0 + 314,title GROUP + 275 WCSH_ + 333,title SAOTNG + 308,line 67 + 276 WCSI_ + 298,line 51 + 352,title {} + 277 WCSJ_ + 342,t 0 + 278 WCSK_ + 279 WCSL_ + 280 WCSM_ + 281 WCSN_ + 305,line 64 + 282 WCSO_ + 295,line 48 + 265,t 0 + 283 WCSP_ + 284 WCSQ_ + 285 WCSR_ +} + +proc regionsend::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ image } + 9 { set _ physical } + 10 { set _ amplifier } + 11 { set _ detector } + 12 { set _ wcs } + 13 { set _ wcsa } + 14 { set _ wcsb } + 15 { set _ wcsc } + 16 { set _ wcsd } + 17 { set _ wcse } + 18 { set _ wcsf } + 19 { set _ wcsg } + 20 { set _ wcsh } + 21 { set _ wcsi } + 22 { set _ wcsj } + 23 { set _ wcsk } + 24 { set _ wcsl } + 25 { set _ wcsm } + 26 { set _ wcsn } + 27 { set _ wcso } + 28 { set _ wcsp } + 29 { set _ wcsq } + 30 { set _ wcsr } + 31 { set _ wcss } + 32 { set _ wcst } + 33 { set _ wcsu } + 34 { set _ wcsv } + 35 { set _ wcsw } + 36 { set _ wcsx } + 37 { set _ wcsy } + 38 { set _ wcsz } + 39 { set _ fk4 } + 40 { set _ fk4 } + 41 { set _ fk5 } + 42 { set _ fk5 } + 43 { set _ icrs } + 44 { set _ galactic } + 45 { set _ ecliptic } + 46 { set _ degrees } + 47 { set _ sexagesimal } + 48 { RegionSendCmd } + 49 { RegionSendCmd } + 50 { ProcessSendCmdGet pmarker epsilon } + 51 { ProcessSendCmdYesNo marker show } + 52 { ProcessSendCmdYesNo marker show,text } + 54 { ProcessSendCmdYesNo marker centroid,auto } + 55 { ProcessSendCmdGet marker format } + 56 { ProcessSendCmdGet marker system } + 57 { ProcessSendCmdGet marker sky } + 58 { ProcessSendCmdGet marker skyformat } + 59 { ProcessSendCmdYesNo marker strip } + 61 { ProcessSendCmdGet marker shape } + 62 { ProcessSendCmdGet marker color } + 63 { ProcessSendCmdGet marker width } + 64 { ProcessSendCmdCurrent "get marker tag all" } + 65 { ProcessSendCmdCurrent "get marker tag all" } + 66 { ProcessSendCmdYesNo marker centroid,auto } + 67 { ProcessSendCmdGet marker centroid,radius } + 68 { ProcessSendCmdGet marker centroid,iteration } + 69 { set _ ds9 } + 70 { set _ xml } + 71 { set _ ciao } + 72 { set _ saotng } + 73 { set _ pros } + 74 { set _ saoimage } + 75 { set _ xy } + 76 { set _ 0 } + 77 { set _ 1 } + 80 { ProcessCmdSet marker load,format $2 } + 81 { ProcessCmdSet marker load,system $2 } + 82 { ProcessCmdSet marker load,system $2 } + 83 { ProcessCmdSet marker load,system wcs; ProcessCmdSet marker load,sky $2 } + 84 { ProcessCmdSet marker load,sky $2 } + 85 { ProcessCmdSet marker load,skyformat $2 } + 86 { ProcessCmdSet marker load,strip $2 } + 87 { ProcessCmdSet marker load,strip $2 } + 88 { ProcessCmdAppend marker load,props "$2 = $3 " } + 89 { ProcessCmdAppend marker load,props "$2 = $3 " } + 90 { ProcessCmdAppend marker load,props "include = 1 " } + 91 { ProcessCmdAppend marker load,props "include = 0 " } + 92 { ProcessCmdAppend marker load,props "source = 1 " } + 93 { ProcessCmdAppend marker load,props "source = 0 " } + 94 { ProcessCmdAppend marker load,tags "tag = $2 " } + 95 { ProcessCmdSet marker load,select select } + } + 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 regionsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/restorelex.tcl b/ds9/parsers/restorelex.tcl new file mode 100644 index 0000000..2da3ac4 --- /dev/null +++ b/ds9/parsers/restorelex.tcl @@ -0,0 +1,286 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval restore { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc restore::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc restore::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc restore::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc restore::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc restore::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc restore::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc restore::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc restore::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc restore::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval $yytext; return $STRING_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/restoreparser.tab.tcl b/ds9/parsers/restoreparser.tab.tcl new file mode 100644 index 0000000..b7d9526 --- /dev/null +++ b/ds9/parsers/restoreparser.tab.tcl @@ -0,0 +1 @@ +set STRING_ 257 diff --git a/ds9/parsers/restoreparser.tcl b/ds9/parsers/restoreparser.tcl new file mode 100644 index 0000000..8b830f6 --- /dev/null +++ b/ds9/parsers/restoreparser.tcl @@ -0,0 +1,287 @@ +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 restore { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc restore::YYABORT {} { + return -code return 1 +} + +proc restore::YYACCEPT {} { + return -code return 0 +} + +proc restore::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc restore::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc restore::yyerror {s} { + puts stderr $s +} + +proc restore::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 restore::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set restore::table { + 3:0,target 1 + 0:257 shift + 0:258 goto + 1:257 reduce + 5:0,target 3 + 0:260 goto + 3:257 reduce + 4:257 shift + 0:258,target 2 + 1:257,target 4 + 3:259 goto + 3:257,target 2 + 2:0,target 0 + 3:259,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:260,target 3 + 1:0,target 4 + 5:0 reduce + 4:257,target 5 +} + +array set restore::rules { + 0,l 261 + 1,l 258 + 2,l 259 + 3,l 258 + 4,l 260 +} + +array set restore::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set restore::rules { + 2,e 1 + 2,line 14 + 4,line 18 + 1,line 14 + 3,line 15 +} + +array set restore::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0}} + 1 {{4 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 257 0}} + 0,trans {{257 1} {258 2} {260 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{259 4}} + 4,trans {{257 5}} + 5,trans {} +} + +array set restore::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 13 + 261,line 19 + 257 STRING_ + 257,t 0 + error,line 12 + 258,t 1 + 258 command + 260,t 1 + 260 restore + 259,t 1 + 259 @PSEUDO1 + error,title {} + 261,t 1 + 261 start' + 257,line 7 + 260,line 17 + 259,line 14 + 257,title string + 258,title {} + 260,title {} + 259,title {} + 261,title {} +} + +proc restore::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { FileLast backupfbox $1; Restore $1 } + } + 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 restore::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/rgbarraylex.tcl b/ds9/parsers/rgbarraylex.tcl new file mode 100644 index 0000000..c30d821 --- /dev/null +++ b/ds9/parsers/rgbarraylex.tcl @@ -0,0 +1,307 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval rgbarray { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc rgbarray::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc rgbarray::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc rgbarray::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc rgbarray::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc rgbarray::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc rgbarray::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc rgbarray::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc rgbarray::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc rgbarray::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/rgbarrayparser.tab.tcl b/ds9/parsers/rgbarrayparser.tab.tcl new file mode 100644 index 0000000..f492518 --- /dev/null +++ b/ds9/parsers/rgbarrayparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set NEW_ 258 diff --git a/ds9/parsers/rgbarrayparser.tcl b/ds9/parsers/rgbarrayparser.tcl new file mode 100644 index 0000000..4ea1e64 --- /dev/null +++ b/ds9/parsers/rgbarrayparser.tcl @@ -0,0 +1,298 @@ +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 rgbarray { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc rgbarray::YYABORT {} { + return -code return 1 +} + +proc rgbarray::YYACCEPT {} { + return -code return 0 +} + +proc rgbarray::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc rgbarray::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc rgbarray::yyerror {s} { + puts stderr $s +} + +proc rgbarray::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 rgbarray::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set rgbarray::table { + 3:0,target 1 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 3 + 0:259 goto + 0:260 goto + 0:261 goto + 4:257 shift + 1:257,target 5 + 0:258,target 1 + 0:0,target 4 + 0:261,target 4 + 2:0,target 0 + 4:0,target 2 + 0:0 reduce + 1:0 reduce + 0:257,target 4 + 2:0 accept + 3:0 reduce + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 5 + 5:0 reduce + 4:257,target 5 +} + +array set rgbarray::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 260 + 4,l 261 + 5,l 261 +} + +array set rgbarray::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 1,dc 1 + 3,dc 2 +} + +array set rgbarray::rules { + 5,line 25 + 2,line 20 + 4,line 24 + 1,line 17 + 3,line 21 +} + +array set rgbarray::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0}} + 1 {{5 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4}} + 1,trans {} + 5 {{3 0 2}} + 2,trans {} + 3,trans {} + 4,trans {{257 5}} + 5,trans {} +} + +array set rgbarray::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 11 + 261,line 23 + error,line 14 + 257 STRING_ + 257,t 0 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 rgbarray + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 opts + 262,t 1 + 262 start' + 257,line 7 + 260,line 19 + 259,line 16 + 257,title string + 258,title NEW + 262,line 26 + 260,title {} + 259,title {} + 261,title {} +} + +proc rgbarray::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 { + 2 { RGBArrayCmdLoad {} } + 3 { RGBArrayCmdLoad $2 } + 5 { CreateRGBFrame } + } + 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 rgbarray::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/rgbcubelex.tcl b/ds9/parsers/rgbcubelex.tcl new file mode 100644 index 0000000..5ad066d --- /dev/null +++ b/ds9/parsers/rgbcubelex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval rgbcube { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc rgbcube::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc rgbcube::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc rgbcube::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc rgbcube::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc rgbcube::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc rgbcube::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc rgbcube::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc rgbcube::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc rgbcube::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NEW_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/rgbcubeparser.tab.tcl b/ds9/parsers/rgbcubeparser.tab.tcl new file mode 100644 index 0000000..f492518 --- /dev/null +++ b/ds9/parsers/rgbcubeparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set NEW_ 258 diff --git a/ds9/parsers/rgbcubeparser.tcl b/ds9/parsers/rgbcubeparser.tcl new file mode 100644 index 0000000..c6e7652 --- /dev/null +++ b/ds9/parsers/rgbcubeparser.tcl @@ -0,0 +1,298 @@ +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 rgbcube { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc rgbcube::YYABORT {} { + return -code return 1 +} + +proc rgbcube::YYACCEPT {} { + return -code return 0 +} + +proc rgbcube::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc rgbcube::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc rgbcube::yyerror {s} { + puts stderr $s +} + +proc rgbcube::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 rgbcube::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set rgbcube::table { + 3:0,target 1 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 3 + 0:259 goto + 0:260 goto + 0:261 goto + 4:257 shift + 1:257,target 5 + 0:258,target 1 + 0:0,target 4 + 0:261,target 4 + 2:0,target 0 + 4:0,target 2 + 0:0 reduce + 1:0 reduce + 0:257,target 4 + 2:0 accept + 3:0 reduce + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 5 + 5:0 reduce + 4:257,target 5 +} + +array set rgbcube::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 260 + 4,l 261 + 5,l 261 +} + +array set rgbcube::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 1,dc 1 + 3,dc 2 +} + +array set rgbcube::rules { + 5,line 25 + 2,line 20 + 4,line 24 + 1,line 17 + 3,line 21 +} + +array set rgbcube::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0}} + 1 {{5 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4}} + 1,trans {} + 5 {{3 0 2}} + 2,trans {} + 3,trans {} + 4,trans {{257 5}} + 5,trans {} +} + +array set rgbcube::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 11 + 261,line 23 + error,line 14 + 257 STRING_ + 257,t 0 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 rgbcube + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 opts + 262,t 1 + 262 start' + 257,line 7 + 260,line 19 + 259,line 16 + 257,title string + 258,title NEW + 262,line 26 + 260,title {} + 259,title {} + 261,title {} +} + +proc rgbcube::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 { + 2 { RGBCubeCmdLoad {} } + 3 { RGBCubeCmdLoad $2 } + 5 { CreateRGBFrame } + } + 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 rgbcube::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/rgbimagelex.tcl b/ds9/parsers/rgbimagelex.tcl new file mode 100644 index 0000000..42e2dac --- /dev/null +++ b/ds9/parsers/rgbimagelex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval rgbimage { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc rgbimage::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc rgbimage::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc rgbimage::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc rgbimage::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc rgbimage::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc rgbimage::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc rgbimage::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc rgbimage::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc rgbimage::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NEW_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/rgbimageparser.tab.tcl b/ds9/parsers/rgbimageparser.tab.tcl new file mode 100644 index 0000000..f492518 --- /dev/null +++ b/ds9/parsers/rgbimageparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set NEW_ 258 diff --git a/ds9/parsers/rgbimageparser.tcl b/ds9/parsers/rgbimageparser.tcl new file mode 100644 index 0000000..76f2252 --- /dev/null +++ b/ds9/parsers/rgbimageparser.tcl @@ -0,0 +1,298 @@ +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 rgbimage { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc rgbimage::YYABORT {} { + return -code return 1 +} + +proc rgbimage::YYACCEPT {} { + return -code return 0 +} + +proc rgbimage::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc rgbimage::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc rgbimage::yyerror {s} { + puts stderr $s +} + +proc rgbimage::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 rgbimage::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set rgbimage::table { + 3:0,target 1 + 0:257 reduce + 1:257 reduce + 0:258 shift + 5:0,target 3 + 0:259 goto + 0:260 goto + 0:261 goto + 4:257 shift + 1:257,target 5 + 0:258,target 1 + 0:0,target 4 + 0:261,target 4 + 2:0,target 0 + 4:0,target 2 + 0:0 reduce + 1:0 reduce + 0:257,target 4 + 2:0 accept + 3:0 reduce + 0:259,target 2 + 0:260,target 3 + 4:0 reduce + 1:0,target 5 + 5:0 reduce + 4:257,target 5 +} + +array set rgbimage::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 260 + 4,l 261 + 5,l 261 +} + +array set rgbimage::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 1,dc 1 + 3,dc 2 +} + +array set rgbimage::rules { + 5,line 26 + 2,line 21 + 4,line 25 + 1,line 18 + 3,line 22 +} + +array set rgbimage::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 {0 257} 0} {5 {0 257} 0}} + 1 {{5 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4}} + 1,trans {} + 5 {{3 0 2}} + 2,trans {} + 3,trans {} + 4,trans {{257 5}} + 5,trans {} +} + +array set rgbimage::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 12 + 261,line 24 + error,line 15 + 257 STRING_ + 257,t 0 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 rgbimage + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 opts + 262,t 1 + 262 start' + 257,line 7 + 260,line 20 + 259,line 17 + 257,title string + 258,title NEW + 262,line 27 + 260,title {} + 259,title {} + 261,title {} +} + +proc rgbimage::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 { + 2 { RGBImageCmdLoad {} } + 3 { RGBImageCmdLoad $2 } + 5 { CreateRGBFrame } + } + 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 rgbimage::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/rgblex.tcl b/ds9/parsers/rgblex.tcl new file mode 100644 index 0000000..5d8a994 --- /dev/null +++ b/ds9/parsers/rgblex.tcl @@ -0,0 +1,847 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval rgb { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc rgb::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc rgb::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc rgb::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc rgb::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc rgb::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc rgb::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc rgb::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc rgb::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc rgb::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set YES_ 284 +set NO_ 285 +set ON_ 286 +set OFF_ 287 +set TRUE_ 288 +set FALSE_ 289 +set STRING_ 290 +set AXES_ 291 +set BIN_ 292 +set BLOCK_ 293 +set BLUE_ 294 +set CHANNEL_ 295 +set CLOSE_ 296 +set COLORBAR_ 297 +set CROP_ 298 +set GREEN_ 299 +set LOCK_ 300 +set OPEN_ 301 +set RED_ 302 +set SCALE_ 303 +set SCALELIMITS_ 304 +set SLICE_ 305 +set SMOOTH_ 306 +set SYSTEM_ 307 +set VIEW_ 308 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: bin + if {[regexp -start $index_ -indices -line -nocase -- {\A(bin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: block + if {[regexp -start $index_ -indices -line -nocase -- {\A(block)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: channel + if {[regexp -start $index_ -indices -line -nocase -- {\A(channel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: crop + if {[regexp -start $index_ -indices -line -nocase -- {\A(crop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: green + if {[regexp -start $index_ -indices -line -nocase -- {\A(green)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: red + if {[regexp -start $index_ -indices -line -nocase -- {\A(red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AXES_ + } + 1 { +return $BIN_ + } + 2 { +return $BLOCK_ + } + 3 { +return $BLUE_ + } + 4 { +return $CHANNEL_ + } + 5 { +return $CLOSE_ + } + 6 { +return $COLORBAR_ + } + 7 { +return $CROP_ + } + 8 { +return $GREEN_ + } + 9 { +return $LOCK_ + } + 10 { +return $OPEN_ + } + 11 { +return $RED_ + } + 12 { +return $SCALE_ + } + 13 { +return $SCALELIMITS_ + } + 14 { +return $SLICE_ + } + 15 { +return $SMOOTH_ + } + 16 { +return $SYSTEM_ + } + 17 { +return $VIEW_ + } + 18 { +return $WCS_ + } + 19 { +return $WCSA_ + } + 20 { +return $WCSB_ + } + 21 { +return $WCSC_ + } + 22 { +return $WCSD_ + } + 23 { +return $WCSE_ + } + 24 { +return $WCSF_ + } + 25 { +return $WCSG_ + } + 26 { +return $WCSH_ + } + 27 { +return $WCSI_ + } + 28 { +return $WCSJ_ + } + 29 { +return $WCSK_ + } + 30 { +return $WCSL_ + } + 31 { +return $WCSM_ + } + 32 { +return $WCSN_ + } + 33 { +return $WCSO_ + } + 34 { +return $WCSP_ + } + 35 { +return $WCSQ_ + } + 36 { +return $WCSR_ + } + 37 { +return $WCSS_ + } + 38 { +return $WCST_ + } + 39 { +return $WCSU_ + } + 40 { +return $WCSV_ + } + 41 { +return $WCSW_ + } + 42 { +return $WCSX_ + } + 43 { +return $WCSY_ + } + 44 { +return $WCSZ_ + } + 45 { +return $YES_ + } + 46 { +return $NO_ + } + 47 { +return $ON_ + } + 48 { +return $OFF_ + } + 49 { +return $TRUE_ + } + 50 { +return $FALSE_ + } + 51 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 52 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 53 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 54 { +set yylval $yytext; return $STRING_ + } + 55 { +# ignore whitespace + } + 56 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/rgbparser.tab.tcl b/ds9/parsers/rgbparser.tab.tcl new file mode 100644 index 0000000..a65f22c --- /dev/null +++ b/ds9/parsers/rgbparser.tab.tcl @@ -0,0 +1,52 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set YES_ 284 +set NO_ 285 +set ON_ 286 +set OFF_ 287 +set TRUE_ 288 +set FALSE_ 289 +set STRING_ 290 +set AXES_ 291 +set BIN_ 292 +set BLOCK_ 293 +set BLUE_ 294 +set CHANNEL_ 295 +set CLOSE_ 296 +set COLORBAR_ 297 +set CROP_ 298 +set GREEN_ 299 +set LOCK_ 300 +set OPEN_ 301 +set RED_ 302 +set SCALE_ 303 +set SCALELIMITS_ 304 +set SLICE_ 305 +set SMOOTH_ 306 +set SYSTEM_ 307 +set VIEW_ 308 diff --git a/ds9/parsers/rgbparser.tcl b/ds9/parsers/rgbparser.tcl new file mode 100644 index 0000000..686f536 --- /dev/null +++ b/ds9/parsers/rgbparser.tcl @@ -0,0 +1,1340 @@ +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 rgb { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc rgb::YYABORT {} { + return -code return 1 +} + +proc rgb::YYACCEPT {} { + return -code return 0 +} + +proc rgb::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc rgb::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc rgb::yyerror {s} { + puts stderr $s +} + +proc rgb::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 rgb::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set rgb::table { + 21:289 reduce + 23:286,target 58 + 60:290 reduce + 59:290 reduce + 30:290,target 6 + 29:290,target 5 + 27:0 reduce + 9:302,target 7 + 48:0 reduce + 0:296,target 3 + 30:290 reduce + 29:290 reduce + 9:302 shift + 18:289,target 56 + 5:305,target 22 + 9:294 shift + 6:0,target 39 + 8:266,target 34 + 17:285,target 57 + 24:288,target 59 + 9:299 shift + 56:0,target 32 + 53:289,target 60 + 53:290,target 28 + 38:290 reduce + 24:0 reduce + 23:284,target 58 + 48:0,target 24 + 41:0,target 17 + 45:0 reduce + 33:0,target 9 + 9:314 goto + 25:0,target 1 + 0:294,target 1 + 17:0,target 57 + 42:290,target 18 + 10:0,target 0 + 18:287,target 56 + 47:290 reduce + 17:284 reduce + 5:303,target 20 + 5:293,target 17 + 17:285 reduce + 8:264,target 32 + 17:286 reduce + 24:286,target 57 + 17:287 reduce + 4:288,target 47 + 31:290,target 7 + 17:288 reduce + 21:0 reduce + 17:289 reduce + 53:287,target 58 + 56:290 reduce + 42:0 reduce + 20:289,target 54 + 19:289,target 50 + 0:302,target 7 + 8:283,target 51 + 63:0 reduce + 6:290 reduce + 26:290 reduce + 18:285,target 56 + 5:291,target 15 + 8:262,target 30 + 54:290,target 63 + 24:284,target 55 + 4:286,target 47 + 17:0 reduce + 53:285,target 56 + 14:288,target 49 + 38:0 reduce + 35:290 reduce + 43:290,target 19 + 60:0 reduce + 59:0 reduce + 20:287,target 54 + 19:287,target 50 + 0:300,target 5 + 0:290,target 38 + 3:0,target 40 + 8:281,target 49 + 61:0,target 43 + 53:0,target 28 + 44:290 reduce + 32:290,target 8 + 14:284 reduce + 8:259,target 27 + 8:260,target 28 + 45:0,target 21 + 14:285 reduce + 9:314,target 53 + 37:0,target 13 + 14:286 reduce + 14:0 reduce + 4:284,target 47 + 53:284 shift + 30:0,target 6 + 29:0,target 5 + 14:287 reduce + 53:285 shift + 22:0,target 51 + 14:288 reduce + 8:309,target 52 + 53:286 shift + 35:0 reduce + 14:289 reduce + 14:286,target 49 + 14:0,target 49 + 53:287 shift + 21:289,target 55 + 53:288 shift + 56:0 reduce + 53:289 shift + 53:290 reduce + 23:284 reduce + 23:285 reduce + 20:285,target 54 + 19:285,target 50 + 8:278,target 46 + 23:286 reduce + 23:287 reduce + 3:290 reduce + 23:288 reduce + 55:290,target 29 + 23:289 reduce + 8:257,target 25 + 11:0 reduce + 62:290 reduce + 15:288,target 53 + 53:310 goto + 2:294,target 1 + 32:0 reduce + 44:290,target 20 + 14:284,target 49 + 8:257 shift + 21:287,target 55 + 1:290,target 48 + 1:289,target 48 + 8:258 shift + 53:0 reduce + 32:290 reduce + 8:259 shift + 8:260 shift + 5:315,target 24 + 8:261 shift + 8:262 shift + 8:276,target 44 + 8:263 shift + 33:290,target 9 + 8:264 shift + 8:265 shift + 6:0 reduce + 8:266 shift + 53:310,target 62 + 8:267 shift + 41:290 reduce + 8:268 shift + 9:299,target 4 + 15:286,target 53 + 8:269 shift + 8:270 shift + 28:0 reduce + 22:289,target 51 + 2:302,target 7 + 7:0,target 46 + 8:271 shift + 0:314,target 12 + 0:0,target 38 + 8:272 shift + 8:273 shift + 50:0 reduce + 49:0 reduce + 21:285,target 55 + 1:287,target 48 + 8:274 shift + 11:290 reduce + 8:275 shift + 57:0,target 30 + 8:276 shift + 50:290 reduce + 50:0,target 26 + 49:290 reduce + 49:0,target 25 + 20:284 reduce + 19:284 reduce + 8:274,target 42 + 8:277 shift + 11:290,target 36 + 56:290,target 32 + 42:0,target 18 + 20:285 reduce + 19:285 reduce + 8:278 shift + 34:0,target 10 + 20:286 reduce + 19:286 reduce + 8:279 shift + 8:280 shift + 26:0,target 2 + 20:287 reduce + 19:287 reduce + 0:300 shift + 0:290 reduce + 3:0 reduce + 8:281 shift + 20:288 reduce + 19:288 reduce + 18:0,target 56 + 16:288,target 52 + 0:301 shift + 8:282 shift + 20:289 reduce + 19:289 reduce + 0:302 shift + 8:283 shift + 11:0,target 35 + 45:290,target 21 + 25:0 reduce + 15:284,target 53 + 0:294 shift + 58:290 reduce + 22:287,target 51 + 0:295 shift + 11:312 goto + 0:296 shift + 46:0 reduce + 0:307 shift + 1:285,target 48 + 0:308 shift + 5:257 shift + 0:299 shift + 7:288,target 46 + 34:290,target 10 + 28:290 reduce + 0:311 goto + 8:272,target 40 + 0:313 goto + 0:314 goto + 0:0 reduce + 16:286,target 52 + 23:289,target 58 + 22:0 reduce + 8:309 goto + 37:290 reduce + 22:285,target 51 + 43:0 reduce + 0:299,target 4 + 12:290,target 41 + 57:290,target 30 + 7:286,target 46 + 5:298,target 19 + 8:269,target 37 + 8:270,target 38 + 46:290 reduce + 17:288,target 57 + 16:284 reduce + 16:285 reduce + 16:286 reduce + 4:0,target 47 + 46:290,target 22 + 16:287 reduce + 16:284,target 52 + 23:287,target 58 + 18:0 reduce + 16:288 reduce + 3:290,target 40 + 16:289 reduce + 62:0,target 45 + 40:0 reduce + 39:0 reduce + 55:290 reduce + 46:0,target 22 + 0:307,target 8 + 38:0,target 14 + 35:290,target 11 + 61:0 reduce + 31:0,target 7 + 23:0,target 58 + 7:284,target 46 + 15:0,target 53 + 5:291 shift + 5:306,target 23 + 25:290 reduce + 5:292 shift + 8:267,target 35 + 17:286,target 57 + 5:303 shift + 5:293 shift + 24:289,target 60 + 24:290,target 28 + 5:304 shift + 2:314,target 13 + 5:305 shift + 15:0 reduce + 5:306 shift + 23:285,target 58 + 5:297 shift + 5:298 shift + 36:0 reduce + 34:290 reduce + 13:290,target 42 + 58:290,target 33 + 0:295,target 2 + 11:312,target 54 + 57:0 reduce + 18:288,target 56 + 5:315 goto + 5:304,target 21 + 8:265,target 33 + 47:290,target 23 + 17:284,target 57 + 43:290 reduce + 24:287,target 58 + 4:289,target 47 + 4:290,target 47 + 12:0 reduce + 53:288,target 59 + 33:0 reduce + 36:290,target 12 + 13:290 reduce + 52:290 reduce + 22:284 reduce + 22:285 reduce + 22:286 reduce + 18:286,target 56 + 1:0,target 48 + 25:290,target 1 + 22:287 reduce + 5:292,target 16 + 22:288 reduce + 8:263,target 31 + 22:289 reduce + 2:302 shift + 7:0 reduce + 58:0,target 33 + 24:285,target 56 + 4:287,target 47 + 51:0,target 27 + 2:299,target 4 + 2:294 shift + 61:290 reduce + 43:0,target 19 + 53:286,target 57 + 35:0,target 11 + 30:0 reduce + 29:0 reduce + 14:289,target 49 + 60:290,target 34 + 59:290,target 31 + 27:0,target 3 + 20:0,target 54 + 19:0,target 50 + 51:0 reduce + 2:299 shift + 12:0,target 41 + 31:290 reduce + 20:288,target 54 + 19:288,target 50 + 0:301,target 6 + 8:282,target 50 + 48:290,target 24 + 18:284,target 56 + 2:314 goto + 4:0 reduce + 8:261,target 29 + 4:285,target 47 + 40:290 reduce + 39:290 reduce + 37:290,target 13 + 26:0 reduce + 53:284,target 55 + 14:287,target 49 + 47:0 reduce + 20:286,target 54 + 19:286,target 50 + 8:279,target 47 + 8:280,target 48 + 26:290,target 2 + 48:290 reduce + 18:284 reduce + 18:285 reduce + 18:286 reduce + 1:0 reduce + 18:287 reduce + 8:258,target 26 + 18:288 reduce + 18:289 reduce + 15:289,target 53 + 61:290,target 43 + 23:0 reduce + 7:284 reduce + 7:285 reduce + 57:290 reduce + 14:285,target 49 + 7:286 reduce + 44:0 reduce + 21:288,target 55 + 7:287 reduce + 7:288 reduce + 7:289 reduce + 7:290 reduce + 50:290,target 26 + 49:290,target 25 + 20:284,target 54 + 19:284,target 50 + 8:277,target 45 + 63:0,target 37 + 27:290 reduce + 6:290,target 39 + 55:0,target 29 + 24:310,target 61 + 47:0,target 23 + 40:0,target 16 + 39:0,target 15 + 32:0,target 8 + 38:290,target 14 + 24:0,target 28 + 20:0 reduce + 19:0 reduce + 16:0,target 52 + 15:287,target 53 + 36:290 reduce + 41:0 reduce + 21:286,target 55 + 1:288,target 48 + 27:290,target 3 + 62:0 reduce + 8:275,target 43 + 45:290 reduce + 15:284 reduce + 16:289,target 52 + 15:285 reduce + 62:290,target 45 + 15:286 reduce + 16:0 reduce + 15:287 reduce + 15:288 reduce + 15:285,target 53 + 22:288,target 51 + 15:289 reduce + 37:0 reduce + 0:313,target 11 + 4:284 reduce + 4:285 reduce + 54:290 shift + 51:290,target 27 + 24:284 shift + 21:284,target 55 + 1:286,target 48 + 4:286 reduce + 58:0 reduce + 24:285 shift + 4:287 reduce + 7:289,target 46 + 7:290,target 46 + 24:286 shift + 4:288 reduce + 24:287 shift + 4:289 reduce + 4:290 reduce + 8:273,target 41 + 24:288 shift + 24:289 shift + 24:290 reduce + 40:290,target 16 + 39:290,target 15 + 16:287,target 52 + 13:0 reduce + 34:0 reduce + 22:286,target 51 + 28:290,target 4 + 0:311,target 10 + 60:0,target 34 + 59:0,target 31 + 33:290 reduce + 55:0 reduce + 52:0,target 44 + 24:310 goto + 1:284,target 48 + 44:0,target 20 + 7:287,target 46 + 36:0,target 12 + 28:0,target 4 + 8:271,target 39 + 21:0,target 55 + 17:289,target 57 + 13:0,target 42 + 42:290 reduce + 16:285,target 52 + 10:0 accept + 23:288,target 58 + 9:294,target 1 + 31:0 reduce + 52:290,target 44 + 22:284,target 51 + 0:308,target 9 + 5:257,target 14 + 12:290 reduce + 52:0 reduce + 1:284 reduce + 1:285 reduce + 51:290 reduce + 21:284 reduce + 1:286 reduce + 7:285,target 46 + 21:285 reduce + 1:287 reduce + 5:297,target 18 + 41:290,target 17 + 21:286 reduce + 1:288 reduce + 8:268,target 36 + 21:287 reduce + 17:287,target 57 + 1:290 reduce + 1:289 reduce + 21:288 reduce +} + +array set rgb::rules { + 9,l 309 + 11,l 309 + 32,l 310 + 53,l 315 + 6,l 309 + 28,l 310 + 50,l 315 + 49,l 315 + 3,l 309 + 25,l 309 + 46,l 314 + 0,l 316 + 22,l 309 + 43,l 313 + 18,l 309 + 40,l 313 + 39,l 313 + 15,l 309 + 36,l 312 + 57,l 315 + 12,l 309 + 33,l 310 + 54,l 315 + 7,l 309 + 29,l 310 + 30,l 310 + 51,l 315 + 4,l 309 + 26,l 309 + 47,l 314 + 1,l 309 + 23,l 309 + 44,l 313 + 19,l 309 + 20,l 309 + 41,l 313 + 16,l 309 + 37,l 311 + 58,l 315 + 13,l 309 + 34,l 310 + 55,l 315 + 8,l 309 + 10,l 309 + 31,l 310 + 52,l 315 + 5,l 309 + 27,l 309 + 48,l 314 + 2,l 309 + 24,l 309 + 45,l 313 + 21,l 309 + 42,l 313 + 17,l 309 + 38,l 313 + 14,l 309 + 35,l 311 + 56,l 315 +} + +array set rgb::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 0 + 53,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 3 + 23,dc 1 + 0,dc 1 + 37,dc 3 + 52,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 1 + 22,dc 1 + 36,dc 0 + 51,dc 1 + 14,dc 1 + 28,dc 0 + 5,dc 1 + 43,dc 3 + 57,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 1 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 2 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set rgb::rules { + 41,line 148 + 7,line 110 + 37,line 142 + 4,line 107 + 34,line 138 + 1,line 104 + 31,line 135 + 27,line 130 + 24,line 127 + 21,line 124 + 17,line 120 + 14,line 117 + 11,line 114 + 56,line 167 + 36,e 1 + 53,line 164 + 50,line 161 + 49,line 160 + 46,line 155 + 43,line 150 + 9,line 112 + 40,line 147 + 39,line 146 + 6,line 109 + 36,line 141 + 3,line 106 + 33,line 137 + 29,line 133 + 30,line 134 + 26,line 129 + 23,line 126 + 19,line 122 + 20,line 123 + 16,line 119 + 13,line 116 + 10,line 113 + 58,line 169 + 55,line 166 + 52,line 163 + 48,line 157 + 45,line 152 + 42,line 149 + 8,line 111 + 38,line 145 + 5,line 108 + 35,line 141 + 2,line 105 + 32,line 136 + 28,line 132 + 25,line 128 + 22,line 125 + 18,line 121 + 15,line 118 + 12,line 115 + 57,line 168 + 54,line 165 + 51,line 162 + 47,line 156 + 44,line 151 +} + +array set rgb::lr1_table { + 66,trans {} + 35 {{11 {0 290} 1}} + 14,trans {} + 36 {{12 {0 290} 1}} + 33,trans {} + 37 {{13 {0 290} 1}} + 52,trans {} + 38 {{14 {0 290} 1}} + 40 {{16 {0 290} 1}} + 39 {{15 {0 290} 1}} + 18,trans {} + 41 {{17 {0 290} 1}} + 1,trans {} + 37,trans {} + 42 {{18 {0 290} 1}} + 56,trans {{284 58} {285 59} {286 60} {287 61} {288 62} {289 63} {310 65}} + 43 {{19 {0 290} 1}} + 44 {{20 {0 290} 1}} + 23,trans {} + 45 {{21 {0 290} 1}} + 5,trans {{257 14} {291 15} {292 16} {293 17} {297 18} {298 19} {303 20} {304 21} {305 22} {306 23} {315 24}} + 42,trans {} + 46 {{22 {0 290} 1}} + 61,trans {} + 47 {{23 {0 290} 1}} + 48 {{24 {0 290} 1}} + 27,trans {} + 9,trans {{294 53} {299 54} {302 55} {314 56}} + 50 {{26 {0 290} 1}} + 49 {{25 {0 290} 1}} + 46,trans {} + 51 {{27 {0 290} 1}} + 65,trans {} + 52 {{44 {0 290} 2}} + 13,trans {} + 53 {{48 {0 284 285 286 287 288 289} 1}} + 32,trans {} + 54 {{47 {0 284 285 286 287 288 289} 1}} + 51,trans {} + 55 {{46 {0 284 285 286 287 288 289} 1}} + 56 {{45 {0 290} 2} {28 {0 290} 0} {29 {0 290} 0} {30 {0 290} 0} {31 {0 290} 0} {32 {0 290} 0} {33 {0 290} 0} {34 {0 290} 0}} + 17,trans {} + 57 {{37 0 2}} + 0,trans {{294 1} {295 2} {296 3} {299 4} {300 5} {301 6} {302 7} {307 8} {308 9} {311 10} {313 11} {314 12}} + 36,trans {} + 58 {{29 {0 290} 1}} + 55,trans {} + 60 {{30 {0 290} 1}} + 59 {{32 {0 290} 1}} + 61 {{33 {0 290} 1}} + 62 {{31 {0 290} 1}} + 22,trans {} + 4,trans {} + 41,trans {} + 63 {{34 {0 290} 1}} + 60,trans {} + 59,trans {} + 64 {{43 {0 290} 3}} + 65 {{45 {0 290} 3}} + 66 {{37 0 3}} + 26,trans {} + 8,trans {{257 25} {258 26} {259 27} {260 28} {261 29} {262 30} {263 31} {264 32} {265 33} {266 34} {267 35} {268 36} {269 37} {270 38} {271 39} {272 40} {273 41} {274 42} {275 43} {276 44} {277 45} {278 46} {279 47} {280 48} {281 49} {282 50} {283 51} {309 52}} + 45,trans {} + 64,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{0 0 1}} + 11 {{35 0 1} {37 0 1} {36 290 0}} + 25,trans {} + 12 {{41 {0 290} 1}} + 7,trans {} + 44,trans {} + 13 {{42 {0 290} 2}} + 63,trans {} + 14 {{49 {0 284 285 286 287 288 289} 1}} + 11,trans {{312 57}} + 15 {{53 {0 284 285 286 287 288 289} 1}} + 30,trans {} + 29,trans {} + 16 {{52 {0 284 285 286 287 288 289} 1}} + 48,trans {} + 0 {{0 0 0} {35 0 0} {37 0 0} {38 {0 290} 0} {39 {0 290} 0} {40 {0 290} 0} {41 {0 290} 0} {42 {0 290} 0} {43 {0 290} 0} {44 {0 290} 0} {45 {0 290} 0} {46 {0 290} 0} {47 {0 290} 0} {48 {0 290} 0}} + 17 {{57 {0 284 285 286 287 288 289} 1}} + 1 {{48 {0 290} 1}} + 18 {{56 {0 284 285 286 287 288 289} 1}} + 15,trans {} + 2 {{42 {0 290} 1} {46 {0 290} 0} {47 {0 290} 0} {48 {0 290} 0}} + 19 {{50 {0 284 285 286 287 288 289} 1}} + 20 {{54 {0 284 285 286 287 288 289} 1}} + 34,trans {} + 3 {{40 {0 290} 1}} + 21 {{55 {0 284 285 286 287 288 289} 1}} + 53,trans {} + 4 {{47 {0 290} 1}} + 22 {{51 {0 284 285 286 287 288 289} 1}} + 5 {{43 {0 290} 1} {49 {0 284 285 286 287 288 289} 0} {50 {0 284 285 286 287 288 289} 0} {51 {0 284 285 286 287 288 289} 0} {52 {0 284 285 286 287 288 289} 0} {53 {0 284 285 286 287 288 289} 0} {54 {0 284 285 286 287 288 289} 0} {55 {0 284 285 286 287 288 289} 0} {56 {0 284 285 286 287 288 289} 0} {57 {0 284 285 286 287 288 289} 0} {58 {0 284 285 286 287 288 289} 0}} + 23 {{58 {0 284 285 286 287 288 289} 1}} + 20,trans {} + 19,trans {} + 6 {{39 {0 290} 1}} + 2,trans {{294 1} {299 4} {302 7} {314 13}} + 24 {{43 {0 290} 2} {28 {0 290} 0} {29 {0 290} 0} {30 {0 290} 0} {31 {0 290} 0} {32 {0 290} 0} {33 {0 290} 0} {34 {0 290} 0}} + 38,trans {} + 7 {{46 {0 290} 1}} + 25 {{1 {0 290} 1}} + 57,trans {{290 66}} + 8 {{44 {0 290} 1} {1 {0 290} 0} {2 {0 290} 0} {3 {0 290} 0} {4 {0 290} 0} {5 {0 290} 0} {6 {0 290} 0} {7 {0 290} 0} {8 {0 290} 0} {9 {0 290} 0} {10 {0 290} 0} {11 {0 290} 0} {12 {0 290} 0} {13 {0 290} 0} {14 {0 290} 0} {15 {0 290} 0} {16 {0 290} 0} {17 {0 290} 0} {18 {0 290} 0} {19 {0 290} 0} {20 {0 290} 0} {21 {0 290} 0} {22 {0 290} 0} {23 {0 290} 0} {24 {0 290} 0} {25 {0 290} 0} {26 {0 290} 0} {27 {0 290} 0}} + 26 {{2 {0 290} 1}} + 9 {{45 {0 290} 1} {46 {0 284 285 286 287 288 289} 0} {47 {0 284 285 286 287 288 289} 0} {48 {0 284 285 286 287 288 289} 0}} + 27 {{3 {0 290} 1}} + 24,trans {{284 58} {285 59} {286 60} {287 61} {288 62} {289 63} {310 64}} + 6,trans {} + 28 {{4 {0 290} 1}} + 43,trans {} + 29 {{5 {0 290} 1}} + 30 {{6 {0 290} 1}} + 62,trans {} + 31 {{7 {0 290} 1}} + 10,trans {} + 32 {{8 {0 290} 1}} + 28,trans {} + 33 {{9 {0 290} 1}} + 47,trans {} + 34 {{10 {0 290} 1}} +} + +array set rgb::token_id_table { + 286 ON_ + 286,t 0 + 287 OFF_ + 292,line 47 + 302,line 57 + 288 TRUE_ + 265,title WCSH + 289 FALSE_ + 290 STRING_ + 300 LOCK_ + 284,title YES + 291 AXES_ + 301 OPEN_ + 313,title {} + 292 BIN_ + 302 RED_ + 288,line 39 + 293 BLOCK_ + 303 SCALE_ + 294 BLUE_ + 304 SCALELIMITS_ + 305 SLICE_ + 295 CHANNEL_ + 306 SMOOTH_ + 296 CLOSE_ + 307 SYSTEM_ + 262,t 0 + 297 COLORBAR_ + 308 VIEW_ + 285,line 36 + 298 CROP_ + 310 yesno + 309 wcssys + 299 GREEN_ + 311 command + 283,t 0 + 312 @PSEUDO1 + 313 rgb + 314,t 1 + 314 channel + 282,line 32 + 315 lock + 316 start' + 264,title WCSG + 283,title WCSZ + 312,title {} + 278,line 28 + error,line 102 + 258,t 0 + 275,line 25 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 22 + 263,title WCSF + 282,title WCSY + 311,title {} + 268,line 18 + 276,t 0 + 265,line 15 + 307,t 0 + 297,t 0 + 262,line 12 + 0,t 0 + 0 {$} + 262,title WCSE + 281,title WCSX + 310,title {} + 309,title {} + error,t 0 + 299,title GREEN + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 261,title WCSD + 279,title WCSV + 280,title WCSW + 308,title VIEW + 269,t 0 + 270,t 0 + 298,title CROP + 314,line 154 + 291,t 0 + 301,t 0 + 311,line 140 + 307,line 62 + 266,t 0 + 260,title WCSC + 259,title WCSB + 297,line 52 + 278,title WCSU + 307,title SYSTEM + 297,title COLORBAR + 287,t 0 + 294,line 49 + 304,line 59 + error,title {} + 291,line 46 + 301,line 56 + 263,t 0 + 258,title WCSA + 287,line 38 + 277,title WCST + 284,t 0 + 306,title SMOOTH + 296,title CLOSE + 315,t 1 + 284,line 35 + 281,line 31 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title WCS + 277,line 27 + 276,title WCSS + 312,t 1 + 305,title SLICE + 295,title CHANNEL + 274,line 24 + 271,line 21 + 277,t 0 + 308,t 0 + 267,line 17 + 298,t 0 + 275,title WCSR + 294,title BLUE + 304,title SCALELIMITS + 264,line 14 + 261,line 11 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSQ + 293,title BLOCK + 303,title SCALE + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 170 + 273,title WCSP + 313,line 144 + 292,title BIN + 302,title RED + 267,t 0 + 310,line 131 + 309,line 103 + 299,line 54 + 288,t 0 + 306,line 61 + 296,line 51 + 272,title WCSO + 291,title AXES + 293,line 48 + 301,title OPEN + 303,line 58 + 264,t 0 + 285,t 0 + 289,line 40 + 290,line 42 + 300,line 55 + 316,t 1 + 286,line 37 + 271,title WCSN + 261,t 0 + 283,line 33 + 289,title FALSE + 290,title string + 300,title LOCK + 282,t 0 + 279,line 29 + 280,line 30 + 313,t 1 + 276,line 26 + 257,t 0 + 269,title WCSL + 270,title WCSM + 273,line 23 + 288,title TRUE + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 19 + 270,line 20 + 266,line 16 + 268,title WCSK + 275,t 0 + 263,line 13 + 287,title OFF + 316,title {} + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSJ + 257 WCS_ + 286,title ON + 293,t 0 + 303,t 0 + 315,title {} + 258 WCSA_ + 260 WCSC_ + 259 WCSB_ + 261 WCSD_ + 262 WCSE_ + 263 WCSF_ + 264 WCSG_ + 315,line 159 + 265 WCSH_ + 266 WCSI_ + 267 WCSJ_ + 268,t 0 + 268 WCSK_ + 269 WCSL_ + 270 WCSM_ + 312,line 141 + 271 WCSN_ + 272 WCSO_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSI + 273 WCSP_ + 274 WCSQ_ + 285,title NO + 314,title {} + 275 WCSR_ + 308,line 63 + 276 WCSS_ + 298,line 53 + 277 WCST_ + 278 WCSU_ + 279 WCSV_ + 280 WCSW_ + 281 WCSX_ + 305,line 60 + 282 WCSY_ + 295,line 50 + 265,t 0 + 283 WCSZ_ + 284 YES_ + 285 NO_ +} + +proc rgb::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 } + 28 { set _ 1 } + 29 { set _ 1 } + 30 { set _ 1 } + 31 { set _ 1 } + 32 { set _ 0 } + 33 { set _ 0 } + 34 { set _ 0 } + 36 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 38 { CreateRGBFrame } + 40 { RGBDestroyDialog } + 41 { ProcessCmdSet current rgb $1 RGBChannel } + 42 { ProcessCmdSet current rgb $2 RGBChannel } + 43 { ProcessCmdSet rgb $2 $3 } + 44 { ProcessCmdSet rgb system $2 RGBSystem } + 45 { ProcessCmdSet rgb $2 $3 RGBView } + 46 { set _ red } + 47 { set _ green } + 48 { set _ blue } + 49 { set _ lock,wcs } + 50 { set _ lock,crop } + 51 { set _ lock,slice } + 52 { set _ lock,bin } + 53 { set _ lock,axes } + 54 { set _ lock,scale } + 55 { set _ lock,scalelimits } + 56 { set _ lock,colorbar } + 57 { set _ lock,block } + 58 { set _ lock,smooth } + } + 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 rgb::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/rgbsendlex.tcl b/ds9/parsers/rgbsendlex.tcl new file mode 100644 index 0000000..b415ca5 --- /dev/null +++ b/ds9/parsers/rgbsendlex.tcl @@ -0,0 +1,432 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval rgbsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc rgbsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc rgbsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc rgbsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc rgbsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc rgbsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc rgbsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc rgbsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc rgbsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc rgbsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set AXES_ 257 +set BIN_ 258 +set BLOCK_ 259 +set BLUE_ 260 +set CHANNEL_ 261 +set COLORBAR_ 262 +set CROP_ 263 +set GREEN_ 264 +set LOCK_ 265 +set RED_ 266 +set SCALE_ 267 +set SCALELIMITS_ 268 +set SLICE_ 269 +set SMOOTH_ 270 +set SYSTEM_ 271 +set VIEW_ 272 +set WCS_ 273 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: axes + if {[regexp -start $index_ -indices -line -nocase -- {\A(axes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: bin + if {[regexp -start $index_ -indices -line -nocase -- {\A(bin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: block + if {[regexp -start $index_ -indices -line -nocase -- {\A(block)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: channel + if {[regexp -start $index_ -indices -line -nocase -- {\A(channel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: crop + if {[regexp -start $index_ -indices -line -nocase -- {\A(crop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: green + if {[regexp -start $index_ -indices -line -nocase -- {\A(green)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: red + if {[regexp -start $index_ -indices -line -nocase -- {\A(red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: smooth + if {[regexp -start $index_ -indices -line -nocase -- {\A(smooth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AXES_ + } + 1 { +return $BIN_ + } + 2 { +return $BLOCK_ + } + 3 { +return $BLUE_ + } + 4 { +return $CHANNEL_ + } + 5 { +return $COLORBAR_ + } + 6 { +return $CROP_ + } + 7 { +return $GREEN_ + } + 8 { +return $LOCK_ + } + 9 { +return $RED_ + } + 10 { +return $SCALE_ + } + 11 { +return $SCALELIMITS_ + } + 12 { +return $SLICE_ + } + 13 { +return $SMOOTH_ + } + 14 { +return $SYSTEM_ + } + 15 { +return $VIEW_ + } + 16 { +return $WCS_ + } + 17 { +# ignore whitespace + } + 18 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/rgbsendparser.tab.tcl b/ds9/parsers/rgbsendparser.tab.tcl new file mode 100644 index 0000000..e8e9e06 --- /dev/null +++ b/ds9/parsers/rgbsendparser.tab.tcl @@ -0,0 +1,17 @@ +set AXES_ 257 +set BIN_ 258 +set BLOCK_ 259 +set BLUE_ 260 +set CHANNEL_ 261 +set COLORBAR_ 262 +set CROP_ 263 +set GREEN_ 264 +set LOCK_ 265 +set RED_ 266 +set SCALE_ 267 +set SCALELIMITS_ 268 +set SLICE_ 269 +set SMOOTH_ 270 +set SYSTEM_ 271 +set VIEW_ 272 +set WCS_ 273 diff --git a/ds9/parsers/rgbsendparser.tcl b/ds9/parsers/rgbsendparser.tcl new file mode 100644 index 0000000..2310024 --- /dev/null +++ b/ds9/parsers/rgbsendparser.tcl @@ -0,0 +1,488 @@ +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 rgbsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc rgbsend::YYABORT {} { + return -code return 1 +} + +proc rgbsend::YYACCEPT {} { + return -code return 0 +} + +proc rgbsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc rgbsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc rgbsend::yyerror {s} { + puts stderr $s +} + +proc rgbsend::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 rgbsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set rgbsend::table { + 2:257 shift + 5:0,target 0 + 15:0,target 5 + 9:0 reduce + 0:261 shift + 2:258 shift + 11:0 reduce + 2:259 shift + 2:262 shift + 4:260 shift + 0:265 shift + 2:263 shift + 15:0 reduce + 0:265,target 2 + 2:263,target 10 + 4:264 shift + 6:0,target 9 + 2:273,target 15 + 2:267 shift + 20:0 reduce + 19:0 reduce + 16:0,target 2 + 0:271 shift + 2:268 shift + 4:266 shift + 0:272 shift + 2:269 shift + 2:270 shift + 0:274 goto + 2:273 shift + 6:0 reduce + 2:262,target 9 + 4:260,target 17 + 0:274,target 5 + 2:275 goto + 7:0,target 8 + 17:0,target 17 + 12:0 reduce + 4:276 goto + 10:0,target 6 + 16:0 reduce + 8:0,target 13 + 3:0 reduce + 18:0,target 16 + 1:0,target 1 + 11:0,target 10 + 2:259,target 8 + 0:272,target 4 + 2:269,target 13 + 2:270,target 14 + 7:0 reduce + 13:0 reduce + 9:0,target 12 + 0:261,target 1 + 2:258,target 7 + 20:0,target 4 + 19:0,target 15 + 0:271,target 3 + 2:268,target 12 + 4:266,target 19 + 12:0,target 11 + 4:276,target 20 + 17:0 reduce + 2:257,target 6 + 2:267,target 11 + 3:0,target 3 + 13:0,target 7 + 8:0 reduce + 10:0 reduce + 4:264,target 18 + 14:0 reduce + 14:0,target 14 + 18:0 reduce + 1:0 reduce + 2:275,target 16 + 5:0 accept +} + +array set rgbsend::rules { + 9,l 275 + 11,l 275 + 15,l 276 + 2,l 274 + 6,l 275 + 12,l 275 + 16,l 276 + 3,l 274 + 7,l 275 + 13,l 275 + 0,l 277 + 17,l 276 + 4,l 274 + 8,l 275 + 10,l 275 + 14,l 275 + 1,l 274 + 5,l 275 +} + +array set rgbsend::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 1 + 3,dc 1 + 15,dc 1 + 10,dc 1 + 6,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 1 + 4,dc 2 + 16,dc 1 + 11,dc 1 + 7,dc 1 + 2,dc 2 + 14,dc 1 +} + +array set rgbsend::rules { + 13,line 43 + 7,line 37 + 10,line 40 + 4,line 32 + 1,line 29 + 15,line 47 + 9,line 39 + 12,line 42 + 6,line 36 + 3,line 31 + 17,line 49 + 14,line 44 + 8,line 38 + 11,line 41 + 5,line 35 + 2,line 30 + 16,line 48 +} + +array set rgbsend::lr1_table { + 13,trans {} + 17 {{17 0 1}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0}} + 14,trans {} + 18 {{16 0 1}} + 1 {{1 0 1}} + 15,trans {} + 20 {{4 0 2}} + 19 {{15 0 1}} + 2 {{2 0 1} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0}} + 16,trans {} + 3 {{3 0 1}} + 17,trans {} + 4 {{4 0 1} {15 0 0} {16 0 0} {17 0 0}} + 0,trans {{261 1} {265 2} {271 3} {272 4} {274 5}} + 18,trans {} + 5 {{0 0 1}} + 1,trans {} + 20,trans {} + 19,trans {} + 2,trans {{257 6} {258 7} {259 8} {262 9} {263 10} {267 11} {268 12} {269 13} {270 14} {273 15} {275 16}} + 6 {{9 0 1}} + 3,trans {} + 7 {{8 0 1}} + 4,trans {{260 17} {264 18} {266 19} {276 20}} + 8 {{13 0 1}} + 5,trans {} + 10 {{6 0 1}} + 9 {{12 0 1}} + 6,trans {} + 11 {{10 0 1}} + 7,trans {} + 12 {{11 0 1}} + 8,trans {} + 13 {{7 0 1}} + 10,trans {} + 9,trans {} + 14 {{14 0 1}} + 11,trans {} + 15 {{5 0 1}} + 12,trans {} + 16 {{2 0 2}} +} + +array set rgbsend::token_id_table { + 264,line 15 + 270,t 0 + 269,t 0 + 276,line 46 + 265,title LOCK + 274,t 1 + 261,line 12 + 257,t 0 + 270,title SMOOTH + 269,title SLICE + 273,line 24 + 257,line 8 + 262,t 0 + 274,title {} + 270,line 21 + 269,line 20 + 259,title BLOCK + 260,title BLUE + 266,t 0 + error error + 271,t 0 + 264,title GREEN + 266,line 17 + 275,t 1 + error,line 27 + 268,title SCALELIMITS + 258,t 0 + 263,line 14 + error,title {} + 275,line 34 + 273,title WCS + 263,t 0 + 259,line 10 + 260,line 11 + 258,title BIN + 277,title {} + 272,line 23 + 267,t 0 + 263,title CROP + 272,t 0 + 268,line 19 + 267,title SCALE + 257 AXES_ + 276,t 1 + 258 BIN_ + 259,t 0 + 259 BLOCK_ + 260 BLUE_ + 260,t 0 + 272,title VIEW + 261 CHANNEL_ + 265,line 16 + 262 COLORBAR_ + 263 CROP_ + 277,line 50 + 257,title AXES + 264 GREEN_ + 264,t 0 + 276,title {} + 265 LOCK_ + 262,line 13 + 266 RED_ + 267 SCALE_ + 0,t 0 + 0 {$} + 262,title COLORBAR + 268 SCALELIMITS_ + 268,t 0 + 274,line 28 + 270 SMOOTH_ + 269 SLICE_ + error,t 0 + 271 SYSTEM_ + 272 VIEW_ + 258,line 9 + 273,t 0 + 273 WCS_ + 266,title RED + 274 rgbsend + 275 lock + 271,line 22 + 276 view + 277,t 1 + 277 start' + 271,title SYSTEM + 261,t 0 + 267,line 18 + 275,title {} + 265,t 0 + 261,title CHANNEL +} + +proc rgbsend::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 { ProcessSendCmdGet current rgb } + 2 { ProcessSendCmdYesNo rgb lock,$2 } + 3 { ProcessSendCmdGet rgb system } + 4 { ProcessSendCmdYesNo rgb $2 } + 5 { set _ wcs } + 6 { set _ crop } + 7 { set _ slice } + 8 { set _ bin } + 9 { set _ axes } + 10 { set _ scale } + 11 { set _ scalelimits } + 12 { set _ colorbar } + 13 { set _ block } + 14 { set _ smooth } + 15 { set _ red } + 16 { set _ green } + 17 { set _ blue } + } + 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 rgbsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/rotatelex.tcl b/ds9/parsers/rotatelex.tcl new file mode 100644 index 0000000..9cdaa93 --- /dev/null +++ b/ds9/parsers/rotatelex.tcl @@ -0,0 +1,349 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval rotate { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc rotate::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc rotate::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc rotate::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc rotate::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc rotate::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc rotate::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc rotate::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc rotate::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc rotate::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set CLOSE_ 260 +set OPEN_ 261 +set TO_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: to + if {[regexp -start $index_ -indices -line -nocase -- {\A(to)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $OPEN_ + } + 2 { +return $TO_ + } + 3 { +set yylval $yytext; return $INT_ + } + 4 - + 5 { +set yylval $yytext; return $REAL_ + } + 6 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 7 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval $yytext; return $STRING_ + } + 10 { +# ignore whitespace + } + 11 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/rotateparser.tab.tcl b/ds9/parsers/rotateparser.tab.tcl new file mode 100644 index 0000000..ec06a47 --- /dev/null +++ b/ds9/parsers/rotateparser.tab.tcl @@ -0,0 +1,6 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set CLOSE_ 260 +set OPEN_ 261 +set TO_ 262 diff --git a/ds9/parsers/rotateparser.tcl b/ds9/parsers/rotateparser.tcl new file mode 100644 index 0000000..41adcf7 --- /dev/null +++ b/ds9/parsers/rotateparser.tcl @@ -0,0 +1,379 @@ +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 rotate { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc rotate::YYABORT {} { + return -code return 1 +} + +proc rotate::YYACCEPT {} { + return -code return 0 +} + +proc rotate::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc rotate::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc rotate::yyerror {s} { + puts stderr $s +} + +proc rotate::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 rotate::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set rotate::table { + 0:257 shift + 0:258 shift + 0:260 shift + 9:0 reduce + 0:261 shift + 0:266,target 8 + 6:259,target 6 + 11:0 reduce + 0:262 shift + 2:259 reduce + 0:263 goto + 0:264 goto + 1:259,target 1 + 4:259 reduce + 0:266 goto + 6:259 reduce + 8:259 reduce + 6:0,target 6 + 2:0 reduce + 9:259,target 7 + 8:265 goto + 6:0 reduce + 0:264,target 7 + 4:259,target 8 + 8:265,target 10 + 7:0,target 0 + 5:263,target 9 + 0:263,target 6 + 10:259 shift + 3:0 reduce + 8:0,target 3 + 1:0,target 1 + 11:0,target 5 + 0:262,target 5 + 2:259,target 2 + 7:0 accept + 1:259 reduce + 3:259 reduce + 5:257 shift + 9:0,target 7 + 0:261,target 4 + 5:258 shift + 2:0,target 2 + 5:263 goto + 9:259 reduce + 0:260,target 3 + 4:0 reduce + 3:0,target 9 + 5:258,target 2 + 8:0 reduce + 0:258,target 2 + 8:259,target 4 + 3:259,target 9 + 5:257,target 1 + 4:0,target 8 + 0:257,target 1 + 1:0 reduce + 10:259,target 11 +} + +array set rotate::rules { + 9,l 266 + 2,l 263 + 6,l 266 + 3,l 264 + 7,l 266 + 0,l 267 + 4,l 265 + 8,l 266 + 1,l 263 + 5,l 264 +} + +array set rotate::rules { + 5,dc 3 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 6,dc 1 + 1,dc 1 + 9,dc 1 + 4,dc 0 + 7,dc 2 + 2,dc 1 +} + +array set rotate::rules { + 7,line 33 + 4,line 28 + 1,line 24 + 9,line 35 + 6,line 32 + 3,line 28 + 4,e 1 + 8,line 34 + 5,line 29 + 2,line 25 +} + +array set rotate::lr1_table { + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {8 {0 259} 0} {9 {0 259} 0} {1 {0 259} 0} {2 {0 259} 0}} + 1 {{1 {0 259} 1}} + 2 {{2 {0 259} 1}} + 3 {{9 {0 259} 1}} + 4 {{8 {0 259} 1}} + 0,trans {{257 1} {258 2} {260 3} {261 4} {262 5} {263 6} {264 7} {266 8}} + 5 {{7 {0 259} 1} {1 {0 259} 0} {2 {0 259} 0}} + 1,trans {} + 6 {{6 {0 259} 1}} + 2,trans {} + 3,trans {} + 7 {{0 0 1}} + 4,trans {} + 8 {{3 0 1} {5 0 1} {4 259 0}} + 10 {{5 0 2}} + 5,trans {{257 1} {258 2} {263 9}} + 9 {{7 {0 259} 2}} + 11 {{5 0 3}} + 6,trans {} + 7,trans {} + 8,trans {{265 10}} + 10,trans {{259 11}} + 9,trans {} + 11,trans {} +} + +array set rotate::token_id_table { + 264,line 27 + 265,title {} + 261,line 15 + 257,t 0 + 257,line 7 + 262,t 0 + 259,title string + 260,title CLOSE + 266,t 1 + error error + 264,title {} + 266,line 31 + error,line 22 + 258,t 0 + 263,line 23 + error,title {} + 263,t 1 + 259,line 10 + 260,line 14 + 258,title float + 267,t 1 + 263,title {} + 267,title {} + 257 INT_ + 258 REAL_ + 259,t 0 + 259 STRING_ + 260 CLOSE_ + 260,t 0 + 261 OPEN_ + 265,line 28 + 262 TO_ + 263 numeric + 257,title integer + 264 command + 264,t 1 + 265 @PSEUDO1 + 262,line 16 + 266 rotate + 267 start' + 262,title TO + 0 {$} + 0,t 0 + error,t 0 + 258,line 8 + 266,title {} + 261,t 0 + 267,line 36 + 265,t 1 + 261,title OPEN +} + +proc rotate::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { Rotate $1 } + 7 { ProcessCmdSet current rotate $2 ChangeRotate } + 8 { PanZoomDialog } + 9 { PanZoomDestroyDialog } + } + 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 rotate::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/samplex.tcl b/ds9/parsers/samplex.tcl new file mode 100644 index 0000000..00a1957 --- /dev/null +++ b/ds9/parsers/samplex.tcl @@ -0,0 +1,418 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval samp { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc samp::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc samp::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc samp::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc samp::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc samp::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc samp::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc samp::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc samp::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc samp::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set BROADCAST_ 264 +set CONNECT_ 265 +set DISCONNECT_ 266 +set IMAGE_ 267 +set SEND_ 268 +set TABLE_ 269 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: broadcast + if {[regexp -start $index_ -indices -line -nocase -- {\A(broadcast)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: connect + if {[regexp -start $index_ -indices -line -nocase -- {\A(connect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: disconnect + if {[regexp -start $index_ -indices -line -nocase -- {\A(disconnect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: send + if {[regexp -start $index_ -indices -line -nocase -- {\A(send)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: table + if {[regexp -start $index_ -indices -line -nocase -- {\A(table)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BROADCAST_ + } + 1 { +return $CONNECT_ + } + 2 { +return $DISCONNECT_ + } + 3 { +return $IMAGE_ + } + 4 { +return $SEND_ + } + 5 { +return $TABLE_ + } + 6 { +return $YES_ + } + 7 { +return $NO_ + } + 8 { +return $ON_ + } + 9 { +return $OFF_ + } + 10 { +return $TRUE_ + } + 11 { +return $FALSE_ + } + 12 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval $yytext; return $STRING_ + } + 16 { +# ignore whitespace + } + 17 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/sampparser.tab.tcl b/ds9/parsers/sampparser.tab.tcl new file mode 100644 index 0000000..b904643 --- /dev/null +++ b/ds9/parsers/sampparser.tab.tcl @@ -0,0 +1,13 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set BROADCAST_ 264 +set CONNECT_ 265 +set DISCONNECT_ 266 +set IMAGE_ 267 +set SEND_ 268 +set TABLE_ 269 diff --git a/ds9/parsers/sampparser.tcl b/ds9/parsers/sampparser.tcl new file mode 100644 index 0000000..c853179 --- /dev/null +++ b/ds9/parsers/sampparser.tcl @@ -0,0 +1,565 @@ +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 samp { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc samp::YYABORT {} { + return -code return 1 +} + +proc samp::YYACCEPT {} { + return -code return 0 +} + +proc samp::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc samp::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc samp::yyerror {s} { + puts stderr $s +} + +proc samp::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 samp::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set samp::table { + 0:257 shift + 0:258 shift + 23:0,target 20 + 11:263,target 10 + 0:259 shift + 0:260 shift + 5:0,target 3 + 15:263 reduce + 15:0,target 17 + 9:0 reduce + 0:266,target 9 + 0:261 shift + 11:0 reduce + 0:262 shift + 17:263 reduce + 0:264 shift + 20:263 shift + 19:263 shift + 7:263,target 16 + 0:265 shift + 2:263 reduce + 15:0 reduce + 0:266 shift + 22:263 shift + 4:263 reduce + 20:263,target 24 + 19:263,target 23 + 0:265,target 8 + 0:268 shift + 2:263,target 4 + 24:263 reduce + 24:0,target 21 + 6:263 reduce + 6:0,target 6 + 0:270 goto + 16:0,target 18 + 0:271 goto + 2:0 reduce + 14:263,target 8 + 10:267,target 19 + 8:263 reduce + 0:272 goto + 14:273,target 22 + 0:274 goto + 24:0 reduce + 6:0 reduce + 0:264,target 7 + 0:274,target 14 + 25:0,target 9 + 7:0,target 16 + 23:263,target 20 + 17:0,target 14 + 12:0 reduce + 10:276,target 21 + 5:263,target 3 + 17:263,target 14 + 16:0 reduce + 12:263,target 11 + 21:0 reduce + 8:0,target 12 + 7:269,target 16 + 3:0 reduce + 18:0,target 19 + 10:263 shift + 1:0,target 1 + 11:0,target 10 + 0:262,target 6 + 12:263 reduce + 8:263,target 12 + 0:272,target 13 + 25:0 reduce + 7:0 reduce + 14:263 reduce + 10:267 shift + 21:263,target 15 + 3:263,target 2 + 16:263 reduce + 10:269 shift + 18:263 reduce + 15:263,target 17 + 13:0 accept + 9:0,target 13 + 0:261,target 5 + 1:263 reduce + 0:271,target 12 + 2:0,target 4 + 21:263 reduce + 12:0,target 11 + 3:263 reduce + 10:263,target 18 + 23:263 reduce + 17:0 reduce + 10:276 goto + 5:263 reduce + 14:273 goto + 7:267,target 15 + 7:263 reduce + 0:259,target 3 + 0:260,target 4 + 24:263,target 21 + 9:263 reduce + 6:263,target 6 + 0:270,target 11 + 4:0 reduce + 21:0,target 15 + 7:267 shift + 3:0,target 2 + 18:263,target 19 + 13:0,target 0 + 1:263,target 1 + 8:0 reduce + 7:269 shift + 0:258,target 2 + 0:268,target 10 + 14:0 reduce + 7:275 goto + 9:263,target 13 + 4:0,target 5 + 14:0,target 7 + 7:275,target 17 + 18:0 reduce + 0:257,target 1 + 1:0 reduce + 22:263,target 25 + 4:263,target 5 + 23:0 reduce + 16:263,target 18 + 11:263 reduce + 10:269,target 20 + 5:0 reduce +} + +array set samp::rules { + 9,l 272 + 11,l 274 + 15,l 274 + 20,l 276 + 19,l 276 + 2,l 270 + 6,l 271 + 12,l 274 + 16,l 275 + 21,l 276 + 3,l 270 + 7,l 272 + 13,l 274 + 0,l 277 + 17,l 275 + 4,l 271 + 8,l 273 + 10,l 274 + 14,l 274 + 18,l 275 + 1,l 270 + 5,l 271 +} + +array set samp::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 0 + 21,dc 2 + 3,dc 1 + 15,dc 2 + 10,dc 1 + 6,dc 1 + 18,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 3 + 4,dc 1 + 16,dc 0 + 11,dc 1 + 7,dc 1 + 20,dc 2 + 19,dc 1 + 2,dc 1 + 14,dc 2 +} + +array set samp::rules { + 13,line 54 + 7,line 47 + 10,line 51 + 4,line 42 + 18,line 61 + 1,line 37 + 15,line 56 + 9,line 48 + 12,line 53 + 6,line 44 + 21,line 66 + 3,line 39 + 17,line 60 + 14,line 55 + 8,e 1 + 8,line 47 + 11,line 52 + 5,line 43 + 20,line 65 + 19,line 64 + 2,line 38 + 16,line 59 +} + +array set samp::lr1_table { + 14,trans {{273 22}} + 1,trans {} + 18,trans {} + 23,trans {} + 5,trans {} + 9,trans {} + 13,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {266 9} {268 10} {270 11} {271 12} {272 13} {274 14}} + 17,trans {} + 22,trans {{263 25}} + 4,trans {} + 8,trans {} + 12,trans {} + 16,trans {} + 3,trans {} + 21,trans {} + 10 {{15 {0 263} 1} {19 {0 263} 0} {20 {0 263} 0} {21 {0 263} 0}} + 11 {{10 {0 263} 1}} + 25,trans {} + 12 {{11 {0 263} 1}} + 7,trans {{267 15} {269 16} {275 17}} + 13 {{0 0 1}} + 14 {{7 0 1} {9 0 1} {8 263 0}} + 15 {{17 {0 263} 1}} + 11,trans {} + 16 {{18 {0 263} 1}} + 0 {{0 0 0} {7 0 0} {9 0 0} {10 {0 263} 0} {11 {0 263} 0} {12 {0 263} 0} {13 {0 263} 0} {14 {0 263} 0} {15 {0 263} 0} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0}} + 17 {{14 {0 263} 2}} + 1 {{1 {0 263} 1}} + 18 {{19 {0 263} 1}} + 2 {{4 {0 263} 1}} + 19 {{20 {0 263} 1}} + 20 {{21 {0 263} 1}} + 15,trans {} + 3 {{2 {0 263} 1}} + 21 {{15 {0 263} 2}} + 4 {{5 {0 263} 1}} + 22 {{9 0 2}} + 5 {{3 {0 263} 1}} + 23 {{20 {0 263} 2}} + 6 {{6 {0 263} 1}} + 2,trans {} + 19,trans {{263 23}} + 24 {{21 {0 263} 2}} + 20,trans {{263 24}} + 7 {{14 {0 263} 1} {16 {0 263} 0} {17 {0 263} 0} {18 {0 263} 0}} + 25 {{9 0 3}} + 8 {{12 {0 263} 1}} + 9 {{13 {0 263} 1}} + 24,trans {} + 6,trans {} + 10,trans {{263 18} {267 19} {269 20} {276 21}} +} + +array set samp::token_id_table { + 264,line 18 + 270,t 1 + 269,t 0 + 276,line 63 + 265,title CONNECT + 274,t 1 + 261,line 11 + 257,t 0 + 270,title {} + 269,title TABLE + 273,line 47 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 36 + 269,line 23 + 259,title ON + 260,title OFF + 266,t 0 + 271,t 1 + error error + 264,title BROADCAST + 266,line 20 + 275,t 1 + error,line 35 + 268,title SEND + 258,t 0 + 263,line 14 + error,title {} + 275,line 58 + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 277,title {} + 272,line 46 + 267,t 0 + 263,title string + 272,t 1 + 268,line 22 + 267,title IMAGE + 257 YES_ + 276,t 1 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title {} + 261 TRUE_ + 265,line 19 + 262 FALSE_ + 263 STRING_ + 277,line 67 + 257,title YES + 264 BROADCAST_ + 264,t 0 + 276,title {} + 265 CONNECT_ + 262,line 12 + 266 DISCONNECT_ + 267 IMAGE_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 SEND_ + 268,t 0 + 274,line 50 + 270 yes + 269 TABLE_ + 271 no + error,t 0 + 272 command + 258,line 8 + 273,t 1 + 273 @PSEUDO1 + 266,title DISCONNECT + 274 samp + 275 broadcast + 271,line 41 + 276 send + 277,t 1 + 277 start' + 271,title {} + 261,t 0 + 267,line 21 + 275,title {} + 265,t 0 + 261,title TRUE +} + +proc samp::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 0 } + 5 { set _ 0 } + 6 { set _ 0 } + 8 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 10 { SAMPConnect } + 11 { SAMPDisconnect } + 12 { SAMPConnect } + 13 { SAMPDisconnect } + 16 { SAMPSendImageLoadFits {} } + 17 { SAMPSendImageLoadFits {} } + 18 { SAMPSendTableLoadFits {} } + 19 { SAMPCmdSendImage $1 } + 20 { SAMPCmdSendImage $2 } + 21 { SAMPCmdSendTable $2 } + } + 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 samp::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/saveimagelex.tcl b/ds9/parsers/saveimagelex.tcl new file mode 100644 index 0000000..fbcd7d7 --- /dev/null +++ b/ds9/parsers/saveimagelex.tcl @@ -0,0 +1,426 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval saveimage { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc saveimage::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc saveimage::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc saveimage::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc saveimage::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc saveimage::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc saveimage::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc saveimage::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc saveimage::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc saveimage::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set FITS_ 260 +set EPS_ 261 +set GIF_ 262 +set TIFF_ 263 +set JPEG_ 264 +set PNG_ 265 +set MPEG_ 266 +set NONE_ 267 +set PACKBITS_ 268 +set DEFLATE_ 269 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: fits + if {[regexp -start $index_ -indices -line -nocase -- {\A(fits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: eps + if {[regexp -start $index_ -indices -line -nocase -- {\A(eps)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: gif + if {[regexp -start $index_ -indices -line -nocase -- {\A(gif)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: tiff + if {[regexp -start $index_ -indices -line -nocase -- {\A(tiff)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: jpeg + if {[regexp -start $index_ -indices -line -nocase -- {\A(jpeg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: png + if {[regexp -start $index_ -indices -line -nocase -- {\A(png)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: mpeg + if {[regexp -start $index_ -indices -line -nocase -- {\A(mpeg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: packbits + if {[regexp -start $index_ -indices -line -nocase -- {\A(packbits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: deflate + if {[regexp -start $index_ -indices -line -nocase -- {\A(deflate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $FITS_ + } + 1 { +return $EPS_ + } + 2 { +return $GIF_ + } + 3 { +return $TIFF_ + } + 4 { +return $JPEG_ + } + 5 { +return $PNG_ + } + 6 { +return $MPEG + } + 7 { +return $NONE_ + } + 8 { +return $PACKBITS_ + } + 9 { +return $DEFLATE_ + } + 10 { +set yylval $yytext; return $INT_ + } + 11 - + 12 { +set yylval $yytext; return $REAL_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval $yytext; return $STRING_ + } + 17 { +# ignore whitespace + } + 18 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/saveimageparser.tab.tcl b/ds9/parsers/saveimageparser.tab.tcl new file mode 100644 index 0000000..9ba77a1 --- /dev/null +++ b/ds9/parsers/saveimageparser.tab.tcl @@ -0,0 +1,13 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set FITS_ 260 +set EPS_ 261 +set GIF_ 262 +set TIFF_ 263 +set JPEG_ 264 +set PNG_ 265 +set MPEG_ 266 +set NONE_ 267 +set PACKBITS_ 268 +set DEFLATE_ 269 diff --git a/ds9/parsers/saveimageparser.tcl b/ds9/parsers/saveimageparser.tcl new file mode 100644 index 0000000..b66ad6d --- /dev/null +++ b/ds9/parsers/saveimageparser.tcl @@ -0,0 +1,711 @@ +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 saveimage { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc saveimage::YYABORT {} { + return -code return 1 +} + +proc saveimage::YYACCEPT {} { + return -code return 0 +} + +proc saveimage::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc saveimage::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc saveimage::yyerror {s} { + puts stderr $s +} + +proc saveimage::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 saveimage::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set saveimage::table { + 7:264,target 17 + 17:259 reduce + 27:0 reduce + 6:259,target 16 + 6:257 reduce + 3:267,target 13 + 6:258 reduce + 6:259 reduce + 0:275,target 11 + 6:0,target 16 + 2:0 reduce + 6:264 reduce + 1:258,target 13 + 27:259,target 7 + 6:267 reduce + 6:268 reduce + 6:257,target 16 + 6:269 reduce + 4:269,target 14 + 25:0,target 11 + 16:259,target 21 + 17:0,target 22 + 10:0,target 3 + 0:273,target 10 + 7:259,target 17 + 21:0 reduce + 11:258,target 13 + 14:259 reduce + 4:267,target 14 + 3:257 reduce + 3:258 reduce + 23:257 shift + 3:259 reduce + 23:258 shift + 2:258,target 12 + 28:259,target 8 + 23:259 reduce + 0:271,target 9 + 3:264 reduce + 7:257,target 17 + 17:0 reduce + 23:264 shift + 5:269,target 15 + 3:267 reduce + 17:259,target 22 + 3:268 reduce + 23:267 shift + 3:269 reduce + 23:268 shift + 23:270 goto + 23:269 shift + 3:0,target 13 + 23:258,target 13 + 8:259,target 20 + 23:276 goto + 14:0 reduce + 5:267,target 15 + 11:257 shift + 14:0,target 20 + 11:258 shift + 11:259 shift + 3:258,target 13 + 11:264 shift + 20:257 shift + 0:259 shift + 0:260 shift + 0:261 shift + 0:266,target 8 + 9:0 accept + 11:267 shift + 20:259 reduce + 19:259 reduce + 0:262 shift + 6:269,target 16 + 11:268 shift + 0:263 shift + 11:269 shift + 11:270 goto + 18:259,target 23 + 0:264 shift + 0:265 shift + 0:266 shift + 8:259 shift + 11:276 goto + 28:259 reduce + 0:271 goto + 1:268,target 16 + 0:273 goto + 0:275 goto + 6:0 reduce + 0:264,target 6 + 6:267,target 16 + 28:0 reduce + 7:0,target 17 + 8:274 goto + 4:258,target 14 + 8:274,target 21 + 26:0,target 5 + 3:0 reduce + 7:269,target 17 + 18:0,target 23 + 20:259,target 10 + 19:259,target 6 + 0:262,target 4 + 11:268,target 16 + 25:0 reduce + 16:259 reduce + 5:257 reduce + 5:258 reduce + 2:268,target 12 + 5:259 reduce + 25:259 reduce + 1:264,target 14 + 5:264 reduce + 7:267,target 17 + 20:257,target 25 + 0:260,target 2 + 0:259,target 1 + 5:267 reduce + 5:268 reduce + 5:269 reduce + 5:258,target 15 + 23:268,target 16 + 21:259,target 9 + 4:0,target 14 + 18:0 reduce + 11:264,target 14 + 10:259,target 4 + 13:259 reduce + 3:268,target 13 + 23:0,target 18 + 2:257 reduce + 2:258 reduce + 2:264,target 12 + 15:0,target 19 + 2:259 reduce + 22:259 shift + 1:259,target 18 + 2:264 reduce + 15:0 reduce + 6:258,target 16 + 2:267 reduce + 2:268 reduce + 2:269 reduce + 23:264,target 14 + 22:259,target 26 + 1:257,target 12 + 12:0 reduce + 11:259,target 23 + 4:268,target 14 + 10:259 reduce + 3:264,target 13 + 1:276,target 19 + 1:0,target 18 + 2:259,target 12 + 7:0 reduce + 18:259 reduce + 7:258,target 17 + 11:257,target 12 + 27:0,target 7 + 10:272 goto + 20:0,target 10 + 19:0,target 6 + 7:257 reduce + 7:258 reduce + 12:0,target 1 + 7:259 reduce + 23:259,target 18 + 27:259 reduce + 2:257,target 12 + 7:264 reduce + 4:0 reduce + 11:276,target 24 + 7:267 reduce + 12:259,target 1 + 7:268 reduce + 10:272,target 22 + 26:0 reduce + 5:268,target 15 + 7:269 reduce + 4:264,target 14 + 23:257,target 12 + 3:259,target 13 + 1:0 reduce + 23:0 reduce + 15:259 reduce + 23:276,target 27 + 5:0,target 15 + 24:259,target 28 + 4:257 reduce + 4:258 reduce + 3:257,target 13 + 4:259 reduce + 1:270,target 18 + 1:269,target 17 + 24:259 shift + 13:259,target 2 + 0:265,target 7 + 4:264 reduce + 6:268,target 16 + 20:0 reduce + 19:0 reduce + 16:0,target 21 + 4:267 reduce + 4:268 reduce + 5:264,target 15 + 4:269 reduce + 4:259,target 14 + 1:267,target 15 + 0:263,target 5 + 11:269,target 17 + 11:270,target 18 + 16:0 reduce + 25:259,target 11 + 12:259 reduce + 4:257,target 14 + 2:269,target 12 + 1:257 shift + 1:258 shift + 14:259,target 20 + 1:259 reduce + 7:268,target 17 + 21:259 reduce + 0:261,target 3 + 9:0,target 0 + 11:267,target 15 + 13:0 reduce + 2:0,target 12 + 1:264 shift + 6:264,target 16 + 1:267 shift + 5:259,target 15 + 23:270,target 18 + 23:269,target 17 + 1:268 shift + 1:270 goto + 1:269 shift + 2:267,target 12 + 28:0,target 8 + 21:0,target 9 + 13:0,target 2 + 1:276 goto + 10:0 reduce + 5:257,target 15 + 23:267,target 15 + 3:269,target 13 + 15:259,target 19 + 5:0 reduce +} + +array set saveimage::rules { + 9,l 273 + 11,l 274 + 15,l 275 + 20,l 276 + 19,l 276 + 2,l 270 + 6,l 273 + 12,l 275 + 16,l 275 + 21,l 276 + 3,l 271 + 7,l 273 + 13,l 275 + 0,l 277 + 17,l 275 + 22,l 276 + 4,l 272 + 8,l 273 + 10,l 274 + 14,l 275 + 18,l 276 + 1,l 270 + 23,l 276 + 5,l 271 +} + +array set saveimage::rules { + 23,dc 1 + 5,dc 3 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 3 + 21,dc 1 + 3,dc 1 + 15,dc 1 + 10,dc 1 + 6,dc 2 + 18,dc 0 + 1,dc 1 + 13,dc 1 + 9,dc 2 + 22,dc 1 + 4,dc 0 + 16,dc 1 + 11,dc 2 + 7,dc 3 + 20,dc 1 + 19,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set saveimage::rules { + 13,line 53 + 7,line 42 + 10,line 48 + 22,line 65 + 4,line 36 + 18,line 61 + 1,line 32 + 15,line 55 + 9,line 45 + 12,line 52 + 6,line 40 + 21,line 64 + 3,line 36 + 17,line 57 + 4,e 1 + 14,line 54 + 8,line 44 + 11,line 49 + 23,line 66 + 5,line 37 + 20,line 63 + 19,line 62 + 2,line 33 + 16,line 56 +} + +array set saveimage::lr1_table { + 35 {{8 {0 259} 3}} + 14,trans {} + 33,trans {} + 18,trans {} + 1,trans {{257 12} {258 13} {264 14} {267 15} {268 16} {269 17} {270 18} {276 19}} + 23,trans {} + 5,trans {} + 27,trans {} + 9,trans {} + 13,trans {} + 32,trans {} + 17,trans {} + 0,trans {{259 1} {260 2} {261 3} {262 4} {263 5} {264 6} {265 7} {266 8} {271 9} {273 10} {275 11}} + 22,trans {{259 33}} + 4,trans {} + 26,trans {} + 8,trans {{259 20} {274 21}} + 12,trans {} + 31,trans {{259 35}} + 16,trans {} + 35,trans {} + 21,trans {} + 3,trans {} + 10 {{3 0 1} {5 0 1} {4 259 0}} + 11 {{7 {0 259} 1} {8 {0 259} 1} {18 259 0} {19 259 0} {20 259 0} {21 259 0} {22 259 0} {23 259 0} {1 259 0} {2 259 0}} + 25,trans {{257 12} {258 13} {264 14} {267 15} {268 16} {269 17} {270 18} {276 34}} + 12 {{1 {0 259} 1}} + 7,trans {} + 13 {{2 {0 259} 1}} + 14 {{20 {0 259} 1}} + 15 {{19 {0 259} 1}} + 11,trans {{257 23} {258 24} {259 25} {264 26} {267 27} {268 28} {269 29} {270 30} {276 31}} + 30,trans {} + 29,trans {} + 16 {{21 {0 259} 1}} + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {8 {0 259} 0} {9 {0 259} 0} {12 {0 257 258 259 264 267 268 269} 0} {13 {0 257 258 259 264 267 268 269} 0} {14 {0 257 258 259 264 267 268 269} 0} {15 {0 257 258 259 264 267 268 269} 0} {16 {0 257 258 259 264 267 268 269} 0} {17 {0 257 258 259 264 267 268 269} 0}} + 17 {{22 {0 259} 1}} + 1 {{6 {0 259} 1} {18 {0 259} 0} {19 {0 259} 0} {20 {0 259} 0} {21 {0 259} 0} {22 {0 259} 0} {23 {0 259} 0} {1 {0 259} 0} {2 {0 259} 0}} + 18 {{23 {0 259} 1}} + 2 {{12 {0 257 258 259 264 267 268 269} 1}} + 19 {{6 {0 259} 2}} + 20 {{10 {0 259} 1} {11 {0 259} 1}} + 15,trans {} + 34,trans {} + 3 {{13 {0 257 258 259 264 267 268 269} 1}} + 21 {{9 {0 259} 2}} + 4 {{14 {0 257 258 259 264 267 268 269} 1}} + 22 {{5 0 2}} + 5 {{15 {0 257 258 259 264 267 268 269} 1}} + 23 {{1 259 1}} + 20,trans {{257 32}} + 19,trans {} + 6 {{16 {0 257 258 259 264 267 268 269} 1}} + 2,trans {} + 24 {{2 259 1}} + 7 {{17 {0 257 258 259 264 267 268 269} 1}} + 25 {{7 {0 259} 2} {18 {0 259} 0} {19 {0 259} 0} {20 {0 259} 0} {21 {0 259} 0} {22 {0 259} 0} {23 {0 259} 0} {1 {0 259} 0} {2 {0 259} 0}} + 8 {{9 {0 259} 1} {10 {0 259} 0} {11 {0 259} 0}} + 26 {{20 259 1}} + 9 {{0 0 1}} + 27 {{19 259 1}} + 24,trans {} + 6,trans {} + 28 {{21 259 1}} + 29 {{22 259 1}} + 30 {{23 259 1}} + 31 {{8 {0 259} 2}} + 32 {{11 {0 259} 2}} + 10,trans {{272 22}} + 28,trans {} + 33 {{5 0 3}} + 34 {{7 {0 259} 3}} +} + +array set saveimage::token_id_table { + 264,line 18 + 270,t 1 + 269,t 0 + 276,line 60 + 265,title PNG + 274,t 1 + 261,line 15 + 257,t 0 + 270,title {} + 269,title DEFLATE + 273,line 39 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 31 + 269,line 24 + 259,title string + 260,title FITS + 266,t 0 + 271,t 1 + error error + 264,title JPEG + 266,line 20 + 275,t 1 + error,line 30 + 268,title PACKBITS + 258,t 0 + 263,line 17 + error,title {} + 275,line 51 + 273,title {} + 263,t 0 + 259,line 10 + 260,line 14 + 258,title float + 277,title {} + 272,line 36 + 267,t 0 + 263,title TIFF + 272,t 1 + 268,line 23 + 267,title NONE + 257 INT_ + 276,t 1 + 258 REAL_ + 259,t 0 + 259 STRING_ + 260 FITS_ + 260,t 0 + 272,title {} + 261 EPS_ + 265,line 19 + 262 GIF_ + 263 TIFF_ + 277,line 67 + 257,title integer + 264 JPEG_ + 264,t 0 + 276,title {} + 265 PNG_ + 262,line 16 + 266 MPEG_ + 267 NONE_ + 0,t 0 + 0 {$} + 262,title GIF + 268 PACKBITS_ + 268,t 0 + 274,line 47 + 270 numeric + 269 DEFLATE_ + 271 command + error,t 0 + 272 @PSEUDO1 + 258,line 8 + 273,t 1 + 273 saveimage + 266,title MPEG + 274 mpeg + 275 ext + 271,line 35 + 276 opts + 277,t 1 + 277 start' + 271,title {} + 261,t 0 + 267,line 22 + 275,title {} + 265,t 0 + 261,title EPS +} + +proc saveimage::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { SaveImageCmdLoad [ExtToFormat $1] $1 } + 7 { SaveImageCmdLoad $1 $2 } + 8 { SaveImageCmdLoad $1 $3 } + 10 { SaveImageCmdMPEG $1 1 } + 11 { SaveImageCmdMPEG $1 $2 } + 12 { set _ fits } + 13 { set _ eps } + 14 { set _ gif } + 15 { set _ tiff } + 16 { set _ jpeg } + 17 { set _ png } + 19 { ProcessCmdSet saveimage tiff,compress none } + 20 { ProcessCmdSet saveimage tiff,compress jpeg } + 21 { ProcessCmdSet saveimage tiff,compress packbits } + 22 { ProcessCmdSet saveimage tiff,compress deflate } + 23 { ProcessCmdSet saveimage jpeg,quality $1 } + } + 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 saveimage::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/savelex.tcl b/ds9/parsers/savelex.tcl new file mode 100644 index 0000000..a94393a --- /dev/null +++ b/ds9/parsers/savelex.tcl @@ -0,0 +1,429 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval save { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc save::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc save::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc save::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc save::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc save::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc save::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc save::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc save::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc save::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 +set FITS_ 259 +set RGBIMAGE_ 260 +set RGBCUBE_ 261 +set MECUBE_ 262 +set MOSAIC_ 263 +set MOSAICWCS_ 264 +set MOSAICIMAGE_ 265 +set MOSAICIMAGEWCS_ 266 +set WCS_ 267 +set IMAGE_ 268 +set TABLE_ 269 +set SLICE_ 270 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: fits + if {[regexp -start $index_ -indices -line -nocase -- {\A(fits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: rgbimage + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgbimage)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: rgbcube + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgbcube)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: mecube + if {[regexp -start $index_ -indices -line -nocase -- {\A(mecube)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: mosaic + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: mosaicwcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicwcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: mosaicimage + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicimage)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: mosaicimagewcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicimagewcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: table + if {[regexp -start $index_ -indices -line -nocase -- {\A(table)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $FITS_ + } + 1 { +return $RGBIMAGE_ + } + 2 { +return $RGBCUBE_ + } + 3 { +return $MECUBE_ + } + 4 { +return $MOSAIC_ + } + 5 { +return $MOSAICWCS_ + } + 6 { +return $MOSAICIMAGE_ + } + 7 { +return $MOSAICIMAGEWCS_ + } + 8 { +return $WCS_ + } + 9 { +return $IMAGE_ + } + 10 { +return $TABLE_ + } + 11 { +return $SLICE_ + } + 12 { +set yylval $yytext; return $INT_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 16 { +set yylval $yytext; return $STRING_ + } + 17 { +# ignore whitespace + } + 18 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/saveparser.tab.tcl b/ds9/parsers/saveparser.tab.tcl new file mode 100644 index 0000000..25bd866 --- /dev/null +++ b/ds9/parsers/saveparser.tab.tcl @@ -0,0 +1,14 @@ +set INT_ 257 +set STRING_ 258 +set FITS_ 259 +set RGBIMAGE_ 260 +set RGBCUBE_ 261 +set MECUBE_ 262 +set MOSAIC_ 263 +set MOSAICWCS_ 264 +set MOSAICIMAGE_ 265 +set MOSAICIMAGEWCS_ 266 +set WCS_ 267 +set IMAGE_ 268 +set TABLE_ 269 +set SLICE_ 270 diff --git a/ds9/parsers/saveparser.tcl b/ds9/parsers/saveparser.tcl new file mode 100644 index 0000000..599abf9 --- /dev/null +++ b/ds9/parsers/saveparser.tcl @@ -0,0 +1,567 @@ +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 save { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc save::YYABORT {} { + return -code return 1 +} + +proc save::YYACCEPT {} { + return -code return 0 +} + +proc save::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc save::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc save::yyerror {s} { + puts stderr $s +} + +proc save::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 save::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set save::table { + 17:258 reduce + 0:258 shift + 23:0,target 18 + 15:258,target 22 + 0:260 shift + 0:259 shift + 20:258 reduce + 19:258 reduce + 15:0,target 22 + 0:261 shift + 0:266,target 9 + 2:258 reduce + 11:0 reduce + 8:267,target 21 + 0:262 shift + 0:276,target 14 + 22:258 shift + 0:263 shift + 4:258 reduce + 0:264 shift + 11:272 goto + 6:258 reduce + 0:265 shift + 1:269,target 17 + 1:270,target 18 + 15:0 reduce + 0:266 shift + 8:258 reduce + 11:272,target 22 + 6:258,target 12 + 0:265,target 8 + 24:0,target 3 + 0:275,target 13 + 19:0 reduce + 16:0,target 19 + 0:271 goto + 18:258,target 21 + 1:258,target 18 + 0:273 goto + 1:268,target 16 + 6:267 shift + 0:274 goto + 24:0 reduce + 13:258,target 10 + 0:275 goto + 8:267 shift + 0:276 goto + 0:264,target 7 + 6:267,target 20 + 0:274,target 12 + 25:0,target 5 + 1:257,target 15 + 17:0,target 20 + 9:258,target 17 + 10:0,target 0 + 1:277,target 19 + 22:258,target 24 + 4:258,target 8 + 0:263,target 6 + 16:0 reduce + 0:273,target 11 + 16:258,target 19 + 12:258 shift + 18:0,target 21 + 14:258 reduce + 11:258,target 2 + 1:0,target 18 + 11:0,target 1 + 0:262,target 5 + 16:258 reduce + 25:0 reduce + 1:257 shift + 18:258 reduce + 1:258 reduce + 25:258,target 5 + 7:258,target 14 + 21:258 reduce + 3:258 reduce + 23:257 shift + 23:258 reduce + 20:258,target 13 + 19:258,target 4 + 5:258 reduce + 0:261,target 4 + 2:258,target 6 + 19:0,target 4 + 0:271,target 10 + 25:258 reduce + 7:258 reduce + 14:258,target 11 + 17:0 reduce + 9:258 reduce + 23:270,target 18 + 23:269,target 17 + 1:268 shift + 1:269 shift + 1:270 shift + 0:259,target 2 + 0:260,target 3 + 23:268 shift + 23:270 shift + 23:269 shift + 23:258,target 18 + 5:258,target 9 + 23:268,target 16 + 10:0 accept + 1:277 goto + 17:258,target 20 + 0:258,target 1 + 23:277 goto + 12:258,target 23 + 23:257,target 15 + 23:277,target 25 + 18:0 reduce + 11:258 reduce + 1:0 reduce + 8:258,target 15 + 13:258 reduce + 23:0 reduce + 21:258,target 16 + 15:258 reduce + 3:258,target 7 +} + +array set save::rules { + 9,l 274 + 11,l 274 + 15,l 276 + 20,l 277 + 19,l 277 + 2,l 272 + 6,l 274 + 12,l 275 + 16,l 276 + 21,l 277 + 3,l 271 + 7,l 274 + 13,l 275 + 0,l 278 + 17,l 276 + 22,l 277 + 4,l 273 + 8,l 274 + 10,l 274 + 14,l 275 + 18,l 277 + 1,l 271 + 5,l 273 +} + +array set save::rules { + 5,dc 3 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 1 + 21,dc 1 + 3,dc 3 + 15,dc 1 + 10,dc 1 + 6,dc 1 + 18,dc 0 + 1,dc 1 + 13,dc 2 + 9,dc 1 + 22,dc 1 + 4,dc 2 + 16,dc 2 + 11,dc 1 + 7,dc 1 + 20,dc 1 + 19,dc 1 + 2,dc 0 + 14,dc 1 +} + +array set save::rules { + 13,line 47 + 2,e 1 + 7,line 39 + 10,line 42 + 22,line 60 + 4,line 34 + 18,line 56 + 1,line 30 + 15,line 51 + 9,line 41 + 12,line 46 + 6,line 38 + 21,line 59 + 3,line 31 + 17,line 53 + 14,line 48 + 8,line 40 + 11,line 43 + 5,line 35 + 20,line 58 + 19,line 57 + 2,line 30 + 16,line 52 +} + +array set save::lr1_table { + 14,trans {} + 1,trans {{257 15} {268 16} {269 17} {270 18} {277 19}} + 18,trans {} + 23,trans {{257 15} {268 16} {269 17} {270 18} {277 25}} + 5,trans {} + 9,trans {} + 13,trans {} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5} {263 6} {264 7} {265 8} {266 9} {271 10} {273 11} {274 12} {275 13} {276 14}} + 17,trans {} + 4,trans {} + 22,trans {{258 24}} + 8,trans {{267 21}} + 12,trans {{258 23}} + 16,trans {} + 3,trans {} + 21,trans {} + 10 {{0 0 1}} + 11 {{1 0 1} {3 0 1} {2 258 0}} + 25,trans {} + 12 {{5 {0 258} 1}} + 7,trans {} + 13 {{10 258 1}} + 14 {{11 258 1}} + 15 {{22 {0 258} 1}} + 11,trans {{272 22}} + 16 {{19 {0 258} 1}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0} {5 {0 258} 0} {6 258 0} {7 258 0} {8 258 0} {9 258 0} {10 258 0} {11 258 0} {12 258 0} {13 258 0} {14 258 0} {15 258 0} {16 258 0} {17 258 0}} + 17 {{20 {0 258} 1}} + 1 {{4 {0 258} 1} {18 {0 258} 0} {19 {0 258} 0} {20 {0 258} 0} {21 {0 258} 0} {22 {0 258} 0}} + 18 {{21 {0 258} 1}} + 2 {{6 258 1}} + 19 {{4 {0 258} 2}} + 20 {{13 258 2}} + 15,trans {} + 3 {{7 258 1}} + 21 {{16 258 2}} + 4 {{8 258 1}} + 22 {{3 0 2}} + 5 {{9 258 1}} + 23 {{5 {0 258} 2} {18 {0 258} 0} {19 {0 258} 0} {20 {0 258} 0} {21 {0 258} 0} {22 {0 258} 0}} + 6 {{12 258 1} {13 258 1}} + 2,trans {} + 19,trans {} + 20,trans {} + 24 {{3 0 3}} + 25 {{5 {0 258} 3}} + 7 {{14 258 1}} + 8 {{15 258 1} {16 258 1}} + 9 {{17 258 1}} + 24,trans {} + 6,trans {{267 20}} + 10,trans {} +} + +array set save::token_id_table { + 264,line 18 + 270,t 0 + 269,t 0 + 276,line 50 + 265,title MOSAICIMAGE + 274,t 1 + 261,line 15 + 257,t 0 + 270,title SLICE + 269,title TABLE + 273,line 33 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 25 + 269,line 24 + 259,title FITS + 260,title RGBIMAGE + 266,t 0 + 278,title {} + 271,t 1 + error error + 264,title MOSAICWCS + 266,line 20 + 278,line 61 + 275,t 1 + error,line 28 + 268,title IMAGE + 258,t 0 + 263,line 17 + error,title {} + 275,line 45 + 273,title {} + 263,t 0 + 259,line 13 + 260,line 14 + 258,title string + 277,title {} + 272,line 30 + 267,t 0 + 263,title MOSAIC + 272,t 1 + 268,line 23 + 267,title WCS + 257 INT_ + 276,t 1 + 258 STRING_ + 259,t 0 + 259 FITS_ + 260 RGBIMAGE_ + 260,t 0 + 272,title {} + 261 RGBCUBE_ + 265,line 19 + 262 MECUBE_ + 263 MOSAIC_ + 277,line 55 + 257,title integer + 264 MOSAICWCS_ + 264,t 0 + 276,title {} + 265 MOSAICIMAGE_ + 262,line 16 + 266 MOSAICIMAGEWCS_ + 267 WCS_ + 0,t 0 + 0 {$} + 262,title MECUBE + 268 IMAGE_ + 268,t 0 + 274,line 37 + 270 SLICE_ + 269 TABLE_ + 271 command + error,t 0 + 272 @PSEUDO1 + 258,line 9 + 273,t 1 + 273 save + 266,title MOSAICIMAGEWCS + 274 format + 275 mosaic + 271,line 29 + 276 mosaicimage + 277,t 1 + 277 opts + 271,title {} + 278 start' + 261,t 0 + 267,line 21 + 275,title {} + 265,t 0 + 261,title RGBCUBE +} + +proc save::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { SaveCmdLoad [ExtToFormat $1] $1 } + 5 { SaveCmdLoad $1 $2 } + 6 { set _ fits } + 7 { set _ rgbimage } + 8 { set _ rgbcube } + 9 { set _ mecube } + 10 { set _ $1 } + 11 { set _ $1 } + 12 { set _ mosaic } + 13 { set _ mosaic } + 14 { set _ mosaic } + 15 { set _ mosaicimage } + 16 { set _ mosaicimage } + 17 { set _ mosaicimage } + 18 { ProcessCmdSet savefits type image; ProcessCmdSet savefits mosaic 1 } + 19 { ProcessCmdSet savefits type image } + 20 { ProcessCmdSet savefits type table } + 21 { ProcessCmdSet savefits type slice } + 22 { ProcessCmdSet savefits mosaic $1 } + } + 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 save::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/scalelex.tcl b/ds9/parsers/scalelex.tcl new file mode 100644 index 0000000..5954148 --- /dev/null +++ b/ds9/parsers/scalelex.tcl @@ -0,0 +1,646 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval scale { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc scale::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc scale::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc scale::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc scale::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc scale::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc scale::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc scale::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc scale::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc scale::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set ASINH_ 266 +set CLOSE_ 267 +set DATASEC_ 268 +set EXP_ 269 +set GLOBAL_ 270 +set HISTEQU_ 271 +set LIMITS_ 272 +set LINEAR_ 273 +set LOCAL_ 274 +set LOCK_ 275 +set LOG_ 276 +set MATCH_ 277 +set MINMAX_ 278 +set MODE_ 279 +set OPEN_ 280 +set POW_ 281 +set SCALELIMITS_ 282 +set SCOPE_ 283 +set SINH_ 284 +set SQRT_ 285 +set SQUARED_ 286 +set USER_ 287 +set ZMAX_ 288 +set ZSCALE_ 289 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: asinh + if {[regexp -start $index_ -indices -line -nocase -- {\A(asinh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: datasec + if {[regexp -start $index_ -indices -line -nocase -- {\A(datasec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: exp + if {[regexp -start $index_ -indices -line -nocase -- {\A(exp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: global + if {[regexp -start $index_ -indices -line -nocase -- {\A(global)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: histequ + if {[regexp -start $index_ -indices -line -nocase -- {\A(histequ)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: limits + if {[regexp -start $index_ -indices -line -nocase -- {\A(limits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: linear + if {[regexp -start $index_ -indices -line -nocase -- {\A(linear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: local + if {[regexp -start $index_ -indices -line -nocase -- {\A(local)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: log + if {[regexp -start $index_ -indices -line -nocase -- {\A(log)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: minmax + if {[regexp -start $index_ -indices -line -nocase -- {\A(minmax)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: pow + if {[regexp -start $index_ -indices -line -nocase -- {\A(pow)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: scope + if {[regexp -start $index_ -indices -line -nocase -- {\A(scope)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: sinh + if {[regexp -start $index_ -indices -line -nocase -- {\A(sinh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: sqrt + if {[regexp -start $index_ -indices -line -nocase -- {\A(sqrt)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: squared + if {[regexp -start $index_ -indices -line -nocase -- {\A(squared)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: user + if {[regexp -start $index_ -indices -line -nocase -- {\A(user)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: zmax + if {[regexp -start $index_ -indices -line -nocase -- {\A(zmax)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: zscale + if {[regexp -start $index_ -indices -line -nocase -- {\A(zscale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ASINH_ + } + 1 { +return $CLOSE_ + } + 2 { +return $DATASEC_ + } + 3 { +return $EXP_ + } + 4 { +return $GLOBAL_ + } + 5 { +return $HISTEQU_ + } + 6 { +return $LIMITS_ + } + 7 { +return $LINEAR_ + } + 8 { +return $LOCAL_ + } + 9 { +return $LOCK_ + } + 10 { +return $LOG_ + } + 11 { +return $MATCH_ + } + 12 { +return $MINMAX_ + } + 13 { +return $MODE_ + } + 14 { +return $OPEN_ + } + 15 { +return $POW_ + } + 16 { +return $SCALELIMITS_ + } + 17 { +return $SCOPE_ + } + 18 { +return $SINH_ + } + 19 { +return $SQRT_ + } + 20 { +return $SQUARED_ + } + 21 { +return $USER_ + } + 22 { +return $ZMAX_ + } + 23 { +return $ZSCALE_ + } + 24 { +return $YES_ + } + 25 { +return $NO_ + } + 26 { +return $ON_ + } + 27 { +return $OFF_ + } + 28 { +return $TRUE_ + } + 29 { +return $FALSE_ + } + 30 { +set yylval $yytext; return $INT_ + } + 31 - + 32 { +set yylval $yytext; return $REAL_ + } + 33 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 34 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 35 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 36 { +set yylval $yytext; return $STRING_ + } + 37 { +# ignore whitespace + } + 38 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/scaleparser.tab.tcl b/ds9/parsers/scaleparser.tab.tcl new file mode 100644 index 0000000..f56019a --- /dev/null +++ b/ds9/parsers/scaleparser.tab.tcl @@ -0,0 +1,33 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set ASINH_ 266 +set CLOSE_ 267 +set DATASEC_ 268 +set EXP_ 269 +set GLOBAL_ 270 +set HISTEQU_ 271 +set LIMITS_ 272 +set LINEAR_ 273 +set LOCAL_ 274 +set LOCK_ 275 +set LOG_ 276 +set MATCH_ 277 +set MINMAX_ 278 +set MODE_ 279 +set OPEN_ 280 +set POW_ 281 +set SCALELIMITS_ 282 +set SCOPE_ 283 +set SINH_ 284 +set SQRT_ 285 +set SQUARED_ 286 +set USER_ 287 +set ZMAX_ 288 +set ZSCALE_ 289 diff --git a/ds9/parsers/scaleparser.tcl b/ds9/parsers/scaleparser.tcl new file mode 100644 index 0000000..77687ea --- /dev/null +++ b/ds9/parsers/scaleparser.tcl @@ -0,0 +1,1083 @@ +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 scale { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc scale::YYABORT {} { + return -code return 1 +} + +proc scale::YYACCEPT {} { + return -code return 0 +} + +proc scale::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc scale::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc scale::yyerror {s} { + puts stderr $s +} + +proc scale::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 scale::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set scale::table { + 34:265,target 3 + 47:265 reduce + 27:0 accept + 15:278,target 14 + 39:264,target 2 + 48:0 reduce + 23:265,target 44 + 17:265 reduce + 56:265 reduce + 2:263,target 9 + 0:275,target 11 + 6:0,target 46 + 11:282,target 41 + 2:0 reduce + 6:265 reduce + 12:265,target 27 + 26:265 reduce + 56:0,target 21 + 24:0 reduce + 11:261,target 36 + 48:0,target 23 + 41:0,target 1 + 45:0 reduce + 40:262,target 37 + 33:0,target 5 + 46:265,target 36 + 25:0,target 42 + 0:294,target 28 + 17:0,target 28 + 3:265,target 31 + 10:0,target 45 + 35:265 reduce + 0:273,target 9 + 8:264,target 2 + 35:265,target 6 + 44:263 shift + 21:0 reduce + 44:264 shift + 11:258,target 33 + 42:0 reduce + 24:265,target 43 + 40:260,target 35 + 40:259,target 34 + 0:292,target 27 + 14:265 reduce + 13:265,target 34 + 53:265 reduce + 0:271,target 7 + 18:264,target 2 + 3:265 reduce + 17:0 reduce + 41:262,target 37 + 23:265 reduce + 47:265,target 15 + 38:0 reduce + 4:265,target 14 + 40:257,target 32 + 0:289,target 25 + 3:0,target 31 + 36:265,target 4 + 32:265 reduce + 53:0,target 38 + 41:257 shift + 0:268,target 5 + 45:0,target 35 + 44:291 goto + 41:258 shift + 41:260 shift + 41:259 shift + 37:0,target 7 + 14:0 reduce + 15:291,target 26 + 41:261 shift + 30:0,target 22 + 29:0,target 17 + 41:262 shift + 25:265,target 42 + 22:0,target 30 + 41:260,target 35 + 41:259,target 34 + 35:0 reduce + 11:257 shift + 14:0,target 41 + 11:258 shift + 41:265 reduce + 11:259 shift + 11:260 shift + 56:0 reduce + 11:261 shift + 13:282,target 46 + 49:291,target 56 + 0:287,target 23 + 11:262 shift + 14:265,target 41 + 11:265 reduce + 49:263 shift + 49:264 shift + 0:266,target 3 + 9:0 reduce + 50:265 reduce + 11:0 reduce + 0:263 shift + 15:288,target 24 + 48:265,target 23 + 0:264 shift + 32:0 reduce + 5:265,target 1 + 11:272 shift + 41:257,target 32 + 0:266 shift + 20:265 reduce + 0:267 shift + 53:0 reduce + 0:268 shift + 0:270 shift + 37:265,target 7 + 0:271 shift + 0:285,target 21 + 19:270 shift + 0:272 shift + 8:263 shift + 0:273 shift + 8:264 shift + 0:274 shift + 0:275 shift + 6:0 reduce + 11:282 shift + 28:265 reduce + 19:274 shift + 0:276 shift + 0:264,target 2 + 41:290 goto + 26:265,target 40 + 0:277 shift + 0:278 shift + 28:0 reduce + 0:279 shift + 0:280 shift + 7:0,target 33 + 28:293,target 51 + 0:281 shift + 0:282 shift + 50:0 reduce + 0:283 shift + 11:290 goto + 0:284 shift + 57:0,target 12 + 37:265 reduce + 0:285 shift + 50:0,target 25 + 0:286 shift + 0:283,target 19 + 11:290,target 42 + 49:291 goto + 42:0,target 37 + 0:287 shift + 34:0,target 3 + 0:288 shift + 39:291,target 52 + 26:0,target 40 + 0:289 shift + 3:0 reduce + 0:291 goto + 11:297 goto + 50:265,target 25 + 0:292 goto + 11:0,target 1 + 6:265,target 46 + 46:265 reduce + 25:0 reduce + 0:294 goto + 0:295 goto + 13:296,target 47 + 19:299,target 50 + 5:261,target 36 + 46:0 reduce + 38:265,target 19 + 0:298 goto + 5:257 shift + 0:299 goto + 5:258 shift + 8:291 goto + 15:263,target 1 + 16:265 reduce + 5:259 shift + 5:260 shift + 19:299 goto + 0:281,target 17 + 5:261 shift + 55:265 reduce + 44:264,target 2 + 5:262 shift + 28:293 goto + 1:264,target 8 + 5:265 reduce + 49:263,target 1 + 25:265 reduce + 22:0 reduce + 43:0 reduce + 0:299,target 31 + 5:258,target 33 + 8:291,target 39 + 16:265,target 13 + 34:265 reduce + 0:278,target 14 + 51:265,target 57 + 4:0,target 14 + 7:265,target 33 + 54:0,target 39 + 43:265 reduce + 40:265,target 1 + 40:0 reduce + 46:0,target 36 + 38:0,target 19 + 31:0,target 24 + 23:0,target 44 + 18:291,target 49 + 5:290 goto + 2:264,target 9 + 13:265 reduce + 28:265,target 11 + 19:274,target 10 + 0:276,target 12 + 52:265 reduce + 15:298,target 48 + 2:263 reduce + 2:264 reduce + 2:265 reduce + 11:262,target 37 + 13:272 shift + 17:265,target 28 + 36:0 reduce + 22:265 reduce + 39:263,target 1 + 0:295,target 29 + 57:0 reduce + 52:265,target 20 + 0:274,target 10 + 13:282 shift + 31:265 reduce + 40:257 shift + 40:258 shift + 12:0 reduce + 40:260 shift + 40:259 shift + 41:265,target 1 + 40:261 shift + 11:259,target 34 + 11:260,target 35 + 40:262 shift + 33:0 reduce + 39:263 shift + 40:261,target 36 + 39:264 shift + 54:0 reduce + 40:265 reduce + 30:265,target 22 + 29:265,target 17 + 1:0,target 8 + 13:296 goto + 19:270,target 6 + 0:272,target 8 + 8:263,target 1 + 10:265 reduce + 7:0 reduce + 48:265 reduce + 43:0,target 16 + 35:0,target 6 + 30:0 reduce + 29:0 reduce + 11:257,target 32 + 27:0,target 0 + 18:263 shift + 20:0,target 32 + 18:264 shift + 40:258,target 33 + 12:0,target 27 + 0:291,target 26 + 11:297,target 43 + 53:265,target 38 + 9:265,target 26 + 5:290,target 38 + 0:270,target 6 + 4:0 reduce + 7:265 reduce + 42:265,target 37 + 40:290 goto + 18:263,target 1 + 39:291 goto + 26:0 reduce + 41:261,target 36 + 47:0 reduce + 31:265,target 24 + 0:288,target 24 + 36:265 reduce + 1:0 reduce + 20:265,target 32 + 0:267,target 4 + 15:289,target 25 + 23:0 reduce + 18:291 goto + 45:265 reduce + 44:291,target 55 + 41:258,target 33 + 5:0,target 1 + 54:265,target 39 + 15:263 shift + 15:264 shift + 0:286,target 22 + 55:0,target 18 + 54:265 reduce + 47:0,target 15 + 43:265,target 16 + 40:0,target 1 + 32:0,target 2 + 11:272,target 40 + 24:0,target 43 + 4:265 reduce + 20:0 reduce + 15:287,target 23 + 16:0,target 13 + 24:265 reduce + 41:0 reduce + 32:265,target 2 + 15:278 shift + 0:284,target 20 + 33:265 reduce + 21:265,target 29 + 0:263,target 1 + 15:287 shift + 16:0 reduce + 15:288 shift + 10:265,target 45 + 15:289 shift + 55:265,target 18 + 37:0 reduce + 5:262,target 37 + 15:291 goto + 42:265 reduce + 15:264,target 2 + 0:282,target 18 + 12:265 reduce + 1:265,target 8 + 15:298 goto + 40:290,target 53 + 51:265 shift + 49:264,target 2 + 1:263 reduce + 9:0,target 26 + 12:269 shift + 13:0 reduce + 1:264 reduce + 2:0,target 9 + 33:265,target 5 + 1:265 reduce + 34:0 reduce + 21:265 reduce + 5:259,target 34 + 5:260,target 35 + 55:0 reduce + 52:0,target 20 + 36:0,target 4 + 22:265,target 30 + 28:0,target 10 + 0:279,target 15 + 0:280,target 16 + 44:263,target 1 + 21:0,target 29 + 9:265 reduce + 1:263,target 8 + 12:269,target 44 + 13:0,target 34 + 30:265 reduce + 29:265 reduce + 10:0 reduce + 11:265,target 1 + 56:265,target 21 + 31:0 reduce + 0:298,target 30 + 5:257,target 32 + 52:0 reduce + 38:265 reduce + 45:265,target 35 + 2:265,target 9 + 13:272,target 45 + 41:290,target 54 + 0:277,target 13 + 5:0 reduce +} + +array set scale::rules { + 9,l 291 + 11,l 293 + 32,l 295 + 6,l 290 + 28,l 295 + 3,l 290 + 25,l 294 + 46,l 299 + 0,l 300 + 22,l 294 + 43,l 298 + 18,l 294 + 40,l 298 + 39,l 297 + 15,l 294 + 36,l 296 + 12,l 292 + 33,l 295 + 7,l 290 + 29,l 295 + 30,l 295 + 4,l 290 + 26,l 295 + 1,l 290 + 23,l 294 + 44,l 298 + 19,l 294 + 20,l 294 + 41,l 298 + 16,l 294 + 37,l 297 + 13,l 294 + 34,l 296 + 8,l 291 + 10,l 292 + 31,l 295 + 5,l 290 + 27,l 295 + 2,l 290 + 24,l 294 + 45,l 299 + 21,l 294 + 42,l 298 + 17,l 294 + 38,l 297 + 14,l 294 + 35,l 296 +} + +array set scale::rules { + 12,dc 3 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 3 + 33,dc 1 + 9,dc 1 + 11,dc 0 + 25,dc 2 + 2,dc 1 + 40,dc 1 + 39,dc 2 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 0 + 38,dc 2 + 16,dc 2 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 2 + 0,dc 1 + 37,dc 1 + 15,dc 2 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 3 + 35,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 2 + 20,dc 3 + 34,dc 0 +} + +array set scale::rules { + 41,line 113 + 7,line 66 + 37,line 107 + 4,line 63 + 34,line 102 + 1,line 60 + 31,line 97 + 27,line 93 + 24,line 88 + 21,line 85 + 17,line 80 + 14,line 77 + 11,line 72 + 46,line 120 + 43,line 115 + 9,line 69 + 40,line 112 + 39,line 109 + 6,line 65 + 36,line 104 + 3,line 62 + 33,line 99 + 29,line 95 + 30,line 96 + 26,line 92 + 23,line 87 + 19,line 82 + 20,line 84 + 16,line 79 + 13,line 76 + 10,line 72 + 45,line 119 + 42,line 114 + 8,line 68 + 38,line 108 + 5,line 64 + 35,line 103 + 2,line 61 + 32,line 98 + 28,line 94 + 25,line 89 + 22,line 86 + 18,line 81 + 15,line 78 + 12,line 73 + 11,e 1 + 44,line 116 +} + +array set scale::lr1_table { + 35 {{6 {0 265} 1}} + 14,trans {} + 36 {{4 {0 265} 1}} + 33,trans {} + 37 {{7 {0 265} 1}} + 52,trans {} + 38 {{19 {0 265} 2}} + 40 {{9 {263 264} 1}} + 39 {{8 {263 264} 1}} + 18,trans {{263 39} {264 40} {291 51}} + 41 {{20 {0 265} 2} {8 {0 265} 0} {9 {0 265} 0}} + 1,trans {} + 37,trans {} + 42 {{38 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 56,trans {} + 43 {{39 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 44 {{37 {0 265} 1}} + 23,trans {} + 45 {{16 {0 265} 2}} + 5,trans {{257 32} {258 33} {259 34} {260 35} {261 36} {262 37} {290 38}} + 42,trans {{257 32} {258 33} {259 34} {260 35} {261 36} {262 37} {290 55}} + 46 {{18 {0 265} 2} {8 {0 265} 0} {9 {0 265} 0}} + 47 {{35 {0 265} 1}} + 48 {{36 {0 265} 1}} + 27,trans {} + 50 {{23 {0 265} 2}} + 49 {{15 {0 265} 2}} + 9,trans {} + 46,trans {{263 1} {264 2} {291 57}} + 51 {{21 {0 265} 2} {8 {0 265} 0} {9 {0 265} 0}} + 52 {{25 {0 265} 2}} + 53 {{12 0 2}} + 13,trans {{272 47} {282 48} {296 49}} + 54 {{20 {0 265} 3}} + 32,trans {} + 51,trans {{263 1} {264 2} {291 58}} + 55 {{38 {0 265} 2}} + 56 {{39 {0 265} 2}} + 57 {{18 {0 265} 3}} + 17,trans {} + 0,trans {{263 1} {264 2} {266 3} {267 4} {268 5} {270 6} {271 7} {272 8} {273 9} {274 10} {275 11} {276 12} {277 13} {278 14} {279 15} {280 16} {281 17} {282 18} {283 19} {284 20} {285 21} {286 22} {287 23} {288 24} {289 25} {291 26} {292 27} {294 28} {295 29} {298 30} {299 31}} + 58 {{21 {0 265} 3}} + 36,trans {} + 55,trans {} + 59 {{12 0 3}} + 22,trans {} + 4,trans {} + 41,trans {{263 1} {264 2} {291 54}} + 59,trans {} + 26,trans {} + 8,trans {{263 39} {264 40} {291 41}} + 45,trans {} + 12,trans {{269 46}} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{45 {0 265} 1}} + 11 {{16 {0 265} 1} {37 {0 265} 0} {38 {0 265} 0} {39 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 25,trans {} + 12 {{18 {0 265} 1} {27 {0 265} 1}} + 7,trans {} + 44,trans {} + 13 {{15 {0 265} 1} {34 {0 265} 0} {35 {0 265} 0} {36 {0 265} 0}} + 14 {{41 {0 265} 1}} + 11,trans {{257 32} {258 33} {259 34} {260 35} {261 36} {262 37} {272 42} {282 43} {290 44} {297 45}} + 15 {{23 {0 265} 1} {40 {0 265} 0} {41 {0 265} 0} {42 {0 265} 0} {43 {0 265} 0} {44 {0 265} 0} {8 {0 265} 0} {9 {0 265} 0}} + 30,trans {} + 29,trans {} + 16 {{13 {0 265} 1}} + 48,trans {} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {18 {0 265} 0} {19 {0 265} 0} {20 {0 265} 0} {21 {0 265} 0} {22 {0 265} 0} {23 {0 265} 0} {24 {0 265} 0} {25 {0 265} 0} {26 {0 265} 0} {27 {0 265} 0} {28 {0 265} 0} {29 {0 265} 0} {30 {0 265} 0} {31 {0 265} 0} {32 {0 265} 0} {33 {0 265} 0} {40 {0 265} 0} {41 {0 265} 0} {42 {0 265} 0} {43 {0 265} 0} {44 {0 265} 0} {45 {0 265} 0} {46 {0 265} 0} {8 {0 265} 0} {9 {0 265} 0}} + 17 {{28 {0 265} 1}} + 1 {{8 {0 265} 1}} + 18 {{21 {0 265} 1} {8 {263 264} 0} {9 {263 264} 0}} + 15,trans {{263 1} {264 2} {278 14} {287 23} {288 24} {289 25} {291 26} {298 50}} + 2 {{9 {0 265} 1}} + 19 {{25 {0 265} 1} {45 {0 265} 0} {46 {0 265} 0}} + 20 {{32 {0 265} 1}} + 34,trans {} + 3 {{31 {0 265} 1}} + 21 {{29 {0 265} 1}} + 53,trans {{265 59}} + 4 {{14 {0 265} 1}} + 22 {{30 {0 265} 1}} + 5 {{19 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 23 {{44 {0 265} 1}} + 20,trans {} + 19,trans {{270 6} {274 10} {299 52}} + 6 {{46 {0 265} 1}} + 24 {{43 {0 265} 1}} + 2,trans {} + 38,trans {} + 7 {{33 {0 265} 1}} + 25 {{42 {0 265} 1}} + 57,trans {} + 8 {{20 {0 265} 1} {8 {263 264} 0} {9 {263 264} 0}} + 26 {{40 {0 265} 1}} + 9 {{26 {0 265} 1}} + 27 {{0 0 1}} + 24,trans {} + 28 {{10 0 1} {12 0 1} {11 265 0}} + 6,trans {} + 43,trans {{257 32} {258 33} {259 34} {260 35} {261 36} {262 37} {290 56}} + 29 {{17 {0 265} 1}} + 30 {{22 {0 265} 1}} + 31 {{24 {0 265} 1}} + 10,trans {} + 32 {{2 {0 265} 1}} + 28,trans {{293 53}} + 33 {{5 {0 265} 1}} + 47,trans {} + 34 {{3 {0 265} 1}} +} + +array set scale::token_id_table { + 286,t 0 + 286 SQUARED_ + 280,title OPEN + 279,title MODE + 264,line 15 + 298,title {} + 292,line 71 + 287 USER_ + 270,t 0 + 269,t 0 + 288 ZMAX_ + 300 start' + 290 yesno + 289 ZSCALE_ + 276,line 31 + 265,title string + 291,t 1 + 291 numeric + 284,title SINH + 292 command + 274,t 0 + 261,line 11 + 293 @PSEUDO1 + 288,line 43 + 257,t 0 + 294 scale + 270,title GLOBAL + 269,title EXP + 295,t 1 + 295 scales + 288,title ZMAX + 273,line 28 + 296 match + 278,t 0 + 297 lock + 257,line 7 + 262,t 0 + 298 mode + 285,line 40 + 274,title LOCAL + 299,t 1 + 299 scope + 293,title {} + 283,t 0 + 270,line 25 + 269,line 24 + 297,line 106 + 259,title ON + 260,title OFF + 266,t 0 + 278,title MINMAX + 297,title {} + 282,line 37 + 287,t 0 + error error + 271,t 0 + 264,title float + 266,line 21 + 294,line 75 + 283,title SCOPE + 292,t 1 + 278,line 33 + error,line 58 + 275,t 0 + 268,title DATASEC + 287,title USER + 258,t 0 + 263,line 14 + 291,line 67 + error,title {} + 296,t 1 + 280,t 0 + 279,t 0 + 275,line 30 + 273,title LINEAR + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 42 + 258,title NO + 284,t 0 + 277,title MATCH + 296,title {} + 272,line 27 + 267,t 0 + 299,line 118 + 263,title integer + 288,t 0 + 284,line 39 + 282,title SCALELIMITS + 272,t 0 + 268,line 23 + 296,line 101 + 267,title CLOSE + 293,t 1 + 286,title SQUARED + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title LIMITS + 261 TRUE_ + 265,line 17 + 297,t 1 + 293,line 72 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 INT_ + 277,line 32 + 257,title YES + 264 REAL_ + 264,t 0 + 276,title LOG + 265 STRING_ + 295,title {} + 262,line 12 + 266 ASINH_ + 300,line 121 + 290,line 59 + 289,line 44 + 285,t 0 + 267 CLOSE_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 DATASEC_ + 268,t 0 + 281,title POW + 274,line 29 + 270 GLOBAL_ + 269 EXP_ + 299,title {} + error,t 0 + 271 HISTEQU_ + 300,t 1 + 290,t 1 + 289,t 0 + 272 LIMITS_ + 258,line 8 + 286,line 41 + 273,t 0 + 273 LINEAR_ + 266,title ASINH + 285,title SQRT + 274 LOCAL_ + 275 LOCK_ + 271,line 26 + 298,line 111 + 294,t 1 + 276 LOG_ + 277,t 0 + 277 MATCH_ + 271,title HISTEQU + 300,title {} + 290,title {} + 289,title ZSCALE + 283,line 38 + 278 MINMAX_ + 261,t 0 + 280 OPEN_ + 279 MODE_ + 298,t 1 + 281 POW_ + 267,line 22 + 295,line 91 + 282,t 0 + 282 SCALELIMITS_ + 275,title LOCK + 294,title {} + 283 SCOPE_ + 265,t 0 + 284 SINH_ + 280,line 35 + 279,line 34 + 285 SQRT_ + 261,title TRUE +} + +proc scale::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { ScaleDialog } + 14 { ScaleDestroyDialog } + 17 { ProcessCmdSet scale type $1 ChangeScale } + 18 { ProcessCmdSet scale log $3 ChangeScale } + 19 { ProcessCmdSet scale datasec $2 ChangeDATASEC } + 20 { ProcessCmdSet scale min $2 {}; ProcessCmdSet scale max $3 ChangeScaleLimit } + 21 { ProcessCmdSet scale min $2 {}; ProcessCmdSet scale max $3 ChangeScaleLimit } + 22 { ProcessCmdSet scale mode $1 ChangeScaleMode } + 23 { ProcessCmdSet scale mode $2 ChangeScaleMode } + 24 { ProcessCmdSet scale scope $1 ChangeScaleScope } + 25 { ProcessCmdSet scale scope $2 ChangeScaleScope } + 26 { set _ linear } + 27 { set _ log } + 28 { set _ pow } + 29 { set _ sqrt } + 30 { set _ squared } + 31 { set _ asinh } + 32 { set _ sinh } + 33 { set _ histequ } + 34 { MatchScaleCurrent } + 35 { MatchScaleLimitsCurrent } + 36 { MatchScaleLimitsCurrent } + 37 { ProcessCmdSet scale lock $1 LockScaleCurrent } + 38 { ProcessCmdSet scale lock,limits $2 LockScaleLimitsCurrent } + 39 { ProcessCmdSet scale lock,limits $2 LockScaleLimitsCurrent } + 40 { set _ $1 } + 41 { set _ minmax } + 42 { set _ zscale } + 43 { set _ zmax } + 44 { set _ user } + 45 { set _ local } + 46 { set _ global } + } + 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 scale::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/scalesendlex.tcl b/ds9/parsers/scalesendlex.tcl new file mode 100644 index 0000000..42f43b1 --- /dev/null +++ b/ds9/parsers/scalesendlex.tcl @@ -0,0 +1,333 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval scalesend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc scalesend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc scalesend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc scalesend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc scalesend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc scalesend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc scalesend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc scalesend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc scalesend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc scalesend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set DATASEC_ 257 +set EXP_ 258 +set LIMITS_ 259 +set LOCK_ 260 +set LOG_ 261 +set MODE_ 262 +set SCALELIMITS_ 263 +set SCOPE_ 264 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: datasec + if {[regexp -start $index_ -indices -line -nocase -- {\A(datasec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: exp + if {[regexp -start $index_ -indices -line -nocase -- {\A(exp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: limits + if {[regexp -start $index_ -indices -line -nocase -- {\A(limits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: log + if {[regexp -start $index_ -indices -line -nocase -- {\A(log)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: scalelimits + if {[regexp -start $index_ -indices -line -nocase -- {\A(scalelimits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: scope + if {[regexp -start $index_ -indices -line -nocase -- {\A(scope)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $DATASEC_ + } + 1 { +return $EXP_ + } + 2 { +return $LIMITS_ + } + 3 { +return $LOCK_ + } + 4 { +return $LOG_ + } + 5 { +return $MODE_ + } + 6 { +return $SCALELIMITS_ + } + 7 { +return $SCOPE_ + } + 8 { +# ignore whitespace + } + 9 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/scalesendparser.tab.tcl b/ds9/parsers/scalesendparser.tab.tcl new file mode 100644 index 0000000..4087802 --- /dev/null +++ b/ds9/parsers/scalesendparser.tab.tcl @@ -0,0 +1,8 @@ +set DATASEC_ 257 +set EXP_ 258 +set LIMITS_ 259 +set LOCK_ 260 +set LOG_ 261 +set MODE_ 262 +set SCALELIMITS_ 263 +set SCOPE_ 264 diff --git a/ds9/parsers/scalesendparser.tcl b/ds9/parsers/scalesendparser.tcl new file mode 100644 index 0000000..aaf4b13 --- /dev/null +++ b/ds9/parsers/scalesendparser.tcl @@ -0,0 +1,362 @@ +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 scalesend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc scalesend::YYABORT {} { + return -code return 1 +} + +proc scalesend::YYACCEPT {} { + return -code return 0 +} + +proc scalesend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc scalesend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc scalesend::yyerror {s} { + puts stderr $s +} + +proc scalesend::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 scalesend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set scalesend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 reduce + 0:264,target 7 + 8:0 accept + 5:0,target 7 + 0:260 shift + 0:259 shift + 10:0 reduce + 9:0 reduce + 0:261 shift + 7:0,target 8 + 0:262 shift + 4:258 shift + 3:259 shift + 0:0,target 1 + 0:263 shift + 10:0,target 9 + 9:0,target 3 + 0:261,target 4 + 0:264 shift + 2:0,target 5 + 0:265 goto + 4:258,target 10 + 3:259,target 9 + 0:263,target 6 + 4:0,target 10 + 0:265,target 8 + 0:0 reduce + 6:0,target 6 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 8:0,target 0 + 3:0 reduce + 0:260,target 3 + 0:259,target 2 + 4:0 reduce + 1:0,target 4 + 5:0 reduce + 0:262,target 5 +} + +array set scalesend::rules { + 9,l 265 + 2,l 265 + 6,l 265 + 3,l 265 + 7,l 265 + 0,l 266 + 4,l 265 + 8,l 265 + 10,l 265 + 1,l 265 + 5,l 265 +} + +array set scalesend::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 2 + 10,dc 1 + 6,dc 1 + 1,dc 0 + 9,dc 2 + 4,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set scalesend::rules { + 7,line 27 + 10,line 31 + 4,line 23 + 1,line 20 + 9,line 30 + 6,line 26 + 3,line 22 + 8,line 28 + 5,line 25 + 2,line 21 +} + +array set scalesend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0}} + 1 {{4 0 1}} + 2 {{5 0 1}} + 3 {{2 0 1} {3 0 1}} + 4 {{9 0 1} {10 0 1}} + 0,trans {{257 1} {259 2} {260 3} {261 4} {262 5} {263 6} {264 7} {265 8}} + 5 {{7 0 1}} + 1,trans {} + 6 {{6 0 1}} + 2,trans {} + 3,trans {{259 9}} + 7 {{8 0 1}} + 4,trans {{258 10}} + 8 {{0 0 1}} + 5,trans {} + 10 {{9 0 2}} + 9 {{3 0 2}} + 6,trans {} + 7,trans {} + 8,trans {} + 10,trans {} + 9,trans {} +} + +array set scalesend::token_id_table { + 0,t 0 + 0 {$} + 264,line 15 + 262,title MODE + 263,title SCALELIMITS + 266,line 32 + error,t 0 + error error + 264,title SCOPE + 265,title {} + 258,line 9 + 266,title {} + 261,line 12 + error,line 18 + 257 DATASEC_ + 257,t 0 + 263,line 14 + 258 EXP_ + 258,t 0 + error,title {} + 260,t 0 + 260 LOCK_ + 259 LIMITS_ + 259,t 0 + 265,line 19 + 261,t 0 + 261 LOG_ + 262,t 0 + 262 MODE_ + 257,line 8 + 263,t 0 + 263 SCALELIMITS_ + 264,t 0 + 264 SCOPE_ + 260,line 11 + 257,title DATASEC + 259,line 10 + 265,t 1 + 265 scalesend + 258,title EXP + 266,t 1 + 266 start' + 262,line 13 + 260,title LOCK + 259,title LIMITS + 261,title LOG +} + +proc scalesend::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 { ProcessSendCmdGet scale type } + 2 { ProcessSendCmdYesNo scale lock } + 3 { ProcessSendCmdYesNo scale lock,limits } + 4 { ProcessSendCmdGet scale datasec } + 5 { ProcessSendCmdCurrent "get clip" } + 6 { ProcessSendCmdCurrent "get clip" } + 7 { ProcessSendCmdGet scale mode } + 8 { ProcessSendCmdGet scale scope } + 9 { ProcessSendCmdGet scale log } + 10 { ProcessSendCmdGet scale log } + } + 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 scalesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/sfitslex.tcl b/ds9/parsers/sfitslex.tcl new file mode 100644 index 0000000..d232c70 --- /dev/null +++ b/ds9/parsers/sfitslex.tcl @@ -0,0 +1,319 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval sfits { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc sfits::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc sfits::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc sfits::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc sfits::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc sfits::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc sfits::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc sfits::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc sfits::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc sfits::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set SLICE_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $SLICE_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/sfitsparser.tab.tcl b/ds9/parsers/sfitsparser.tab.tcl new file mode 100644 index 0000000..4d5b356 --- /dev/null +++ b/ds9/parsers/sfitsparser.tab.tcl @@ -0,0 +1,4 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set SLICE_ 260 diff --git a/ds9/parsers/sfitsparser.tcl b/ds9/parsers/sfitsparser.tcl new file mode 100644 index 0000000..6df65a4 --- /dev/null +++ b/ds9/parsers/sfitsparser.tcl @@ -0,0 +1,362 @@ +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 sfits { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc sfits::YYABORT {} { + return -code return 1 +} + +proc sfits::YYACCEPT {} { + return -code return 0 +} + +proc sfits::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc sfits::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc sfits::yyerror {s} { + puts stderr $s +} + +proc sfits::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 sfits::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set sfits::table { + 0:257 reduce + 0:258 reduce + 0:260 reduce + 0:259 shift + 15:0,target 5 + 0:261 goto + 6:260,target 10 + 0:262 goto + 4:257 shift + 0:263 goto + 4:258 shift + 1:260,target 7 + 4:260 shift + 6:257 shift + 15:0 reduce + 6:260 shift + 2:0 accept + 10:257,target 13 + 1:258,target 7 + 4:260,target 7 + 6:257,target 9 + 1:257,target 7 + 12:0 reduce + 13:257,target 15 + 0:263,target 4 + 4:258,target 6 + 10:257 shift + 9:257,target 12 + 3:0 reduce + 8:0,target 2 + 0:262,target 3 + 4:257,target 5 + 1:257 reduce + 1:258 reduce + 1:260 reduce + 5:257 shift + 11:257,target 14 + 0:261,target 2 + 2:0,target 0 + 7:257 shift + 12:0,target 3 + 9:257 shift + 7:257,target 11 + 0:260,target 6 + 0:259,target 1 + 3:0,target 1 + 8:0 reduce + 0:258,target 6 + 14:0 reduce + 5:257,target 8 + 14:0,target 4 + 11:257 shift + 0:257,target 6 + 13:257 shift +} + +array set sfits::rules { + 0,l 264 + 1,l 261 + 2,l 262 + 3,l 262 + 4,l 262 + 5,l 262 + 6,l 263 + 7,l 263 +} + +array set sfits::rules { + 5,dc 5 + 7,dc 1 + 0,dc 1 + 2,dc 3 + 4,dc 4 + 6,dc 0 + 1,dc 1 + 3,dc 4 +} + +array set sfits::rules { + 5,line 25 + 7,line 29 + 2,line 22 + 4,line 24 + 6,line 28 + 1,line 19 + 3,line 23 +} + +array set sfits::lr1_table { + 13,trans {{257 15}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 {257 258 260} 0} {7 {257 258 260} 0}} + 14,trans {} + 1 {{7 {257 258 260} 1}} + 15,trans {} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1} {4 0 1} {5 0 1}} + 0,trans {{259 1} {261 2} {262 3} {263 4}} + 1,trans {} + 5 {{2 0 2}} + 2,trans {} + 6 {{3 0 2} {5 0 2}} + 3,trans {} + 7 {{4 0 2}} + 8 {{2 0 3}} + 4,trans {{257 5} {258 6} {260 7}} + 10 {{5 0 3}} + 9 {{3 0 3}} + 5,trans {{257 8}} + 11 {{4 0 3}} + 6,trans {{257 9} {260 10}} + 12 {{3 0 4}} + 7,trans {{257 11}} + 13 {{5 0 4}} + 8,trans {} + 14 {{4 0 4}} + 10,trans {{257 13}} + 9,trans {{257 12}} + 15 {{5 0 5}} + 11,trans {{257 14}} + 12,trans {} +} + +array set sfits::token_id_table { + 264,line 30 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 11 + 261,line 18 + error,line 16 + 257 STRING_ + 257,t 0 + 263,line 27 + 258 MASK_ + 258,t 0 + error,title {} + 260,t 0 + 260 SLICE_ + 259 NEW_ + 259,t 0 + 261,t 1 + 261 command + 262,t 1 + 262 sfits + 257,line 7 + 263,t 1 + 263 new + 264,t 1 + 264 start' + 260,line 13 + 257,title string + 259,line 12 + 258,title MASK + 262,line 21 + 260,title SLICE + 259,title NEW + 261,title {} +} + +proc sfits::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 { + 2 { LoadSFitsFile $2 $3 {} {} } + 3 { LoadSFitsFile $3 $4 mask {} } + 4 { LoadSFitsFile $3 $4 {} slice } + 5 { LoadSFitsFile $4 $5 mask slice } + 7 { CreateFrame } + } + 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 sfits::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/shmlex.tcl b/ds9/parsers/shmlex.tcl new file mode 100644 index 0000000..aa77cec --- /dev/null +++ b/ds9/parsers/shmlex.tcl @@ -0,0 +1,835 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval shm { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc shm::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc shm::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc shm::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc shm::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc shm::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc shm::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc shm::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc shm::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc shm::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set INT_ 284 +set STRING_ 285 +set KEY_ 286 +set SHMID_ 287 +set ARRAY_ 288 +set FITS_ 289 +set SFITS_ 290 +set MOSAIC_ 291 +set MOSAICWCS_ 292 +set MOSAICIRAF_ 293 +set SMOSAIC_ 294 +set MOSAICIMAGE_ 295 +set MOSAICIMAGEWCS_ 296 +set MOSAICIMAGEIRAF_ 297 +set MOSAICIMAGEWFPC2_ 298 +set RGBARRAY_ 299 +set RGBCUBE_ 300 +set SRGBCUBE_ 301 +set RGBIMAGE_ 302 +set WFPC2_ 303 +set IRAF_ 304 +set SHM_ 305 +set SHMCMD_ 306 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: key + if {[regexp -start $index_ -indices -line -nocase -- {\A(key)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: shmid + if {[regexp -start $index_ -indices -line -nocase -- {\A(shmid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: array + if {[regexp -start $index_ -indices -line -nocase -- {\A(array)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: fits + if {[regexp -start $index_ -indices -line -nocase -- {\A(fits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: sfits + if {[regexp -start $index_ -indices -line -nocase -- {\A(sfits)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: mosaic + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: mosaicwcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicwcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: mosaiciraf + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaiciraf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: smosaic + if {[regexp -start $index_ -indices -line -nocase -- {\A(smosaic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: mosaicimage + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicimage)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: mosaicimagewcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicimagewcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: mosaicimageiraf + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicimageiraf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: mosaicimagewfpc2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(mosaicimagewfpc2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: rgbarray + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgbarray)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: rgbcube + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgbcube)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: srgbcube + if {[regexp -start $index_ -indices -line -nocase -- {\A(srgbcube)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: rgbimage + if {[regexp -start $index_ -indices -line -nocase -- {\A(rgbimage)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wfpc2 + if {[regexp -start $index_ -indices -line -nocase -- {\A(wfpc2)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: iraf + if {[regexp -start $index_ -indices -line -nocase -- {\A(iraf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: shm + if {[regexp -start $index_ -indices -line -nocase -- {\A(shm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: -shm + if {[regexp -start $index_ -indices -line -nocase -- {\A(-shm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $KEY_ + } + 2 { +return $SHMID_ + } + 3 { +return $ARRAY_ + } + 4 { +return $FITS_ + } + 5 { +return $SFITS_ + } + 6 { +return $MOSAIC_ + } + 7 { +return $MOSAICWCS_ + } + 8 { +return $MOSAICIRAF_ + } + 9 { +return $SMOSAIC_ + } + 10 { +return $MOSAICIMAGE_ + } + 11 { +return $MOSAICIMAGEWCS_ + } + 12 { +return $MOSAICIMAGEIRAF_ + } + 13 { +return $MOSAICIMAGEWFPC2_ + } + 14 { +return $RGBARRAY_ + } + 15 { +return $RGBCUBE_ + } + 16 { +return $SRGBCUBE_ + } + 17 { +return $RGBIMAGE_ + } + 18 { +return $WFPC2_ + } + 19 { +return $IRAF_ + } + 20 { +return $SHM_ + } + 21 { +return $SHMCMD_ + } + 22 { +return $WCS_ + } + 23 { +return $WCSA_ + } + 24 { +return $WCSB_ + } + 25 { +return $WCSC_ + } + 26 { +return $WCSD_ + } + 27 { +return $WCSE_ + } + 28 { +return $WCSF_ + } + 29 { +return $WCSG_ + } + 30 { +return $WCSH_ + } + 31 { +return $WCSI_ + } + 32 { +return $WCSJ_ + } + 33 { +return $WCSK_ + } + 34 { +return $WCSL_ + } + 35 { +return $WCSM_ + } + 36 { +return $WCSN_ + } + 37 { +return $WCSO_ + } + 38 { +return $WCSP_ + } + 39 { +return $WCSQ_ + } + 40 { +return $WCSR_ + } + 41 { +return $WCSS_ + } + 42 { +return $WCST_ + } + 43 { +return $WCSU_ + } + 44 { +return $WCSV_ + } + 45 { +return $WCSW_ + } + 46 { +return $WCSX_ + } + 47 { +return $WCSY_ + } + 48 { +return $WCSZ_ + } + 49 { +set yylval $yytext; return $INT_ + } + 50 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 51 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 52 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 53 { +set yylval $yytext; return $STRING_ + } + 54 { +# ignore whitespace + } + 55 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/shmparser.tab.tcl b/ds9/parsers/shmparser.tab.tcl new file mode 100644 index 0000000..d0420b7 --- /dev/null +++ b/ds9/parsers/shmparser.tab.tcl @@ -0,0 +1,50 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set INT_ 284 +set STRING_ 285 +set KEY_ 286 +set SHMID_ 287 +set ARRAY_ 288 +set FITS_ 289 +set SFITS_ 290 +set MOSAIC_ 291 +set MOSAICWCS_ 292 +set MOSAICIRAF_ 293 +set SMOSAIC_ 294 +set MOSAICIMAGE_ 295 +set MOSAICIMAGEWCS_ 296 +set MOSAICIMAGEIRAF_ 297 +set MOSAICIMAGEWFPC2_ 298 +set RGBARRAY_ 299 +set RGBCUBE_ 300 +set SRGBCUBE_ 301 +set RGBIMAGE_ 302 +set WFPC2_ 303 +set IRAF_ 304 +set SHM_ 305 +set SHMCMD_ 306 diff --git a/ds9/parsers/shmparser.tcl b/ds9/parsers/shmparser.tcl new file mode 100644 index 0000000..5c7ae50 --- /dev/null +++ b/ds9/parsers/shmparser.tcl @@ -0,0 +1,3234 @@ +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 shm { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc shm::YYABORT {} { + return -code return 1 +} + +proc shm::YYACCEPT {} { + return -code return 0 +} + +proc shm::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc shm::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc shm::yyerror {s} { + puts stderr $s +} + +proc shm::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 shm::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set shm::table { + 9:283 shift + 21:289 shift + 21:300 shift + 21:290 shift + 102:306,target 55 + 102:296,target 55 + 21:291 shift + 21:301 shift + 117:301,target 36 + 117:291,target 36 + 92:288,target 43 + 21:302 shift + 21:292 shift + 6:260,target 31 + 6:259,target 30 + 21:293 shift + 21:294 shift + 2:284,target 54 + 21:305 shift + 21:295 shift + 114:298,target 55 + 21:306 shift + 21:296 shift + 74:285,target 92 + 21:297 shift + 21:298 shift + 21:310 goto + 21:299 shift + 21:311 goto + 95:0,target 55 + 21:312 goto + 41:287,target 14 + 71:293,target 32 + 112:300,target 40 + 112:290,target 40 + 112:289,target 40 + 91:0 reduce + 86:287,target 55 + 9:307 goto + 108:297,target 41 + 98:300,target 48 + 98:290,target 48 + 98:289,target 48 + 7:312,target 57 + 80:313,target 99 + 79:313,target 98 + 19:302,target 17 + 19:292,target 7 + 95:297,target 55 + 35:286,target 8 + 112:286 reduce + 106:288,target 47 + 9:268,target 39 + 112:287 reduce + 86:285 shift + 112:288 reduce + 86:286 reduce + 112:300 reduce + 112:290 reduce + 112:289 reduce + 86:287 reduce + 112:301 reduce + 112:291 reduce + 103:306,target 55 + 103:296,target 55 + 86:288 reduce + 6:276,target 47 + 118:301,target 52 + 118:291,target 52 + 112:302 reduce + 112:292 reduce + 93:288,target 56 + 86:300 reduce + 86:290 reduce + 86:289 reduce + 112:293 reduce + 86:301 reduce + 86:291 reduce + 112:294 reduce + 86:302 reduce + 86:292 reduce + 21:0 reduce + 56:286 shift + 112:305 reduce + 112:295 reduce + 86:293 reduce + 56:287 shift + 115:298,target 38 + 112:306 reduce + 112:296 reduce + 89:306,target 55 + 89:296,target 55 + 86:294 reduce + 112:297 reduce + 101:287,target 55 + 86:305 reduce + 86:295 reduce + 75:285,target 93 + 26:284 shift + 112:298 reduce + 86:306 reduce + 86:296 reduce + 112:299 reduce + 107:0 reduce + 86:297 reduce + 0:302,target 17 + 0:292,target 7 + 86:298 reduce + 86:299 reduce + 72:293,target 29 + 42:287,target 15 + 113:300,target 39 + 113:290,target 39 + 113:289,target 39 + 87:287,target 55 + 118:0,target 52 + 86:313 goto + 110:297,target 42 + 109:297,target 55 + 24:284,target 73 + 99:300,target 49 + 99:290,target 49 + 99:289,target 49 + 10:273,target 44 + 69:284,target 91 + 8:312,target 58 + 56:312 goto + 21:302,target 17 + 21:292,target 7 + 96:297,target 55 + 36:286,target 9 + 107:288,target 44 + 92:0,target 43 + 104:306,target 45 + 104:296,target 45 + 119:301,target 51 + 119:291,target 51 + 94:288,target 35 + 116:298,target 37 + 91:306,target 55 + 91:296,target 55 + 102:287,target 55 + 117:286 reduce + 117:287 reduce + 117:288 reduce + 92:286 reduce + 73:293,target 34 + 43:287,target 16 + 117:300 reduce + 117:290 reduce + 117:289 reduce + 114:300,target 55 + 114:290,target 55 + 114:289,target 55 + 92:287 reduce + 117:301 reduce + 117:291 reduce + 92:288 reduce + 117:302 reduce + 117:292 reduce + 92:300 reduce + 92:290 reduce + 92:289 reduce + 117:293 reduce + 92:301 reduce + 92:291 reduce + 117:294 reduce + 111:297,target 50 + 92:302 reduce + 92:292 reduce + 85:305,target 55 + 85:295,target 55 + 25:284,target 74 + 62:286 shift + 117:305 reduce + 117:295 reduce + 92:293 reduce + 62:287 shift + 117:306 reduce + 117:296 reduce + 92:294 reduce + 117:297 reduce + 92:305 reduce + 92:295 reduce + 117:298 reduce + 92:306 reduce + 92:296 reduce + 22:292,target 30 + 22:302,target 30 + 117:299 reduce + 97:297,target 55 + 92:297 reduce + 32:286 reduce + 37:286,target 10 + 108:288,target 41 + 92:298 reduce + 32:287 reduce + 92:299 reduce + 18:299,target 14 + 115:0,target 38 + 105:306,target 46 + 105:296,target 46 + 80:294,target 55 + 79:294,target 55 + 95:288,target 55 + 9:260,target 31 + 9:259,target 30 + 62:312 goto + 117:298,target 36 + 92:306,target 43 + 92:296,target 43 + 103:287,target 55 + 6:267,target 38 + 44:287,target 17 + 115:300,target 38 + 115:290,target 38 + 115:289,target 38 + 89:287,target 55 + 112:297,target 40 + 86:305,target 55 + 86:295,target 55 + 26:284,target 75 + 92:0 reduce + 23:292,target 31 + 23:302,target 31 + 98:297,target 48 + 38:286,target 11 + 110:288,target 42 + 109:288,target 55 + 97:285 shift + 97:286 reduce + 10:264,target 35 + 97:287 reduce + 19:299,target 14 + 97:288 reduce + 106:306,target 47 + 106:296,target 47 + 97:300 reduce + 97:290 reduce + 97:289 reduce + 9:276,target 47 + 67:284 shift + 97:301 reduce + 97:291 reduce + 96:288,target 55 + 97:302 reduce + 97:292 reduce + 97:293 reduce + 97:294 reduce + 118:298,target 52 + 97:305 reduce + 97:295 reduce + 93:306,target 56 + 93:296,target 56 + 104:287,target 45 + 97:306 reduce + 97:296 reduce + 97:297 reduce + 37:286 reduce + 97:298 reduce + 37:287 reduce + 97:299 reduce + 22:0 reduce + 101:305,target 55 + 101:295,target 55 + 75:293,target 55 + 45:287,target 18 + 116:300,target 37 + 116:290,target 37 + 116:289,target 37 + 91:287,target 55 + 112:0,target 40 + 97:313 goto + 0:310,target 22 + 0:309,target 21 + 0:299,target 14 + 108:0 reduce + 113:297,target 39 + 87:305,target 55 + 87:295,target 55 + 99:297,target 49 + 10:281,target 52 + 39:286,target 12 + 40:286,target 13 + 70:292,target 33 + 70:302,target 33 + 111:288,target 50 + 85:286,target 55 + 85:0,target 55 + 21:310,target 72 + 21:299,target 14 + 107:306,target 44 + 107:296,target 44 + 97:288,target 55 + 18:291,target 6 + 18:301,target 16 + 23:0,target 31 + 119:298,target 51 + 94:306,target 35 + 94:296,target 35 + 105:287,target 46 + 80:285,target 93 + 79:285,target 93 + 102:305,target 55 + 102:295,target 55 + 46:287,target 19 + 117:300,target 36 + 117:290,target 36 + 117:289,target 36 + 92:287,target 43 + 6:258,target 29 + 73:286 reduce + 114:297,target 55 + 73:287 reduce + 73:288 reduce + 73:300 reduce + 73:290 reduce + 73:289 reduce + 73:301 reduce + 73:291 reduce + 10:307,target 62 + 85:313,target 104 + 73:302 reduce + 73:292 reduce + 43:286 reduce + 73:293 reduce + 41:286,target 14 + 43:287 reduce + 71:292,target 32 + 71:302,target 32 + 112:288,target 40 + 86:286,target 55 + 73:294 reduce + 73:305 reduce + 73:295 reduce + 73:306 reduce + 73:296 reduce + 22:299,target 30 + 108:0,target 41 + 73:297 reduce + 13:286 shift + 108:306,target 41 + 108:296,target 41 + 73:298 reduce + 13:287 shift + 98:288,target 48 + 73:299 reduce + 2:284 reduce + 2:285 reduce + 19:291,target 6 + 19:301,target 16 + 95:306,target 55 + 95:296,target 55 + 106:287,target 47 + 81:285,target 100 + 9:267,target 38 + 103:305,target 55 + 103:295,target 55 + 6:275,target 46 + 47:287,target 20 + 118:300,target 52 + 118:290,target 52 + 118:289,target 52 + 93:287,target 56 + 13:312 goto + 115:297,target 38 + 89:305,target 55 + 89:295,target 55 + 101:286,target 55 + 20:0,target 0 + 0:291,target 6 + 0:301,target 16 + 86:313,target 105 + 72:302,target 29 + 72:292,target 29 + 42:286,target 15 + 113:288,target 39 + 87:286,target 55 + 93:0 reduce + 23:299,target 31 + 104:286 reduce + 78:284 shift + 110:306,target 42 + 110:296,target 42 + 109:306,target 55 + 109:296,target 55 + 104:287 reduce + 104:288 reduce + 99:288,target 49 + 10:272,target 43 + 104:300 reduce + 104:290 reduce + 104:289 reduce + 104:301 reduce + 104:291 reduce + 104:302 reduce + 104:292 reduce + 21:291,target 6 + 21:301,target 16 + 104:293 reduce + 96:306,target 55 + 96:296,target 55 + 107:287,target 44 + 104:294 reduce + 48:286 reduce + 104:305 reduce + 104:295 reduce + 48:287 reduce + 104:306 reduce + 104:296 reduce + 104:297 reduce + 104:305,target 45 + 104:298 reduce + 104:295,target 45 + 48:287,target 21 + 119:300,target 51 + 119:290,target 51 + 119:289,target 51 + 105:0,target 46 + 104:299 reduce + 94:287,target 35 + 18:286 shift + 18:287 shift + 18:288 shift + 101:313,target 115 + 18:289 shift + 18:300 shift + 18:290 shift + 116:297,target 37 + 91:305,target 55 + 91:295,target 55 + 18:291 shift + 18:301 shift + 23:0 reduce + 102:286,target 55 + 76:284,target 95 + 18:302 shift + 18:292 shift + 7:286 shift + 18:293 shift + 7:287 shift + 18:294 shift + 87:313,target 106 + 18:295 shift + 110:0 reduce + 109:0 reduce + 73:302,target 34 + 73:292,target 34 + 18:296 shift + 43:286,target 16 + 114:288,target 55 + 18:297 shift + 18:298 shift + 18:299 shift + 18:311 goto + 70:299,target 33 + 111:306,target 50 + 111:296,target 50 + 85:294,target 55 + 18:312 goto + 22:291,target 30 + 22:301,target 30 + 97:306,target 55 + 97:296,target 55 + 108:287,target 41 + 7:312 goto + 18:298,target 13 + 109:285 shift + 105:305,target 46 + 105:295,target 46 + 80:293,target 55 + 79:293,target 55 + 49:287,target 22 + 50:287,target 23 + 110:286 reduce + 109:286 reduce + 95:287,target 55 + 84:284 shift + 110:287 reduce + 109:287 reduce + 9:258,target 29 + 110:288 reduce + 109:288 reduce + 110:300 reduce + 110:290 reduce + 110:289 reduce + 109:300 reduce + 109:290 reduce + 109:289 reduce + 102:313,target 116 + 117:297,target 36 + 110:301 reduce + 110:291 reduce + 109:301 reduce + 109:291 reduce + 92:305,target 43 + 92:295,target 43 + 110:302 reduce + 110:292 reduce + 109:302 reduce + 109:292 reduce + 103:286,target 55 + 77:284,target 96 + 6:266,target 37 + 110:293 reduce + 109:293 reduce + 110:294 reduce + 109:294 reduce + 54:286 reduce + 110:305 reduce + 110:295 reduce + 109:305 reduce + 109:295 reduce + 54:287 reduce + 110:306 reduce + 110:296 reduce + 109:306 reduce + 109:296 reduce + 44:286,target 17 + 115:288,target 38 + 110:297 reduce + 109:297 reduce + 89:286,target 55 + 24:284 shift + 110:298 reduce + 109:298 reduce + 110:299 reduce + 109:299 reduce + 102:0,target 55 + 71:299,target 32 + 112:306,target 40 + 112:296,target 40 + 86:294,target 55 + 80:0 reduce + 79:0 reduce + 109:313 goto + 23:291,target 31 + 23:301,target 31 + 98:306,target 48 + 98:296,target 48 + 110:287,target 42 + 109:287,target 55 + 75:0,target 55 + 10:263,target 34 + 19:298,target 13 + 106:305,target 47 + 106:295,target 47 + 9:275,target 46 + 51:287,target 24 + 96:287,target 55 + 103:313,target 117 + 6:283,target 54 + 118:297,target 52 + 93:305,target 56 + 93:295,target 56 + 104:286,target 45 + 78:284,target 97 + 89:313,target 108 + 101:294,target 55 + 75:302,target 55 + 75:292,target 55 + 45:286,target 18 + 116:288,target 37 + 91:286,target 55 + 0:308,target 20 + 0:298,target 13 + 115:286 reduce + 90:284 shift + 115:287 reduce + 89:285 shift + 72:299,target 29 + 115:288 reduce + 113:306,target 39 + 113:296,target 39 + 89:286 reduce + 87:294,target 55 + 115:300 reduce + 115:290 reduce + 115:289 reduce + 89:287 reduce + 115:301 reduce + 115:291 reduce + 89:288 reduce + 115:302 reduce + 115:292 reduce + 89:300 reduce + 89:290 reduce + 89:289 reduce + 115:293 reduce + 94:0 reduce + 89:301 reduce + 89:291 reduce + 115:294 reduce + 99:306,target 49 + 99:296,target 49 + 89:302 reduce + 89:292 reduce + 10:279,target 50 + 10:280,target 51 + 59:286 shift + 60:286 shift + 70:291,target 33 + 70:301,target 33 + 115:305 reduce + 115:295 reduce + 111:287,target 50 + 89:293 reduce + 85:285,target 93 + 59:287 shift + 60:287 shift + 115:306 reduce + 115:296 reduce + 89:294 reduce + 115:297 reduce + 89:305 reduce + 89:295 reduce + 21:298,target 13 + 115:298 reduce + 89:306 reduce + 89:296 reduce + 115:299 reduce + 107:305,target 44 + 107:295,target 44 + 89:297 reduce + 29:286 reduce + 30:286 reduce + 52:287,target 25 + 97:287,target 55 + 89:298 reduce + 29:287 reduce + 30:287 reduce + 89:299 reduce + 18:289,target 4 + 18:300,target 15 + 18:290,target 5 + 119:297,target 51 + 94:305,target 35 + 94:295,target 35 + 89:313 goto + 105:286,target 46 + 91:313,target 110 + 59:312 goto + 60:312 goto + 72:0,target 29 + 102:294,target 55 + 46:286,target 19 + 117:288,target 36 + 92:286,target 43 + 6:257,target 28 + 73:299,target 34 + 114:306,target 55 + 114:296,target 55 + 111:0 reduce + 71:291,target 32 + 71:301,target 32 + 112:287,target 40 + 86:285,target 93 + 22:298,target 30 + 108:305,target 41 + 108:295,target 41 + 53:287,target 26 + 98:287,target 48 + 95:285 shift + 95:286 reduce + 95:287 reduce + 95:288 reduce + 19:289,target 4 + 19:300,target 15 + 19:290,target 5 + 95:305,target 55 + 95:300 reduce + 95:295,target 55 + 95:290 reduce + 95:289 reduce + 65:284 shift + 106:286,target 47 + 95:301 reduce + 95:291 reduce + 9:266,target 37 + 95:302 reduce + 95:292 reduce + 95:293 reduce + 95:294 reduce + 103:294,target 55 + 95:305 reduce + 95:295 reduce + 6:274,target 45 + 47:286,target 20 + 118:288,target 52 + 95:306 reduce + 95:296 reduce + 93:286,target 56 + 95:297 reduce + 35:286 reduce + 95:298 reduce + 35:287 reduce + 95:299 reduce + 115:306,target 38 + 115:296,target 38 + 89:294,target 55 + 101:285,target 93 + 99:0,target 49 + 95:313 goto + 0:289,target 4 + 0:300,target 15 + 0:290,target 5 + 72:301,target 29 + 72:291,target 29 + 113:287,target 39 + 87:285,target 93 + 23:298,target 31 + 110:305,target 42 + 110:295,target 42 + 109:305,target 55 + 109:295,target 55 + 54:287,target 27 + 99:287,target 49 + 10:271,target 42 + 9:283,target 54 + 21:289,target 4 + 21:300,target 15 + 21:290,target 5 + 96:305,target 55 + 96:295,target 55 + 107:286,target 44 + 82:284,target 101 + 104:294,target 45 + 48:286,target 21 + 119:288,target 51 + 94:286,target 35 + 75:299,target 55 + 116:306,target 37 + 116:296,target 37 + 91:294,target 55 + 102:285,target 93 + 71:286 reduce + 73:301,target 34 + 73:291,target 34 + 71:287 reduce + 114:287,target 55 + 88:285,target 107 + 71:288 reduce + 71:289 reduce + 71:290 reduce + 71:300 reduce + 71:291 reduce + 71:301 reduce + 41:286 reduce + 70:298,target 33 + 71:292 reduce + 71:302 reduce + 111:305,target 50 + 111:295,target 50 + 95:0 reduce + 85:293,target 55 + 41:287 reduce + 55:287,target 2 + 71:293 reduce + 71:294 reduce + 71:295 reduce + 71:305 reduce + 71:296 reduce + 71:306 reduce + 96:0,target 55 + 11:286 shift + 22:289,target 30 + 22:290,target 30 + 22:300,target 30 + 71:297 reduce + 97:305,target 55 + 97:295,target 55 + 11:287 shift + 71:298 reduce + 108:286,target 41 + 83:284,target 102 + 71:299 reduce + 18:297,target 12 + 105:294,target 46 + 80:302,target 55 + 80:292,target 55 + 79:302,target 55 + 79:292,target 55 + 0:286 shift + 49:286,target 22 + 50:286,target 23 + 95:286,target 55 + 0:287 shift + 9:257,target 28 + 0:288 shift + 0:289 shift + 0:300 shift + 0:290 shift + 0:291 shift + 0:301 shift + 117:306,target 36 + 117:296,target 36 + 92:294,target 43 + 0:302 shift + 0:292 shift + 103:285,target 93 + 6:265,target 36 + 0:293 shift + 0:294 shift + 0:305 shift + 0:295 shift + 11:312 goto + 0:306 shift + 0:296 shift + 0:297 shift + 115:287,target 38 + 89:285,target 93 + 0:308 goto + 0:298 shift + 112:0 reduce + 0:310 goto + 0:309 goto + 0:299 shift + 0:311 goto + 0:312 goto + 11:287,target 2 + 71:298,target 32 + 112:305,target 40 + 112:295,target 40 + 86:293,target 55 + 56:287,target 2 + 102:285 shift + 102:286 reduce + 76:284 shift + 23:289,target 31 + 23:290,target 31 + 23:300,target 31 + 102:287 reduce + 98:305,target 48 + 98:295,target 48 + 110:286,target 42 + 109:286,target 55 + 102:288 reduce + 84:284,target 103 + 119:0,target 51 + 102:300 reduce + 102:290 reduce + 102:289 reduce + 10:262,target 33 + 102:301 reduce + 102:291 reduce + 19:297,target 12 + 102:302 reduce + 102:292 reduce + 95:313,target 111 + 106:294,target 47 + 102:293 reduce + 9:274,target 45 + 51:286,target 24 + 102:294 reduce + 96:286,target 55 + 46:286 reduce + 102:305 reduce + 102:295 reduce + 46:287 reduce + 102:306 reduce + 102:296 reduce + 102:297 reduce + 6:282,target 53 + 118:306,target 52 + 118:296,target 52 + 102:298 reduce + 93:294,target 56 + 102:299 reduce + 93:0,target 56 + 16:286 shift + 16:287 shift + 102:313 goto + 101:293,target 55 + 75:301,target 55 + 75:291,target 55 + 116:287,target 37 + 91:285,target 93 + 5:286 shift + 0:297,target 12 + 5:287 shift + 72:298,target 29 + 12:287,target 2 + 113:305,target 39 + 113:295,target 39 + 87:293,target 55 + 109:313,target 118 + 99:305,target 49 + 99:295,target 49 + 10:278,target 49 + 16:312 goto + 70:289,target 33 + 70:290,target 33 + 70:300,target 33 + 111:286,target 50 + 21:297,target 12 + 96:313,target 112 + 107:294,target 44 + 52:286,target 25 + 97:286,target 55 + 5:312 goto + 18:288,target 3 + 119:306,target 51 + 119:296,target 51 + 94:294,target 35 + 107:286 reduce + 82:284 shift + 107:287 reduce + 107:288 reduce + 116:0,target 37 + 107:300 reduce + 107:290 reduce + 107:289 reduce + 107:301 reduce + 107:291 reduce + 102:293,target 55 + 117:287,target 36 + 107:302 reduce + 107:292 reduce + 107:293 reduce + 107:294 reduce + 52:286 reduce + 107:305 reduce + 107:295 reduce + 73:298,target 34 + 13:287,target 2 + 52:287 reduce + 114:305,target 55 + 114:295,target 55 + 107:306 reduce + 107:296 reduce + 107:297 reduce + 100:284,target 114 + 107:298 reduce + 107:299 reduce + 89:0,target 55 + 22:286 reduce + 22:287 reduce + 22:288 reduce + 71:289,target 32 + 71:290,target 32 + 71:300,target 32 + 112:286,target 40 + 96:0 reduce + 22:289 reduce + 22:290 reduce + 22:300 reduce + 22:291 reduce + 22:301 reduce + 22:292 reduce + 22:297,target 30 + 22:302 reduce + 97:313,target 113 + 22:293 reduce + 108:294,target 41 + 22:294 reduce + 53:286,target 26 + 98:286,target 48 + 22:295 reduce + 22:305 reduce + 22:296 reduce + 22:306 reduce + 22:297 reduce + 80:299,target 55 + 79:299,target 55 + 19:288,target 3 + 22:298 reduce + 95:294,target 55 + 22:299 reduce + 9:265,target 36 + 103:293,target 55 + 6:273,target 44 + 118:287,target 52 + 14:287,target 2 + 115:305,target 38 + 115:295,target 38 + 89:293,target 55 + 59:287,target 2 + 60:287,target 2 + 113:286 reduce + 113:0 reduce + 0:288,target 3 + 113:287 reduce + 87:285 shift + 113:288 reduce + 87:286 reduce + 72:300,target 29 + 72:290,target 29 + 72:289,target 29 + 113:300 reduce + 113:290 reduce + 113:289 reduce + 113:286,target 39 + 113:0,target 39 + 87:287 reduce + 113:301 reduce + 113:291 reduce + 87:288 reduce + 113:302 reduce + 113:292 reduce + 87:300 reduce + 87:290 reduce + 87:289 reduce + 23:297,target 31 + 57:284 shift + 113:293 reduce + 87:301 reduce + 87:291 reduce + 113:294 reduce + 110:294,target 42 + 109:294,target 55 + 87:302 reduce + 87:292 reduce + 54:286,target 27 + 113:305 reduce + 113:295 reduce + 99:286,target 49 + 87:293 reduce + 10:269,target 40 + 10:270,target 41 + 113:306 reduce + 113:296 reduce + 87:294 reduce + 113:297 reduce + 87:305 reduce + 87:295 reduce + 113:298 reduce + 87:306 reduce + 87:296 reduce + 9:282,target 53 + 21:288,target 3 + 27:285 shift + 113:299 reduce + 96:294,target 55 + 87:297 reduce + 86:0,target 55 + 87:298 reduce + 87:299 reduce + 104:293,target 45 + 87:313 goto + 119:287,target 51 + 75:298,target 55 + 15:287,target 2 + 116:305,target 37 + 116:295,target 37 + 91:293,target 55 + 61:287,target 2 + 73:300,target 34 + 73:290,target 34 + 73:289,target 34 + 114:286,target 55 + 70:297,target 33 + 111:294,target 50 + 85:302,target 55 + 85:292,target 55 + 55:286,target 1 + 22:288,target 30 + 118:286 reduce + 97:294,target 55 + 118:287 reduce + 118:288 reduce + 93:286 reduce + 118:300 reduce + 118:290 reduce + 118:289 reduce + 110:0,target 42 + 109:0,target 55 + 93:287 reduce + 18:296,target 11 + 118:301 reduce + 118:291 reduce + 93:288 reduce + 118:302 reduce + 118:292 reduce + 105:293,target 46 + 93:300 reduce + 93:290 reduce + 93:289 reduce + 80:301,target 55 + 80:291,target 55 + 79:301,target 55 + 79:291,target 55 + 63:284 shift + 118:293 reduce + 95:285,target 93 + 93:301 reduce + 93:291 reduce + 118:294 reduce + 93:302 reduce + 93:292 reduce + 118:305 reduce + 118:295 reduce + 93:293 reduce + 118:306 reduce + 118:296 reduce + 93:294 reduce + 16:287,target 2 + 118:297 reduce + 117:305,target 36 + 117:295,target 36 + 93:305 reduce + 93:295 reduce + 92:293,target 43 + 62:287,target 2 + 118:298 reduce + 93:306 reduce + 93:296 reduce + 6:264,target 35 + 118:299 reduce + 93:297 reduce + 33:286 reduce + 93:298 reduce + 33:287 reduce + 114:313,target 119 + 93:299 reduce + 115:286,target 38 + 90:284,target 109 + 11:286,target 1 + 71:297,target 32 + 112:294,target 40 + 86:302,target 55 + 86:292,target 55 + 21:0,target 28 + 56:286,target 1 + 97:0 reduce + 23:288,target 31 + 98:294,target 48 + 109:285,target 93 + 10:261,target 32 + 19:296,target 11 + 106:293,target 47 + 9:273,target 44 + 96:285,target 93 + 6:281,target 52 + 17:287,target 2 + 118:305,target 52 + 118:295,target 52 + 93:293,target 56 + 98:286 reduce + 106:0,target 47 + 101:302,target 55 + 101:292,target 55 + 98:287 reduce + 75:300,target 55 + 75:290,target 55 + 75:289,target 55 + 116:286,target 37 + 98:288 reduce + 98:300 reduce + 98:290 reduce + 98:289 reduce + 0:306,target 19 + 0:296,target 11 + 98:301 reduce + 98:291 reduce + 68:285 shift + 114:0 reduce + 98:302 reduce + 98:292 reduce + 72:297,target 29 + 12:286,target 1 + 113:294,target 39 + 98:293 reduce + 87:302,target 55 + 87:292,target 55 + 70:0 reduce + 98:294 reduce + 98:305 reduce + 98:295 reduce + 98:306 reduce + 98:296 reduce + 98:297 reduce + 80:0,target 55 + 79:0,target 55 + 38:286 reduce + 99:294,target 49 + 98:298 reduce + 10:277,target 48 + 38:287 reduce + 70:288,target 33 + 98:299 reduce + 21:306,target 19 + 21:296,target 11 + 107:293,target 44 + 97:285,target 93 + 6:307,target 56 + 18:287,target 2 + 119:305,target 51 + 119:295,target 51 + 94:293,target 35 + 102:302,target 55 + 102:292,target 55 + 117:286,target 36 + 73:297,target 34 + 13:286,target 1 + 114:294,target 55 + 10:304,target 61 + 85:299,target 55 + 71:288,target 32 + 103:0,target 55 + 100:284 shift + 22:296,target 30 + 22:306,target 30 + 108:293,target 41 + 74:285 shift + 80:298,target 55 + 79:298,target 55 + 19:287,target 2 + 95:293,target 55 + 9:264,target 35 + 44:286 reduce + 44:287 reduce + 103:302,target 55 + 103:292,target 55 + 6:272,target 43 + 118:286,target 52 + 14:286 shift + 14:287 shift + 14:286,target 1 + 115:294,target 38 + 89:302,target 55 + 89:292,target 55 + 59:286,target 1 + 60:286,target 1 + 101:0 reduce + 3:286 shift + 3:287 shift + 0:287,target 2 + 86:299,target 55 + 72:288,target 29 + 98:0 reduce + 23:296,target 31 + 23:306,target 31 + 110:293,target 42 + 109:293,target 55 + 14:312 goto + 10:268,target 39 + 9:281,target 52 + 21:287,target 2 + 96:293,target 55 + 3:312 goto + 104:302,target 45 + 104:292,target 45 + 119:286,target 51 + 105:286 reduce + 105:287 reduce + 80:285 shift + 79:285 shift + 105:288 reduce + 80:286 reduce + 79:286 reduce + 105:300 reduce + 105:290 reduce + 105:289 reduce + 101:299,target 55 + 80:287 reduce + 79:287 reduce + 75:297,target 55 + 15:286,target 1 + 116:294,target 37 + 105:301 reduce + 105:291 reduce + 91:302,target 55 + 91:292,target 55 + 80:288 reduce + 79:288 reduce + 61:286,target 1 + 105:302 reduce + 105:292 reduce + 80:300 reduce + 80:290 reduce + 80:289 reduce + 79:300 reduce + 79:290 reduce + 79:289 reduce + 105:293 reduce + 80:301 reduce + 80:291 reduce + 79:301 reduce + 79:291 reduce + 105:294 reduce + 80:302 reduce + 80:292 reduce + 79:302 reduce + 79:292 reduce + 73:0,target 34 + 49:286 reduce + 50:286 reduce + 105:305 reduce + 105:295 reduce + 87:299,target 55 + 80:293 reduce + 79:293 reduce + 49:287 reduce + 50:287 reduce + 115:0 reduce + 105:306 reduce + 105:296 reduce + 80:294 reduce + 79:294 reduce + 73:288,target 34 + 114:285,target 93 + 105:297 reduce + 80:305 reduce + 80:295 reduce + 79:305 reduce + 79:295 reduce + 71:0 reduce + 105:298 reduce + 80:306 reduce + 80:296 reduce + 79:306 reduce + 79:296 reduce + 105:299 reduce + 80:297 reduce + 79:297 reduce + 19:286 shift + 80:298 reduce + 79:298 reduce + 19:287 shift + 70:296,target 33 + 70:306,target 33 + 111:293,target 50 + 85:301,target 55 + 85:291,target 55 + 80:299 reduce + 79:299 reduce + 19:288 shift + 19:289 shift + 19:300 shift + 19:290 shift + 9:307,target 59 + 19:291 shift + 19:301 shift + 80:313 goto + 79:313 goto + 19:302 shift + 19:292 shift + 8:286 shift + 19:293 shift + 22:287,target 30 + 97:293,target 55 + 8:287 shift + 19:294 shift + 19:295 shift + 19:296 shift + 18:295,target 10 + 19:297 shift + 19:298 shift + 105:302,target 46 + 105:292,target 46 + 80:300,target 55 + 80:290,target 55 + 80:289,target 55 + 79:300,target 55 + 79:290,target 55 + 79:289,target 55 + 19:299 shift + 19:311 goto + 19:312 goto + 102:299,target 55 + 16:286,target 1 + 117:294,target 36 + 92:302,target 43 + 92:292,target 43 + 62:286,target 1 + 6:263,target 34 + 8:312 goto + 111:286 reduce + 55:312,target 77 + 111:287 reduce + 85:285 shift + 71:296,target 32 + 71:306,target 32 + 112:293,target 40 + 111:288 reduce + 86:301,target 55 + 86:291,target 55 + 85:286 reduce + 85:0 reduce + 111:300 reduce + 111:290 reduce + 111:289 reduce + 85:287 reduce + 111:301 reduce + 111:291 reduce + 85:288 reduce + 111:302 reduce + 111:292 reduce + 85:300 reduce + 85:290 reduce + 85:289 reduce + 111:293 reduce + 85:301 reduce + 85:291 reduce + 23:287,target 31 + 111:294 reduce + 98:293,target 48 + 85:302 reduce + 85:292 reduce + 55:286 shift + 70:0,target 33 + 111:305 reduce + 111:295 reduce + 85:293 reduce + 55:287 shift + 111:306 reduce + 111:296 reduce + 85:294 reduce + 10:259,target 30 + 10:260,target 31 + 111:297 reduce + 85:305 reduce + 85:295 reduce + 19:295,target 10 + 25:284 shift + 111:298 reduce + 85:306 reduce + 85:296 reduce + 111:299 reduce + 106:302,target 47 + 106:292,target 47 + 85:297 reduce + 9:272,target 43 + 85:298 reduce + 85:299 reduce + 103:299,target 55 + 6:280,target 51 + 6:279,target 50 + 17:286,target 1 + 118:294,target 52 + 93:302,target 56 + 93:292,target 56 + 85:313 goto + 3:287,target 2 + 89:299,target 55 + 55:312 goto + 101:301,target 55 + 101:291,target 55 + 75:288,target 55 + 102:0 reduce + 0:305,target 18 + 0:295,target 10 + 11:312,target 63 + 56:312,target 78 + 72:306,target 29 + 72:296,target 29 + 113:293,target 39 + 87:301,target 55 + 87:291,target 55 + 99:0 reduce + 99:293,target 49 + 10:276,target 47 + 70:287,target 33 + 21:305,target 18 + 21:295,target 10 + 116:286 reduce + 107:302,target 44 + 107:292,target 44 + 116:287 reduce + 91:285 shift + 116:288 reduce + 91:286 reduce + 116:300 reduce + 116:290 reduce + 116:289 reduce + 97:0,target 55 + 91:287 reduce + 116:301 reduce + 116:291 reduce + 104:299,target 45 + 91:288 reduce + 18:286,target 1 + 119:294,target 51 + 116:302 reduce + 116:292 reduce + 94:302,target 35 + 94:292,target 35 + 91:300 reduce + 91:290 reduce + 91:289 reduce + 116:293 reduce + 91:301 reduce + 91:291 reduce + 116:294 reduce + 91:302 reduce + 91:292 reduce + 61:286 shift + 116:305 reduce + 116:295 reduce + 91:293 reduce + 4:287,target 2 + 61:287 shift + 116:306 reduce + 116:296 reduce + 91:299,target 55 + 91:294 reduce + 116:297 reduce + 102:301,target 55 + 102:291,target 55 + 91:305 reduce + 91:295 reduce + 116:298 reduce + 91:306 reduce + 91:296 reduce + 116:299 reduce + 91:297 reduce + 12:312,target 64 + 31:286 reduce + 91:298 reduce + 31:287 reduce + 91:299 reduce + 73:306,target 34 + 73:296,target 34 + 114:293,target 55 + 116:0 reduce + 91:313 goto + 72:0 reduce + 10:303,target 60 + 85:298,target 55 + 71:287,target 32 + 61:312 goto + 22:295,target 30 + 22:305,target 30 + 108:302,target 41 + 108:292,target 41 + 105:299,target 46 + 80:297,target 55 + 79:297,target 55 + 19:286,target 1 + 95:302,target 55 + 95:292,target 55 + 9:263,target 34 + 5:287,target 2 + 92:299,target 43 + 103:301,target 55 + 103:291,target 55 + 6:271,target 42 + 13:312,target 65 + 96:285 shift + 96:286 reduce + 115:293,target 38 + 96:287 reduce + 94:0,target 35 + 89:301,target 55 + 89:291,target 55 + 96:288 reduce + 96:300 reduce + 96:290 reduce + 96:289 reduce + 66:284 shift + 96:301 reduce + 96:291 reduce + 0:286,target 1 + 96:302 reduce + 96:292 reduce + 86:298,target 55 + 96:293 reduce + 72:287,target 29 + 96:294 reduce + 86:0 reduce + 96:305 reduce + 96:295 reduce + 96:306 reduce + 96:296 reduce + 23:295,target 31 + 23:305,target 31 + 96:297 reduce + 36:286 reduce + 110:302,target 42 + 110:292,target 42 + 109:302,target 55 + 109:292,target 55 + 96:298 reduce + 36:287 reduce + 96:299 reduce + 10:267,target 38 + 106:299,target 47 + 96:313 goto + 9:279,target 50 + 9:280,target 51 + 21:286,target 1 + 96:302,target 55 + 96:292,target 55 + 93:299,target 56 + 104:301,target 45 + 104:291,target 45 + 14:312,target 66 + 59:312,target 81 + 60:312,target 82 + 101:298,target 55 + 75:306,target 55 + 75:296,target 55 + 116:293,target 37 + 91:301,target 55 + 91:291,target 55 + 117:0,target 36 + 103:0 reduce + 87:298,target 55 + 73:287,target 34 + 70:295,target 33 + 70:305,target 33 + 111:302,target 50 + 111:292,target 50 + 85:300,target 55 + 85:290,target 55 + 85:289,target 55 + 91:0,target 55 + 107:299,target 44 + 22:286,target 30 + 97:302,target 55 + 97:292,target 55 + 72:286 reduce + 72:287 reduce + 7:287,target 2 + 18:294,target 9 + 72:288 reduce + 94:299,target 35 + 72:300 reduce + 72:289 reduce + 72:290 reduce + 105:301,target 46 + 105:291,target 46 + 80:288,target 55 + 79:288,target 55 + 72:301 reduce + 72:291 reduce + 72:302 reduce + 72:292 reduce + 42:286 reduce + 72:293 reduce + 15:312,target 67 + 42:287 reduce + 72:294 reduce + 61:312,target 83 + 102:298,target 55 + 72:305 reduce + 72:295 reduce + 117:293,target 36 + 92:301,target 43 + 92:291,target 43 + 72:306 reduce + 72:296 reduce + 72:297 reduce + 6:262,target 33 + 12:286 shift + 72:298 reduce + 12:287 shift + 72:299 reduce + 28:287,target 1 + 1:284 reduce + 1:285 reduce + 117:0 reduce + 73:0 reduce + 71:295,target 32 + 71:305,target 32 + 112:302,target 40 + 112:292,target 40 + 86:300,target 55 + 86:290,target 55 + 86:289,target 55 + 108:299,target 41 + 23:286,target 31 + 114:0,target 55 + 98:302,target 48 + 98:292,target 48 + 12:312 goto + 10:258,target 29 + 8:287,target 2 + 6:257 shift + 19:294,target 9 + 95:299,target 55 + 6:258 shift + 106:301,target 47 + 106:291,target 47 + 9:271,target 42 + 6:260 shift + 6:259 shift + 6:261 shift + 6:262 shift + 16:312,target 68 + 6:263 shift + 62:312,target 84 + 103:298,target 55 + 87:0,target 55 + 6:278,target 49 + 6:264 shift + 118:293,target 52 + 103:285 shift + 93:301,target 56 + 93:291,target 56 + 6:265 shift + 103:286 reduce + 77:284 shift + 6:266 shift + 103:287 reduce + 6:267 shift + 103:288 reduce + 6:268 shift + 3:286,target 1 + 103:300 reduce + 103:290 reduce + 103:289 reduce + 89:298,target 55 + 6:270 shift + 6:269 shift + 29:287,target 2 + 30:287,target 3 + 103:301 reduce + 103:291 reduce + 101:300,target 55 + 101:290,target 55 + 101:289,target 55 + 75:287,target 55 + 6:271 shift + 103:302 reduce + 103:292 reduce + 6:272 shift + 103:293 reduce + 6:273 shift + 0:294,target 9 + 103:294 reduce + 6:274 shift + 47:286 reduce + 103:305 reduce + 103:295 reduce + 72:305,target 29 + 72:295,target 29 + 6:275 shift + 47:287 reduce + 113:302,target 39 + 113:292,target 39 + 103:306 reduce + 103:296 reduce + 87:300,target 55 + 87:290,target 55 + 87:289,target 55 + 6:276 shift + 57:284,target 79 + 103:297 reduce + 6:277 shift + 103:298 reduce + 87:0 reduce + 6:278 shift + 103:299 reduce + 6:280 shift + 6:279 shift + 17:286 shift + 110:299,target 42 + 109:299,target 55 + 6:281 shift + 17:287 shift + 99:302,target 49 + 99:292,target 49 + 6:282 shift + 10:275,target 46 + 70:286,target 33 + 103:313 goto + 6:283 shift + 21:294,target 9 + 96:299,target 55 + 107:301,target 44 + 107:291,target 44 + 17:312,target 69 + 104:298,target 45 + 119:293,target 51 + 94:301,target 35 + 94:291,target 35 + 6:304 shift + 111:0,target 50 + 17:312 goto + 4:286,target 1 + 91:298,target 55 + 6:307 goto + 31:287,target 4 + 102:300,target 55 + 102:290,target 55 + 102:289,target 55 + 104:0 reduce + 73:305,target 34 + 73:295,target 34 + 114:302,target 55 + 114:292,target 55 + 58:284,target 80 + 108:286 reduce + 83:284 shift + 111:299,target 50 + 108:287 reduce + 85:297,target 55 + 108:288 reduce + 71:286,target 32 + 108:300 reduce + 108:290 reduce + 108:289 reduce + 108:301 reduce + 108:291 reduce + 108:302 reduce + 108:292 reduce + 22:294,target 30 + 108:293 reduce + 97:299,target 55 + 22:0,target 30 + 108:301,target 41 + 108:294 reduce + 108:291,target 41 + 53:286 reduce + 108:305 reduce + 108:295 reduce + 53:287 reduce + 108:306 reduce + 108:296 reduce + 18:312,target 24 + 108:297 reduce + 108:298 reduce + 105:298,target 46 + 80:306,target 55 + 80:296,target 55 + 79:306,target 55 + 79:296,target 55 + 108:299 reduce + 95:301,target 55 + 95:291,target 55 + 23:286 reduce + 9:262,target 33 + 23:287 reduce + 23:288 reduce + 5:286,target 1 + 23:289 reduce + 23:290 reduce + 23:300 reduce + 92:298,target 43 + 23:291 reduce + 23:301 reduce + 32:287,target 5 + 103:300,target 55 + 103:290,target 55 + 103:289,target 55 + 6:270,target 41 + 6:269,target 40 + 23:292 reduce + 23:302 reduce + 23:293 reduce + 23:294 reduce + 23:295 reduce + 23:305 reduce + 23:296 reduce + 23:306 reduce + 115:302,target 38 + 115:292,target 38 + 89:300,target 55 + 89:290,target 55 + 89:289,target 55 + 23:297 reduce + 23:298 reduce + 23:299 reduce + 118:0 reduce + 112:299,target 40 + 107:0,target 44 + 86:297,target 55 + 72:286,target 29 + 23:294,target 31 + 98:299,target 48 + 110:301,target 42 + 110:291,target 42 + 109:301,target 55 + 109:291,target 55 + 10:266,target 37 + 19:312,target 24 + 114:285 shift + 106:298,target 47 + 9:278,target 49 + 114:286 reduce + 96:301,target 55 + 96:291,target 55 + 114:287 reduce + 88:285 shift + 114:288 reduce + 114:300 reduce + 114:290 reduce + 114:289 reduce + 114:301 reduce + 114:291 reduce + 93:298,target 56 + 33:287,target 6 + 114:302 reduce + 114:292 reduce + 104:300,target 45 + 104:290,target 45 + 104:289,target 45 + 58:284 shift + 114:293 reduce + 114:294 reduce + 114:305 reduce + 114:295 reduce + 114:306 reduce + 114:296 reduce + 101:297,target 55 + 75:305,target 55 + 75:295,target 55 + 116:302,target 37 + 116:292,target 37 + 114:297 reduce + 91:300,target 55 + 91:290,target 55 + 91:289,target 55 + 114:298 reduce + 0:312,target 24 + 114:299 reduce + 28:286 reduce + 1:285,target 53 + 28:287 reduce + 113:299,target 39 + 87:297,target 55 + 114:313 goto + 73:286,target 34 + 99:299,target 49 + 10:283,target 54 + 70:294,target 33 + 111:301,target 50 + 111:291,target 50 + 85:288,target 55 + 21:312,target 24 + 107:298,target 44 + 97:301,target 55 + 97:291,target 55 + 104:0,target 45 + 7:286,target 1 + 18:293,target 8 + 94:298,target 35 + 34:287,target 7 + 105:300,target 46 + 105:290,target 46 + 105:289,target 46 + 80:287,target 55 + 79:287,target 55 + 102:297,target 55 + 117:302,target 36 + 117:292,target 36 + 92:300,target 43 + 92:290,target 43 + 92:289,target 43 + 6:261,target 32 + 119:286 reduce + 119:287 reduce + 2:285,target 54 + 119:288 reduce + 114:299,target 55 + 94:286 reduce + 28:286,target 1 + 119:300 reduce + 119:290 reduce + 119:289 reduce + 105:0 reduce + 94:287 reduce + 119:301 reduce + 119:291 reduce + 94:288 reduce + 119:302 reduce + 119:292 reduce + 94:300 reduce + 94:290 reduce + 94:289 reduce + 64:284 shift + 119:293 reduce + 94:301 reduce + 94:291 reduce + 119:294 reduce + 94:302 reduce + 94:292 reduce + 71:294,target 32 + 119:305 reduce + 119:295 reduce + 112:301,target 40 + 112:291,target 40 + 94:293 reduce + 86:288,target 55 + 119:306 reduce + 119:296 reduce + 94:294 reduce + 119:297 reduce + 94:305 reduce + 94:295 reduce + 119:298 reduce + 94:306 reduce + 94:296 reduce + 119:299 reduce + 108:298,target 41 + 94:297 reduce + 34:286 reduce + 98:301,target 48 + 98:291,target 48 + 94:298 reduce + 34:287 reduce + 68:285,target 90 + 94:299 reduce + 10:257,target 28 + 8:286,target 1 + 19:293,target 8 + 95:298,target 55 + 35:287,target 8 + 106:300,target 47 + 106:290,target 47 + 106:289,target 47 + 9:270,target 41 + 9:269,target 40 + 103:297,target 55 + 6:277,target 48 + 118:302,target 52 + 118:292,target 52 + 93:300,target 56 + 93:290,target 56 + 93:289,target 56 + 63:284,target 85 + 101:0,target 55 + 115:299,target 38 + 89:297,target 55 + 29:286,target 2 + 30:286,target 3 + 101:288,target 55 + 75:286,target 55 + 10:257 shift + 10:258 shift + 0:293,target 8 + 10:259 shift + 10:260 shift + 10:261 shift + 119:0 reduce + 72:294,target 29 + 10:262 shift + 113:301,target 39 + 113:291,target 39 + 87:288,target 55 + 75:0 reduce + 10:263 shift + 10:264 shift + 10:265 shift + 10:266 shift + 110:298,target 42 + 109:298,target 55 + 10:267 shift + 99:301,target 49 + 99:291,target 49 + 10:268 shift + 10:274,target 45 + 99:286 reduce + 10:269 shift + 10:270 shift + 99:287 reduce + 10:271 shift + 99:288 reduce + 10:272 shift + 21:293,target 8 + 99:300 reduce + 99:290 reduce + 99:289 reduce + 96:298,target 55 + 10:273 shift + 36:287,target 9 + 69:284 shift + 107:300,target 44 + 107:290,target 44 + 107:289,target 44 + 99:301 reduce + 99:291 reduce + 10:274 shift + 99:302 reduce + 99:292 reduce + 10:275 shift + 70:286 reduce + 99:293 reduce + 6:304,target 55 + 10:276 shift + 70:287 reduce + 99:294 reduce + 10:277 shift + 70:288 reduce + 104:297,target 45 + 99:305 reduce + 99:295 reduce + 10:278 shift + 70:289 reduce + 70:290 reduce + 70:300 reduce + 119:302,target 51 + 119:292,target 51 + 99:306 reduce + 99:296 reduce + 94:300,target 35 + 94:290,target 35 + 94:289,target 35 + 10:279 shift + 10:280 shift + 64:284,target 86 + 70:291 reduce + 70:301 reduce + 99:297 reduce + 3:312,target 25 + 10:281 shift + 39:286 reduce + 40:286 reduce + 70:292 reduce + 70:302 reduce + 99:298 reduce + 10:282 shift + 39:287 reduce + 40:287 reduce + 70:293 reduce + 99:299 reduce + 75:313,target 94 + 10:283 shift + 70:294 reduce + 116:299,target 37 + 91:297,target 55 + 31:286,target 4 + 70:295 reduce + 70:305 reduce + 102:288,target 55 + 70:296 reduce + 70:306 reduce + 70:297 reduce + 70:298 reduce + 70:299 reduce + 73:294,target 34 + 114:301,target 55 + 114:291,target 55 + 10:303 shift + 10:304 shift + 111:298,target 50 + 89:0 reduce + 85:306,target 55 + 85:296,target 55 + 10:307 goto + 22:293,target 30 + 97:298,target 55 + 37:287,target 10 + 108:300,target 41 + 108:290,target 41 + 108:289,target 41 + 18:311,target 70 + 105:297,target 46 + 80:305,target 55 + 80:295,target 55 + 79:305,target 55 + 79:295,target 55 + 71:0,target 32 + 95:300,target 55 + 95:290,target 55 + 95:289,target 55 + 65:284,target 87 + 9:261,target 32 + 4:312,target 26 + 117:299,target 36 + 92:297,target 43 + 32:286,target 5 + 103:288,target 55 + 101:285 shift + 6:268,target 39 + 101:286 reduce + 20:0 accept + 101:287 reduce + 75:285 shift + 101:288 reduce + 75:286 reduce + 101:300 reduce + 101:290 reduce + 101:289 reduce + 75:287 reduce + 115:301,target 38 + 115:291,target 38 + 101:301 reduce + 101:291 reduce + 89:288,target 55 + 75:288 reduce + 106:0 reduce + 101:302 reduce + 101:292 reduce + 75:300 reduce + 75:290 reduce + 75:289 reduce + 101:293 reduce + 75:301 reduce + 75:291 reduce + 101:294 reduce + 75:302 reduce + 75:292 reduce + 45:286 reduce + 112:298,target 40 + 101:305 reduce + 101:295 reduce + 86:306,target 55 + 86:296,target 55 + 75:293 reduce + 45:287 reduce + 101:306 reduce + 101:296 reduce + 75:294 reduce + 101:297 reduce + 75:305 reduce + 75:295 reduce + 101:298 reduce + 75:306 reduce + 75:296 reduce + 101:299 reduce + 75:297 reduce + 15:286 shift + 23:293,target 31 + 98:298,target 48 + 75:298 reduce + 15:287 shift + 38:287,target 11 + 110:300,target 42 + 110:290,target 42 + 110:289,target 42 + 109:300,target 55 + 109:290,target 55 + 109:289,target 55 + 75:299 reduce + 101:313 goto + 10:265,target 36 + 19:311,target 71 + 75:313 goto + 106:297,target 47 + 9:277,target 48 + 4:286 shift + 96:300,target 55 + 96:290,target 55 + 96:289,target 55 + 4:287 shift + 66:284,target 88 + 5:312,target 27 + 118:299,target 52 + 93:297,target 56 + 33:286,target 6 + 104:288,target 45 + 98:0,target 48 + 15:312 goto + 101:306,target 55 + 101:296,target 55 + 75:294,target 55 + 116:301,target 37 + 116:291,target 37 + 91:288,target 55 + 9:257 shift + 9:258 shift + 0:311,target 23 + 9:260 shift + 9:259 shift + 9:261 shift + 4:312 goto + 1:284,target 53 + 113:298,target 39 + 87:306,target 55 + 87:296,target 55 + 9:262 shift + 27:285,target 76 + 9:263 shift + 9:264 shift + 9:265 shift + 106:286 reduce + 9:266 shift + 106:287 reduce + 99:298,target 49 + 81:285 shift + 9:267 shift + 10:282,target 53 + 39:287,target 12 + 40:287,target 13 + 70:293,target 33 + 111:300,target 50 + 111:290,target 50 + 111:289,target 50 + 106:288 reduce + 85:287,target 55 + 9:268 shift + 106:300 reduce + 106:290 reduce + 106:289 reduce + 9:270 shift + 9:269 shift + 106:301 reduce + 106:291 reduce + 9:271 shift + 21:311,target 23 + 106:302 reduce + 106:292 reduce + 9:272 shift + 107:297,target 44 + 106:293 reduce + 9:273 shift + 106:294 reduce + 97:300,target 55 + 97:290,target 55 + 97:289,target 55 + 9:274 shift + 51:286 reduce + 67:284,target 89 + 106:305 reduce + 106:295 reduce + 9:275 shift + 51:287 reduce + 106:306 reduce + 106:296 reduce + 9:276 shift + 106:297 reduce + 9:277 shift + 18:302,target 17 + 18:292,target 7 + 119:299,target 51 + 106:298 reduce + 94:297,target 35 + 9:278 shift + 34:286,target 7 + 106:299 reduce + 105:288,target 46 + 80:286,target 55 + 79:286,target 55 + 9:279 shift + 9:280 shift + 21:286 shift + 9:281 shift + 21:287 shift + 9:282 shift + 21:288 shift +} + +array set shm::rules { + 9,l 307 + 11,l 307 + 32,l 310 + 53,l 312 + 6,l 307 + 28,l 308 + 50,l 311 + 49,l 311 + 3,l 307 + 25,l 307 + 46,l 311 + 0,l 314 + 22,l 307 + 43,l 311 + 18,l 307 + 40,l 311 + 39,l 311 + 15,l 307 + 36,l 311 + 12,l 307 + 33,l 310 + 54,l 312 + 7,l 307 + 29,l 309 + 30,l 309 + 51,l 311 + 4,l 307 + 26,l 307 + 47,l 311 + 1,l 307 + 23,l 307 + 44,l 311 + 19,l 307 + 20,l 307 + 41,l 311 + 16,l 307 + 37,l 311 + 13,l 307 + 34,l 311 + 55,l 313 + 8,l 307 + 10,l 307 + 31,l 310 + 52,l 311 + 5,l 307 + 27,l 307 + 48,l 311 + 2,l 307 + 24,l 307 + 45,l 311 + 21,l 307 + 42,l 311 + 17,l 307 + 38,l 311 + 14,l 307 + 35,l 311 + 56,l 313 +} + +array set shm::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 4 + 55,dc 0 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 47,dc 4 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 5 + 39,dc 5 + 54,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 1 + 46,dc 4 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 5 + 53,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 4 + 23,dc 1 + 0,dc 1 + 37,dc 5 + 52,dc 5 + 15,dc 1 + 29,dc 2 + 30,dc 1 + 6,dc 1 + 44,dc 4 + 22,dc 1 + 36,dc 5 + 51,dc 6 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 4 + 21,dc 1 + 35,dc 4 + 50,dc 5 + 49,dc 4 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 4 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 2 + 48,dc 4 +} + +array set shm::rules { + 41,line 145 + 7,line 102 + 37,line 141 + 4,line 99 + 34,line 138 + 1,line 96 + 31,line 133 + 27,line 122 + 24,line 119 + 21,line 116 + 17,line 112 + 14,line 109 + 11,line 106 + 56,line 168 + 53,line 163 + 50,line 158 + 49,line 157 + 46,line 152 + 43,line 147 + 9,line 104 + 40,line 144 + 39,line 143 + 6,line 101 + 36,line 140 + 3,line 98 + 33,line 135 + 29,line 129 + 30,line 130 + 26,line 121 + 23,line 118 + 19,line 114 + 20,line 115 + 16,line 111 + 13,line 108 + 10,line 105 + 55,line 167 + 52,line 160 + 48,line 154 + 45,line 151 + 42,line 146 + 8,line 103 + 38,line 142 + 5,line 100 + 35,line 139 + 2,line 97 + 32,line 134 + 28,line 126 + 25,line 120 + 22,line 117 + 18,line 113 + 15,line 110 + 12,line 107 + 54,line 164 + 51,line 159 + 47,line 153 + 44,line 150 +} + +array set shm::lr1_table { + 35 {{6 {286 287} 1}} + 66,trans {{284 88}} + 36 {{7 {286 287} 1}} + 85,trans {{284 104}} + 37 {{8 {286 287} 1}} + 38 {{9 {286 287} 1}} + 40 {{11 {286 287} 1}} + 39 {{10 {286 287} 1}} + 117,trans {} + 41 {{12 {286 287} 1}} + 42 {{13 {286 287} 1}} + 43 {{14 {286 287} 1}} + 44 {{15 {286 287} 1}} + 45 {{16 {286 287} 1}} + 46 {{17 {286 287} 1}} + 47 {{18 {286 287} 1}} + 48 {{19 {286 287} 1}} + 49 {{20 {286 287} 1}} + 50 {{21 {286 287} 1}} + 27,trans {} + 51 {{22 {286 287} 1}} + 46,trans {} + 52 {{23 {286 287} 1}} + 65,trans {{284 87}} + 53 {{24 {286 287} 1}} + 84,trans {{284 103}} + 54 {{25 {286 287} 1}} + 55 {{26 {286 287} 1}} + 56 {{27 {286 287} 1}} + 116,trans {{285 95} {313 121}} + 57 {{40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2} {53 284 0} {54 284 0}} + 58 {{39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2} {53 284 0} {54 284 0}} + 59 {{48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 60 {{49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 61 {{51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2} {53 285 0} {54 285 0}} + 62 {{38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2} {53 284 0} {54 284 0}} + 63 {{37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2} {53 284 0} {54 284 0}} + 64 {{36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2} {53 284 0} {54 284 0}} + 65 {{45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 66 {{46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 26,trans {{284 77}} + 67 {{47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 45,trans {} + 68 {{44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 64,trans {{286 1} {287 2} {312 86}} + 69 {{41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 70 {{52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 83,trans {{285 102}} + 71 {{42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 72 {{33 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 73 {{32 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 115,trans {} + 74 {{29 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 75 {{34 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 76 {{43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 77 {{35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 78 {{50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 79 {{40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 80 {{39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 81 {{48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 82 {{49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 25,trans {{284 76}} + 83 {{51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 44,trans {} + 84 {{38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 85 {{37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 63,trans {{286 1} {287 2} {312 85}} + 86 {{36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 82,trans {{285 95} {313 101}} + 87 {{45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 0 {{0 0 0} {28 0 0} {29 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {30 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {31 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {32 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {33 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {34 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {53 284 0} {54 284 0}} + 88 {{46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 1 {{53 284 1}} + 89 {{47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 90 {{44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 114,trans {} + 2 {{54 284 1}} + 91 {{41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 3 {{43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 92 {{52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3}} + 4 {{35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 93 {{42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 3} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 5 {{50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 285 0} {54 285 0}} + 94 {{43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 6 {{39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {1 {286 287} 0} {2 {286 287} 0} {3 {286 287} 0} {4 {286 287} 0} {5 {286 287} 0} {6 {286 287} 0} {7 {286 287} 0} {8 {286 287} 0} {9 {286 287} 0} {10 {286 287} 0} {11 {286 287} 0} {12 {286 287} 0} {13 {286 287} 0} {14 {286 287} 0} {15 {286 287} 0} {16 {286 287} 0} {17 {286 287} 0} {18 {286 287} 0} {19 {286 287} 0} {20 {286 287} 0} {21 {286 287} 0} {22 {286 287} 0} {23 {286 287} 0} {24 {286 287} 0} {25 {286 287} 0} {26 {286 287} 0} {27 {286 287} 0}} + 95 {{56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1}} + 7 {{48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 96 {{35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 8 {{49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 97 {{50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 9 {{51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {1 {286 287} 0} {2 {286 287} 0} {3 {286 287} 0} {4 {286 287} 0} {5 {286 287} 0} {6 {286 287} 0} {7 {286 287} 0} {8 {286 287} 0} {9 {286 287} 0} {10 {286 287} 0} {11 {286 287} 0} {12 {286 287} 0} {13 {286 287} 0} {14 {286 287} 0} {15 {286 287} 0} {16 {286 287} 0} {17 {286 287} 0} {18 {286 287} 0} {19 {286 287} 0} {20 {286 287} 0} {21 {286 287} 0} {22 {286 287} 0} {23 {286 287} 0} {24 {286 287} 0} {25 {286 287} 0} {26 {286 287} 0} {27 {286 287} 0}} + 98 {{40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 24,trans {{284 75}} + 99 {{39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 43,trans {} + 62,trans {{286 1} {287 2} {312 84}} + 81,trans {{285 95} {313 100}} + 99,trans {{285 95} {313 115}} + 113,trans {} + 23,trans {} + 42,trans {} + 61,trans {{286 27} {287 28} {312 83}} + 79,trans {{284 98}} + 80,trans {{284 99}} + 98,trans {{285 95} {313 114}} + 9,trans {{257 30} {258 31} {259 32} {260 33} {261 34} {262 35} {263 36} {264 37} {265 38} {266 39} {267 40} {268 41} {269 42} {270 43} {271 44} {272 45} {273 46} {274 47} {275 48} {276 49} {277 50} {278 51} {279 52} {280 53} {281 54} {282 55} {283 56} {307 61}} + 112,trans {} + 22,trans {} + 41,trans {} + 59,trans {{284 81}} + 60,trans {{284 82}} + 78,trans {{284 97}} + 97,trans {{285 95} {313 113}} + 8,trans {{286 1} {287 2} {312 60}} + 111,trans {{285 95} {313 120}} + 100 {{48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 101 {{49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 102 {{51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 103 {{38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 104 {{37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 105 {{36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 106 {{45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 21,trans {{286 1} {287 2} {288 3} {289 4} {290 5} {291 6} {292 7} {293 8} {294 9} {295 10} {296 11} {297 12} {298 13} {299 14} {300 15} {301 16} {302 17} {305 18} {306 19} {310 74} {311 23} {312 24}} + 107 {{46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 39,trans {} + 40,trans {} + 108 {{47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 58,trans {{286 1} {287 2} {312 80}} + 110 {{41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 109 {{44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 77,trans {{285 95} {313 96}} + 96,trans {} + 111 {{52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 7,trans {{286 1} {287 2} {312 59}} + 112 {{42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 4}} + 113 {{50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 110,trans {} + 109,trans {} + 114 {{40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 115 {{39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 116 {{51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5} {55 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {56 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0}} + 117 {{38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 118 {{37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 120 {{52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 119 {{36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 5}} + 121 {{51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 6}} + 19,trans {{286 1} {287 2} {288 3} {289 4} {290 5} {291 6} {292 7} {293 8} {294 9} {295 10} {296 11} {297 12} {298 13} {299 14} {300 15} {301 16} {302 17} {311 73} {312 24}} + 20,trans {} + 38,trans {} + 57,trans {{286 1} {287 2} {312 79}} + 76,trans {{285 94}} + 95,trans {} + 6,trans {{257 30} {258 31} {259 32} {260 33} {261 34} {262 35} {263 36} {264 37} {265 38} {266 39} {267 40} {268 41} {269 42} {270 43} {271 44} {272 45} {273 46} {274 47} {275 48} {276 49} {277 50} {278 51} {279 52} {280 53} {281 54} {282 55} {283 56} {304 57} {307 58}} + 108,trans {} + 18,trans {{286 1} {287 2} {288 3} {289 4} {290 5} {291 6} {292 7} {293 8} {294 9} {295 10} {296 11} {297 12} {298 13} {299 14} {300 15} {301 16} {302 17} {311 72} {312 24}} + 37,trans {} + 56,trans {} + 75,trans {} + 94,trans {} + 5,trans {{286 27} {287 28} {312 29}} + 107,trans {} + 17,trans {{286 1} {287 2} {312 71}} + 36,trans {} + 55,trans {} + 74,trans {} + 93,trans {{285 95} {313 112}} + 4,trans {{286 1} {287 2} {312 26}} + 106,trans {} + 16,trans {{286 27} {287 28} {312 70}} + 35,trans {} + 54,trans {} + 73,trans {} + 92,trans {{284 111}} + 3,trans {{286 1} {287 2} {312 25}} + 105,trans {{285 95} {313 119}} + 15,trans {{286 1} {287 2} {312 69}} + 34,trans {} + 53,trans {} + 72,trans {} + 91,trans {{285 95} {313 110}} + 2,trans {} + 104,trans {{285 95} {313 118}} + 14,trans {{286 1} {287 2} {312 68}} + 33,trans {} + 52,trans {} + 71,trans {{284 93}} + 90,trans {{285 109}} + 89,trans {{285 95} {313 108}} + 1,trans {} + 103,trans {{285 95} {313 117}} + 13,trans {{286 1} {287 2} {312 67}} + 32,trans {} + 51,trans {} + 69,trans {{284 91}} + 70,trans {{285 92}} + 88,trans {{285 95} {313 107}} + 0,trans {{286 1} {287 2} {288 3} {289 4} {290 5} {291 6} {292 7} {293 8} {294 9} {295 10} {296 11} {297 12} {298 13} {299 14} {300 15} {301 16} {302 17} {305 18} {306 19} {308 20} {309 21} {310 22} {311 23} {312 24}} + 102,trans {{284 116}} + 121,trans {} + 12,trans {{286 1} {287 2} {312 66}} + 31,trans {} + 49,trans {} + 50,trans {} + 68,trans {{284 90}} + 87,trans {{285 95} {313 106}} + 101,trans {} + 120,trans {} + 119,trans {} + 10 {{36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {1 {286 287} 0} {2 {286 287} 0} {3 {286 287} 0} {4 {286 287} 0} {5 {286 287} 0} {6 {286 287} 0} {7 {286 287} 0} {8 {286 287} 0} {9 {286 287} 0} {10 {286 287} 0} {11 {286 287} 0} {12 {286 287} 0} {13 {286 287} 0} {14 {286 287} 0} {15 {286 287} 0} {16 {286 287} 0} {17 {286 287} 0} {18 {286 287} 0} {19 {286 287} 0} {20 {286 287} 0} {21 {286 287} 0} {22 {286 287} 0} {23 {286 287} 0} {24 {286 287} 0} {25 {286 287} 0} {26 {286 287} 0} {27 {286 287} 0}} + 11 {{45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 12 {{46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 13 {{47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 14 {{44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 15 {{41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 11,trans {{286 1} {287 2} {312 65}} + 16 {{52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 285 0} {54 285 0}} + 29,trans {{285 78}} + 30,trans {} + 17 {{42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {53 284 0} {54 284 0}} + 48,trans {} + 18 {{33 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {34 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {53 284 0} {54 284 0}} + 67,trans {{284 89}} + 86,trans {{284 105}} + 20 {{0 0 1}} + 19 {{32 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {34 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {53 284 0} {54 284 0}} + 21 {{28 0 1} {29 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1} {31 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {32 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {33 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {34 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {36 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {37 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {38 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {39 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {40 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {41 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {42 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {44 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {45 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {46 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {47 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {48 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {49 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {51 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {52 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 0} {53 284 0} {54 284 0}} + 22 {{30 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1}} + 100,trans {} + 23 {{31 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1}} + 118,trans {} + 24 {{34 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 1}} + 25 {{43 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 26 {{35 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 27 {{53 285 1}} + 28 {{54 285 1}} + 30 {{1 {286 287} 1}} + 29 {{50 {0 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 305 306} 2}} + 31 {{2 {286 287} 1}} + 32 {{3 {286 287} 1}} + 10,trans {{257 30} {258 31} {259 32} {260 33} {261 34} {262 35} {263 36} {264 37} {265 38} {266 39} {267 40} {268 41} {269 42} {270 43} {271 44} {272 45} {273 46} {274 47} {275 48} {276 49} {277 50} {278 51} {279 52} {280 53} {281 54} {282 55} {283 56} {303 62} {304 63} {307 64}} + 33 {{4 {286 287} 1}} + 28,trans {} + 34 {{5 {286 287} 1}} + 47,trans {} +} + +array set shm::token_id_table { + 286 KEY_ + 286,t 0 + 287 SHMID_ + 292,line 48 + 302,line 58 + 288 ARRAY_ + 265,title WCSH + 289 FITS_ + 290 SFITS_ + 300 RGBCUBE_ + 284,title integer + 291 MOSAIC_ + 301 SRGBCUBE_ + 313,title {} + 292 MOSAICWCS_ + 302 RGBIMAGE_ + 288,line 44 + 293 MOSAICIRAF_ + 303 WFPC2_ + 294 SMOSAIC_ + 304 IRAF_ + 305 SHM_ + 295 MOSAICIMAGE_ + 306 SHMCMD_ + 296 MOSAICIMAGEWCS_ + 307 wcssys + 262,t 0 + 297 MOSAICIMAGEIRAF_ + 308 command + 285,line 37 + 298 MOSAICIMAGEWFPC2_ + 310 shmm + 309 shms + 299 RGBARRAY_ + 311 shm + 283,t 0 + 312 key + 313 filename + 314,t 1 + 314 start' + 282,line 32 + 264,title WCSG + 283,title WCSZ + 312,title {} + 278,line 28 + error,line 94 + 258,t 0 + 275,line 25 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 22 + 263,title WCSF + 282,title WCSY + 311,title {} + 268,line 18 + 276,t 0 + 265,line 15 + 307,t 1 + 297,t 0 + 262,line 12 + 0,t 0 + 0 {$} + 262,title WCSE + 281,title WCSX + 310,title {} + 309,title {} + error,t 0 + 299,title RGBARRAY + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 261,title WCSD + 279,title WCSV + 280,title WCSW + 308,title {} + 269,t 0 + 270,t 0 + 298,title MOSAICIMAGEWFPC2 + 314,line 169 + 291,t 0 + 301,t 0 + 311,line 137 + 307,line 95 + 266,t 0 + 260,title WCSC + 259,title WCSB + 297,line 53 + 278,title WCSU + 307,title {} + 297,title MOSAICIMAGEIRAF + 287,t 0 + 294,line 50 + 304,line 60 + error,title {} + 291,line 47 + 301,line 57 + 263,t 0 + 258,title WCSA + 287,line 42 + 277,title WCST + 284,t 0 + 306,title SHMCMD + 296,title MOSAICIMAGEWCS + 284,line 35 + 281,line 31 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title WCS + 277,line 27 + 276,title WCSS + 312,t 1 + 305,title SHM + 295,title MOSAICIMAGE + 274,line 24 + 271,line 21 + 277,t 0 + 308,t 1 + 267,line 17 + 298,t 0 + 275,title WCSR + 294,title SMOSAIC + 304,title IRAF + 264,line 14 + 261,line 11 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSQ + 293,title MOSAICIRAF + 303,title WFPC2 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 273,title WCSP + 313,line 166 + 292,title MOSAICWCS + 302,title RGBIMAGE + 267,t 0 + 310,line 132 + 309,line 128 + 299,line 55 + 288,t 0 + 306,line 63 + 296,line 52 + 272,title WCSO + 291,title MOSAIC + 293,line 49 + 301,title SRGBCUBE + 303,line 59 + 264,t 0 + 285,t 0 + 289,line 45 + 290,line 46 + 300,line 56 + 286,line 41 + 271,title WCSN + 261,t 0 + 283,line 33 + 289,title FITS + 290,title SFITS + 300,title RGBCUBE + 282,t 0 + 279,line 29 + 280,line 30 + 313,t 1 + 276,line 26 + 257,t 0 + 269,title WCSL + 270,title WCSM + 273,line 23 + 288,title ARRAY + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 19 + 270,line 20 + 266,line 16 + 268,title WCSK + 275,t 0 + 263,line 13 + 287,title SHMID + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSJ + 257 WCS_ + 286,title KEY + 293,t 0 + 303,t 0 + 258 WCSA_ + 260 WCSC_ + 259 WCSB_ + 261 WCSD_ + 262 WCSE_ + 263 WCSF_ + 264 WCSG_ + 265 WCSH_ + 266 WCSI_ + 267 WCSJ_ + 268,t 0 + 268 WCSK_ + 269 WCSL_ + 270 WCSM_ + 312,line 162 + 271 WCSN_ + 272 WCSO_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSI + 273 WCSP_ + 274 WCSQ_ + 285,title string + 314,title {} + 275 WCSR_ + 308,line 125 + 276 WCSS_ + 298,line 54 + 277 WCST_ + 278 WCSU_ + 279 WCSV_ + 280 WCSW_ + 281 WCSX_ + 305,line 62 + 282 WCSY_ + 295,line 51 + 265,t 0 + 283 WCSZ_ + 284 INT_ + 285 STRING_ +} + +proc shm::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 } + 34 { MultiLoad; ShmCmdSet shared fits {} $1 $2 {} } + 35 { MultiLoad; ShmCmdSet shared fits {} $2 $3 $4 } + 36 { MultiLoad; ShmCmdSet shared fits "mosaic image $2" $3 $4 $5 } + 37 { MultiLoad; ShmCmdSet shared fits {mosaic image iraf} $3 $4 $5 } + 38 { MultiLoad; ShmCmdSet shared fits {mosaic image wfpc2} $3 $4 $5 } + 39 { ShmCmdSet shared fits "mosaic $2" $3 $4 $5 } + 40 { ShmCmdSet shared fits {mosaic iraf} $3 $4 $5 } + 41 { MultiLoadRGB; ShmCmdSet shared fits {rgb cube} $2 $3 $4 } + 42 { MultiLoadRGB; ShmCmdSet shared fits {rgb image} $2 $3 $4 } + 43 { MultiLoad; ShmCmdSet shared array {} $2 $3 $4 } + 44 { MultiLoadRGB; ShmCmdSet shared array {rgb cube} $2 $3 $4 } + 45 { MultiLoad; ShmCmdSet shared fits {mosaic image wcs} $2 $3 $4 } + 46 { MultiLoad; ShmCmdSet shared fits {mosaic image iraf} $2 $3 $4 } + 47 { MultiLoad; ShmCmdSet shared fits {mosaic image wfpc2} $2 $3 $4 } + 48 { ShmCmdSet shared fits {mosaic wcs} $2 $3 $4 } + 49 { ShmCmdSet shared fits {mosaic iraf} $2 $3 $4 } + 50 { MultiLoad; ShmCmdSet sshared fits {} $2 $4 $5 $3 } + 51 { ShmCmdSet sshared fits "mosaic $2" $3 $5 $6 $4 } + 52 { MultiLoadRGB; ShmCmdSet sshared fits {rgb cube} $2 $4 $5 $3 } + 53 { set _ key } + 54 { set _ shmid } + 55 { set _ {} } + 56 { set _ $1 } + } + 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 shm::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/sialex.tcl b/ds9/parsers/sialex.tcl new file mode 100644 index 0000000..c243e44 --- /dev/null +++ b/ds9/parsers/sialex.tcl @@ -0,0 +1,1094 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval sia { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc sia::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc sia::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc sia::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc sia::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc sia::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc sia::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc sia::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc sia::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc sia::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set FK4_ 284 +set B1950_ 285 +set FK5_ 286 +set J2000_ 287 +set ICRS_ 288 +set GALACTIC_ 289 +set ECLIPTIC_ 290 +set DEGREES_ 291 +set ARCMIN_ 292 +set ARCSEC_ 293 +set SEXAGESIMAL_ 294 +set INT_ 295 +set REAL_ 296 +set SEXSTR_ 297 +set STRING_ 298 +set CANCEL_ 299 +set CLEAR_ 300 +set CLOSE_ 301 +set COORDINATE_ 302 +set CROSSHAIR_ 303 +set EXPORT_ 304 +set NAME_ 305 +set PRINT_ 306 +set RADIUS_ 307 +set RETRIEVE_ 308 +set SAVE_ 309 +set SIZE_ 310 +set SKY_ 311 +set SKYFORMAT_ 312 +set SYSTEM_ 313 +set UPDATE_ 314 +set 2MASS_ 315 +set AKARI_ 316 +set ASTROWISE_ 317 +set CADC_ 318 +set CXC_ 319 +set MAST_ 320 +set SDSS_ 321 +set SKYVIEW_ 322 +set TGSSADR_ 323 +set XML_ 324 +set VOT_ 325 +set SB_ 326 +set STARBASE_ 327 +set CSV_ 328 +set TSV_ 329 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: cancel + if {[regexp -start $index_ -indices -line -nocase -- {\A(cancel)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: coordinate + if {[regexp -start $index_ -indices -line -nocase -- {\A(coordinate)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: export + if {[regexp -start $index_ -indices -line -nocase -- {\A(export)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: print + if {[regexp -start $index_ -indices -line -nocase -- {\A(print)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: radius + if {[regexp -start $index_ -indices -line -nocase -- {\A(radius)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: retrieve + if {[regexp -start $index_ -indices -line -nocase -- {\A(retrieve)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: 2mass + if {[regexp -start $index_ -indices -line -nocase -- {\A(2mass)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: akari + if {[regexp -start $index_ -indices -line -nocase -- {\A(akari)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: astrowise + if {[regexp -start $index_ -indices -line -nocase -- {\A(astrowise)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: cadc + if {[regexp -start $index_ -indices -line -nocase -- {\A(cadc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: cxc + if {[regexp -start $index_ -indices -line -nocase -- {\A(cxc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: mast + if {[regexp -start $index_ -indices -line -nocase -- {\A(mast)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: sdss + if {[regexp -start $index_ -indices -line -nocase -- {\A(sdss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: skyview + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyview)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: tgssadr + if {[regexp -start $index_ -indices -line -nocase -- {\A(tgssadr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: xml + if {[regexp -start $index_ -indices -line -nocase -- {\A(xml)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: vot + if {[regexp -start $index_ -indices -line -nocase -- {\A(vot)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: sb + if {[regexp -start $index_ -indices -line -nocase -- {\A(sb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: starbase + if {[regexp -start $index_ -indices -line -nocase -- {\A(starbase)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: csv + if {[regexp -start $index_ -indices -line -nocase -- {\A(csv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: tsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(tsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + # rule 68: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 68 + } + # rule 69: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 69 + } + # rule 70: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 70 + } + # rule 71: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 71 + } + # rule 72: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 72 + } + # rule 73: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 73 + } + # rule 74: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 74 + } + # rule 75: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 75 + } + # rule 76: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 76 + } + # rule 77: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 77 + } + # rule 78: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 78 + } + # rule 79: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 79 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CANCEL_ + } + 1 { +return $CLEAR_ + } + 2 { +return $CLOSE_ + } + 3 { +return $COORDINATE_ + } + 4 { +return $CROSSHAIR_ + } + 5 { +return $EXPORT_ + } + 6 { +return $NAME_ + } + 7 { +return $PRINT_ + } + 8 { +return $RADIUS_ + } + 9 { +return $RETRIEVE_ + } + 10 { +return $SAVE_ + } + 11 { +return $SIZE_ + } + 12 { +return $SKY_ + } + 13 { +return $SKYFORMAT_ + } + 14 { +return $SYSTEM_ + } + 15 { +return $UPDATE_ + } + 16 { +return $2MASS_ + } + 17 { +return $AKARI_ + } + 18 { +return $ASTROWISE_ + } + 19 { +return $CADC_ + } + 20 { +return $CXC_ + } + 21 { +return $MAST_ + } + 22 { +return $SDSS_ + } + 23 { +return $SKYVIEW_ + } + 24 { +return $TGSSADR_ + } + 25 { +return $XML_ + } + 26 { +return $VOT_ + } + 27 { +return $SB_ + } + 28 { +return $STARBASE_ + } + 29 { +return $CSV_ + } + 30 { +return $TSV_ + } + 31 { +return $WCS_ + } + 32 { +return $WCSA_ + } + 33 { +return $WCSB_ + } + 34 { +return $WCSC_ + } + 35 { +return $WCSD_ + } + 36 { +return $WCSE_ + } + 37 { +return $WCSF_ + } + 38 { +return $WCSG_ + } + 39 { +return $WCSH_ + } + 40 { +return $WCSI_ + } + 41 { +return $WCSJ_ + } + 42 { +return $WCSK_ + } + 43 { +return $WCSL_ + } + 44 { +return $WCSM_ + } + 45 { +return $WCSN_ + } + 46 { +return $WCSO_ + } + 47 { +return $WCSP_ + } + 48 { +return $WCSQ_ + } + 49 { +return $WCSR_ + } + 50 { +return $WCSS_ + } + 51 { +return $WCST_ + } + 52 { +return $WCSU_ + } + 53 { +return $WCSV_ + } + 54 { +return $WCSW_ + } + 55 { +return $WCSX_ + } + 56 { +return $WCSY_ + } + 57 { +return $WCSZ_ + } + 58 { +return $FK4_ + } + 59 { +return $FK4_ + } + 60 { +return $FK5_ + } + 61 { +return $FK5_ + } + 62 { +return $ICRS_ + } + 63 { +return $GALACTIC_ + } + 64 { +return $ECLIPTIC_ + } + 65 { +return $DEGREES_ + } + 66 { +return $ARCMIN_ + } + 67 { +return $ARCSEC_ + } + 68 { +return $SEXAGESIMAL_ + } + 69 { +set yylval $yytext; return $INT_ + } + 70 - + 71 { +set yylval $yytext; return $REAL_ + } + 72 - + 73 { +set yylval $yytext; return $SEXSTR_ + } + 74 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 75 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 76 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 77 { +set yylval $yytext; return $STRING_ + } + 78 { +# ignore whitespace + } + 79 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/siaparser.tab.tcl b/ds9/parsers/siaparser.tab.tcl new file mode 100644 index 0000000..d7cf932 --- /dev/null +++ b/ds9/parsers/siaparser.tab.tcl @@ -0,0 +1,73 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set FK4_ 284 +set B1950_ 285 +set FK5_ 286 +set J2000_ 287 +set ICRS_ 288 +set GALACTIC_ 289 +set ECLIPTIC_ 290 +set DEGREES_ 291 +set ARCMIN_ 292 +set ARCSEC_ 293 +set SEXAGESIMAL_ 294 +set INT_ 295 +set REAL_ 296 +set SEXSTR_ 297 +set STRING_ 298 +set CANCEL_ 299 +set CLEAR_ 300 +set CLOSE_ 301 +set COORDINATE_ 302 +set CROSSHAIR_ 303 +set EXPORT_ 304 +set NAME_ 305 +set PRINT_ 306 +set RADIUS_ 307 +set RETRIEVE_ 308 +set SAVE_ 309 +set SIZE_ 310 +set SKY_ 311 +set SKYFORMAT_ 312 +set SYSTEM_ 313 +set UPDATE_ 314 +set 2MASS_ 315 +set AKARI_ 316 +set ASTROWISE_ 317 +set CADC_ 318 +set CXC_ 319 +set MAST_ 320 +set SDSS_ 321 +set SKYVIEW_ 322 +set TGSSADR_ 323 +set XML_ 324 +set VOT_ 325 +set SB_ 326 +set STARBASE_ 327 +set CSV_ 328 +set TSV_ 329 diff --git a/ds9/parsers/siaparser.tcl b/ds9/parsers/siaparser.tcl new file mode 100644 index 0000000..783ac3d --- /dev/null +++ b/ds9/parsers/siaparser.tcl @@ -0,0 +1,2108 @@ +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 sia { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc sia::YYABORT {} { + return -code return 1 +} + +proc sia::YYACCEPT {} { + return -code return 0 +} + +proc sia::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc sia::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc sia::yyerror {s} { + puts stderr $s +} + +proc sia::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 sia::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set sia::table { + 1:311,target 70 + 51:298 reduce + 13:301,target 48 + 9:300 reduce + 48:0 reduce + 9:301 reduce + 9:302 reduce + 21:298 shift + 29:268,target 72 + 9:303 reduce + 55:298,target 33 + 9:304 reduce + 95:0,target 39 + 9:305 reduce + 91:0 reduce + 9:306 reduce + 9:307 reduce + 9:298 reduce + 9:308 reduce + 64:0,target 4 + 9:299 reduce + 9:309 reduce + 9:310 reduce + 37:295,target 34 + 9:311 reduce + 9:312 reduce + 7:312,target 76 + 9:313 reduce + 9:314 reduce + 33:0,target 44 + 35:286,target 41 + 5:303,target 74 + 32:304,target 20 + 2:311,target 71 + 0:302,target 45 + 11:298,target 43 + 86:298 reduce + 63:0 reduce + 56:298,target 34 + 97:333,target 100 + 56:298 reduce + 26:295 shift + 8:312,target 77 + 26:296 shift + 92:0,target 55 + 6:303,target 75 + 61:0,target 1 + 3:311,target 72 + 30:0,target 65 + 0:318,target 4 + 35:0 reduce + 1:302,target 70 + 12:308,target 24 + 57:298,target 62 + 77:0 reduce + 29:259,target 63 + 29:260,target 64 + 9:0 reduce + 9:312,target 78 + 26:334 goto + 92:298 reduce + 7:303,target 76 + 32:300 shift + 32:301 shift + 32:302 shift + 62:298 reduce + 32:303 shift + 4:311,target 73 + 32:304 shift + 32:305 shift + 0:335,target 10 + 32:306 shift + 32:307 shift + 32:308 shift + 32:299 shift + 32:309 shift + 32:310 shift + 2:302,target 71 + 13:298,target 47 + 13:308,target 48 + 32:311 shift + 88:0,target 64 + 58:298,target 35 + 32:312 shift + 32:313 shift + 90:287,target 53 + 29:276,target 80 + 32:314 shift + 50:0 reduce + 57:0,target 62 + 92:0 reduce + 8:303,target 77 + 97:291 shift + 97:292 shift + 5:311,target 74 + 97:293 shift + 32:312,target 28 + 3:302,target 72 + 14:298,target 33 + 60:298,target 63 + 59:298,target 36 + 22:0 reduce + 32:340 goto + 91:287,target 53 + 0:299,target 45 + 0:309,target 45 + 0:310,target 45 + 67:298 reduce + 12:300,target 16 + 64:0 reduce + 27:284,target 50 + 37:295 shift + 37:296 shift + 85:0,target 25 + 20:326,target 41 + 9:303,target 78 + 54:0,target 32 + 6:311,target 75 + 97:333 goto + 34:285,target 40 + 90:331,target 98 + 4:302,target 73 + 15:298,target 50 + 61:298,target 1 + 1:310,target 70 + 1:309,target 70 + 1:299,target 70 + 13:300,target 48 + 37:334 goto + 29:267,target 71 + 78:0 reduce + 20:343,target 45 + 73:298 reduce + 7:311,target 76 + 13:300 reduce + 13:301 reduce + 13:302 reduce + 49:296,target 35 + 13:303 reduce + 35:285,target 41 + 43:298 reduce + 8:0,target 77 + 13:304 reduce + 91:331,target 99 + 13:305 reduce + 82:0,target 22 + 2:300 reduce + 5:302,target 74 + 13:306 reduce + 16:298,target 52 + 62:298,target 2 + 2:301 reduce + 13:307 reduce + 32:303,target 19 + 2:302 reduce + 13:298 reduce + 13:308 reduce + 2:303 reduce + 13:299 reduce + 13:309 reduce + 13:310 reduce + 2:310,target 71 + 2:309,target 71 + 2:304 reduce + 2:299,target 71 + 13:311 reduce + 51:0,target 29 + 2:305 reduce + 13:312 reduce + 2:306 reduce + 13:313 reduce + 2:307 reduce + 13:314 reduce + 2:308 reduce + 2:298 reduce + 19:0,target 54 + 2:310 reduce + 2:309 reduce + 2:299 reduce + 51:0 reduce + 2:311 reduce + 0:301,target 45 + 2:312 reduce + 2:313 reduce + 2:314 reduce + 93:0 reduce + 18:334,target 37 + 8:311,target 77 + 6:302,target 75 + 17:298,target 51 + 63:298,target 3 + 78:298 reduce + 3:310,target 72 + 3:309,target 72 + 3:299,target 72 + 13:339 goto + 0:317,target 3 + 48:298 reduce + 1:301,target 70 + 5:0,target 74 + 12:307,target 23 + 18:295 shift + 78:0,target 18 + 7:300 reduce + 18:296 shift + 65:0 reduce + 7:301 reduce + 18:297 shift + 7:302 reduce + 7:303 reduce + 29:258,target 62 + 7:304 reduce + 7:305 reduce + 7:306 reduce + 7:307 reduce + 9:311,target 78 + 7:298 reduce + 7:308 reduce + 16:0,target 52 + 7:299 reduce + 7:309 reduce + 7:310 reduce + 7:311 reduce + 7:312 reduce + 7:313 reduce + 7:302,target 76 + 7:314 reduce + 64:298,target 4 + 34:293,target 40 + 4:299,target 73 + 4:309,target 73 + 4:310,target 73 + 2:301,target 71 + 13:307,target 48 + 18:334 goto + 90:286,target 52 + 29:275,target 79 + 84:298 reduce + 80:0 reduce + 79:0 reduce + 18:341 goto + 54:298 reduce + 2:0,target 71 + 75:0,target 15 + 8:302,target 77 + 19:298,target 54 + 65:298,target 5 + 24:298 reduce + 29:257 shift + 35:293,target 41 + 29:258 shift + 29:259 shift + 29:260 shift + 5:299,target 74 + 5:309,target 74 + 5:310,target 74 + 29:261 shift + 29:262 shift + 32:311,target 27 + 29:263 shift + 13:0,target 47 + 29:264 shift + 29:265 shift + 10:0 accept + 29:266 shift + 3:301,target 72 + 29:267 shift + 29:268 shift + 29:269 shift + 29:270 shift + 91:286,target 52 + 29:271 shift + 0:308,target 45 + 29:272 shift + 90:284 shift + 29:273 shift + 52:0 reduce + 90:285 shift + 29:274 shift + 90:286 shift + 29:275 shift + 90:287 shift + 29:276 shift + 90:288 shift + 29:277 shift + 90:290 shift + 90:289 shift + 29:278 shift + 94:0 reduce + 29:279 shift + 29:280 shift + 29:281 shift + 20:325,target 40 + 29:282 shift + 29:283 shift + 9:302,target 78 + 21:298,target 46 + 66:298,target 6 + 90:298 reduce + 89:298 reduce + 6:299,target 75 + 6:309,target 75 + 6:310,target 75 + 34:284,target 40 + 60:298 reduce + 59:298 reduce + 4:301,target 73 + 72:0,target 12 + 24:0 reduce + 30:298 reduce + 1:308,target 70 + 1:298,target 70 + 23:334,target 47 + 66:0 reduce + 10:0,target 0 + 29:266,target 70 + 90:331 goto + 22:298,target 58 + 67:298,target 7 + 7:299,target 76 + 7:309,target 76 + 7:310,target 76 + 49:295,target 34 + 29:330 goto + 35:284,target 41 + 0:342,target 13 + 5:301,target 74 + 32:302,target 18 + 35:284 reduce + 35:285 reduce + 2:308,target 71 + 2:298,target 71 + 35:286 reduce + 95:298 reduce + 35:287 reduce + 35:288 reduce + 29:283,target 87 + 35:289 reduce + 35:290 reduce + 38:0 reduce + 35:291 reduce + 99:0,target 67 + 35:292 reduce + 65:298 reduce + 0:300,target 45 + 35:293 reduce + 35:295 reduce + 81:0 reduce + 68:0,target 8 + 35:296 reduce + 35:298 reduce + 68:298,target 8 + 8:299,target 77 + 8:309,target 77 + 8:310,target 77 + 6:301,target 75 + 3:308,target 72 + 3:298,target 72 + 11:0 reduce + 0:316,target 2 + 1:300,target 70 + 12:306,target 22 + 53:0 reduce + 24:298,target 59 + 29:257,target 61 + 70:298,target 10 + 69:298,target 9 + 95:0 reduce + 9:299,target 78 + 9:309,target 78 + 9:310,target 78 + 96:0,target 60 + 71:298 reduce + 65:0,target 5 + 7:301,target 76 + 18:297,target 36 + 34:292,target 40 + 41:298 reduce + 4:308,target 73 + 4:298,target 73 + 34:0,target 40 + 0:300 reduce + 0:301 reduce + 0:302 reduce + 11:298 reduce + 26:334,target 49 + 0:303 reduce + 0:304 reduce + 2:300,target 71 + 0:305 reduce + 13:306,target 48 + 0:306 reduce + 28:291,target 58 + 0:307 reduce + 90:285,target 51 + 0:308 reduce + 29:274,target 78 + 0:299 reduce + 0:309 reduce + 0:310 reduce + 67:0 reduce + 0:311 reduce + 25:298,target 48 + 71:298,target 11 + 0:312 reduce + 0:313 reduce + 0:314 reduce + 0:315 shift + 0:316 shift + 0:317 shift + 0:318 shift + 0:320 shift + 0:319 shift + 0:321 shift + 0:322 shift + 8:301,target 77 + 0:323 shift + 35:292,target 41 + 5:298,target 74 + 5:308,target 74 + 32:299,target 15 + 32:309,target 25 + 32:310,target 26 + 12:340,target 31 + 11:336 goto + 93:0,target 37 + 76:298 reduce + 3:300,target 72 + 62:0,target 2 + 0:335 goto + 91:285,target 51 + 0:337 goto + 0:307,target 45 + 46:298 reduce + 0:338 goto + 72:298,target 12 + 31:0,target 46 + 5:300 reduce + 0:342 goto + 5:301 reduce + 82:0 reduce + 5:302 reduce + 16:298 reduce + 5:303 reduce + 5:304 reduce + 18:341,target 38 + 5:305 reduce + 5:306 reduce + 20:324,target 39 + 5:307 reduce + 5:298 reduce + 5:308 reduce + 9:301,target 78 + 5:299 reduce + 5:309 reduce + 5:310 reduce + 5:311 reduce + 5:312 reduce + 5:313 reduce + 6:298,target 75 + 6:308,target 75 + 5:314 reduce + 13:339,target 32 + 4:300,target 73 + 1:307,target 70 + 12:314,target 30 + 73:298,target 13 + 54:0 reduce + 29:265,target 69 + 90:0,target 68 + 89:0,target 49 + 82:298 reduce + 96:0 reduce + 58:0,target 35 + 52:298 reduce + 7:298,target 76 + 7:308,target 76 + 22:298 reduce + 5:300,target 74 + 32:301,target 17 + 2:307,target 71 + 13:314,target 48 + 74:298,target 14 + 29:282,target 86 + 68:0 reduce + 1:0 reduce + 8:298,target 77 + 8:308,target 77 + 27:284 shift + 27:285 shift + 86:0,target 26 + 27:286 shift + 87:298 reduce + 27:287 shift + 27:288 shift + 6:300,target 75 + 27:289 shift + 27:290 shift + 55:0,target 33 + 57:298 reduce + 3:307,target 72 + 24:0,target 59 + 30:298,target 65 + 75:298,target 15 + 0:315,target 1 + 12:305,target 21 + 27:289,target 55 + 27:290,target 56 + 83:0 reduce + 9:298,target 78 + 9:308,target 78 + 7:300,target 76 + 18:296,target 35 + 34:291,target 40 + 27:331 goto + 4:307,target 73 + 31:298,target 46 + 76:298,target 16 + 9:0,target 78 + 13:0 reduce + 83:0,target 23 + 93:298 reduce + 13:305,target 48 + 100:0 reduce + 90:284,target 50 + 55:0 reduce + 29:273,target 77 + 52:0,target 30 + 63:298 reduce + 8:300,target 77 + 35:291,target 41 + 5:307,target 74 + 32:308,target 24 + 77:298,target 17 + 47:293,target 95 + 91:284,target 50 + 0:306,target 45 + 70:0 reduce + 69:0 reduce + 6:0,target 75 + 2:0 reduce + 80:0,target 20 + 79:0,target 19 + 98:298 reduce + 9:300,target 78 + 48:0,target 56 + 68:298 reduce + 6:307,target 75 + 17:0,target 51 + 78:298,target 18 + 38:298 reduce + 0:323,target 9 + 1:306,target 70 + 12:313,target 29 + 29:264,target 68 + 84:0 reduce + 7:307,target 76 + 34:298,target 40 + 80:298,target 20 + 79:298,target 19 + 3:0,target 72 + 76:0,target 16 + 32:300,target 16 + 100:298 reduce + 74:298 reduce + 2:306,target 71 + 13:313,target 48 + 29:281,target 85 + 56:0 reduce + 44:298 reduce + 3:300 reduce + 3:301 reduce + 3:302 reduce + 14:298 shift + 98:0 reduce + 3:303 reduce + 23:296,target 35 + 3:304 reduce + 3:305 reduce + 3:306 reduce + 3:307 reduce + 8:307,target 77 + 3:308 reduce + 3:298 reduce + 35:298,target 41 + 81:298,target 21 + 3:310 reduce + 3:309 reduce + 3:299 reduce + 3:311 reduce + 3:312 reduce + 3:313 reduce + 3:314 reduce + 100:0,target 61 + 3:306,target 72 + 0:314,target 45 + 73:0,target 13 + 12:304,target 20 + 27:288,target 54 + 37:334,target 91 + 71:0 reduce + 80:298 reduce + 79:298 reduce + 3:0 reduce + 11:0,target 42 + 49:295 shift + 9:307,target 78 + 49:296 shift + 82:298,target 22 + 50:298 reduce + 97:293,target 95 + 8:300 reduce + 8:301 reduce + 18:295,target 34 + 8:302 reduce + 19:298 reduce + 34:289,target 40 + 34:290,target 40 + 8:303 reduce + 8:304 reduce + 4:306,target 73 + 8:305 reduce + 8:306 reduce + 8:307 reduce + 8:298 reduce + 8:308 reduce + 1:314,target 70 + 8:299 reduce + 8:309 reduce + 8:310 reduce + 8:311 reduce + 8:312 reduce + 13:304,target 48 + 8:313 reduce + 8:314 reduce + 29:272,target 76 + 20:324 shift + 20:325 shift + 85:0 reduce + 20:326 shift + 20:327 shift + 20:328 shift + 49:334 goto + 20:329 shift + 83:298,target 23 + 70:0,target 10 + 69:0,target 9 + 35:289,target 41 + 35:290,target 41 + 38:0,target 53 + 85:298 reduce + 5:306,target 74 + 32:307,target 23 + 47:292,target 94 + 20:343 goto + 55:298 reduce + 2:314,target 71 + 15:0 reduce + 25:298 shift + 0:305,target 45 + 57:0 reduce + 26:296,target 35 + 38:298,target 53 + 99:0 reduce + 84:298,target 24 + 91:284 shift + 91:285 shift + 91:286 shift + 6:306,target 75 + 91:287 shift + 91:288 shift + 91:290 shift + 91:289 shift + 28:332,target 60 + 3:314,target 72 + 66:0,target 6 + 0:322,target 8 + 30:0 reduce + 35:0,target 41 + 1:305,target 70 + 12:312,target 28 + 91:298 reduce + 72:0 reduce + 29:263,target 67 + 61:298 reduce + 39:298,target 79 + 40:298,target 80 + 85:298,target 25 + 4:0 reduce + 31:298 reduce + 7:306,target 76 + 4:314,target 73 + 91:331 goto + 0:338,target 12 + 2:305,target 71 + 13:312,target 48 + 100:298,target 61 + 94:0,target 38 + 29:279,target 83 + 29:280,target 84 + 41:298,target 81 + 86:298,target 26 + 63:0,target 3 + 86:0 reduce + 23:295,target 34 + 96:298 reduce + 8:306,target 77 + 66:298 reduce + 5:314,target 74 + 36:297 shift + 3:305,target 72 + 16:0 reduce + 0:313,target 45 + 12:303,target 19 + 42:298,target 82 + 87:298,target 27 + 58:0 reduce + 27:287,target 53 + 20:329,target 44 + 91:0,target 66 + 9:306,target 78 + 36:297,target 90 + 97:292,target 94 + 60:0,target 63 + 59:0,target 36 + 6:314,target 75 + 34:288,target 40 + 4:305,target 73 + 11:336,target 14 + 1:313,target 70 + 72:298 reduce + 31:0 reduce + 13:303,target 48 + 43:298,target 83 + 88:298,target 64 + 12:300 shift + 12:301 shift + 12:302 shift + 29:271,target 75 + 12:303 shift + 42:298 reduce + 73:0 reduce + 12:304 shift + 12:305 shift + 1:300 reduce + 12:306 shift + 1:301 reduce + 5:0 reduce + 12:307 shift + 1:302 reduce + 12:308 shift + 1:303 reduce + 12:299 shift + 12:309 shift + 12:310 shift + 1:304 reduce + 12:311 shift + 1:305 reduce + 12:312 shift + 1:306 reduce + 7:314,target 76 + 12:313 shift + 1:307 reduce + 12:314 shift + 1:308 reduce + 1:298 reduce + 1:310 reduce + 1:309 reduce + 1:299 reduce + 35:288,target 41 + 1:311 reduce + 1:312 reduce + 1:313 reduce + 5:305,target 74 + 1:314 reduce + 32:306,target 22 + 87:0,target 27 + 47:291,target 93 + 27:331,target 57 + 2:313,target 71 + 56:0,target 34 + 44:298,target 84 + 90:298,target 68 + 89:298,target 49 + 0:304,target 45 + 26:295,target 34 + 87:0 reduce + 47:291 shift + 47:292 shift + 77:298 reduce + 47:293 shift + 12:340 goto + 8:314,target 77 + 6:300 reduce + 6:305,target 75 + 6:301 reduce + 6:302 reduce + 17:298 reduce + 6:303 reduce + 3:313,target 72 + 6:304 reduce + 6:305 reduce + 6:306 reduce + 45:298,target 92 + 91:298,target 66 + 6:307 reduce + 17:0 reduce + 0:321,target 7 + 6:298 reduce + 6:308 reduce + 6:299 reduce + 6:309 reduce + 6:310 reduce + 1:304,target 70 + 6:311 reduce + 12:311,target 27 + 6:312 reduce + 6:313 reduce + 60:0 reduce + 59:0 reduce + 6:314 reduce + 84:0,target 24 + 29:262,target 66 + 53:0,target 31 + 9:314,target 78 + 47:333 goto + 22:0,target 58 + 32:340,target 89 + 7:305,target 76 + 34:296,target 40 + 83:298 reduce + 4:313,target 73 + 0:337,target 11 + 46:298,target 57 + 92:298,target 55 + 53:298 reduce + 2:304,target 71 + 13:311,target 48 + 23:295 shift + 23:296 shift + 90:290,target 56 + 90:289,target 55 + 29:278,target 82 + 74:0 reduce + 6:0 reduce + 7:0,target 76 + 8:305,target 77 + 81:0,target 21 + 35:296,target 41 + 5:313,target 74 + 32:314,target 30 + 50:0,target 28 + 93:298,target 37 + 3:304,target 72 + 23:334 goto + 91:290,target 56 + 91:289,target 55 + 0:312,target 45 + 46:0 reduce + 88:298 reduce + 12:302,target 18 + 27:286,target 52 + 28:291 shift + 88:0 reduce + 58:298 reduce + 28:294 shift + 20:328,target 43 + 49:334,target 97 + 9:305,target 78 + 97:291,target 93 + 6:313,target 75 + 48:298,target 56 + 94:298,target 38 + 34:287,target 40 + 4:304,target 73 + 4:0,target 73 + 77:0,target 17 + 1:312,target 70 + 13:302,target 48 + 46:0,target 57 + 61:0 reduce + 29:269,target 73 + 29:270,target 74 + 15:0,target 50 + 28:332 goto + 34:284 reduce + 34:285 reduce + 37:296,target 35 + 34:286 reduce + 94:298 reduce + 34:287 reduce + 7:313,target 76 + 34:288 reduce + 34:289 reduce + 34:290 reduce + 34:291 reduce + 50:298,target 28 + 95:298,target 39 + 34:292 reduce + 35:287,target 41 + 64:298 reduce + 34:293 reduce + 5:304,target 74 + 34:295 reduce + 32:305,target 21 + 34:296 reduce + 34:298 reduce + 2:312,target 71 + 33:0 reduce + 0:303,target 45 + 75:0 reduce + 1:0,target 70 + 74:0,target 14 + 7:0 reduce + 8:313,target 77 + 51:298,target 29 + 96:298,target 60 + 6:304,target 75 + 3:312,target 72 + 99:298 reduce + 0:320,target 6 + 0:319,target 5 + 70:298 reduce + 69:298 reduce + 1:303,target 70 + 12:299,target 15 + 12:309,target 25 + 12:310,target 26 + 29:261,target 65 + 39:298 reduce + 40:298 reduce + 90:0 reduce + 89:0 reduce + 9:313,target 78 + 52:298,target 30 + 47:333,target 96 + 7:304,target 76 + 34:295,target 40 + 71:0,target 11 + 29:330,target 88 + 4:312,target 73 + 19:0 reduce + 2:303,target 71 + 13:299,target 48 + 13:309,target 48 + 13:310,target 48 + 28:294,target 59 + 90:288,target 54 + 29:277,target 81 + 62:0 reduce + 53:298,target 31 + 98:298,target 69 + 75:298 reduce + 8:304,target 77 + 35:295,target 41 + 45:298 shift + 5:312,target 74 + 4:300 reduce + 32:313,target 29 + 4:301 reduce + 4:302 reduce + 15:298 reduce + 4:303 reduce + 4:304 reduce + 98:0,target 69 + 4:305 reduce + 3:303,target 72 + 4:306 reduce + 4:307 reduce + 91:288,target 54 + 4:308 reduce + 4:298 reduce + 34:0 reduce + 67:0,target 7 + 4:309 reduce + 4:299 reduce + 0:311,target 45 + 4:310 reduce + 4:311 reduce + 4:312 reduce + 12:301,target 17 + 4:313 reduce + 27:285,target 51 + 4:314 reduce + 76:0 reduce + 54:298,target 32 + 99:298,target 67 + 8:0 reduce + 20:327,target 42 + 9:304,target 78 + 6:312,target 75 + 34:286,target 40 + 81:298 reduce + 4:303,target 73 +} + +array set sia::rules { + 9,l 330 + 11,l 330 + 32,l 331 + 53,l 340 + 74,l 342 + 6,l 330 + 28,l 331 + 50,l 340 + 49,l 337 + 71,l 342 + 3,l 330 + 25,l 330 + 46,l 337 + 67,l 341 + 0,l 344 + 22,l 330 + 43,l 336 + 64,l 340 + 18,l 330 + 40,l 334 + 39,l 333 + 61,l 340 + 82,l 343 + 15,l 330 + 36,l 332 + 57,l 340 + 78,l 342 + 12,l 330 + 33,l 331 + 54,l 340 + 75,l 342 + 7,l 330 + 29,l 331 + 30,l 331 + 51,l 340 + 72,l 342 + 4,l 330 + 26,l 330 + 47,l 337 + 68,l 341 + 1,l 330 + 23,l 330 + 44,l 335 + 65,l 340 + 19,l 330 + 20,l 330 + 41,l 334 + 62,l 340 + 83,l 343 + 16,l 330 + 37,l 333 + 58,l 340 + 80,l 343 + 79,l 343 + 13,l 330 + 34,l 331 + 55,l 340 + 76,l 342 + 8,l 330 + 10,l 330 + 31,l 331 + 52,l 340 + 73,l 342 + 5,l 330 + 27,l 330 + 48,l 339 + 70,l 342 + 69,l 341 + 2,l 330 + 24,l 330 + 45,l 338 + 66,l 341 + 21,l 330 + 42,l 335 + 63,l 340 + 84,l 343 + 17,l 330 + 38,l 333 + 60,l 340 + 59,l 340 + 81,l 343 + 14,l 330 + 35,l 332 + 56,l 340 + 77,l 342 +} + +array set sia::rules { + 63,dc 2 + 12,dc 1 + 77,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 3 + 70,dc 1 + 69,dc 3 + 18,dc 1 + 84,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 2 + 11,dc 1 + 76,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 1 + 68,dc 2 + 17,dc 1 + 83,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 61,dc 4 + 10,dc 1 + 75,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 2 + 67,dc 3 + 16,dc 1 + 82,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 0 + 60,dc 3 + 59,dc 1 + 74,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 1 + 66,dc 2 + 15,dc 1 + 81,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 3 + 58,dc 1 + 73,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 65,dc 1 + 14,dc 1 + 80,dc 1 + 79,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 0 + 57,dc 2 + 72,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 1 + 49,dc 3 + 64,dc 2 + 13,dc 1 + 78,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 2 + 71,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 0 +} + +array set sia::rules { + 41,line 187 + 7,line 148 + 37,line 182 + 4,line 145 + 34,line 176 + 1,line 142 + 31,line 173 + 27,line 168 + 83,line 239 + 24,line 165 + 80,line 236 + 79,line 235 + 21,line 162 + 76,line 230 + 17,line 158 + 73,line 227 + 43,e 1 + 14,line 155 + 70,line 224 + 69,line 221 + 11,line 152 + 66,line 218 + 63,line 213 + 60,line 210 + 59,line 208 + 56,line 205 + 53,line 202 + 50,line 199 + 49,line 196 + 46,line 194 + 43,line 190 + 9,line 150 + 40,line 186 + 39,line 184 + 6,line 147 + 36,line 179 + 3,line 144 + 33,line 175 + 29,line 171 + 30,line 172 + 26,line 167 + 82,line 238 + 23,line 164 + 78,line 232 + 19,line 160 + 20,line 161 + 75,line 229 + 16,line 157 + 72,line 226 + 13,line 154 + 68,line 220 + 10,line 151 + 65,line 215 + 62,line 212 + 58,line 207 + 55,line 204 + 52,line 201 + 48,line 195 + 45,line 193 + 42,line 190 + 8,line 149 + 38,line 183 + 5,line 146 + 35,line 178 + 2,line 143 + 32,line 174 + 48,e 1 + 28,line 170 + 84,line 240 + 25,line 166 + 81,line 237 + 22,line 163 + 77,line 231 + 45,e 0 + 18,line 159 + 74,line 228 + 15,line 156 + 71,line 225 + 12,line 153 + 67,line 219 + 64,line 214 + 61,line 211 + 57,line 206 + 54,line 203 + 51,line 200 + 47,line 195 + 44,line 191 +} + +array set sia::lr1_table { + 35 {{41 {295 296} 1}} + 66,trans {} + 36 {{68 {0 298} 1} {69 {0 298} 1}} + 85,trans {} + 37 {{66 {0 298} 1} {67 {0 298} 1} {40 {0 284 285 286 287 288 289 290 298} 0} {41 {0 284 285 286 287 288 289 290 298} 0}} + 38 {{53 {0 298} 2}} + 39 {{79 298 1}} + 40 {{80 298 1}} + 41 {{81 298 1}} + 42 {{82 298 1}} + 43 {{83 298 1}} + 44 {{84 298 1}} + 45 {{55 {0 298} 2}} + 46 {{57 {0 298} 2}} + 47 {{40 {291 292 293} 1}} + 48 {{41 {291 292 293} 1}} + 49 {{60 {0 298} 2} {37 {0 298} 0} {38 {0 298} 0} {39 {0 298} 0}} + 50 {{56 {0 298} 2}} + 27,trans {{284 52} {285 53} {286 54} {287 55} {288 56} {289 57} {290 58} {331 59}} + 51 {{61 {0 298} 2} {40 {291 292 293} 0} {41 {291 292 293} 0}} + 46,trans {} + 52 {{28 {0 298} 1}} + 65,trans {} + 53 {{29 {0 298} 1}} + 84,trans {} + 54 {{30 {0 298} 1}} + 55 {{31 {0 298} 1}} + 56 {{32 {0 298} 1}} + 57 {{33 {0 298} 1}} + 58 {{34 {0 298} 1}} + 59 {{62 {0 298} 2}} + 60 {{35 {0 298} 1}} + 61 {{36 {0 298} 1}} + 62 {{63 {0 298} 2}} + 63 {{1 {0 298} 1}} + 64 {{2 {0 298} 1}} + 65 {{3 {0 298} 1}} + 26,trans {{295 34} {296 35} {334 51}} + 66 {{4 {0 298} 1}} + 67 {{5 {0 298} 1}} + 45,trans {{298 96}} + 68 {{6 {0 298} 1}} + 64,trans {} + 69 {{7 {0 298} 1}} + 70 {{8 {0 298} 1}} + 83,trans {} + 71 {{9 {0 298} 1}} + 72 {{10 {0 298} 1}} + 73 {{11 {0 298} 1}} + 74 {{12 {0 298} 1}} + 75 {{13 {0 298} 1}} + 76 {{14 {0 298} 1}} + 77 {{15 {0 298} 1}} + 78 {{16 {0 298} 1}} + 79 {{17 {0 298} 1}} + 80 {{18 {0 298} 1}} + 81 {{19 {0 298} 1}} + 82 {{20 {0 298} 1}} + 25,trans {{298 50}} + 83 {{21 {0 298} 1}} + 84 {{22 {0 298} 1}} + 44,trans {} + 85 {{23 {0 298} 1}} + 63,trans {} + 86 {{24 {0 298} 1}} + 82,trans {} + 87 {{25 {0 298} 1}} + 0 {{0 0 0} {42 0 0} {44 0 0} {46 {0 298} 0} {47 {0 298} 0} {49 {0 298} 0} {45 {299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {70 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {71 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {72 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {73 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {74 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {75 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {76 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {77 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0} {78 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0}} + 88 {{26 {0 298} 1}} + 1 {{70 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 89 {{27 {0 298} 1}} + 90 {{64 {0 298} 2}} + 2 {{71 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 91 {{49 {0 298} 3}} + 3 {{72 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 92 {{68 {0 298} 2} {69 {0 298} 2} {28 {0 298} 0} {29 {0 298} 0} {30 {0 298} 0} {31 {0 298} 0} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0}} + 4 {{73 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 93 {{40 {0 284 285 286 287 288 289 290 298} 1}} + 5 {{74 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 94 {{41 {0 284 285 286 287 288 289 290 298} 1}} + 6 {{75 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 95 {{66 {0 298} 2} {67 {0 298} 2} {28 {0 298} 0} {29 {0 298} 0} {30 {0 298} 0} {31 {0 298} 0} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0}} + 7 {{76 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 96 {{55 {0 298} 3}} + 8 {{77 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 97 {{37 {0 298} 1}} + 9 {{78 {0 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 1}} + 98 {{38 {0 298} 1}} + 24,trans {} + 99 {{39 {0 298} 1}} + 43,trans {} + 62,trans {} + 81,trans {} + 99,trans {} + 23,trans {{295 47} {296 48} {334 49}} + 42,trans {} + 61,trans {} + 79,trans {} + 80,trans {} + 98,trans {} + 9,trans {} + 22,trans {} + 41,trans {} + 59,trans {} + 60,trans {} + 78,trans {} + 97,trans {} + 8,trans {} + 100 {{60 {0 298} 3}} + 101 {{61 {0 298} 3} {37 {0 298} 0} {38 {0 298} 0} {39 {0 298} 0}} + 102 {{69 {0 298} 3}} + 103 {{67 {0 298} 3}} + 104 {{61 {0 298} 4}} + 21,trans {{298 46}} + 39,trans {} + 40,trans {} + 58,trans {} + 77,trans {} + 96,trans {} + 7,trans {} + 19,trans {} + 20,trans {{324 39} {325 40} {326 41} {327 42} {328 43} {329 44} {343 45}} + 38,trans {} + 57,trans {} + 76,trans {} + 95,trans {{284 52} {285 53} {286 54} {287 55} {288 56} {289 57} {290 58} {331 103}} + 6,trans {} + 18,trans {{295 34} {296 35} {297 36} {334 37} {341 38}} + 37,trans {{295 93} {296 94} {334 95}} + 56,trans {} + 75,trans {} + 94,trans {} + 5,trans {} + 17,trans {} + 36,trans {{297 92}} + 55,trans {} + 74,trans {} + 93,trans {} + 4,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 73,trans {} + 92,trans {{284 52} {285 53} {286 54} {287 55} {288 56} {289 57} {290 58} {331 102}} + 3,trans {} + 15,trans {} + 34,trans {} + 53,trans {} + 72,trans {} + 91,trans {} + 2,trans {} + 104,trans {} + 14,trans {{298 33}} + 33,trans {} + 52,trans {} + 71,trans {} + 90,trans {} + 1,trans {} + 89,trans {} + 103,trans {} + 13,trans {{339 32}} + 32,trans {{299 15} {300 16} {301 17} {302 18} {303 19} {304 20} {305 21} {306 22} {307 23} {308 24} {309 25} {310 26} {311 27} {312 28} {313 29} {314 30} {340 91}} + 51,trans {{295 47} {296 48} {334 101}} + 69,trans {} + 70,trans {} + 0,trans {{315 1} {316 2} {317 3} {318 4} {319 5} {320 6} {321 7} {322 8} {323 9} {335 10} {337 11} {338 12} {342 13}} + 88,trans {} + 102,trans {} + 12,trans {{299 15} {300 16} {301 17} {302 18} {303 19} {304 20} {305 21} {306 22} {307 23} {308 24} {309 25} {310 26} {311 27} {312 28} {313 29} {314 30} {340 31}} + 31,trans {} + 49,trans {{291 97} {292 98} {293 99} {333 100}} + 50,trans {} + 68,trans {} + 87,trans {} + 101,trans {{291 97} {292 98} {293 99} {333 104}} + 10 {{0 0 1}} + 11 {{42 0 1} {44 0 1} {43 298 0}} + 12 {{46 {0 298} 1} {50 {0 298} 0} {51 {0 298} 0} {52 {0 298} 0} {53 {0 298} 0} {54 {0 298} 0} {55 {0 298} 0} {56 {0 298} 0} {57 {0 298} 0} {58 {0 298} 0} {59 {0 298} 0} {60 {0 298} 0} {61 {0 298} 0} {62 {0 298} 0} {63 {0 298} 0} {64 {0 298} 0} {65 {0 298} 0}} + 13 {{47 {0 298} 1} {49 {0 298} 1} {48 {299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314} 0}} + 14 {{44 0 2}} + 15 {{50 {0 298} 1}} + 11,trans {{336 14}} + 16 {{52 {0 298} 1}} + 29,trans {{257 63} {258 64} {259 65} {260 66} {261 67} {262 68} {263 69} {264 70} {265 71} {266 72} {267 73} {268 74} {269 75} {270 76} {271 77} {272 78} {273 79} {274 80} {275 81} {276 82} {277 83} {278 84} {279 85} {280 86} {281 87} {282 88} {283 89} {330 90}} + 30,trans {} + 17 {{51 {0 298} 1}} + 48,trans {} + 18 {{53 {0 298} 1} {66 {0 298} 0} {67 {0 298} 0} {68 {0 298} 0} {69 {0 298} 0} {40 {295 296} 0} {41 {295 296} 0}} + 67,trans {} + 20 {{55 {0 298} 1} {79 298 0} {80 298 0} {81 298 0} {82 298 0} {83 298 0} {84 298 0}} + 19 {{54 {0 298} 1}} + 86,trans {} + 21 {{57 {0 298} 1}} + 22 {{58 {0 298} 1}} + 100,trans {} + 23 {{60 {0 298} 1} {40 {291 292 293} 0} {41 {291 292 293} 0}} + 24 {{59 {0 298} 1}} + 25 {{56 {0 298} 1}} + 26 {{61 {0 298} 1} {40 {295 296} 0} {41 {295 296} 0}} + 27 {{62 {0 298} 1} {28 {0 298} 0} {29 {0 298} 0} {30 {0 298} 0} {31 {0 298} 0} {32 {0 298} 0} {33 {0 298} 0} {34 {0 298} 0}} + 28 {{63 {0 298} 1} {35 {0 298} 0} {36 {0 298} 0}} + 30 {{65 {0 298} 1}} + 29 {{64 {0 298} 1} {1 {0 298} 0} {2 {0 298} 0} {3 {0 298} 0} {4 {0 298} 0} {5 {0 298} 0} {6 {0 298} 0} {7 {0 298} 0} {8 {0 298} 0} {9 {0 298} 0} {10 {0 298} 0} {11 {0 298} 0} {12 {0 298} 0} {13 {0 298} 0} {14 {0 298} 0} {15 {0 298} 0} {16 {0 298} 0} {17 {0 298} 0} {18 {0 298} 0} {19 {0 298} 0} {20 {0 298} 0} {21 {0 298} 0} {22 {0 298} 0} {23 {0 298} 0} {24 {0 298} 0} {25 {0 298} 0} {26 {0 298} 0} {27 {0 298} 0}} + 31 {{46 {0 298} 2}} + 32 {{49 {0 298} 2} {50 {0 298} 0} {51 {0 298} 0} {52 {0 298} 0} {53 {0 298} 0} {54 {0 298} 0} {55 {0 298} 0} {56 {0 298} 0} {57 {0 298} 0} {58 {0 298} 0} {59 {0 298} 0} {60 {0 298} 0} {61 {0 298} 0} {62 {0 298} 0} {63 {0 298} 0} {64 {0 298} 0} {65 {0 298} 0}} + 10,trans {} + 33 {{44 0 3}} + 28,trans {{291 60} {294 61} {332 62}} + 34 {{40 {295 296} 1}} + 47,trans {} +} + +array set sia::token_id_table { + 286 FK5_ + 286,t 0 + 287 J2000_ + 292,line 44 + 302,line 61 + 288 ICRS_ + 317,t 0 + 265,title WCSH + 289 GALACTIC_ + 290 ECLIPTIC_ + 300 CLEAR_ + 284,title FK4 + 291 DEGREES_ + 301 CLOSE_ + 313,title SYSTEM + 292 ARCMIN_ + 302 COORDINATE_ + 338,t 1 + 332,title {} + 288,line 39 + 293 ARCSEC_ + 303 CROSSHAIR_ + 294 SEXAGESIMAL_ + 304 EXPORT_ + 305 NAME_ + 295 INT_ + 306 PRINT_ + 296 REAL_ + 307 RADIUS_ + 262,t 0 + 297 SEXSTR_ + 308 RETRIEVE_ + 285,line 36 + 298 STRING_ + 310 SIZE_ + 309 SAVE_ + 299 CANCEL_ + 311 SKY_ + 283,t 0 + 312 SKYFORMAT_ + 313 SYSTEM_ + 314,t 0 + 314 UPDATE_ + 282,line 32 + 315 2MASS_ + 316 AKARI_ + 264,title WCSG + 335,t 1 + 317 ASTROWISE_ + 283,title WCSZ + 318 CADC_ + 312,title SKYFORMAT + 331,title {} + 320 MAST_ + 319 CXC_ + 278,line 28 + error,line 140 + 321 SDSS_ + 344,line 241 + 322 SKYVIEW_ + 258,t 0 + 323 TGSSADR_ + 324 XML_ + 325 VOT_ + 275,line 25 + 279,t 0 + 280,t 0 + 326 SB_ + 341,line 217 + 327 STARBASE_ + 328 CSV_ + 311,t 0 + 330 wcssys + 329 TSV_ + 331 skyframe + 272,line 22 + 332,t 1 + 332 skyformat + 337,line 193 + 333 rformat + 263,title WCSF + 334 numeric + 282,title WCSY + 335 command + 311,title SKY + 336 @PSEUDO1 + 330,title {} + 329,title TSV + 268,line 18 + 337 sia + 338 @PSEUDO2 + 334,line 185 + 340 siaCmd + 339 @PSEUDO3 + 276,t 0 + 341 coordinate + 342 site + 265,line 15 + 343 writer + 307,t 0 + 297,t 0 + 344 start' + 331,line 169 + 328,t 0 + 262,line 12 + 0,t 0 + 0 {$} + 327,line 88 + 262,title WCSE + 281,title WCSX + error,t 0 + 310,title SIZE + 309,title SAVE + 299,title CANCEL + 328,title CSV + 258,line 8 + 273,t 0 + 324,line 85 + 294,t 0 + 304,t 0 + 325,t 0 + 321,line 81 + 317,line 77 + 261,title WCSD + 279,title WCSV + 280,title WCSW + 308,title RETRIEVE + 269,t 0 + 270,t 0 + 298,title string + 327,title STARBASE + 314,line 73 + 291,t 0 + 301,t 0 + 322,t 0 + 311,line 70 + 343,t 1 + 307,line 66 + 266,t 0 + 260,title WCSC + 259,title WCSB + 297,line 52 + 278,title WCSU + 307,title RADIUS + 297,title sexagesimal + 326,title SB + 287,t 0 + 294,line 47 + 304,line 63 + 318,t 0 + 340,t 1 + 339,t 1 + error,title {} + 291,line 43 + 301,line 60 + 263,t 0 + 258,title WCSA + 287,line 38 + 277,title WCST + 284,t 0 + 306,title PRINT + 296,title float + 325,title VOT + 344,title {} + 315,t 0 + 284,line 35 + 336,t 1 + 281,line 31 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title WCS + 277,line 27 + 276,title WCSS + 343,line 234 + 312,t 0 + 305,title NAME + 295,title integer + 324,title XML + 343,title {} + 333,t 1 + 274,line 24 + 340,line 198 + 339,line 195 + 271,line 21 + 336,line 190 + 277,t 0 + 308,t 0 + 267,line 17 + 298,t 0 + 275,title WCSR + 333,line 181 + 294,title SEXAGESIMAL + 304,title EXPORT + 330,t 1 + 329,t 0 + 323,title TGSSADR + 342,title {} + 264,line 14 + 330,line 141 + 329,line 90 + 261,line 11 + 274,t 0 + 326,line 87 + 305,t 0 + 295,t 0 + 257,line 7 + 326,t 0 + 274,title WCSQ + 323,line 83 + 293,title ARCSEC + 303,title CROSSHAIR + 322,title SKYVIEW + 341,title {} + 320,line 80 + 319,line 79 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 76 + 323,t 0 + 273,title WCSP + 344,t 1 + 313,line 72 + 292,title ARCMIN + 302,title COORDINATE + 321,title SDSS + 340,title {} + 339,title {} + 267,t 0 + 310,line 69 + 309,line 68 + 299,line 58 + 288,t 0 + 320,t 0 + 319,t 0 + 306,line 65 + 296,line 50 + 341,t 1 + 272,title WCSO + 291,title DEGREES + 293,line 45 + 301,title CLOSE + 303,line 62 + 320,title MAST + 319,title CXC + 338,title {} + 264,t 0 + 285,t 0 + 289,line 40 + 290,line 41 + 300,line 59 + 316,t 0 + 286,line 37 + 337,t 1 + 271,title WCSN + 261,t 0 + 283,line 33 + 289,title GALACTIC + 290,title ECLIPTIC + 300,title CLEAR + 318,title CADC + 337,title {} + 282,t 0 + 279,line 29 + 280,line 30 + 313,t 0 + 334,t 1 + 276,line 26 + 342,line 223 + 257,t 0 + 269,title WCSL + 270,title WCSM + 273,line 23 + 288,title ICRS + 317,title ASTROWISE + 278,t 0 + 338,line 193 + 336,title {} + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 19 + 270,line 20 + 335,line 189 + 331,t 1 + 266,line 16 + 332,line 177 + 268,title WCSK + 275,t 0 + 263,line 13 + 287,title J2000 + 316,title AKARI + 335,title {} + 328,line 89 + 306,t 0 + 296,t 0 + 327,t 0 + 260,line 10 + 259,line 9 + 325,line 86 + 322,line 82 + 272,t 0 + 267,title WCSJ + 257 WCS_ + 286,title FK5 + 293,t 0 + 303,t 0 + 315,title 2MASS + 258 WCSA_ + 334,title {} + 318,line 78 + 260 WCSC_ + 259 WCSB_ + 324,t 0 + 261 WCSD_ + 262 WCSE_ + 263 WCSF_ + 264 WCSG_ + 315,line 75 + 265 WCSH_ + 266 WCSI_ + 267 WCSJ_ + 268,t 0 + 268 WCSK_ + 269 WCSL_ + 270 WCSM_ + 312,line 71 + 271 WCSN_ + 272 WCSO_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSI + 273 WCSP_ + 274 WCSQ_ + 285,title B1950 + 321,t 0 + 314,title UPDATE + 275 WCSR_ + 333,title {} + 308,line 67 + 276 WCSS_ + 298,line 54 + 277 WCST_ + 342,t 1 + 278 WCSU_ + 279 WCSV_ + 280 WCSW_ + 281 WCSX_ + 305,line 64 + 282 WCSY_ + 295,line 49 + 265,t 0 + 283 WCSZ_ + 284 FK4_ + 285 B1950_ +} + +proc sia::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 } + 28 { set _ fk4 } + 29 { set _ fk4 } + 30 { set _ fk5 } + 31 { set _ fk5 } + 32 { set _ icrs } + 33 { set _ galactic } + 34 { set _ ecliptic } + 35 { set _ degrees } + 36 { set _ sexagesimal } + 37 { set _ degrees } + 38 { set _ arcmin } + 39 { set _ arcsec } + 40 { set _ $1 } + 41 { set _ $1 } + 43 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 45 { if {![SIACmdCheck]} {sia::YYABORT} } + 47 { SIACmdRef $1 } + 48 { SIACmdRef $1 } + 50 { ProcessCmdCVAR0 ARCancel } + 51 { ProcessCmdCVAR0 SIADestroy } + 52 { ProcessCmdCVAR0 SIAOff } + 54 { ProcessCmdCVAR0 IMGSVRCrosshair } + 55 { SIACmdSave $3 $2 } + 56 { SIACmdSave $2 VOTWrite } + 57 { ProcessCmdCVAR name $2 } + 58 { ProcessCmdCVAR0 CATPrint } + 59 { global cvarname; SIAApply $cvarname 1 } + 60 { SIACmdSize $2 $3 } + 61 { SIACmdSize [expr ($2+$3)/2.] $4 } + 62 { SIACmdSkyframe $2 } + 63 { ProcessCmdCVAR skyformat $2 } + 64 { SIACmdSystem $2 } + 65 { ProcessCVAR0 IMGSVRUpdate } + 66 { SIACmdCoord $1 $2 fk5 } + 67 { SIACmdCoord $1 $2 $3 } + 68 { SIACmdCoord $1 $2 fk5 } + 69 { SIACmdCoord $1 $2 $3 } + 70 { set _ 2mass } + 71 { set _ akari } + 72 { set _ astrowise } + 73 { set _ cadc } + 74 { set _ cxc } + 75 { set _ mast } + 76 { set _ sdss } + 77 { set _ skyview } + 78 { set _ tgssadr } + 79 { set _ VOTWrite } + 80 { set _ VOTWrite } + 81 { set _ starbase_write } + 82 { set _ starbase_write } + 83 { set _ TSVWrite } + 84 { set _ TSVWrite } + } + 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 sia::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/skyviewlex.tcl b/ds9/parsers/skyviewlex.tcl new file mode 100644 index 0000000..e42fffa --- /dev/null +++ b/ds9/parsers/skyviewlex.tcl @@ -0,0 +1,599 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval skyview { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc skyview::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc skyview::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc skyview::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc skyview::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc skyview::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc skyview::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc skyview::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc skyview::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc skyview::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set PIXELS_ 284 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: pixels + if {[regexp -start $index_ -indices -line -nocase -- {\A(pixels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $PIXELS_ + } + 1 { +return $YES_ + } + 2 { +return $NO_ + } + 3 { +return $ON_ + } + 4 { +return $OFF_ + } + 5 { +return $TRUE_ + } + 6 { +return $FALSE_ + } + 7 { +return $CLEAR_ + } + 8 { +return $CLOSE_ + } + 9 { +return $COORD_ + } + 10 { +return $CROSSHAIR_ + } + 11 { +return $CURRENT_ + } + 12 { +return $FRAME_ + } + 13 { +return $NAME_ + } + 14 { +return $NEW_ + } + 15 { +return $OPEN_ + } + 16 { +return $SAVE_ + } + 17 { +return $SIZE_ + } + 18 { +return $SURVEY_ + } + 19 { +return $UPDATE_ + } + 20 { +return $DEGREES_ + } + 21 { +return $ARCMIN_ + } + 22 { +return $ARCSEC_ + } + 23 { +return $SEXAGESIMAL_ + } + 24 - + 25 { +set yylval $yytext; return $SEXSTR_ + } + 26 { +set yylval $yytext; return $INT_ + } + 27 - + 28 { +set yylval $yytext; return $REAL_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval $yytext; return $STRING_ + } + 33 { +# ignore whitespace + } + 34 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/skyviewparser.tab.tcl b/ds9/parsers/skyviewparser.tab.tcl new file mode 100644 index 0000000..7bc8f3c --- /dev/null +++ b/ds9/parsers/skyviewparser.tab.tcl @@ -0,0 +1,28 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set PIXELS_ 284 diff --git a/ds9/parsers/skyviewparser.tcl b/ds9/parsers/skyviewparser.tcl new file mode 100644 index 0000000..d8cf573 --- /dev/null +++ b/ds9/parsers/skyviewparser.tcl @@ -0,0 +1,995 @@ +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 skyview { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc skyview::YYABORT {} { + return -code return 1 +} + +proc skyview::YYACCEPT {} { + return -code return 0 +} + +proc skyview::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc skyview::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc skyview::yyerror {s} { + puts stderr $s +} + +proc skyview::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 skyview::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set skyview::table { + 9:283 shift + 10:280,target 37 + 30:283 reduce + 29:283 reduce + 38:281,target 11 + 27:0 reduce + 48:0 reduce + 3:267,target 20 + 51:283,target 38 + 38:281 shift + 38:282 shift + 7:283,target 1 + 41:287,target 50 + 0:275,target 9 + 11:282,target 19 + 40:283,target 49 + 39:283,target 8 + 6:266 shift + 7:262,target 33 + 56:0,target 13 + 6:268 shift + 24:0 reduce + 48:0,target 36 + 38:291 goto + 47:283 reduce + 41:0,target 10 + 45:0 reduce + 33:0,target 7 + 2:282,target 12 + 28:283,target 2 + 0:294,target 17 + 25:0,target 41 + 17:0,target 21 + 17:283 reduce + 0:273,target 7 + 56:283 reduce + 17:283,target 22 + 7:259,target 30 + 7:260,target 31 + 21:0 reduce + 14:291,target 38 + 26:283 reduce + 42:0 reduce + 17:293 goto + 52:283,target 16 + 2:280,target 18 + 0:292,target 16 + 6:295,target 27 + 12:282,target 20 + 35:281 shift + 35:282 shift + 41:283,target 10 + 0:271,target 5 + 11:277,target 19 + 6:295 goto + 7:257,target 28 + 17:0 reduce + 3:267 shift + 30:283,target 3 + 29:283,target 5 + 35:291 goto + 3:270 shift + 44:283 reduce + 43:290,target 56 + 8:281,target 11 + 35:282,target 12 + 14:281 shift + 14:282 shift + 53:0,target 17 + 0:268,target 3 + 45:0,target 37 + 53:283 reduce + 37:0,target 10 + 15:291,target 39 + 39:276,target 47 + 30:0,target 3 + 29:0,target 5 + 22:0,target 33 + 53:283,target 17 + 9:283,target 36 + 14:291 goto + 4:263,target 23 + 23:283 reduce + 56:0 reduce + 42:283,target 8 + 3:289 goto + 12:277,target 20 + 38:291,target 46 + 32:283 reduce + 11:0 reduce + 31:283,target 6 + 0:264 shift + 32:0 reduce + 0:265 shift + 41:279 shift + 53:0 reduce + 0:268 shift + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 20:283,target 15 + 0:272 shift + 11:278 reduce + 0:273 shift + 0:274 shift + 11:281 reduce + 41:287 goto + 0:275 shift + 11:282 reduce + 0:264,target 1 + 11:283 reduce + 54:283,target 18 + 50:283 reduce + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 0:282 shift + 14:282,target 12 + 50:0 reduce + 49:0 reduce + 0:283 shift + 19:281 shift + 0:284 shift + 19:282 shift + 43:283,target 12 + 20:283 reduce + 50:0,target 39 + 49:0,target 23 + 0:283,target 13 + 19:281,target 11 + 42:0,target 8 + 17:293,target 40 + 34:0,target 32 + 8:281 shift + 26:0,target 40 + 0:291 goto + 8:282 shift + 32:283,target 4 + 0:292 goto + 11:0,target 19 + 19:291 goto + 0:294 goto + 25:0 reduce + 28:283 reduce + 46:0 reduce + 21:283,target 14 + 37:279 shift + 8:291 goto + 0:281,target 11 + 37:283 reduce + 42:276,target 47 + 0:0 reduce + 55:283,target 30 + 37:287 goto + 22:0 reduce + 15:282,target 12 + 46:283 reduce + 43:0 reduce + 37:279,target 44 + 8:291,target 35 + 44:283,target 11 + 1:283,target 26 + 43:278,target 54 + 33:283,target 7 + 55:283 reduce + 39:286,target 48 + 3:289,target 22 + 38:282,target 12 + 5:283 reduce + 54:0,target 18 + 39:0 reduce + 22:283,target 33 + 25:283 reduce + 46:0,target 31 + 31:0,target 6 + 23:0,target 28 + 43:276,target 52 + 11:283,target 19 + 56:283,target 13 + 34:283 reduce + 43:276 shift + 43:277 shift + 43:278 shift + 45:283,target 37 + 36:0 reduce + 43:283 reduce + 34:283,target 32 + 0:274,target 8 + 11:281,target 19 + 43:288 goto + 13:283 reduce + 43:290 goto + 7:261,target 32 + 12:0 reduce + 52:283 reduce + 2:280 shift + 2:281 shift + 23:283,target 28 + 33:0 reduce + 2:282 shift + 2:281,target 11 + 54:0 reduce + 19:291,target 42 + 22:283 reduce + 12:283,target 20 + 1:0,target 26 + 2:291 goto + 0:272,target 6 + 11:278,target 19 + 7:0 reduce + 51:0,target 38 + 31:283 reduce + 7:258,target 29 + 46:283,target 31 + 43:0,target 12 + 39:276 shift + 30:0 reduce + 29:0 reduce + 27:0,target 35 + 7:257 shift + 20:0,target 15 + 51:0 reduce + 7:258 shift + 12:0,target 20 + 0:291,target 15 + 7:259 shift + 7:260 shift + 8:282,target 12 + 7:261 shift + 42:286,target 51 + 40:283 shift + 39:283 reduce + 7:262 shift + 12:281,target 20 + 10:280 shift + 39:286 goto + 0:269,target 4 + 11:276,target 19 + 24:283,target 29 + 26:0 reduce + 48:283 reduce + 47:0 reduce + 18:280 shift + 43:288,target 55 + 13:283,target 27 + 35:281,target 11 + 12:278,target 20 + 1:0 reduce + 41:279,target 44 + 47:283,target 9 + 4:283,target 24 + 7:283 reduce + 23:0 reduce + 37:287,target 45 + 7:285 goto + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 36:283,target 34 + 55:0,target 30 + 12:276,target 20 + 47:0,target 9 + 36:283 reduce + 18:280,target 41 + 39:0,target 8 + 4:263 shift + 25:283,target 41 + 32:0,target 4 + 0:265,target 2 + 6:268,target 26 + 24:0,target 29 + 16:0,target 0 + 20:0 reduce + 41:0 reduce + 45:283 reduce + 0:284,target 14 + 15:281 shift + 19:282,target 12 + 15:282 shift + 48:283,target 36 + 5:283,target 25 + 54:283 reduce + 6:266,target 25 + 16:0 accept + 2:291,target 19 + 4:283 shift + 37:283,target 10 + 37:0 reduce + 15:291 goto + 14:281,target 11 + 24:283 reduce + 0:282,target 12 + 26:283,target 40 + 33:283 reduce + 13:0 reduce + 42:276 shift + 34:0 reduce + 55:0 reduce + 52:0,target 16 + 12:276 reduce + 44:0,target 11 + 42:283 reduce + 12:277 reduce + 36:0,target 34 + 12:278 reduce + 50:283,target 39 + 0:280,target 10 + 28:0,target 2 + 42:286 goto + 12:281 reduce + 21:0,target 14 + 12:282 reduce + 13:0,target 27 + 12:283 reduce + 51:283 reduce + 31:0 reduce + 15:281,target 11 + 1:283 reduce + 52:0 reduce + 35:291,target 43 + 3:270,target 21 + 21:283 reduce + 7:285,target 34 + 27:283,target 35 + 43:277,target 53 + 5:0 reduce +} + +array set skyview::rules { + 9,l 286 + 11,l 287 + 32,l 294 + 6,l 285 + 28,l 294 + 3,l 285 + 25,l 294 + 0,l 296 + 22,l 293 + 18,l 290 + 40,l 295 + 39,l 294 + 15,l 289 + 36,l 294 + 12,l 288 + 33,l 294 + 7,l 285 + 29,l 294 + 30,l 294 + 4,l 285 + 26,l 294 + 1,l 285 + 23,l 292 + 19,l 291 + 20,l 291 + 41,l 295 + 16,l 290 + 37,l 294 + 13,l 288 + 34,l 294 + 8,l 286 + 10,l 287 + 31,l 294 + 5,l 285 + 27,l 294 + 2,l 285 + 24,l 294 + 21,l 292 + 17,l 290 + 38,l 294 + 14,l 289 + 35,l 294 +} + +array set skyview::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 4 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 4 + 16,dc 1 + 31,dc 3 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 3 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 22,dc 0 + 36,dc 3 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 21,dc 1 + 35,dc 2 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 2 +} + +array set skyview::rules { + 41,line 147 + 7,line 90 + 37,line 141 + 4,line 87 + 34,line 136 + 1,line 84 + 31,line 133 + 27,line 128 + 24,line 125 + 21,line 121 + 17,line 114 + 22,e 1 + 14,line 109 + 11,line 102 + 9,line 98 + 40,line 146 + 39,line 143 + 6,line 89 + 36,line 139 + 3,line 86 + 33,line 135 + 29,line 130 + 30,line 132 + 26,line 127 + 23,line 122 + 19,line 117 + 20,line 118 + 16,line 113 + 13,line 106 + 10,line 101 + 8,line 97 + 38,line 142 + 5,line 88 + 35,line 138 + 2,line 85 + 32,line 134 + 28,line 129 + 25,line 126 + 22,line 121 + 18,line 115 + 15,line 110 + 12,line 105 +} + +array set skyview::lr1_table { + 35 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} + 14,trans {{281 11} {282 12} {291 38}} + 36 {{34 {0 283} 2}} + 33,trans {} + 37 {{37 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} + 52,trans {} + 38 {{31 {0 283} 2} {19 {0 283} 0} {20 {0 283} 0}} + 40 {{20 {0 276} 1}} + 39 {{19 {0 276} 1}} + 18,trans {{280 43}} + 41 {{36 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 1,trans {} + 37,trans {{279 48} {287 49}} + 42 {{23 0 2}} + 56,trans {} + 43 {{39 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 44 {{38 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 45 {{19 {0 276 277 278} 1}} + 23,trans {} + 5,trans {} + 42,trans {{283 55}} + 46 {{20 {0 276 277 278} 1}} + 61,trans {} + 47 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 48 {{11 {0 283} 1}} + 50 {{19 {0 283} 1}} + 49 {{37 {0 283} 3}} + 27,trans {} + 9,trans {{283 36}} + 46,trans {} + 51 {{20 {0 283} 1}} + 52 {{31 {0 283} 3}} + 53 {{9 {0 283} 1}} + 13,trans {} + 54 {{36 {0 283} 3}} + 32,trans {} + 51,trans {} + 55 {{23 0 3}} + 56 {{39 {0 283} 4}} + 57 {{38 {0 283} 4}} + 17,trans {{293 42}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {275 9} {280 10} {281 11} {282 12} {283 13} {284 14} {291 15} {292 16} {294 17}} + 58 {{16 {0 283} 1}} + 36,trans {} + 55,trans {} + 60 {{18 {0 283} 1}} + 59 {{17 {0 283} 1}} + 61 {{30 {0 283} 4}} + 62 {{13 {0 283} 1}} + 22,trans {} + 4,trans {{263 23} {283 24}} + 41,trans {{276 53} {286 54}} + 60,trans {} + 59,trans {} + 26,trans {} + 8,trans {{281 11} {282 12} {291 35}} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {{281 45} {282 46} {291 47}} + 54,trans {} + 21,trans {} + 3,trans {{267 20} {270 21} {289 22}} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{37 {0 283} 1}} + 11 {{19 {281 282} 1}} + 25,trans {} + 12 {{20 {281 282} 1}} + 7,trans {{257 28} {258 29} {259 30} {260 31} {261 32} {262 33} {285 34}} + 44,trans {{276 53} {286 57}} + 13 {{27 {0 283} 1}} + 14 {{31 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 11,trans {} + 15 {{36 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 30,trans {} + 29,trans {} + 16 {{0 0 1}} + 48,trans {} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {38 {0 283} 0} {39 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{21 0 1} {23 0 1} {22 283 0}} + 1 {{26 {0 283} 1}} + 18 {{39 {0 283} 2}} + 15,trans {{281 39} {282 40} {291 41}} + 2 {{38 {0 283} 1} {39 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{38 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 20 {{15 {0 283} 1}} + 34,trans {} + 3 {{33 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{14 {0 283} 1}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{33 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{28 {0 283} 2}} + 20,trans {} + 19,trans {{281 39} {282 40} {291 44}} + 6 {{35 {0 283} 1} {40 {0 283} 0} {41 {0 283} 0}} + 2,trans {{280 18} {281 11} {282 12} {291 19}} + 24 {{29 {0 283} 2}} + 38,trans {{281 50} {282 51} {291 52}} + 7 {{32 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{41 {0 283} 1}} + 57,trans {} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{40 {0 283} 1}} + 9 {{34 {0 283} 1}} + 27 {{35 {0 283} 2}} + 24,trans {} + 6,trans {{266 25} {268 26} {295 27}} + 28 {{2 {0 283} 1}} + 43,trans {{279 48} {287 56}} + 29 {{5 {0 283} 1}} + 30 {{3 {0 283} 1}} + 62,trans {} + 31 {{6 {0 283} 1}} + 10,trans {{280 37}} + 32 {{4 {0 283} 1}} + 28,trans {} + 33 {{7 {0 283} 1}} + 47,trans {{276 58} {277 59} {278 60} {288 61} {290 62}} + 34 {{32 {0 283} 2}} +} + +array set skyview::token_id_table { + 286,t 1 + 286 deg + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 292,line 120 + 287 sex + 270,t 0 + 269,t 0 + 288 sizeOpt + 290 rformat + 289 frame + 276,line 28 + 265,title COORD + 291,t 1 + 291 numeric + 284,title PIXELS + 292 command + 274,t 0 + 261,line 11 + 293 @PSEUDO1 + 288,line 104 + 257,t 0 + 294 skyview + 270,title NEW + 269,title NAME + 295,t 1 + 295 update + 288,title {} + 273,line 24 + 296 start' + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 83 + 274,title SIZE + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 124 + 283,title string + 292,t 1 + 278,line 30 + error,line 82 + 275,t 0 + 268,title FRAME + 287,title {} + 258,t 0 + 263,line 14 + 291,line 116 + error,title {} + 296,t 1 + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 100 + 258,title NO + 284,t 0 + 277,title ARCMIN + 296,title {} + 272,line 23 + 267,t 0 + 263,title CLEAR + 288,t 1 + 284,line 43 + 282,title float + 272,t 0 + 268,line 19 + 296,line 148 + 267,title CURRENT + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + 293,line 121 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 290,line 112 + 289,line 108 + 285,t 1 + 267 CURRENT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + error,t 0 + 271 OPEN_ + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 96 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title {} + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 281 INT_ + 267,line 18 + 295,line 145 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 PIXELS_ + 280,line 34 + 279,line 32 + 285 yesno + 261,title TRUE +} + +proc skyview::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dskyview 1 } + 26 { ARDestroy dskyview } + 27 { ProcessCmdSet dskyview name $1 "IMGSVRApply dskyview 1" } + 28 { ProcessCmdSet dskyview name {} } + 29 { ProcessCmdSet dskyview name $2 "IMGSVRApply dskyview 1" } + 30 { ProcessCmdSet4 dskyview width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet2 dskyview width,pixels $2 height,pixels $3 } + 32 { ProcessCmdSet dskyview save $2 } + 33 { ProcessCmdSet dskyview mode $2 } + 34 { ProcessCmdSet dskyview survey $2 } + 36 { ProcessCmdSet4 dskyview x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dskyview 1" } + 37 { ProcessCmdSet4 dskyview x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dskyview 1" } + 38 { ProcessCmdSet4 dskyview x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dskyview 1" } + 39 { ProcessCmdSet4 dskyview x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dskyview 1" } + 40 { IMGSVRUpdate dskyview; IMGSVRApply dskyview 1 } + 41 { IMGSVRCrosshair dskyview; IMGSVRApply dskyview 1 } + } + 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 skyview::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/skyviewsendlex.tcl b/ds9/parsers/skyviewsendlex.tcl new file mode 100644 index 0000000..7cfe9a2 --- /dev/null +++ b/ds9/parsers/skyviewsendlex.tcl @@ -0,0 +1,322 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval skyviewsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc skyviewsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc skyviewsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc skyviewsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc skyviewsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc skyviewsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc skyviewsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc skyviewsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc skyviewsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc skyviewsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 +set PIXELS_ 263 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: pixels + if {[regexp -start $index_ -indices -line -nocase -- {\A(pixels)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $PIXELS_ + } + 1 { +return $COORD_ + } + 2 { +return $FRAME_ + } + 3 { +return $NAME_ + } + 4 { +return $SAVE_ + } + 5 { +return $SIZE_ + } + 6 { +return $SURVEY_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/skyviewsendparser.tab.tcl b/ds9/parsers/skyviewsendparser.tab.tcl new file mode 100644 index 0000000..6464cd7 --- /dev/null +++ b/ds9/parsers/skyviewsendparser.tab.tcl @@ -0,0 +1,7 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 +set PIXELS_ 263 diff --git a/ds9/parsers/skyviewsendparser.tcl b/ds9/parsers/skyviewsendparser.tcl new file mode 100644 index 0000000..daf5cc9 --- /dev/null +++ b/ds9/parsers/skyviewsendparser.tcl @@ -0,0 +1,338 @@ +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 skyviewsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc skyviewsend::YYABORT {} { + return -code return 1 +} + +proc skyviewsend::YYACCEPT {} { + return -code return 0 +} + +proc skyviewsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc skyviewsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc skyviewsend::yyerror {s} { + puts stderr $s +} + +proc skyviewsend::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 skyviewsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set skyviewsend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 reduce + 0:264,target 8 + 0:258 shift + 8:0 accept + 5:0,target 6 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 7 + 0:258,target 2 + 0:262 shift + 0:263 shift + 0:0,target 1 + 0:261,target 5 + 0:264 goto + 2:0,target 4 + 0:263,target 7 + 4:0,target 3 + 0:0 reduce + 6:0,target 5 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 8:0,target 0 + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 8 + 5:0 reduce + 0:262,target 6 +} + +array set skyviewsend::rules { + 2,l 264 + 6,l 264 + 3,l 264 + 7,l 264 + 0,l 265 + 4,l 264 + 8,l 264 + 1,l 264 + 5,l 264 +} + +array set skyviewsend::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 6,dc 1 + 1,dc 0 + 4,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set skyviewsend::rules { + 7,line 28 + 4,line 25 + 1,line 22 + 6,line 27 + 3,line 24 + 8,line 29 + 5,line 26 + 2,line 23 +} + +array set skyviewsend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0}} + 1 {{8 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8}} + 5 {{6 0 1}} + 1,trans {} + 6 {{5 0 1}} + 2,trans {} + 3,trans {} + 7 {{7 0 1}} + 4,trans {} + 8 {{0 0 1}} + 5,trans {} + 6,trans {} + 7,trans {} + 8,trans {} +} + +array set skyviewsend::token_id_table { + 264,line 21 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title PIXELS + 264,title {} + error,t 0 + error error + 265,title {} + 258,line 8 + 261,line 11 + error,line 20 + 257 COORD_ + 257,t 0 + 263,line 17 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 265,line 30 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 0 + 263 PIXELS_ + 264,t 1 + 264 skyviewsend + 260,line 10 + 257,title COORD + 259,line 9 + 265,t 1 + 265 start' + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc skyviewsend::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 { ProcessSendCmdGet dskyview name } + 2 { ProcessSendCmdGet dskyview name } + 3 { ProcessSendCmdYesNo dskyview save } + 4 { ProcessSendCmdGet dskyview mode } + 5 { ProcessSendCmdGet dskyview survey } + 6 { ProcessSendCmdGet3 dskyview width height rformat } + 7 { ProcessSendCmdGet2 dskyview width,pixels height,pixels } + 8 { ProcessSendCmdGet3 dskyview x y skyformat } + } + 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 skyviewsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/sleeplex.tcl b/ds9/parsers/sleeplex.tcl new file mode 100644 index 0000000..1d47768 --- /dev/null +++ b/ds9/parsers/sleeplex.tcl @@ -0,0 +1,316 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval sleep { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc sleep::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc sleep::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc sleep::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc sleep::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc sleep::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc sleep::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc sleep::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc sleep::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc sleep::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval $yytext; return $INT_ + } + 1 - + 2 { +set yylval $yytext; return $REAL_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/sleepparser.tab.tcl b/ds9/parsers/sleepparser.tab.tcl new file mode 100644 index 0000000..86d5e78 --- /dev/null +++ b/ds9/parsers/sleepparser.tab.tcl @@ -0,0 +1,3 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 diff --git a/ds9/parsers/sleepparser.tcl b/ds9/parsers/sleepparser.tcl new file mode 100644 index 0000000..3c9dfc0 --- /dev/null +++ b/ds9/parsers/sleepparser.tcl @@ -0,0 +1,331 @@ +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 sleep { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc sleep::YYABORT {} { + return -code return 1 +} + +proc sleep::YYACCEPT {} { + return -code return 0 +} + +proc sleep::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc sleep::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc sleep::yyerror {s} { + puts stderr $s +} + +proc sleep::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 sleep::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set sleep::table { + 3:0,target 7 + 0:257 shift + 7:0 reduce + 0:258 shift + 5:0,target 3 + 0:259 reduce + 0:260 goto + 6:259,target 7 + 1:259 reduce + 0:261 goto + 7:0,target 5 + 2:259 reduce + 0:258,target 2 + 3:259 reduce + 0:263 goto + 0:0,target 6 + 1:259,target 1 + 0:261,target 4 + 5:259 reduce + 2:0,target 2 + 6:259 shift + 3:259,target 7 + 0:263,target 5 + 5:262 goto + 4:0,target 0 + 5:259,target 4 + 0:0 reduce + 1:0 reduce + 0:257,target 1 + 5:262,target 6 + 2:0 reduce + 3:0 reduce + 0:259,target 6 + 0:260,target 3 + 4:0 accept + 1:0,target 1 + 5:0 reduce + 2:259,target 2 +} + +array set sleep::rules { + 0,l 264 + 1,l 260 + 2,l 260 + 3,l 261 + 4,l 262 + 5,l 261 + 6,l 263 + 7,l 263 +} + +array set sleep::rules { + 5,dc 3 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 0 + 6,dc 0 + 1,dc 1 + 3,dc 1 +} + +array set sleep::rules { + 5,line 25 + 7,line 29 + 4,e 1 + 2,line 21 + 4,line 24 + 6,line 28 + 1,line 20 + 3,line 24 +} + +array set sleep::lr1_table { + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {1 {0 259} 0} {2 {0 259} 0}} + 1 {{1 {0 259} 1}} + 2 {{2 {0 259} 1}} + 3 {{7 {0 259} 1}} + 4 {{0 0 1}} + 0,trans {{257 1} {258 2} {260 3} {261 4} {263 5}} + 5 {{3 0 1} {5 0 1} {4 259 0}} + 1,trans {} + 2,trans {} + 6 {{5 0 2}} + 7 {{5 0 3}} + 3,trans {} + 4,trans {} + 5,trans {{262 6}} + 6,trans {{259 7}} + 7,trans {} +} + +array set sleep::token_id_table { + 264,line 30 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 23 + error,line 18 + 257 INT_ + 257,t 0 + 263,line 27 + 258 REAL_ + 258,t 0 + 260,t 1 + 260 numeric + error,title {} + 259 STRING_ + 259,t 0 + 261,t 1 + 261 command + 262,t 1 + 262 @PSEUDO1 + 257,line 7 + 263,t 1 + 263 sleep + 264,t 1 + 264 start' + 260,line 19 + 257,title integer + 259,line 10 + 258,title float + 262,line 24 + 260,title {} + 259,title string + 261,title {} +} + +proc sleep::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { after 1000 } + 7 { after [expr int($1*1000)] } + } + 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 sleep::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/smoothlex.tcl b/ds9/parsers/smoothlex.tcl new file mode 100644 index 0000000..e3b3e3a --- /dev/null +++ b/ds9/parsers/smoothlex.tcl @@ -0,0 +1,536 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval smooth { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc smooth::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc smooth::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc smooth::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc smooth::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc smooth::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc smooth::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc smooth::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc smooth::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc smooth::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set ANGLE_ 266 +set BOXCAR_ 267 +set CLOSE_ 268 +set ELLIPTIC_ 269 +set FUNCTION_ 270 +set GAUSSIAN_ 271 +set LOCK_ 272 +set MATCH_ 273 +set OPEN_ 274 +set RADIUS_ 275 +set RADIUSMINOR_ 276 +set SIGMA_ 277 +set SIGMAMINOR_ 278 +set TOPHAT_ 279 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: angle + if {[regexp -start $index_ -indices -line -nocase -- {\A(angle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: boxcar + if {[regexp -start $index_ -indices -line -nocase -- {\A(boxcar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: elliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(elliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: function + if {[regexp -start $index_ -indices -line -nocase -- {\A(function)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: gaussian + if {[regexp -start $index_ -indices -line -nocase -- {\A(gaussian)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: radius + if {[regexp -start $index_ -indices -line -nocase -- {\A(radius)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: radiusminor + if {[regexp -start $index_ -indices -line -nocase -- {\A(radiusminor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: sigma + if {[regexp -start $index_ -indices -line -nocase -- {\A(sigma)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: sigmaminor + if {[regexp -start $index_ -indices -line -nocase -- {\A(sigmaminor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: tophat + if {[regexp -start $index_ -indices -line -nocase -- {\A(tophat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ANGLE_ + } + 1 { +return $BOXCAR_ + } + 2 { +return $CLOSE_ + } + 3 { +return $ELLIPTIC_ + } + 4 { +return $FUNCTION_ + } + 5 { +return $GAUSSIAN_ + } + 6 { +return $LOCK_ + } + 7 { +return $MATCH_ + } + 8 { +return $OPEN_ + } + 9 { +return $RADIUS_ + } + 10 { +return $RADIUSMINOR_ + } + 11 { +return $SIGMA_ + } + 12 { +return $SIGMAMINOR_ + } + 13 { +return $TOPHAT_ + } + 14 { +return $YES_ + } + 15 { +return $NO_ + } + 16 { +return $ON_ + } + 17 { +return $OFF_ + } + 18 { +return $TRUE_ + } + 19 { +return $FALSE_ + } + 20 { +set yylval $yytext; return $INT_ + } + 21 - + 22 { +set yylval $yytext; return $REAL_ + } + 23 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 24 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 25 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 26 { +set yylval $yytext; return $STRING_ + } + 27 { +# ignore whitespace + } + 28 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/smoothparser.tab.tcl b/ds9/parsers/smoothparser.tab.tcl new file mode 100644 index 0000000..5a0d528 --- /dev/null +++ b/ds9/parsers/smoothparser.tab.tcl @@ -0,0 +1,23 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set ANGLE_ 266 +set BOXCAR_ 267 +set CLOSE_ 268 +set ELLIPTIC_ 269 +set FUNCTION_ 270 +set GAUSSIAN_ 271 +set LOCK_ 272 +set MATCH_ 273 +set OPEN_ 274 +set RADIUS_ 275 +set RADIUSMINOR_ 276 +set SIGMA_ 277 +set SIGMAMINOR_ 278 +set TOPHAT_ 279 diff --git a/ds9/parsers/smoothparser.tcl b/ds9/parsers/smoothparser.tcl new file mode 100644 index 0000000..4a33129 --- /dev/null +++ b/ds9/parsers/smoothparser.tcl @@ -0,0 +1,711 @@ +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 smooth { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc smooth::YYABORT {} { + return -code return 1 +} + +proc smooth::YYACCEPT {} { + return -code return 0 +} + +proc smooth::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc smooth::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc smooth::yyerror {s} { + puts stderr $s +} + +proc smooth::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 smooth::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set smooth::table { + 7:264,target 21 + 10:280,target 28 + 9:285 goto + 27:0 reduce + 10:258,target 2 + 17:265 reduce + 23:265,target 24 + 9:271,target 25 + 0:275,target 13 + 6:0,target 7 + 2:0 reduce + 6:265 reduce + 12:265,target 14 + 16:281,target 32 + 26:265 reduce + 24:0 reduce + 25:0,target 27 + 3:265,target 3 + 17:0,target 13 + 10:0,target 1 + 7:281,target 22 + 0:273,target 11 + 21:0 reduce + 24:265,target 25 + 14:263 shift + 3:265 reduce + 17:0 reduce + 23:265 reduce + 9:285,target 27 + 4:265,target 6 + 3:0,target 3 + 13:263,target 29 + 32:265 reduce + 0:268,target 8 + 29:0,target 19 + 30:0,target 20 + 22:0,target 23 + 25:265,target 27 + 0:257 shift + 0:258 shift + 11:265 reduce + 0:260 shift + 0:259 shift + 0:261 shift + 0:266,target 7 + 0:262 shift + 11:0 reduce + 0:265 reduce + 5:265,target 4 + 32:0 reduce + 0:266 shift + 19:265 reduce + 20:265 reduce + 0:268 shift + 0:270 shift + 19:283,target 33 + 0:272 shift + 14:263,target 30 + 0:273 shift + 0:274 shift + 8:265 reduce + 0:275 shift + 6:0 reduce + 0:276 shift + 28:265 reduce + 0:277 shift + 26:265,target 26 + 0:278 shift + 0:280 goto + 28:0 reduce + 0:0,target 1 + 0:282 goto + 0:284 goto + 19:283 goto + 34:0,target 12 + 3:0 reduce + 26:0,target 26 + 18:0,target 0 + 0:262,target 6 + 11:0,target 16 + 6:265,target 7 + 25:0 reduce + 16:263 shift + 16:264 shift + 15:263,target 20 + 0:0 reduce + 27:265,target 18 + 5:265 reduce + 0:260,target 4 + 0:259,target 3 + 22:0 reduce + 25:265 reduce + 10:262,target 6 + 16:281 goto + 0:278,target 16 + 4:0,target 6 + 0:257,target 1 + 18:0 accept + 10:259,target 3 + 10:260,target 4 + 16:263,target 20 + 13:263 shift + 31:0,target 21 + 23:0,target 24 + 0:276,target 14 + 28:265,target 17 + 7:263,target 20 + 2:265 reduce + 17:265,target 13 + 22:265 reduce + 10:257,target 1 + 9:269,target 24 + 0:274,target 12 + 8:265,target 15 + 31:265 reduce + 12:0 reduce + 10:257 shift + 10:258 shift + 10:259 shift + 10:260 shift + 10:261 shift + 8:0,target 15 + 9:267,target 23 + 10:262 shift + 29:265,target 19 + 30:265,target 20 + 1:0,target 2 + 0:272,target 10 + 10:265 reduce + 29:0 reduce + 30:0 reduce + 27:0,target 18 + 19:0,target 10 + 20:0,target 8 + 12:0,target 14 + 7:263 shift + 7:264 shift + 10:280 goto + 0:270,target 9 + 4:0 reduce + 27:265 reduce + 26:0 reduce + 31:265,target 21 + 1:0 reduce + 7:281 goto + 19:265,target 11 + 20:265,target 8 + 23:0 reduce + 5:0,target 4 + 15:263 shift + 15:264 shift + 0:265,target 1 + 32:0,target 22 + 4:265 reduce + 24:0,target 25 + 19:0 reduce + 20:0 reduce + 24:265 reduce + 32:265,target 22 + 9:279,target 26 + 0:284,target 19 + 15:281 goto + 33:265 shift + 21:265,target 9 + 10:265,target 1 + 15:264,target 21 + 0:282,target 18 + 12:265 reduce + 1:265,target 2 + 0:261,target 5 + 2:0,target 5 + 33:265,target 34 + 1:265 reduce + 34:0 reduce + 21:265 reduce + 22:265,target 23 + 0:280,target 17 + 28:0,target 17 + 21:0,target 9 + 8:0 reduce + 9:267 shift + 29:265 reduce + 30:265 reduce + 10:0 reduce + 0:258,target 2 + 9:269 shift + 11:265,target 16 + 9:271 shift + 15:281,target 31 + 31:0 reduce + 10:261,target 5 + 16:264,target 21 + 2:265,target 5 + 0:277,target 15 + 9:279 shift + 5:0 reduce +} + +array set smooth::rules { + 27,l 285 + 9,l 281 + 11,l 283 + 15,l 284 + 20,l 284 + 19,l 284 + 2,l 280 + 24,l 285 + 6,l 280 + 12,l 282 + 16,l 284 + 21,l 284 + 3,l 280 + 25,l 285 + 7,l 280 + 13,l 284 + 0,l 286 + 17,l 284 + 22,l 284 + 4,l 280 + 26,l 285 + 8,l 281 + 10,l 282 + 14,l 284 + 18,l 284 + 1,l 280 + 23,l 284 + 5,l 280 +} + +array set smooth::rules { + 23,dc 2 + 5,dc 1 + 0,dc 1 + 17,dc 2 + 12,dc 3 + 26,dc 1 + 8,dc 1 + 21,dc 2 + 3,dc 1 + 15,dc 1 + 10,dc 1 + 24,dc 1 + 6,dc 1 + 18,dc 2 + 1,dc 0 + 13,dc 1 + 27,dc 1 + 9,dc 1 + 22,dc 2 + 4,dc 1 + 16,dc 1 + 11,dc 0 + 25,dc 1 + 7,dc 1 + 20,dc 2 + 19,dc 2 + 2,dc 1 + 14,dc 1 +} + +array set smooth::rules { + 13,line 67 + 25,line 81 + 7,line 56 + 10,line 62 + 22,line 76 + 4,line 53 + 18,line 72 + 1,line 50 + 15,line 69 + 27,line 83 + 9,line 59 + 12,line 63 + 24,line 80 + 6,line 55 + 21,line 75 + 3,line 52 + 17,line 71 + 14,line 68 + 26,line 82 + 8,line 58 + 11,line 62 + 23,line 77 + 5,line 54 + 20,line 74 + 19,line 73 + 2,line 51 + 16,line 70 + 11,e 1 +} + +array set smooth::lr1_table { + 14,trans {{263 30}} + 33,trans {{265 34}} + 18,trans {} + 1,trans {} + 23,trans {} + 5,trans {} + 27,trans {} + 9,trans {{267 23} {269 24} {271 25} {279 26} {285 27}} + 13,trans {{263 29}} + 32,trans {} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {266 7} {268 8} {270 9} {272 10} {273 11} {274 12} {275 13} {276 14} {277 15} {278 16} {280 17} {282 18} {284 19}} + 22,trans {} + 4,trans {} + 26,trans {} + 8,trans {} + 12,trans {} + 31,trans {} + 16,trans {{263 20} {264 21} {281 32}} + 21,trans {} + 3,trans {} + 10 {{17 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 11 {{16 {0 265} 1}} + 25,trans {} + 12 {{14 {0 265} 1}} + 7,trans {{263 20} {264 21} {281 22}} + 13 {{19 {0 265} 1}} + 14 {{20 {0 265} 1}} + 15 {{21 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{22 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {18 {0 265} 0} {19 {0 265} 0} {20 {0 265} 0} {21 {0 265} 0} {22 {0 265} 0} {23 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 17 {{13 {0 265} 1}} + 1 {{2 {0 265} 1}} + 18 {{0 0 1}} + 2 {{5 {0 265} 1}} + 19 {{10 0 1} {12 0 1} {11 265 0}} + 20 {{8 {0 265} 1}} + 15,trans {{263 20} {264 21} {281 31}} + 34,trans {} + 3 {{3 {0 265} 1}} + 21 {{9 {0 265} 1}} + 4 {{6 {0 265} 1}} + 22 {{23 {0 265} 2}} + 5 {{4 {0 265} 1}} + 23 {{24 {0 265} 1}} + 20,trans {} + 19,trans {{283 33}} + 6 {{7 {0 265} 1}} + 2,trans {} + 24 {{25 {0 265} 1}} + 7 {{23 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 25 {{27 {0 265} 1}} + 8 {{15 {0 265} 1}} + 26 {{26 {0 265} 1}} + 9 {{18 {0 265} 1} {24 {0 265} 0} {25 {0 265} 0} {26 {0 265} 0} {27 {0 265} 0}} + 27 {{18 {0 265} 2}} + 24,trans {} + 6,trans {} + 28 {{17 {0 265} 2}} + 29 {{19 {0 265} 2}} + 30 {{20 {0 265} 2}} + 31 {{21 {0 265} 2}} + 32 {{22 {0 265} 2}} + 10,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {280 28}} + 28,trans {} + 33 {{12 0 2}} + 34 {{12 0 3}} +} + +array set smooth::token_id_table { + 286,t 1 + 286 start' + 280,title {} + 279,title TOPHAT + 264,line 15 + 270,t 0 + 269,t 0 + 276,line 31 + 265,title string + 284,title {} + 274,t 0 + 261,line 11 + 257,t 0 + 270,title FUNCTION + 269,title ELLIPTIC + 273,line 28 + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 79 + 274,title OPEN + 283,t 1 + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 278,title SIGMAMINOR + 282,line 61 + error error + 271,t 0 + 264,title float + 266,line 21 + 283,title {} + 278,line 33 + error,line 48 + 275,t 0 + 268,title CLOSE + 258,t 0 + 263,line 14 + error,title {} + 280,t 1 + 279,t 0 + 275,line 30 + 273,title MATCH + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 284,t 1 + 277,title SIGMA + 272,line 27 + 267,t 0 + 263,title integer + 284,line 66 + 282,title {} + 272,t 0 + 268,line 23 + 267,title BOXCAR + 286,title {} + 257 YES_ + 281,line 57 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title LOCK + 261 TRUE_ + 265,line 17 + 262 FALSE_ + 281,t 1 + 263 INT_ + 277,line 32 + 257,title YES + 264 REAL_ + 264,t 0 + 276,title RADIUSMINOR + 265 STRING_ + 262,line 12 + 266 ANGLE_ + 285,t 1 + 267 BOXCAR_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 CLOSE_ + 268,t 0 + 281,title {} + 274,line 29 + 270 FUNCTION_ + 269 ELLIPTIC_ + error,t 0 + 271 GAUSSIAN_ + 272 LOCK_ + 258,line 8 + 286,line 84 + 273,t 0 + 273 MATCH_ + 266,title ANGLE + 285,title {} + 274 OPEN_ + 275 RADIUS_ + 271,line 26 + 276 RADIUSMINOR_ + 277,t 0 + 277 SIGMA_ + 271,title GAUSSIAN + 283,line 62 + 278 SIGMAMINOR_ + 261,t 0 + 280 yesno + 279 TOPHAT_ + 281 numeric + 267,line 22 + 282,t 1 + 282 command + 275,title RADIUS + 283 @PSEUDO1 + 265,t 0 + 284 smooth + 280,line 49 + 279,line 34 + 285 function + 261,title TRUE +} + +proc smooth::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { ProcessCmdSet smooth view $1 SmoothUpdate } + 14 { SmoothDialog } + 15 { SmoothDestroyDialog } + 16 { MatchSmoothCurrent } + 17 { ProcessCmdSet smooth lock $2 LockSmoothCurrent } + 18 { ProcessCmdSet smooth function $2 SmoothUpdate } + 19 { ProcessCmdSet smooth radius $2 SmoothUpdate } + 20 { ProcessCmdSet smooth radius,minor $2 SmoothUpdate } + 21 { ProcessCmdSet smooth sigma $2 SmoothUpdate } + 22 { ProcessCmdSet smooth sigma,minor $2 SmoothUpdate } + 23 { ProcessCmdSet smooth angle $2 SmoothUpdate } + 24 { set _ boxcar } + 25 { set _ elliptic } + 26 { set _ tophat } + 27 { set _ gaussian } + } + 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 smooth::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/smoothsendlex.tcl b/ds9/parsers/smoothsendlex.tcl new file mode 100644 index 0000000..c51766c --- /dev/null +++ b/ds9/parsers/smoothsendlex.tcl @@ -0,0 +1,322 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval smoothsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc smoothsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc smoothsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc smoothsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc smoothsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc smoothsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc smoothsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc smoothsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc smoothsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc smoothsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set ANGLE_ 257 +set FUNCTION_ 258 +set LOCK_ 259 +set RADIUS_ 260 +set RADIUSMINOR_ 261 +set SIGMA_ 262 +set SIGMAMINOR_ 263 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: angle + if {[regexp -start $index_ -indices -line -nocase -- {\A(angle)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: function + if {[regexp -start $index_ -indices -line -nocase -- {\A(function)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: radius + if {[regexp -start $index_ -indices -line -nocase -- {\A(radius)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: radiusminor + if {[regexp -start $index_ -indices -line -nocase -- {\A(radiusminor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: sigma + if {[regexp -start $index_ -indices -line -nocase -- {\A(sigma)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: sigmaminor + if {[regexp -start $index_ -indices -line -nocase -- {\A(sigmaminor)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ANGLE_ + } + 1 { +return $FUNCTION_ + } + 2 { +return $LOCK_ + } + 3 { +return $RADIUS_ + } + 4 { +return $RADIUSMINOR_ + } + 5 { +return $SIGMA_ + } + 6 { +return $SIGMAMINOR_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/smoothsendparser.tab.tcl b/ds9/parsers/smoothsendparser.tab.tcl new file mode 100644 index 0000000..bb7b31b --- /dev/null +++ b/ds9/parsers/smoothsendparser.tab.tcl @@ -0,0 +1,7 @@ +set ANGLE_ 257 +set FUNCTION_ 258 +set LOCK_ 259 +set RADIUS_ 260 +set RADIUSMINOR_ 261 +set SIGMA_ 262 +set SIGMAMINOR_ 263 diff --git a/ds9/parsers/smoothsendparser.tcl b/ds9/parsers/smoothsendparser.tcl new file mode 100644 index 0000000..fe55688 --- /dev/null +++ b/ds9/parsers/smoothsendparser.tcl @@ -0,0 +1,338 @@ +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 smoothsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc smoothsend::YYABORT {} { + return -code return 1 +} + +proc smoothsend::YYACCEPT {} { + return -code return 0 +} + +proc smoothsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc smoothsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc smoothsend::yyerror {s} { + puts stderr $s +} + +proc smoothsend::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 smoothsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set smoothsend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 reduce + 0:264,target 8 + 0:258 shift + 8:0 accept + 5:0,target 5 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 7 + 0:262 shift + 0:258,target 2 + 0:263 shift + 0:0,target 1 + 0:261,target 5 + 0:264 goto + 2:0,target 3 + 0:263,target 7 + 4:0,target 4 + 0:0 reduce + 6:0,target 6 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 8:0,target 0 + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 8 + 5:0 reduce + 0:262,target 6 +} + +array set smoothsend::rules { + 2,l 264 + 6,l 264 + 3,l 264 + 7,l 264 + 0,l 265 + 4,l 264 + 8,l 264 + 1,l 264 + 5,l 264 +} + +array set smoothsend::rules { + 5,dc 1 + 0,dc 1 + 8,dc 1 + 3,dc 1 + 6,dc 1 + 1,dc 0 + 4,dc 1 + 7,dc 1 + 2,dc 1 +} + +array set smoothsend::rules { + 7,line 25 + 4,line 22 + 1,line 19 + 6,line 24 + 3,line 21 + 8,line 26 + 5,line 23 + 2,line 20 +} + +array set smoothsend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0}} + 1 {{8 0 1}} + 2 {{3 0 1}} + 3 {{2 0 1}} + 4 {{4 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8}} + 5 {{5 0 1}} + 1,trans {} + 6 {{6 0 1}} + 2,trans {} + 3,trans {} + 7 {{7 0 1}} + 4,trans {} + 8 {{0 0 1}} + 5,trans {} + 6,trans {} + 7,trans {} + 8,trans {} +} + +array set smoothsend::token_id_table { + 264,line 18 + 0,t 0 + 0 {$} + 262,title SIGMA + 263,title SIGMAMINOR + 264,title {} + error,t 0 + error error + 265,title {} + 258,line 9 + 261,line 12 + error,line 17 + 257 ANGLE_ + 257,t 0 + 263,line 14 + 258 FUNCTION_ + 258,t 0 + error,title {} + 260,t 0 + 260 RADIUS_ + 259 LOCK_ + 259,t 0 + 265,line 27 + 261,t 0 + 261 RADIUSMINOR_ + 262,t 0 + 262 SIGMA_ + 257,line 8 + 263,t 0 + 263 SIGMAMINOR_ + 264,t 1 + 264 smoothsend + 260,line 11 + 257,title ANGLE + 259,line 10 + 265,t 1 + 265 start' + 258,title FUNCTION + 262,line 13 + 260,title RADIUS + 259,title LOCK + 261,title RADIUSMINOR +} + +proc smoothsend::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 { ProcessSendCmdYesNo smooth view } + 2 { ProcessSendCmdYesNo smooth lock } + 3 { ProcessSendCmdGet smooth function } + 4 { ProcessSendCmdGet smooth radius } + 5 { ProcessSendCmdGet smooth radius,minor } + 6 { ProcessSendCmdGet smooth sigma } + 7 { ProcessSendCmdGet smooth sigma,minor } + 8 { ProcessSendCmdGet smooth angle } + } + 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 smoothsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/smosaiciraflex.tcl b/ds9/parsers/smosaiciraflex.tcl new file mode 100644 index 0000000..76327c9 --- /dev/null +++ b/ds9/parsers/smosaiciraflex.tcl @@ -0,0 +1,308 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval smosaiciraf { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc smosaiciraf::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc smosaiciraf::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc smosaiciraf::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc smosaiciraf::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc smosaiciraf::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc smosaiciraf::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc smosaiciraf::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc smosaiciraf::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc smosaiciraf::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval $yytext; return $STRING_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/smosaicirafparser.tab.tcl b/ds9/parsers/smosaicirafparser.tab.tcl new file mode 100644 index 0000000..67faf4c --- /dev/null +++ b/ds9/parsers/smosaicirafparser.tab.tcl @@ -0,0 +1,3 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 diff --git a/ds9/parsers/smosaicirafparser.tcl b/ds9/parsers/smosaicirafparser.tcl new file mode 100644 index 0000000..307035a --- /dev/null +++ b/ds9/parsers/smosaicirafparser.tcl @@ -0,0 +1,306 @@ +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 smosaiciraf { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc smosaiciraf::YYABORT {} { + return -code return 1 +} + +proc smosaiciraf::YYACCEPT {} { + return -code return 0 +} + +proc smosaiciraf::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc smosaiciraf::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc smosaiciraf::yyerror {s} { + puts stderr $s +} + +proc smosaiciraf::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 smosaiciraf::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set smosaiciraf::table { + 3:0,target 0 + 0:257 reduce + 7:0 reduce + 6:257,target 7 + 1:257 reduce + 0:258 shift + 2:257 reduce + 0:260 goto + 0:259 shift + 0:261 goto + 7:0,target 2 + 1:257,target 5 + 0:258,target 1 + 0:262 goto + 5:257 shift + 6:257 shift + 0:261,target 4 + 5:257,target 6 + 4:0,target 1 + 0:257,target 3 + 3:0 accept + 2:257,target 4 + 0:260,target 3 + 0:259,target 2 + 4:0 reduce + 0:262,target 5 +} + +array set smosaiciraf::rules { + 0,l 263 + 1,l 260 + 2,l 261 + 3,l 262 + 4,l 262 + 5,l 262 +} + +array set smosaiciraf::rules { + 5,dc 1 + 0,dc 1 + 2,dc 3 + 4,dc 1 + 1,dc 1 + 3,dc 0 +} + +array set smosaiciraf::rules { + 5,line 26 + 2,line 21 + 4,line 25 + 1,line 18 + 3,line 24 +} + +array set smosaiciraf::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 257 0} {4 257 0} {5 257 0}} + 1 {{5 257 1}} + 2 {{4 257 1}} + 3 {{0 0 1}} + 4 {{1 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4} {262 5}} + 5 {{2 0 1}} + 1,trans {} + 2,trans {} + 6 {{2 0 2}} + 7 {{2 0 3}} + 3,trans {} + 4,trans {} + 5,trans {{257 6}} + 6,trans {{257 7}} + 7,trans {} +} + +array set smosaiciraf::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 11 + 261,line 20 + error,line 15 + 257 STRING_ + 257,t 0 + 263,line 27 + 258 MASK_ + 258,t 0 + 260,t 1 + 260 command + error,title {} + 259 NEW_ + 259,t 0 + 261,t 1 + 261 smosaiciraf + 262,t 1 + 262 opts + 257,line 7 + 263,t 1 + 263 start' + 260,line 17 + 257,title string + 259,line 12 + 258,title MASK + 262,line 23 + 260,title {} + 259,title NEW + 261,title {} +} + +proc smosaiciraf::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 { + 2 { LoadSMosaicIRAFFile $2 $3 $1 } + 4 { CreateFrame; set _ {} } + 5 { 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 smosaiciraf::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/smosaicwcslex.tcl b/ds9/parsers/smosaicwcslex.tcl new file mode 100644 index 0000000..ba58bc0 --- /dev/null +++ b/ds9/parsers/smosaicwcslex.tcl @@ -0,0 +1,605 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval smosaicwcs { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc smosaicwcs::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc smosaicwcs::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc smosaicwcs::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc smosaicwcs::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc smosaicwcs::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc smosaicwcs::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc smosaicwcs::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc smosaicwcs::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc smosaicwcs::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set STRING_ 284 +set MASK_ 285 +set NEW_ 286 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $WCS_ + } + 3 { +return $WCSA_ + } + 4 { +return $WCSB_ + } + 5 { +return $WCSC_ + } + 6 { +return $WCSD_ + } + 7 { +return $WCSE_ + } + 8 { +return $WCSF_ + } + 9 { +return $WCSG_ + } + 10 { +return $WCSH_ + } + 11 { +return $WCSI_ + } + 12 { +return $WCSJ_ + } + 13 { +return $WCSK_ + } + 14 { +return $WCSL_ + } + 15 { +return $WCSM_ + } + 16 { +return $WCSN_ + } + 17 { +return $WCSO_ + } + 18 { +return $WCSP_ + } + 19 { +return $WCSQ_ + } + 20 { +return $WCSR_ + } + 21 { +return $WCSS_ + } + 22 { +return $WCST_ + } + 23 { +return $WCSU_ + } + 24 { +return $WCSV_ + } + 25 { +return $WCSW_ + } + 26 { +return $WCSX_ + } + 27 { +return $WCSY_ + } + 28 { +return $WCSZ_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval $yytext; return $STRING_ + } + 33 { +# ignore whitespace + } + 34 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/smosaicwcsparser.tab.tcl b/ds9/parsers/smosaicwcsparser.tab.tcl new file mode 100644 index 0000000..8e61664 --- /dev/null +++ b/ds9/parsers/smosaicwcsparser.tab.tcl @@ -0,0 +1,30 @@ +set WCS_ 257 +set WCSA_ 258 +set WCSB_ 259 +set WCSC_ 260 +set WCSD_ 261 +set WCSE_ 262 +set WCSF_ 263 +set WCSG_ 264 +set WCSH_ 265 +set WCSI_ 266 +set WCSJ_ 267 +set WCSK_ 268 +set WCSL_ 269 +set WCSM_ 270 +set WCSN_ 271 +set WCSO_ 272 +set WCSP_ 273 +set WCSQ_ 274 +set WCSR_ 275 +set WCSS_ 276 +set WCST_ 277 +set WCSU_ 278 +set WCSV_ 279 +set WCSW_ 280 +set WCSX_ 281 +set WCSY_ 282 +set WCSZ_ 283 +set STRING_ 284 +set MASK_ 285 +set NEW_ 286 diff --git a/ds9/parsers/smosaicwcsparser.tcl b/ds9/parsers/smosaicwcsparser.tcl new file mode 100644 index 0000000..39201fc --- /dev/null +++ b/ds9/parsers/smosaicwcsparser.tcl @@ -0,0 +1,874 @@ +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 smosaicwcs { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc smosaicwcs::YYABORT {} { + return -code return 1 +} + +proc smosaicwcs::YYACCEPT {} { + return -code return 0 +} + +proc smosaicwcs::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc smosaicwcs::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc smosaicwcs::yyerror {s} { + puts stderr $s +} + +proc smosaicwcs::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 smosaicwcs::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set smosaicwcs::table { + 9:284 reduce + 5:276,target 25 + 30:284 reduce + 29:284 reduce + 2:284,target 33 + 1:279,target 34 + 1:280,target 34 + 34:284,target 35 + 2:263,target 33 + 0:275,target 32 + 1:258,target 34 + 5:274,target 23 + 23:284,target 18 + 2:282,target 33 + 12:284,target 7 + 1:277,target 34 + 17:284 reduce + 2:261,target 33 + 0:273,target 32 + 5:272,target 21 + 6:284 reduce + 26:284 reduce + 2:279,target 33 + 2:280,target 33 + 35:284,target 36 + 1:275,target 34 + 2:258,target 33 + 0:271,target 32 + 35:284 shift + 24:284,target 19 + 5:270,target 19 + 5:269,target 18 + 13:284,target 8 + 2:277,target 33 + 0:289,target 4 + 3:0,target 0 + 1:273,target 34 + 14:284 reduce + 0:268,target 32 + 5:267,target 16 + 23:284 reduce + 2:275,target 33 + 0:257 reduce + 1:271,target 34 + 0:258 reduce + 25:284,target 20 + 0:260 reduce + 0:259 reduce + 0:266,target 32 + 0:261 reduce + 0:262 reduce + 32:284 reduce + 0:263 reduce + 0:264 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 33 + 0:271 reduce + 0:285,target 1 + 0:272 reduce + 0:273 reduce + 1:268,target 34 + 0:274 reduce + 0:275 reduce + 5:284,target 30 + 0:276 reduce + 0:264,target 32 + 11:284 reduce + 0:277 reduce + 0:278 reduce + 0:279 reduce + 0:280 reduce + 5:263,target 12 + 0:281 reduce + 0:282 reduce + 0:283 reduce + 0:284 reduce + 0:285 shift + 2:271,target 33 + 20:284 reduce + 19:284 reduce + 0:283,target 32 + 0:286 shift + 26:284,target 21 + 0:288 goto + 1:266,target 34 + 0:289 goto + 3:0 accept + 5:282,target 31 + 0:291 goto + 0:262,target 32 + 8:284 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 33 + 5:261 shift + 0:281,target 32 + 6:284,target 1 + 5:262 shift + 5:263 shift + 1:264,target 34 + 5:264 shift + 5:280,target 29 + 5:279,target 28 + 5:265 shift + 5:266 shift + 0:260,target 32 + 0:259,target 32 + 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 34 + 27:284,target 22 + 5:274 shift + 5:275 shift + 2:266,target 33 + 5:276 shift + 0:278,target 32 + 16:284 reduce + 5:277 shift + 5:278 shift + 1:262,target 34 + 5:280 shift + 5:279 shift + 4:0,target 28 + 16:284,target 11 + 5:281 shift + 5:277,target 26 + 5:282 shift + 0:257,target 32 + 5:283 shift + 5:284 reduce + 25:284 reduce + 5:287 goto + 1:281,target 34 + 7:284,target 2 + 2:257 reduce + 5:290 goto + 2:258 reduce + 2:264,target 33 + 0:276,target 32 + 2:259 reduce + 2:260 reduce + 2:261 reduce + 1:259,target 34 + 1:260,target 34 + 2:262 reduce + 34:284 shift + 2:263 reduce + 5:275,target 24 + 2:264 reduce + 2:265 reduce + 2:266 reduce + 36:0 reduce + 2:267 reduce + 2:268 reduce + 2:283,target 33 + 28:284,target 23 + 2:269 reduce + 2:270 reduce + 2:271 reduce + 1:278,target 34 + 2:272 reduce + 2:273 reduce + 2:262,target 33 + 2:274 reduce + 0:274,target 32 + 2:275 reduce + 17:284,target 12 + 2:276 reduce + 13:284 reduce + 1:257,target 34 + 2:277 reduce + 2:278 reduce + 5:273,target 22 + 2:279 reduce + 2:280 reduce + 2:281 reduce + 2:282 reduce + 2:283 reduce + 2:281,target 33 + 2:284 reduce + 8:284,target 3 + 22:284 reduce + 1:276,target 34 + 2:259,target 33 + 2:260,target 33 + 0:272,target 32 + 31:284 reduce + 5:271,target 20 + 30:284,target 25 + 29:284,target 24 + 2:278,target 33 + 0:291,target 5 + 1:274,target 34 + 18:284,target 13 + 2:257,target 33 + 5:290,target 34 + 0:270,target 32 + 0:269,target 32 + 4:0 reduce + 10:284 reduce + 5:268,target 17 + 9:284,target 4 + 2:276,target 33 + 0:288,target 3 + 18:284 reduce + 1:272,target 34 + 5:287,target 33 + 0:267,target 32 + 31:284,target 26 + 7:284 reduce + 5:266,target 15 + 27:284 reduce + 2:274,target 33 + 20:284,target 15 + 19:284,target 14 + 0:286,target 2 + 1:269,target 34 + 1:270,target 34 + 0:265,target 32 + 5:264,target 13 + 2:272,target 33 + 0:284,target 32 + 1:267,target 34 + 15:284 reduce + 5:283,target 32 + 32:284,target 27 + 0:263,target 32 + 5:262,target 11 + 24:284 reduce + 21:284,target 16 + 2:269,target 33 + 2:270,target 33 + 0:282,target 32 + 1:257 reduce + 1:258 reduce + 1:259 reduce + 1:260 reduce + 1:265,target 34 + 10:284,target 5 + 1:261 reduce + 5:281,target 30 + 1:262 reduce + 33:284 reduce + 0:261,target 32 + 1:263 reduce + 1:264 reduce + 1:265 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 34 + 1:271 reduce + 36:0,target 29 + 1:272 reduce + 2:267,target 33 + 0:279,target 32 + 0:280,target 32 + 1:273 reduce + 1:274 reduce + 33:284,target 31 + 1:263,target 34 + 1:275 reduce + 1:276 reduce + 12:284 reduce + 5:278,target 27 + 1:277 reduce + 0:258,target 32 + 1:278 reduce + 1:279 reduce + 1:280 reduce + 1:281 reduce + 22:284,target 17 + 1:282 reduce + 1:283 reduce + 5:257,target 6 + 1:284 reduce + 1:282,target 34 + 21:284 reduce + 2:265,target 33 + 11:284,target 6 + 0:277,target 32 + 1:261,target 34 +} + +array set smosaicwcs::rules { + 9,l 287 + 11,l 287 + 32,l 291 + 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 290 + 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 +} + +array set smosaicwcs::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 17,dc 1 + 32,dc 0 + 8,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 23,dc 1 + 0,dc 1 + 15,dc 1 + 29,dc 4 + 30,dc 0 + 6,dc 1 + 22,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 21,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 +} + +array set smosaicwcs::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 109 + 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 + 2,line 74 + 32,line 113 + 28,line 103 + 25,line 97 + 22,line 94 + 18,line 90 + 15,line 87 + 12,line 84 +} + +array set smosaicwcs::lr1_table { + 35 {{29 0 3}} + 36 {{29 0 4}} + 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}} + 36,trans {} + 22,trans {} + 4,trans {} + 26,trans {} + 8,trans {} + 12,trans {} + 31,trans {} + 16,trans {} + 35,trans {{284 36}} + 21,trans {} + 3,trans {} + 10 {{5 284 1}} + 11 {{6 284 1}} + 25,trans {} + 12 {{7 284 1}} + 7,trans {} + 13 {{8 284 1}} + 14 {{9 284 1}} + 15 {{10 284 1}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{11 284 1}} + 0 {{0 0 0} {28 0 0} {29 0 0} {32 {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} {33 {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 {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 284 1}} + 1 {{34 {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 284 1}} + 15,trans {} + 2 {{33 {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 284 1}} + 20 {{15 284 1}} + 34,trans {{284 35}} + 3 {{0 0 1}} + 21 {{16 284 1}} + 4 {{28 0 1}} + 22 {{17 284 1}} + 5 {{29 0 1} {30 284 0} {31 284 0} {1 284 0} {2 284 0} {3 284 0} {4 284 0} {5 284 0} {6 284 0} {7 284 0} {8 284 0} {9 284 0} {10 284 0} {11 284 0} {12 284 0} {13 284 0} {14 284 0} {15 284 0} {16 284 0} {17 284 0} {18 284 0} {19 284 0} {20 284 0} {21 284 0} {22 284 0} {23 284 0} {24 284 0} {25 284 0} {26 284 0} {27 284 0}} + 23 {{18 284 1}} + 20,trans {} + 19,trans {} + 6 {{1 284 1}} + 2,trans {} + 24 {{19 284 1}} + 7 {{2 284 1}} + 25 {{20 284 1}} + 8 {{3 284 1}} + 26 {{21 284 1}} + 9 {{4 284 1}} + 27 {{22 284 1}} + 24,trans {} + 28 {{23 284 1}} + 6,trans {} + 29 {{24 284 1}} + 30 {{25 284 1}} + 31 {{26 284 1}} + 32 {{27 284 1}} + 10,trans {} + 28,trans {} + 33 {{31 284 1}} + 34 {{29 0 2}} +} + +array set smosaicwcs::token_id_table { + 286,t 0 + 286 NEW_ + 280,title WCSW + 279,title WCSV + 264,line 14 + 292,line 116 + 287 wcssys + 270,t 0 + 269,t 0 + 288 command + 290 sys + 289 smosaicwcs + 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 112 + 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 108 + 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 smosaicwcs::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 { LoadSMosaicWCSFile $3 $4 $2 $1 } + 30 { set _ wcs } + 31 { set _ $1 } + 33 { CreateFrame; set _ {} } + 34 { 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 smosaicwcs::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/sourcelex.tcl b/ds9/parsers/sourcelex.tcl new file mode 100644 index 0000000..9635542 --- /dev/null +++ b/ds9/parsers/sourcelex.tcl @@ -0,0 +1,286 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval source { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc source::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc source::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc source::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc source::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc source::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc source::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc source::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc source::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc source::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval $yytext; return $STRING_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/sourceparser.tab.tcl b/ds9/parsers/sourceparser.tab.tcl new file mode 100644 index 0000000..b7d9526 --- /dev/null +++ b/ds9/parsers/sourceparser.tab.tcl @@ -0,0 +1 @@ +set STRING_ 257 diff --git a/ds9/parsers/sourceparser.tcl b/ds9/parsers/sourceparser.tcl new file mode 100644 index 0000000..5cafe53 --- /dev/null +++ b/ds9/parsers/sourceparser.tcl @@ -0,0 +1,287 @@ +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 source { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc source::YYABORT {} { + return -code return 1 +} + +proc source::YYACCEPT {} { + return -code return 0 +} + +proc source::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc source::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc source::yyerror {s} { + puts stderr $s +} + +proc source::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 source::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set source::table { + 3:0,target 1 + 0:257 shift + 0:258 goto + 1:257 reduce + 5:0,target 3 + 0:260 goto + 3:257 reduce + 4:257 shift + 0:258,target 2 + 1:257,target 4 + 3:259 goto + 3:257,target 2 + 2:0,target 0 + 3:259,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:260,target 3 + 1:0,target 4 + 5:0 reduce + 4:257,target 5 +} + +array set source::rules { + 0,l 261 + 1,l 258 + 2,l 259 + 3,l 258 + 4,l 260 +} + +array set source::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set source::rules { + 2,e 1 + 2,line 14 + 4,line 18 + 1,line 14 + 3,line 15 +} + +array set source::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 257} 0}} + 1 {{4 {0 257} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 257 0}} + 0,trans {{257 1} {258 2} {260 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{259 4}} + 4,trans {{257 5}} + 5,trans {} +} + +array set source::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 13 + 261,line 19 + 257 STRING_ + 257,t 0 + error,line 12 + 258,t 1 + 258 command + 260,t 1 + 260 source + 259,t 1 + 259 @PSEUDO1 + error,title {} + 261,t 1 + 261 start' + 257,line 7 + 260,line 17 + 259,line 14 + 257,title string + 258,title {} + 260,title {} + 259,title {} + 261,title {} +} + +proc source::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { SourceCmd $1 } + } + 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 source::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/srgbcubelex.tcl b/ds9/parsers/srgbcubelex.tcl new file mode 100644 index 0000000..c59f2f3 --- /dev/null +++ b/ds9/parsers/srgbcubelex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval srgbcube { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc srgbcube::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc srgbcube::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc srgbcube::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc srgbcube::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc srgbcube::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc srgbcube::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc srgbcube::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc srgbcube::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc srgbcube::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set NEW_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NEW_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/srgbcubeparser.tab.tcl b/ds9/parsers/srgbcubeparser.tab.tcl new file mode 100644 index 0000000..f492518 --- /dev/null +++ b/ds9/parsers/srgbcubeparser.tab.tcl @@ -0,0 +1,2 @@ +set STRING_ 257 +set NEW_ 258 diff --git a/ds9/parsers/srgbcubeparser.tcl b/ds9/parsers/srgbcubeparser.tcl new file mode 100644 index 0000000..0ff336a --- /dev/null +++ b/ds9/parsers/srgbcubeparser.tcl @@ -0,0 +1,292 @@ +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 srgbcube { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc srgbcube::YYABORT {} { + return -code return 1 +} + +proc srgbcube::YYACCEPT {} { + return -code return 0 +} + +proc srgbcube::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc srgbcube::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc srgbcube::yyerror {s} { + puts stderr $s +} + +proc srgbcube::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 srgbcube::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set srgbcube::table { + 6:0 reduce + 3:0,target 1 + 0:257 reduce + 0:258 shift + 1:257 reduce + 0:259 goto + 0:260 goto + 0:261 goto + 4:257 shift + 1:257,target 4 + 0:258,target 1 + 5:257 shift + 0:261,target 4 + 2:0,target 0 + 5:257,target 6 + 6:0,target 2 + 0:257,target 3 + 2:0 accept + 3:0 reduce + 0:259,target 2 + 0:260,target 3 + 4:257,target 5 +} + +array set srgbcube::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 261 + 4,l 261 +} + +array set srgbcube::rules { + 0,dc 1 + 2,dc 3 + 4,dc 1 + 1,dc 1 + 3,dc 0 +} + +array set srgbcube::rules { + 2,line 20 + 4,line 24 + 1,line 17 + 3,line 23 +} + +array set srgbcube::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 257 0} {4 257 0}} + 1 {{4 257 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1}} + 0,trans {{258 1} {259 2} {260 3} {261 4}} + 1,trans {} + 5 {{2 0 2}} + 2,trans {} + 6 {{2 0 3}} + 3,trans {} + 4,trans {{257 5}} + 5,trans {{257 6}} + 6,trans {} +} + +array set srgbcube::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 11 + 261,line 22 + error,line 14 + 257 STRING_ + 257,t 0 + 258 NEW_ + 258,t 0 + 260,t 1 + 260 srgbcube + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 opts + 262,t 1 + 262 start' + 257,line 7 + 260,line 19 + 259,line 16 + 257,title string + 258,title NEW + 262,line 25 + 260,title {} + 259,title {} + 261,title {} +} + +proc srgbcube::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 { + 2 { LoadSRGBCubeFile $2 $3 } + 4 { CreateRGBFrame } + } + 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 srgbcube::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/threadslex.tcl b/ds9/parsers/threadslex.tcl new file mode 100644 index 0000000..5385823 --- /dev/null +++ b/ds9/parsers/threadslex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval threads { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc threads::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc threads::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc threads::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc threads::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc threads::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc threads::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc threads::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc threads::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc threads::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval $yytext; return $INT_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/threadsparser.tab.tcl b/ds9/parsers/threadsparser.tab.tcl new file mode 100644 index 0000000..e736960 --- /dev/null +++ b/ds9/parsers/threadsparser.tab.tcl @@ -0,0 +1,2 @@ +set INT_ 257 +set STRING_ 258 diff --git a/ds9/parsers/threadsparser.tcl b/ds9/parsers/threadsparser.tcl new file mode 100644 index 0000000..3fec602 --- /dev/null +++ b/ds9/parsers/threadsparser.tcl @@ -0,0 +1,291 @@ +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 threads { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc threads::YYABORT {} { + return -code return 1 +} + +proc threads::YYACCEPT {} { + return -code return 0 +} + +proc threads::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc threads::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc threads::yyerror {s} { + puts stderr $s +} + +proc threads::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 threads::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set threads::table { + 3:0,target 1 + 0:257 shift + 5:0,target 3 + 0:259 goto + 1:258 reduce + 0:261 goto + 3:258 reduce + 4:258 shift + 3:260 goto + 0:261,target 3 + 2:0,target 0 + 4:258,target 5 + 3:260,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:259,target 2 + 1:258,target 4 + 1:0,target 4 + 5:0 reduce + 3:258,target 2 +} + +array set threads::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 259 + 4,l 261 +} + +array set threads::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set threads::rules { + 2,e 1 + 2,line 16 + 4,line 20 + 1,line 16 + 3,line 17 +} + +array set threads::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0}} + 1 {{4 {0 258} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{257 1} {259 2} {261 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{260 4}} + 4,trans {{258 5}} + 5,trans {} +} + +array set threads::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 9 + 261,line 19 + error,line 14 + 257 INT_ + 257,t 0 + 258 STRING_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 threads + 262,t 1 + 262 start' + 257,line 7 + 260,line 16 + 259,line 15 + 257,title integer + 258,title string + 262,line 21 + 260,title {} + 259,title {} + 261,title {} +} + +proc threads::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet ds9 threads $1 ChangeThreads } + } + 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 threads::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/threedlex.tcl b/ds9/parsers/threedlex.tcl new file mode 100644 index 0000000..9b3cca2 --- /dev/null +++ b/ds9/parsers/threedlex.tcl @@ -0,0 +1,609 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval threed { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc threed::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc threed::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc threed::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc threed::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc threed::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc threed::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc threed::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc threed::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc threed::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set AIP_ 266 +set AZ_ 267 +set BG_ 268 +set BORDER_ 269 +set CLOSE_ 270 +set COLOR_ 271 +set COMPASS_ 272 +set EL_ 273 +set HIGHLITE_ 274 +set LOCK_ 275 +set MATCH_ 276 +set METHOD_ 277 +set MIP_ 278 +set NONE_ 279 +set OPEN_ 280 +set SCALE_ 281 +set VIEW_ 282 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: aip + if {[regexp -start $index_ -indices -line -nocase -- {\A(aip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: az + if {[regexp -start $index_ -indices -line -nocase -- {\A(az)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: azimuth + if {[regexp -start $index_ -indices -line -nocase -- {\A(azimuth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: background + if {[regexp -start $index_ -indices -line -nocase -- {\A(background)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: bg + if {[regexp -start $index_ -indices -line -nocase -- {\A(bg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: border + if {[regexp -start $index_ -indices -line -nocase -- {\A(border)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: compass + if {[regexp -start $index_ -indices -line -nocase -- {\A(compass)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: el + if {[regexp -start $index_ -indices -line -nocase -- {\A(el)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: elevation + if {[regexp -start $index_ -indices -line -nocase -- {\A(elevation)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: highlite + if {[regexp -start $index_ -indices -line -nocase -- {\A(highlite)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: match + if {[regexp -start $index_ -indices -line -nocase -- {\A(match)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: method + if {[regexp -start $index_ -indices -line -nocase -- {\A(method)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: mip + if {[regexp -start $index_ -indices -line -nocase -- {\A(mip)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: none + if {[regexp -start $index_ -indices -line -nocase -- {\A(none)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: vp + if {[regexp -start $index_ -indices -line -nocase -- {\A(vp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AIP_ + } + 1 { +return $AZ_ + } + 2 { +return $AZ_ + } + 3 { +return $BG_ + } + 4 { +return $BG_ + } + 5 { +return $BORDER_ + } + 6 { +return $CLOSE_ + } + 7 { +return $COLOR_ + } + 8 { +return $COMPASS_ + } + 9 { +return $EL_ + } + 10 { +return $EL_ + } + 11 { +return $HIGHLITE_ + } + 12 { +return $LOCK_ + } + 13 { +return $MATCH_ + } + 14 { +return $METHOD_ + } + 15 { +return $MIP_ + } + 16 { +return $NONE_ + } + 17 { +return $OPEN_ + } + 18 { +return $SCALE_ + } + 19 { +return $VIEW_ + } + 20 { +return $VIEW_ + } + 21 { +return $YES_ + } + 22 { +return $NO_ + } + 23 { +return $ON_ + } + 24 { +return $OFF_ + } + 25 { +return $TRUE_ + } + 26 { +return $FALSE_ + } + 27 { +set yylval $yytext; return $INT_ + } + 28 - + 29 { +set yylval $yytext; return $REAL_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 33 { +set yylval $yytext; return $STRING_ + } + 34 { +# ignore whitespace + } + 35 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/threedparser.tab.tcl b/ds9/parsers/threedparser.tab.tcl new file mode 100644 index 0000000..0387fc9 --- /dev/null +++ b/ds9/parsers/threedparser.tab.tcl @@ -0,0 +1,26 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set AIP_ 266 +set AZ_ 267 +set BG_ 268 +set BORDER_ 269 +set CLOSE_ 270 +set COLOR_ 271 +set COMPASS_ 272 +set EL_ 273 +set HIGHLITE_ 274 +set LOCK_ 275 +set MATCH_ 276 +set METHOD_ 277 +set MIP_ 278 +set NONE_ 279 +set OPEN_ 280 +set SCALE_ 281 +set VIEW_ 282 diff --git a/ds9/parsers/threedparser.tcl b/ds9/parsers/threedparser.tcl new file mode 100644 index 0000000..e7b6c6f --- /dev/null +++ b/ds9/parsers/threedparser.tcl @@ -0,0 +1,931 @@ +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 threed { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc threed::YYABORT {} { + return -code return 1 +} + +proc threed::YYACCEPT {} { + return -code return 0 +} + +proc threed::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc threed::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc threed::yyerror {s} { + puts stderr $s +} + +proc threed::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 threed::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set threed::table { + 34:265,target 24 + 47:265 reduce + 27:0 reduce + 17:263 reduce + 48:0 reduce + 17:264 reduce + 23:265,target 2 + 17:265 reduce + 7:283,target 37 + 0:275,target 8 + 6:263 shift + 6:264 shift + 7:262,target 28 + 26:265 reduce + 24:0 reduce + 48:0,target 32 + 17:264,target 9 + 41:0,target 28 + 33:0,target 37 + 46:265,target 34 + 25:0,target 3 + 3:265,target 1 + 17:0,target 9 + 12:284,target 43 + 35:265 reduce + 0:273,target 6 + 35:265,target 17 + 12:263,target 16 + 7:259,target 25 + 7:260,target 26 + 44:263 shift + 21:0 reduce + 44:264 shift + 6:284 goto + 42:0 reduce + 24:265,target 5 + 2:279,target 21 + 8:283,target 39 + 3:257 shift + 3:258 shift + 3:259 shift + 3:260 shift + 3:261 shift + 3:262 shift + 8:262,target 28 + 3:265 reduce + 7:257,target 23 + 17:0 reduce + 23:265 reduce + 47:265,target 36 + 38:0 reduce + 4:265,target 15 + 3:271 shift + 13:284,target 44 + 44:284 goto + 3:0,target 1 + 3:261,target 27 + 36:265,target 48 + 32:265 shift + 13:263,target 16 + 0:268,target 2 + 8:259,target 25 + 8:260,target 26 + 37:0,target 33 + 14:0 accept + 30:0,target 35 + 25:265,target 3 + 22:0,target 21 + 35:0 reduce + 3:283 goto + 14:0,target 0 + 41:265 reduce + 0:287,target 15 + 3:258,target 24 + 3:291 goto + 11:265 reduce + 8:257,target 23 + 9:0 reduce + 49:265 reduce + 11:0 reduce + 48:265,target 32 + 0:265 reduce + 5:265,target 1 + 8:257 shift + 20:265 reduce + 19:265 reduce + 0:267 shift + 8:258 shift + 0:268 shift + 8:259 shift + 8:260 shift + 0:269 shift + 0:270 shift + 2:273,target 20 + 8:261 shift + 37:265,target 33 + 0:285,target 14 + 8:262 shift + 0:272 shift + 0:273 shift + 0:274 shift + 8:265 reduce + 0:275 shift + 28:265 reduce + 0:276 shift + 26:265,target 6 + 0:277 shift + 15:286,target 45 + 28:0 reduce + 0:280 shift + 7:0,target 1 + 10:266,target 40 + 0:281 shift + 0:0,target 13 + 0:282 shift + 50:0 reduce + 49:0 reduce + 15:265,target 11 + 37:265 reduce + 0:285 goto + 50:0,target 12 + 49:0,target 18 + 42:0,target 20 + 0:287 goto + 34:0,target 24 + 26:0,target 6 + 3:0 reduce + 18:0,target 16 + 49:265,target 18 + 8:283 goto + 11:0,target 14 + 46:265 reduce + 25:0 reduce + 2:289,target 22 + 5:261,target 27 + 46:0 reduce + 16:263 reduce + 38:265,target 22 + 5:257 shift + 16:264 reduce + 5:258 shift + 16:265 reduce + 5:259 shift + 5:260 shift + 0:281,target 12 + 5:261 shift + 44:264,target 17 + 5:262 shift + 6:284,target 35 + 1:264,target 17 + 0:0 reduce + 27:265,target 4 + 5:265 reduce + 25:265 reduce + 22:0 reduce + 6:263,target 16 + 43:0 reduce + 5:271 shift + 5:258,target 24 + 16:265,target 8 + 3:271,target 29 + 34:265 reduce + 4:0,target 15 + 7:265,target 1 + 18:0 reduce + 5:283 goto + 43:265 reduce + 40:265,target 27 + 40:0 reduce + 39:265,target 26 + 39:0 reduce + 46:0,target 34 + 16:263,target 8 + 38:0,target 22 + 31:0,target 23 + 13:263 shift + 23:0,target 2 + 13:264 shift + 15:0,target 10 + 28:265,target 7 + 0:276,target 9 + 5:292 goto + 10:278,target 41 + 15:0 reduce + 17:265,target 9 + 22:265 reduce + 2:267 shift + 2:273 shift + 0:274,target 7 + 8:265,target 1 + 31:265 reduce + 12:264,target 17 + 13:284 goto + 7:261,target 27 + 2:279 shift + 41:265,target 28 + 33:0 reduce + 17:263,target 9 + 40:265 reduce + 39:265 reduce + 30:265,target 35 + 29:265,target 46 + 8:0,target 1 + 2:289 goto + 5:292,target 34 + 0:272,target 5 + 7:0 reduce + 10:266 shift + 48:265 reduce + 18:265,target 16 + 7:258,target 24 + 43:0,target 19 + 5:271,target 32 + 35:0,target 17 + 30:0 reduce + 3:283,target 30 + 27:0,target 4 + 20:0,target 31 + 19:0,target 30 + 7:257 shift + 18:265 reduce + 7:258 shift + 7:259 shift + 7:260 shift + 3:262,target 28 + 7:261 shift + 7:262 shift + 9:265,target 25 + 10:278 shift + 13:264,target 17 + 0:269,target 3 + 0:270,target 4 + 4:0 reduce + 7:265 reduce + 8:261,target 27 + 42:265,target 20 + 27:265 reduce + 26:0 reduce + 7:271 shift + 47:0 reduce + 10:288 goto + 31:265,target 23 + 36:265 shift + 3:259,target 25 + 3:260,target 26 + 20:265,target 31 + 19:265,target 30 + 0:267,target 1 + 8:258,target 24 + 7:283 goto + 23:0 reduce + 45:265 shift + 5:0,target 1 + 7:290 goto + 15:265 reduce + 3:257,target 23 + 47:0,target 36 + 10:288,target 42 + 43:265,target 19 + 40:0,target 27 + 39:0,target 26 + 0:265,target 13 + 24:0,target 5 + 4:265 reduce + 20:0 reduce + 19:0 reduce + 16:0,target 8 + 24:265 reduce + 41:0 reduce + 32:265,target 47 + 33:265 reduce + 21:265,target 29 + 7:271,target 36 + 5:283,target 33 + 15:286 goto + 16:0 reduce + 37:0 reduce + 5:262,target 28 + 42:265 reduce + 7:290,target 38 + 12:263 shift + 0:282,target 13 + 12:264 shift + 1:263 shift + 9:0,target 25 + 1:264 shift + 6:264,target 17 + 33:265,target 37 + 34:0 reduce + 21:265 reduce + 5:259,target 25 + 5:260,target 26 + 44:284,target 49 + 1:284,target 18 + 22:265,target 21 + 2:267,target 19 + 28:0,target 7 + 0:280,target 11 + 44:263,target 16 + 21:0,target 29 + 9:265 reduce + 1:263,target 16 + 30:265 reduce + 29:265 shift + 8:0 reduce + 12:284 goto + 3:291,target 31 + 11:265,target 14 + 31:0 reduce + 5:257,target 23 + 16:264,target 8 + 1:284 goto + 38:265 reduce + 45:265,target 50 + 0:277,target 10 + 5:0 reduce +} + +array set threed::rules { + 9,l 284 + 11,l 286 + 32,l 290 + 6,l 283 + 28,l 288 + 3,l 283 + 25,l 287 + 0,l 293 + 22,l 287 + 18,l 287 + 15,l 287 + 36,l 292 + 12,l 285 + 33,l 290 + 7,l 283 + 29,l 289 + 30,l 289 + 4,l 283 + 26,l 287 + 1,l 283 + 23,l 287 + 19,l 287 + 20,l 287 + 16,l 287 + 37,l 292 + 13,l 287 + 34,l 291 + 8,l 284 + 10,l 285 + 31,l 289 + 5,l 283 + 27,l 288 + 2,l 283 + 24,l 287 + 21,l 287 + 17,l 287 + 14,l 287 + 35,l 291 +} + +array set threed::rules { + 12,dc 3 + 26,dc 2 + 3,dc 1 + 18,dc 3 + 33,dc 1 + 9,dc 1 + 11,dc 0 + 25,dc 1 + 2,dc 1 + 17,dc 2 + 32,dc 2 + 8,dc 1 + 10,dc 1 + 24,dc 2 + 1,dc 0 + 16,dc 2 + 31,dc 1 + 7,dc 1 + 23,dc 2 + 0,dc 1 + 37,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 22,dc 2 + 36,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 21,dc 2 + 35,dc 1 + 13,dc 0 + 27,dc 1 + 4,dc 1 + 19,dc 2 + 20,dc 2 + 34,dc 2 +} + +array set threed::rules { + 7,line 59 + 37,line 103 + 4,line 56 + 34,line 98 + 1,line 53 + 31,line 91 + 27,line 85 + 24,line 80 + 21,line 77 + 17,line 73 + 14,line 70 + 11,line 65 + 9,line 62 + 6,line 58 + 36,line 102 + 3,line 55 + 33,line 95 + 29,line 89 + 30,line 90 + 26,line 82 + 23,line 79 + 19,line 75 + 20,line 76 + 16,line 72 + 13,line 69 + 10,line 65 + 8,line 61 + 5,line 57 + 35,line 99 + 2,line 54 + 32,line 94 + 28,line 86 + 25,line 81 + 22,line 78 + 18,line 74 + 15,line 71 + 12,line 66 + 11,e 1 +} + +array set threed::lr1_table { + 35 {{17 {0 265} 2}} + 14,trans {} + 36 {{32 {0 265} 1}} + 33,trans {} + 37 {{33 {0 265} 1}} + 52,trans {} + 38 {{22 {0 265} 2}} + 40 {{27 {0 265} 1}} + 39 {{26 {0 265} 2}} + 18,trans {} + 41 {{28 {0 265} 1}} + 1,trans {{263 16} {264 17} {284 18}} + 37,trans {} + 42 {{20 {0 265} 2}} + 43 {{19 {0 265} 2}} + 44 {{8 {263 264} 1}} + 23,trans {} + 45 {{9 {263 264} 1}} + 5,trans {{257 23} {258 24} {259 25} {260 26} {261 27} {262 28} {271 32} {283 33} {292 34}} + 42,trans {} + 46 {{18 {0 265} 2} {8 {0 265} 0} {9 {0 265} 0}} + 47 {{12 0 2}} + 48 {{34 {0 265} 2}} + 50 {{32 {0 265} 2}} + 49 {{36 {0 265} 2}} + 27,trans {} + 9,trans {} + 46,trans {{263 16} {264 17} {284 51}} + 51 {{18 {0 265} 3}} + 52 {{12 0 3}} + 13,trans {{263 44} {264 45} {284 46}} + 32,trans {{265 49}} + 51,trans {} + 17,trans {} + 0,trans {{267 1} {268 2} {269 3} {270 4} {272 5} {273 6} {274 7} {275 8} {276 9} {277 10} {280 11} {281 12} {282 13} {285 14} {287 15}} + 36,trans {{265 50}} + 22,trans {} + 4,trans {} + 41,trans {} + 26,trans {} + 8,trans {{257 23} {258 24} {259 25} {260 26} {261 27} {262 28} {283 39}} + 45,trans {} + 12,trans {{263 16} {264 17} {284 43}} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 21,trans {} + 3,trans {{257 23} {258 24} {259 25} {260 26} {261 27} {262 28} {271 29} {283 30} {291 31}} + 40,trans {} + 39,trans {} + 10 {{20 {0 265} 1} {27 {0 265} 0} {28 {0 265} 0}} + 11 {{14 {0 265} 1}} + 25,trans {} + 12 {{19 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 7,trans {{257 23} {258 24} {259 25} {260 26} {261 27} {262 28} {271 36} {283 37} {290 38}} + 44,trans {} + 13 {{18 {0 265} 1} {8 {263 264} 0} {9 {263 264} 0}} + 14 {{0 0 1}} + 11,trans {} + 15 {{10 0 1} {12 0 1} {11 265 0}} + 30,trans {} + 29,trans {{265 48}} + 16 {{8 {0 265} 1}} + 48,trans {} + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0} {17 {0 265} 0} {18 {0 265} 0} {19 {0 265} 0} {20 {0 265} 0} {21 {0 265} 0} {22 {0 265} 0} {23 {0 265} 0} {24 {0 265} 0} {25 {0 265} 0} {26 {0 265} 0}} + 17 {{9 {0 265} 1}} + 1 {{16 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 18 {{16 {0 265} 2}} + 15,trans {{286 47}} + 2 {{21 {0 265} 1} {29 {0 265} 0} {30 {0 265} 0} {31 {0 265} 0}} + 19 {{30 {0 265} 1}} + 20 {{31 {0 265} 1}} + 34,trans {} + 3 {{23 {0 265} 1} {34 {0 265} 0} {35 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 21 {{29 {0 265} 1}} + 4 {{15 {0 265} 1}} + 22 {{21 {0 265} 2}} + 5 {{24 {0 265} 1} {36 {0 265} 0} {37 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 23 {{2 {0 265} 1}} + 20,trans {} + 19,trans {} + 6 {{17 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 2,trans {{267 19} {273 20} {279 21} {289 22}} + 24 {{5 {0 265} 1}} + 38,trans {} + 7 {{22 {0 265} 1} {32 {0 265} 0} {33 {0 265} 0} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 25 {{3 {0 265} 1}} + 8 {{26 {0 265} 1} {1 {0 265} 0} {2 {0 265} 0} {3 {0 265} 0} {4 {0 265} 0} {5 {0 265} 0} {6 {0 265} 0} {7 {0 265} 0}} + 26 {{6 {0 265} 1}} + 9 {{25 {0 265} 1}} + 27 {{4 {0 265} 1}} + 24,trans {} + 28 {{7 {0 265} 1}} + 6,trans {{263 16} {264 17} {284 35}} + 43,trans {} + 29 {{34 {0 265} 1}} + 30 {{35 {0 265} 1}} + 31 {{23 {0 265} 2}} + 10,trans {{266 40} {278 41} {288 42}} + 32 {{36 {0 265} 1}} + 28,trans {} + 33 {{37 {0 265} 1}} + 47,trans {{265 52}} + 34 {{24 {0 265} 2}} +} + +array set threed::token_id_table { + 286,t 1 + 286 @PSEUDO1 + 280,title OPEN + 279,title NONE + 264,line 15 + 292,line 101 + 287 3d + 270,t 0 + 269,t 0 + 288 method + 290 highlite + 289 bg + 276,line 31 + 265,title string + 291,t 1 + 291 border + 284,title {} + 292 compass + 274,t 0 + 261,line 11 + 293 start' + 288,line 84 + 257,t 0 + 270,title CLOSE + 269,title BORDER + 288,title {} + 273,line 28 + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 64 + 274,title HIGHLITE + 293,title {} + 283,t 1 + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 278,title MIP + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title float + 266,line 21 + 283,title {} + 292,t 1 + 278,line 33 + error,line 51 + 275,t 0 + 268,title BG + 287,title {} + 258,t 0 + 263,line 14 + 291,line 97 + error,title {} + 280,t 0 + 279,t 0 + 275,line 30 + 273,title EL + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 68 + 258,title NO + 284,t 1 + 277,title METHOD + 272,line 27 + 267,t 0 + 263,title integer + 288,t 1 + 284,line 60 + 282,title VIEW + 272,t 0 + 268,line 23 + 267,title AZ + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title COMPASS + 261 TRUE_ + 265,line 17 + 293,line 104 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 INT_ + 277,line 32 + 257,title YES + 264 REAL_ + 264,t 0 + 276,title MATCH + 265 STRING_ + 262,line 12 + 266 AIP_ + 290,line 93 + 289,line 88 + 285,t 1 + 267 AZ_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 BG_ + 268,t 0 + 281,title SCALE + 274,line 29 + 270 CLOSE_ + 269 BORDER_ + error,t 0 + 271 COLOR_ + 290,t 1 + 289,t 1 + 272 COMPASS_ + 258,line 8 + 286,line 65 + 273,t 0 + 273 EL_ + 266,title AIP + 285,title {} + 274 HIGHLITE_ + 275 LOCK_ + 271,line 26 + 276 MATCH_ + 277,t 0 + 277 METHOD_ + 271,title COLOR + 290,title {} + 289,title {} + 283,line 52 + 278 MIP_ + 261,t 0 + 280 OPEN_ + 279 NONE_ + 281 SCALE_ + 267,line 22 + 282,t 0 + 282 VIEW_ + 275,title LOCK + 283 yesno + 265,t 0 + 284 numeric + 280,line 35 + 279,line 34 + 285 command + 261,title TRUE +} + +proc threed::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { Create3DFrame } + 15 { 3DDestroyDialog } + 16 { ProcessCmdSet threed az $2 3DViewPoint } + 17 { ProcessCmdSet threed el $2 3DViewPoint } + 18 { ProcessCmdSet threed az $2; ProcessCmdSet threed el $3 3DViewPoint } + 19 { ProcessCmdSet threed scale $2 3DScale } + 20 { ProcessCmdSet threed method $2 3DRenderMethod } + 21 { ProcessCmdSet threed background $2 3DBackground } + 25 { Match3DCurrent } + 26 { ProcessCmdSet threed lock $2 Lock3DCurrent } + 27 { set _ aip } + 28 { set _ mip } + 29 { set _ none } + 30 { set _ azimuth } + 31 { set _ elevation } + 32 { ProcessCmdSet threed highlite,color $2 3DHighliteColor } + 33 { ProcessCmdSet threed highlite $1 3DHighlite } + 34 { ProcessCmdSet threed border,color $2 3DBorderColor } + 35 { ProcessCmdSet threed border $1 3DBorder } + 36 { ProcessCmdSet threed compass,color $2 3DCompassColor } + 37 { ProcessCmdSet threed compass $1 3DCompass } + } + 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 threed::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/threedsendlex.tcl b/ds9/parsers/threedsendlex.tcl new file mode 100644 index 0000000..4aa36b5 --- /dev/null +++ b/ds9/parsers/threedsendlex.tcl @@ -0,0 +1,406 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval threedsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc threedsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc threedsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc threedsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc threedsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc threedsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc threedsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc threedsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc threedsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc threedsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set AZ_ 257 +set BG_ 258 +set BORDER_ 259 +set COLOR_ 260 +set COMPASS_ 261 +set EL_ 262 +set HIGHLITE_ 263 +set LOCK_ 264 +set METHOD_ 265 +set SCALE_ 266 +set VIEW_ 267 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: az + if {[regexp -start $index_ -indices -line -nocase -- {\A(az)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: azimuth + if {[regexp -start $index_ -indices -line -nocase -- {\A(azimuth)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: background + if {[regexp -start $index_ -indices -line -nocase -- {\A(background)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: bg + if {[regexp -start $index_ -indices -line -nocase -- {\A(bg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: border + if {[regexp -start $index_ -indices -line -nocase -- {\A(border)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: color + if {[regexp -start $index_ -indices -line -nocase -- {\A(color)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: compass + if {[regexp -start $index_ -indices -line -nocase -- {\A(compass)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: el + if {[regexp -start $index_ -indices -line -nocase -- {\A(el)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: elevation + if {[regexp -start $index_ -indices -line -nocase -- {\A(elevation)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: highlite + if {[regexp -start $index_ -indices -line -nocase -- {\A(highlite)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: lock + if {[regexp -start $index_ -indices -line -nocase -- {\A(lock)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: method + if {[regexp -start $index_ -indices -line -nocase -- {\A(method)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: scale + if {[regexp -start $index_ -indices -line -nocase -- {\A(scale)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: view + if {[regexp -start $index_ -indices -line -nocase -- {\A(view)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: vp + if {[regexp -start $index_ -indices -line -nocase -- {\A(vp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AZ_ + } + 1 { +return $AZ_ + } + 2 { +return $BG_ + } + 3 { +return $BG_ + } + 4 { +return $BORDER_ + } + 5 { +return $COLOR_ + } + 6 { +return $COMPASS_ + } + 7 { +return $EL_ + } + 8 { +return $EL_ + } + 9 { +return $HIGHLITE_ + } + 10 { +return $LOCK_ + } + 11 { +return $METHOD_ + } + 12 { +return $SCALE_ + } + 13 { +return $VIEW_ + } + 14 { +return $VIEW_ + } + 15 { +# ignore whitespace + } + 16 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/threedsendparser.tab.tcl b/ds9/parsers/threedsendparser.tab.tcl new file mode 100644 index 0000000..99e4a48 --- /dev/null +++ b/ds9/parsers/threedsendparser.tab.tcl @@ -0,0 +1,11 @@ +set AZ_ 257 +set BG_ 258 +set BORDER_ 259 +set COLOR_ 260 +set COMPASS_ 261 +set EL_ 262 +set HIGHLITE_ 263 +set LOCK_ 264 +set METHOD_ 265 +set SCALE_ 266 +set VIEW_ 267 diff --git a/ds9/parsers/threedsendparser.tcl b/ds9/parsers/threedsendparser.tcl new file mode 100644 index 0000000..4116669 --- /dev/null +++ b/ds9/parsers/threedsendparser.tcl @@ -0,0 +1,447 @@ +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 threedsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc threedsend::YYABORT {} { + return -code return 1 +} + +proc threedsend::YYACCEPT {} { + return -code return 0 +} + +proc threedsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc threedsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc threedsend::yyerror {s} { + puts stderr $s +} + +proc threedsend::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 threedsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set threedsend::table { + 0:257 shift + 0:258 shift + 0:259 shift + 5:0,target 2 + 15:0,target 10 + 9:0 reduce + 0:266,target 9 + 0:261 shift + 6:260,target 16 + 11:0 accept + 0:262 shift + 6:269,target 17 + 0:263 shift + 0:264 shift + 4:260 shift + 0:265 shift + 15:0 reduce + 0:266 shift + 6:260 shift + 0:267 shift + 0:268 goto + 0:265,target 8 + 4:271,target 15 + 6:0,target 11 + 16:0,target 12 + 2:0 reduce + 4:271 goto + 6:0 reduce + 0:264,target 7 + 4:260,target 14 + 6:269 goto + 7:0,target 7 + 17:0,target 8 + 12:0 reduce + 10:0,target 3 + 0:263,target 6 + 16:0 reduce + 8:0,target 5 + 3:0 reduce + 1:0,target 1 + 11:0,target 0 + 0:262,target 5 + 7:0 reduce + 3:260 shift + 13:0 reduce + 9:0,target 4 + 0:261,target 4 + 2:0,target 6 + 12:0,target 14 + 17:0 reduce + 0:259,target 3 + 3:270 goto + 4:0 reduce + 3:0,target 13 + 13:0,target 9 + 8:0 reduce + 10:0 reduce + 0:258,target 2 + 0:268,target 11 + 14:0 reduce + 3:260,target 12 + 3:270,target 13 + 4:0,target 15 + 14:0,target 16 + 0:257,target 1 + 1:0 reduce + 0:267,target 10 + 5:0 reduce +} + +array set threedsend::rules { + 9,l 268 + 11,l 269 + 15,l 271 + 2,l 268 + 6,l 268 + 12,l 269 + 16,l 271 + 3,l 268 + 7,l 268 + 13,l 270 + 0,l 272 + 4,l 268 + 8,l 268 + 10,l 268 + 14,l 270 + 1,l 268 + 5,l 268 +} + +array set threedsend::rules { + 5,dc 1 + 0,dc 1 + 12,dc 1 + 8,dc 2 + 3,dc 1 + 15,dc 0 + 10,dc 2 + 6,dc 1 + 1,dc 1 + 13,dc 0 + 9,dc 2 + 4,dc 1 + 16,dc 1 + 11,dc 0 + 7,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set threedsend::rules { + 13,line 39 + 7,line 29 + 10,line 32 + 4,line 26 + 1,line 23 + 15,line 43 + 9,line 31 + 12,line 36 + 6,line 28 + 3,line 25 + 14,line 40 + 8,line 30 + 11,line 35 + 5,line 27 + 2,line 24 + 16,line 44 +} + +array set threedsend::lr1_table { + 13,trans {} + 17 {{8 0 2}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0}} + 14,trans {} + 1 {{1 0 1}} + 15,trans {} + 2 {{6 0 1}} + 16,trans {} + 3 {{9 0 1} {13 0 0} {14 0 0}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {261 4} {262 5} {263 6} {264 7} {265 8} {266 9} {267 10} {268 11}} + 4 {{10 0 1} {15 0 0} {16 0 0}} + 1,trans {} + 5 {{2 0 1}} + 2,trans {} + 6 {{8 0 1} {11 0 0} {12 0 0}} + 3,trans {{260 12} {270 13}} + 7 {{7 0 1}} + 4,trans {{260 14} {271 15}} + 8 {{5 0 1}} + 5,trans {} + 9 {{4 0 1}} + 10 {{3 0 1}} + 6,trans {{260 16} {269 17}} + 11 {{0 0 1}} + 7,trans {} + 12 {{14 0 1}} + 8,trans {} + 13 {{9 0 2}} + 10,trans {} + 9,trans {} + 14 {{16 0 1}} + 11,trans {} + 15 {{10 0 2}} + 12,trans {} + 16 {{12 0 1}} +} + +array set threedsend::token_id_table { + 264,line 15 + 270,t 1 + 269,t 1 + 265,title METHOD + 261,line 12 + 257,t 0 + 270,title {} + 269,title {} + 257,line 8 + 262,t 0 + 270,line 38 + 269,line 34 + 259,title BORDER + 260,title COLOR + 266,t 0 + 271,t 1 + 264,title LOCK + 266,line 17 + error error + 268,title {} + error,line 21 + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 10 + 260,line 11 + 258,title BG + 272,line 45 + 267,t 0 + 263,title HIGHLITE + 272,t 1 + 268,line 22 + 267,title VIEW + 257 AZ_ + 258 BG_ + 259,t 0 + 259 BORDER_ + 260 COLOR_ + 260,t 0 + 272,title {} + 261 COMPASS_ + 265,line 16 + 262 EL_ + 263 HIGHLITE_ + 257,title AZ + 264 LOCK_ + 264,t 0 + 265 METHOD_ + 262,line 13 + 266 SCALE_ + 267 VIEW_ + 268,t 1 + 268 threedsend + 262,title EL + 0 {$} + 0,t 0 + 270 border + 269 highlite + 271 compass + error,t 0 + 272 start' + 258,line 9 + 266,title SCALE + 271,line 42 + 271,title {} + 261,t 0 + 267,line 18 + 265,t 0 + 261,title COMPASS +} + +proc threedsend::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 { ProcessSendCmdGet threed az } + 2 { ProcessSendCmdGet threed el } + 3 { ProcessSendCmdGet2 threed az el } + 4 { ProcessSendCmdGet threed scale } + 5 { ProcessSendCmdGet threed method } + 6 { ProcessSendCmdGet threed background } + 7 { ProcessSendCmdYesNo threed lock } + 11 { ProcessSendCmdYesNo threed highlite } + 12 { ProcessSendCmdGet threed highlite,color } + 13 { ProcessSendCmdYesNo threed border } + 14 { ProcessSendCmdGet threed border,color } + 15 { ProcessSendCmdYesNo threed compass } + 16 { ProcessSendCmdGet threed compass,color } + } + 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 threedsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/tilelex.tcl b/ds9/parsers/tilelex.tcl new file mode 100644 index 0000000..22991c1 --- /dev/null +++ b/ds9/parsers/tilelex.tcl @@ -0,0 +1,462 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval tile { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc tile::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc tile::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc tile::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc tile::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc tile::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc tile::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc tile::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc tile::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc tile::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set AUTOMATIC_ 265 +set COLUMN_ 266 +set DIRECTION_ 267 +set GAP_ 268 +set GRID_ 269 +set LAYOUT_ 270 +set MANUAL_ 271 +set MODE_ 272 +set ROW_ 273 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: automatic + if {[regexp -start $index_ -indices -line -nocase -- {\A(automatic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: column + if {[regexp -start $index_ -indices -line -nocase -- {\A(column)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: direction + if {[regexp -start $index_ -indices -line -nocase -- {\A(direction)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: gap + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: layout + if {[regexp -start $index_ -indices -line -nocase -- {\A(layout)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: manual + if {[regexp -start $index_ -indices -line -nocase -- {\A(manual)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: row + if {[regexp -start $index_ -indices -line -nocase -- {\A(row)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $AUTOMATIC_ + } + 1 { +return $COLUMN_ + } + 2 { +return $DIRECTION_ + } + 3 { +return $GAP_ + } + 4 { +return $GRID_ + } + 5 { +return $LAYOUT_ + } + 6 { +return $MANUAL_ + } + 7 { +return $MODE_ + } + 8 { +return $ROW_ + } + 9 { +return $YES_ + } + 10 { +return $NO_ + } + 11 { +return $ON_ + } + 12 { +return $OFF_ + } + 13 { +return $TRUE_ + } + 14 { +return $FALSE_ + } + 15 { +set yylval $yytext; return $INT_ + } + 16 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval $yytext; return $STRING_ + } + 20 { +# ignore whitespace + } + 21 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/tileparser.tab.tcl b/ds9/parsers/tileparser.tab.tcl new file mode 100644 index 0000000..c962915 --- /dev/null +++ b/ds9/parsers/tileparser.tab.tcl @@ -0,0 +1,17 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set AUTOMATIC_ 265 +set COLUMN_ 266 +set DIRECTION_ 267 +set GAP_ 268 +set GRID_ 269 +set LAYOUT_ 270 +set MANUAL_ 271 +set MODE_ 272 +set ROW_ 273 diff --git a/ds9/parsers/tileparser.tcl b/ds9/parsers/tileparser.tcl new file mode 100644 index 0000000..86ee202 --- /dev/null +++ b/ds9/parsers/tileparser.tcl @@ -0,0 +1,722 @@ +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 tile { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc tile::YYABORT {} { + return -code return 1 +} + +proc tile::YYACCEPT {} { + return -code return 0 +} + +proc tile::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc tile::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc tile::yyerror {s} { + puts stderr $s +} + +proc tile::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 tile::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set tile::table { + 25:264,target 28 + 18:271,target 33 + 11:264 reduce + 7:264,target 15 + 0:257 shift + 18:281,target 34 + 0:258 shift + 23:0,target 13 + 5:0,target 3 + 0:259 shift + 0:260 shift + 27:0 reduce + 20:264,target 18 + 19:264,target 14 + 0:266,target 7 + 0:261 shift + 2:264,target 4 + 31:263,target 36 + 15:y,target 28 + 11:0 reduce + 8:267,target 15 + 0:276,target 13 + 0:262 shift + 17:263 shift + 14:264,target 8 + 0:264 reduce + 32:0 reduce + 34:264,target 21 + 20:264 reduce + 19:264 reduce + 0:266 shift + 2:264 reduce + 32:0,target 25 + 22:264 reduce + 4:264 reduce + 36:0 reduce + 28:264,target 29 + 15:x,target 27 + 6:0,target 6 + 0:275,target 12 + 0:269 shift + 24:264 shift + 20:0 reduce + 19:0 reduce + 6:264 reduce + 2:0 reduce + 0:272 shift + 26:264 reduce + 23:264,target 13 + 8:264 reduce + 5:264,target 3 + 0:273 shift + 9:269,target 21 + 0:274 goto + 28:264 reduce + 15:x shift + 9:279,target 23 + 6:0 reduce + 0:275 goto + 31:263 shift + 15:y shift + 8:267 shift + 0:264,target 10 + 0:276 goto + 8:268 shift + 0:274,target 11 + 33:0,target 26 + 8:270 shift + 0:278 goto + 33:264 reduce + 28:0 reduce + 25:0,target 28 + 15:282 goto + 12:264,target 12 + 7:0,target 15 + 12:0 reduce + 8:272 shift + 0:0,target 10 + 32:264,target 25 + 10:0,target 16 + 33:0 reduce + 17:263,target 31 + 26:264,target 30 + 8:264,target 20 + 0:273,target 10 + 34:0,target 21 + 21:264,target 17 + 8:280 goto + 3:264,target 2 + 26:0,target 30 + 21:0 reduce + 8:0,target 20 + 3:0 reduce + 1:0,target 1 + 11:0,target 11 + 10:264 reduce + 0:262,target 6 + 0:272,target 9 + 25:0 reduce + 12:264 reduce + 7:0 reduce + 10:264,target 16 + 18:265,target 32 + 14:264 reduce + 30:264,target 24 + 29:264,target 22 + 16:263 shift + 15:Y,target 26 + 9:266,target 20 + 35:0,target 9 + 30:0 reduce + 29:0 reduce + 27:0,target 27 + 13:0 accept + 0:261,target 5 + 24:264,target 35 + 20:0,target 18 + 19:0,target 14 + 6:264,target 6 + 1:264 reduce + 2:0,target 4 + 18:265 shift + 12:0,target 12 + 8:272,target 18 + 34:0 reduce + 21:264 reduce + 3:264 reduce + 0:0 reduce + 1:264,target 1 + 23:264 reduce + 15:X,target 25 + 5:264 reduce + 25:264 reduce + 18:271 shift + 7:264 reduce + 0:259,target 3 + 0:260,target 4 + 36:0,target 23 + 22:0 reduce + 0:269,target 8 + 4:0 reduce + 33:264,target 26 + 28:0,target 29 + 27:264 reduce + 15:282,target 29 + 14:277 goto + 21:0,target 17 + 15:X shift + 3:0,target 2 + 30:264 reduce + 29:264 reduce + 15:Y shift + 13:0,target 0 + 9:266 shift + 27:264,target 27 + 26:0 reduce + 14:277,target 24 + 8:0 reduce + 32:264 reduce + 10:0 reduce + 9:269 shift + 0:258,target 2 + 34:264 reduce + 22:264,target 19 + 4:264,target 5 + 18:281 goto + 8:270,target 17 + 0:278,target 14 + 36:264 reduce + 14:0 reduce + 9:273 shift + 8:280,target 19 + 30:0,target 24 + 29:0,target 22 + 22:0,target 19 + 4:0,target 5 + 36:264,target 23 + 35:0 reduce + 14:0,target 7 + 9:273,target 22 + 11:264,target 11 + 0:257,target 1 + 1:0 reduce + 9:279 goto + 8:268,target 16 + 23:0 reduce + 16:263,target 30 + 5:0 reduce +} + +array set tile::rules { + 27,l 282 + 9,l 276 + 11,l 278 + 15,l 278 + 20,l 280 + 19,l 279 + 2,l 274 + 24,l 280 + 6,l 275 + 28,l 282 + 12,l 278 + 16,l 278 + 21,l 280 + 3,l 274 + 25,l 281 + 7,l 276 + 30,l 282 + 29,l 282 + 13,l 278 + 0,l 283 + 17,l 279 + 22,l 280 + 4,l 275 + 26,l 281 + 8,l 277 + 10,l 278 + 14,l 278 + 18,l 279 + 1,l 274 + 23,l 280 + 5,l 275 +} + +array set tile::rules { + 23,dc 3 + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 26,dc 1 + 8,dc 0 + 21,dc 2 + 3,dc 1 + 15,dc 1 + 10,dc 0 + 30,dc 1 + 29,dc 1 + 24,dc 2 + 6,dc 1 + 18,dc 1 + 1,dc 1 + 13,dc 2 + 27,dc 1 + 9,dc 3 + 22,dc 2 + 4,dc 1 + 16,dc 1 + 11,dc 1 + 25,dc 1 + 7,dc 1 + 20,dc 0 + 19,dc 1 + 2,dc 1 + 14,dc 2 + 28,dc 1 +} + +array set tile::rules { + 13,line 59 + 25,line 77 + 7,line 52 + 10,line 56 + 22,line 72 + 4,line 47 + 18,line 66 + 1,line 42 + 15,line 61 + 27,line 81 + 9,line 53 + 12,line 58 + 24,line 74 + 6,line 49 + 21,line 71 + 3,line 44 + 17,line 65 + 30,line 84 + 29,line 83 + 14,line 60 + 8,e 1 + 26,line 78 + 8,line 52 + 11,line 57 + 23,line 73 + 5,line 48 + 20,line 70 + 19,line 67 + 2,line 43 + 16,line 62 + 28,line 82 +} + +array set tile::lr1_table { + 35 {{9 0 3}} + 36 {{23 {0 264} 3}} + 14,trans {{277 24}} + 33,trans {} + 18,trans {{265 32} {271 33} {281 34}} + 1,trans {} + 23,trans {} + 5,trans {} + 27,trans {} + 9,trans {{266 20} {269 21} {273 22} {279 23}} + 13,trans {} + 32,trans {} + 17,trans {{263 31}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {266 7} {269 8} {272 9} {273 10} {274 11} {275 12} {276 13} {278 14}} + 36,trans {} + 22,trans {} + 4,trans {} + 26,trans {} + 8,trans {{267 15} {268 16} {270 17} {272 18} {280 19}} + 12,trans {} + 31,trans {{263 36}} + 16,trans {{263 30}} + 35,trans {} + 21,trans {} + 3,trans {} + 10 {{16 {0 264} 1}} + 11 {{11 {0 264} 1}} + 25,trans {} + 12 {{12 {0 264} 1}} + 7,trans {} + 13 {{0 0 1}} + 14 {{7 0 1} {9 0 1} {8 264 0}} + 15 {{22 {0 264} 1} {27 {0 264} 0} {28 {0 264} 0} {29 {0 264} 0} {30 {0 264} 0}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{24 {0 264} 1}} + 0 {{0 0 0} {7 0 0} {9 0 0} {10 {0 264} 0} {11 {0 264} 0} {12 {0 264} 0} {13 {0 264} 0} {14 {0 264} 0} {15 {0 264} 0} {16 {0 264} 0} {1 {0 264} 0} {2 {0 264} 0} {3 {0 264} 0} {4 {0 264} 0} {5 {0 264} 0} {6 {0 264} 0}} + 17 {{23 {0 264} 1}} + 1 {{1 {0 264} 1}} + 18 {{21 {0 264} 1} {25 {0 264} 0} {26 {0 264} 0}} + 2 {{4 {0 264} 1}} + 19 {{14 {0 264} 2}} + 20 {{18 {0 264} 1}} + 15,trans {{X 25} {Y 26} {x 27} {y 28} {282 29}} + 34,trans {} + 3 {{2 {0 264} 1}} + 21 {{17 {0 264} 1}} + 4 {{5 {0 264} 1}} + 22 {{19 {0 264} 1}} + 5 {{3 {0 264} 1}} + 23 {{13 {0 264} 2}} + 20,trans {} + 19,trans {} + 6 {{6 {0 264} 1}} + 2,trans {} + 24 {{9 0 2}} + 7 {{15 {0 264} 1}} + 25 {{28 {0 264} 1}} + 8 {{14 {0 264} 1} {20 {0 264} 0} {21 {0 264} 0} {22 {0 264} 0} {23 {0 264} 0} {24 {0 264} 0}} + 26 {{30 {0 264} 1}} + 9 {{13 {0 264} 1} {17 {0 264} 0} {18 {0 264} 0} {19 {0 264} 0}} + 27 {{27 {0 264} 1}} + 24,trans {{264 35}} + 6,trans {} + 28 {{29 {0 264} 1}} + 29 {{22 {0 264} 2}} + 30 {{24 {0 264} 2}} + 31 {{23 {0 264} 2}} + 32 {{25 {0 264} 1}} + 10,trans {} + 28,trans {} + 33 {{26 {0 264} 1}} + 34 {{21 {0 264} 2}} +} + +array set tile::token_id_table { + 280,title {} + 279,title {} + 264,line 16 + 270,t 0 + 269,t 0 + 276,line 51 + 265,title AUTOMATIC + 274,t 1 + 261,line 11 + 257,t 0 + 270,title LAYOUT + 269,title GRID + 273,line 28 + y,t 0 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + X,line 81 + 283,t 1 + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + y,title {} + 278,title {} + 282,line 80 + error error + 271,t 0 + 264,title string + 266,line 21 + 283,title {} + y,line 82 + 278,line 55 + 275,t 1 + error,line 40 + 268,title GAP + 258,t 0 + 263,line 14 + X,t 0 + X X + error,title {} + Y Y + 280,t 1 + 279,t 1 + 275,line 46 + 273,title ROW + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + x,title {} + 277,title {} + 272,line 27 + 267,t 0 + 263,title integer + 282,title {} + 272,t 0 + 268,line 23 + 267,title DIRECTION + 257 YES_ + 281,line 76 + 276,t 1 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + Y,t 0 + 272,title MODE + 261 TRUE_ + 265,line 20 + 262 FALSE_ + 281,t 1 + 263 INT_ + x,line 80 + 277,line 52 + 257,title YES + 264 STRING_ + 264,t 0 + 276,title {} + 265 AUTOMATIC_ + 262,line 12 + 266 COLUMN_ + Y,title {} + 267 DIRECTION_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 GAP_ + 268,t 0 + 281,title {} + 274,line 41 + 270 LAYOUT_ + 269 GRID_ + error,t 0 + 271 MANUAL_ + 272 MODE_ + 258,line 8 + 273,t 0 + 273 ROW_ + 266,title COLUMN + Y,line 83 + 274 yes + 275 no + 271,line 26 + 276 command + x,t 0 + x x + 277,t 1 + 277 @PSEUDO1 + 271,title MANUAL + 283,line 85 + y y + 278 tile + 261,t 0 + 280 tileGrid + 279 tileMode + 281 tileGridMode + 267,line 22 + 282,t 1 + 282 tileGridDir + 275,title {} + 283 start' + 265,t 0 + X,title {} + 280,line 69 + 279,line 64 + 261,title TRUE +} + +proc tile::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 0 } + 5 { set _ 0 } + 6 { set _ 0 } + 8 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 10 { ProcessCmdSet current display tile DisplayMode } + 11 { ProcessCmdSet current display tile DisplayMode } + 12 { ProcessCmdSet current display single DisplayMode } + 13 { ProcessCmdSet tile mode $2 DisplayMode } + 15 { ProcessCmdSet tile mode column DisplayMode } + 16 { ProcessCmdSet tile mode row DisplayMode } + 17 { set _ grid } + 18 { set _ column } + 19 { set _ row } + 20 { ProcessCmdSet tile mode grid DisplayMode } + 21 { ProcessCmdSet tile grid,mode $2 DisplayMode } + 22 { ProcessCmdSet tile grid,dir $2 DisplayMode } + 23 { ProcessCmdSet tile grid,col $2; ProcessCmdSet tile grid,row $3; ProcessCmdSet tile grid,mode manual DisplayMode } + 24 { ProcessCmdSet tile grid,gap $2 DisplayMode } + 25 { set _ automatic } + 26 { set _ manual } + 27 { set _ x } + 28 { set _ x } + 29 { set _ y } + 30 { set _ y } + } + 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 tile::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/tilesendlex.tcl b/ds9/parsers/tilesendlex.tcl new file mode 100644 index 0000000..bd4c3f1 --- /dev/null +++ b/ds9/parsers/tilesendlex.tcl @@ -0,0 +1,300 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval tilesend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc tilesend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc tilesend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc tilesend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc tilesend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc tilesend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc tilesend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc tilesend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc tilesend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc tilesend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set DIRECTION_ 257 +set GAP_ 258 +set GRID_ 259 +set LAYOUT_ 260 +set MODE_ 261 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: direction + if {[regexp -start $index_ -indices -line -nocase -- {\A(direction)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: gap + if {[regexp -start $index_ -indices -line -nocase -- {\A(gap)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: grid + if {[regexp -start $index_ -indices -line -nocase -- {\A(grid)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: layout + if {[regexp -start $index_ -indices -line -nocase -- {\A(layout)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: mode + if {[regexp -start $index_ -indices -line -nocase -- {\A(mode)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $DIRECTION_ + } + 1 { +return $GAP_ + } + 2 { +return $GRID_ + } + 3 { +return $LAYOUT_ + } + 4 { +return $MODE_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/tilesendparser.tab.tcl b/ds9/parsers/tilesendparser.tab.tcl new file mode 100644 index 0000000..5b802b4 --- /dev/null +++ b/ds9/parsers/tilesendparser.tab.tcl @@ -0,0 +1,5 @@ +set DIRECTION_ 257 +set GAP_ 258 +set GRID_ 259 +set LAYOUT_ 260 +set MODE_ 261 diff --git a/ds9/parsers/tilesendparser.tcl b/ds9/parsers/tilesendparser.tcl new file mode 100644 index 0000000..ef39b59 --- /dev/null +++ b/ds9/parsers/tilesendparser.tcl @@ -0,0 +1,327 @@ +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 tilesend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc tilesend::YYABORT {} { + return -code return 1 +} + +proc tilesend::YYACCEPT {} { + return -code return 0 +} + +proc tilesend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc tilesend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc tilesend::yyerror {s} { + puts stderr $s +} + +proc tilesend::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 tilesend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set tilesend::table { + 6:0 reduce + 3:0,target 0 + 7:0 reduce + 1:257 shift + 1:263,target 8 + 8:0 reduce + 5:0,target 7 + 1:258 shift + 0:259 shift + 1:260 shift + 0:261 shift + 7:0,target 4 + 1:257,target 4 + 0:262 goto + 1:261 shift + 0:0,target 1 + 1:260,target 6 + 0:261,target 2 + 1:263 goto + 2:0,target 2 + 4:0,target 5 + 0:0 reduce + 6:0,target 6 + 2:0 reduce + 8:0,target 3 + 3:0 accept + 1:258,target 5 + 0:259,target 1 + 4:0 reduce + 5:0 reduce + 1:261,target 7 + 0:262,target 3 +} + +array set tilesend::rules { + 0,l 264 + 1,l 262 + 2,l 262 + 3,l 262 + 4,l 263 + 5,l 263 + 6,l 263 + 7,l 263 +} + +array set tilesend::rules { + 5,dc 1 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 2 +} + +array set tilesend::rules { + 5,line 23 + 7,line 25 + 2,line 18 + 4,line 22 + 6,line 24 + 1,line 17 + 3,line 19 +} + +array set tilesend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0}} + 1 {{3 0 1} {4 0 0} {5 0 0} {6 0 0} {7 0 0}} + 2 {{2 0 1}} + 3 {{0 0 1}} + 0,trans {{259 1} {261 2} {262 3}} + 4 {{5 0 1}} + 5 {{7 0 1}} + 1,trans {{257 4} {258 5} {260 6} {261 7} {263 8}} + 6 {{6 0 1}} + 2,trans {} + 3,trans {} + 7 {{4 0 1}} + 4,trans {} + 8 {{3 0 2}} + 5,trans {} + 6,trans {} + 7,trans {} + 8,trans {} +} + +array set tilesend::token_id_table { + 264,line 26 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 9 + 261,line 12 + error,line 15 + 257 DIRECTION_ + 257,t 0 + 263,line 21 + 258 GAP_ + 258,t 0 + error,title {} + 260,t 0 + 260 LAYOUT_ + 259 GRID_ + 259,t 0 + 261,t 0 + 261 MODE_ + 262,t 1 + 262 tilesend + 257,line 8 + 263,t 1 + 263 grid + 264,t 1 + 264 start' + 260,line 11 + 257,title DIRECTION + 259,line 10 + 258,title GAP + 262,line 16 + 260,title LAYOUT + 259,title GRID + 261,title MODE +} + +proc tilesend::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 { TileSendCmd } + 2 { ProcessSendCmdGet tile mode } + 4 { ProcessSendCmdGet tile grid,mode } + 5 { ProcessSendCmdGet tile grid,dir } + 6 { ProcessSendCmdGet tile grid,row } + 7 { ProcessSendCmdGet tile grid,gap } + } + 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 tilesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/twomasslex.tcl b/ds9/parsers/twomasslex.tcl new file mode 100644 index 0000000..8b40c55 --- /dev/null +++ b/ds9/parsers/twomasslex.tcl @@ -0,0 +1,588 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval twomass { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc twomass::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc twomass::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc twomass::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc twomass::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc twomass::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc twomass::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc twomass::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc twomass::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc twomass::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $YES_ + } + 1 { +return $NO_ + } + 2 { +return $ON_ + } + 3 { +return $OFF_ + } + 4 { +return $TRUE_ + } + 5 { +return $FALSE_ + } + 6 { +return $CLEAR_ + } + 7 { +return $CLOSE_ + } + 8 { +return $COORD_ + } + 9 { +return $CROSSHAIR_ + } + 10 { +return $CURRENT_ + } + 11 { +return $FRAME_ + } + 12 { +return $NAME_ + } + 13 { +return $NEW_ + } + 14 { +return $OPEN_ + } + 15 { +return $SAVE_ + } + 16 { +return $SIZE_ + } + 17 { +return $SURVEY_ + } + 18 { +return $UPDATE_ + } + 19 { +return $DEGREES_ + } + 20 { +return $ARCMIN_ + } + 21 { +return $ARCSEC_ + } + 22 { +return $SEXAGESIMAL_ + } + 23 - + 24 { +set yylval $yytext; return $SEXSTR_ + } + 25 { +set yylval $yytext; return $INT_ + } + 26 - + 27 { +set yylval $yytext; return $REAL_ + } + 28 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval $yytext; return $STRING_ + } + 32 { +# ignore whitespace + } + 33 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/twomassparser.tab.tcl b/ds9/parsers/twomassparser.tab.tcl new file mode 100644 index 0000000..0eda1ee --- /dev/null +++ b/ds9/parsers/twomassparser.tab.tcl @@ -0,0 +1,27 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 diff --git a/ds9/parsers/twomassparser.tcl b/ds9/parsers/twomassparser.tcl new file mode 100644 index 0000000..4f8a757 --- /dev/null +++ b/ds9/parsers/twomassparser.tcl @@ -0,0 +1,1007 @@ +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 twomass { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc twomass::YYABORT {} { + return -code return 1 +} + +proc twomass::YYACCEPT {} { + return -code return 0 +} + +proc twomass::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc twomass::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc twomass::yyerror {s} { + puts stderr $s +} + +proc twomass::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 twomass::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set twomass::table { + 40:285,target 48 + 10:280,target 39 + 16:283,target 22 + 30:283 reduce + 29:283 reduce + 3:288,target 21 + 27:0 reduce + 48:0 reduce + 3:267,target 19 + 51:283,target 37 + 7:283,target 1 + 18:290,target 43 + 38:283 reduce + 0:275,target 9 + 9:295 goto + 11:282,target 19 + 40:283,target 8 + 39:283,target 10 + 6:266 shift + 7:262,target 32 + 56:0,target 13 + 6:268 shift + 24:0 reduce + 48:0,target 35 + 47:283 reduce + 45:0 reduce + 33:0,target 31 + 2:282,target 12 + 17:280 shift + 25:0,target 39 + 28:283,target 5 + 44:277,target 53 + 34:282,target 12 + 0:273,target 7 + 56:283 reduce + 7:259,target 29 + 7:260,target 30 + 21:0 reduce + 26:283 reduce + 42:0 reduce + 52:283,target 16 + 2:280,target 17 + 12:282,target 20 + 41:283,target 49 + 35:283 reduce + 0:271,target 5 + 6:294 goto + 11:277,target 19 + 44:276 shift + 44:277 shift + 7:257,target 27 + 44:278 shift + 3:267 shift + 38:0 reduce + 30:283,target 6 + 29:283,target 3 + 3:270 shift + 44:283 reduce + 0:290,target 14 + 8:281,target 11 + 14:281 shift + 44:287 goto + 14:282 shift + 53:0,target 17 + 44:289 goto + 0:268,target 3 + 45:0,target 11 + 53:283 reduce + 37:0,target 43 + 40:276,target 47 + 30:0,target 6 + 29:0,target 3 + 22:0,target 28 + 53:283,target 17 + 35:0 reduce + 14:290 goto + 4:263,target 22 + 23:283 reduce + 56:0 reduce + 3:288 goto + 42:283,target 10 + 12:277,target 20 + 18:281,target 11 + 32:283 reduce + 11:0 reduce + 31:283,target 4 + 0:264 shift + 32:0 reduce + 0:265 shift + 44:289,target 56 + 53:0 reduce + 0:268 shift + 43:285,target 51 + 0:269 shift + 11:276 reduce + 41:283 shift + 0:271 shift + 11:277 reduce + 19:283,target 15 + 20:283,target 14 + 0:272 shift + 11:278 reduce + 0:273 shift + 0:274 shift + 11:281 reduce + 0:275 shift + 9:j,target 36 + 11:282 reduce + 0:264,target 1 + 54:283,target 18 + 50:283 reduce + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 44:287,target 55 + 0:282 shift + 14:282,target 12 + 50:0 reduce + 49:0 reduce + 0:283 shift + 43:283,target 8 + 19:283 reduce + 20:283 reduce + 50:0,target 38 + 49:0,target 23 + 0:283,target 13 + 42:0,target 10 + 0:290 goto + 8:281 shift + 26:0,target 34 + 0:291 goto + 8:282 shift + 9:h,target 35 + 32:283,target 7 + 11:0,target 19 + 0:293 goto + 25:0 reduce + 28:283 reduce + 2:290,target 18 + 46:0 reduce + 8:290 goto + 21:283,target 32 + 34:290,target 44 + 0:281,target 11 + 37:283 reduce + 0:0 reduce + 55:283,target 30 + 9:295,target 38 + 22:0 reduce + 46:283 reduce + 43:0 reduce + 44:283,target 12 + 1:283,target 26 + 16:283 reduce + 33:283,target 31 + 55:283 reduce + 39:286,target 46 + 9:h shift + 5:283 reduce + 9:j shift + 54:0,target 18 + 40:0 reduce + 39:0 reduce + 9:k shift + 16:292 goto + 22:283,target 28 + 25:283 reduce + 46:0,target 36 + 38:0,target 33 + 31:0,target 4 + 7:284,target 33 + 23:0,target 29 + 43:276,target 47 + 15:0,target 0 + 34:281 shift + 56:283,target 13 + 34:282 shift + 43:276 shift + 15:0 accept + 45:283,target 11 + 36:0 reduce + 34:290 goto + 44:278,target 54 + 43:283 reduce + 43:285 goto + 0:274,target 8 + 11:281,target 19 + 13:283 reduce + 7:261,target 31 + 12:0 reduce + 52:283 reduce + 2:280 shift + 2:281 shift + 23:283,target 29 + 33:0 reduce + 2:282 shift + 2:281,target 11 + 54:0 reduce + 0:293,target 16 + 22:283 reduce + 44:276,target 52 + 1:0,target 26 + 34:281,target 11 + 2:290 goto + 0:272,target 6 + 11:278,target 19 + 7:0 reduce + 51:0,target 37 + 39:279,target 45 + 31:283 reduce + 7:258,target 28 + 46:283,target 36 + 43:0,target 8 + 40:276 shift + 35:0,target 42 + 30:0 reduce + 14:290,target 40 + 29:0 reduce + 27:0,target 2 + 7:257 shift + 19:0,target 15 + 20:0,target 14 + 51:0 reduce + 39:279 shift + 7:258 shift + 12:0,target 20 + 0:291,target 15 + 7:259 shift + 7:260 shift + 8:282,target 12 + 35:283,target 42 + 6:294,target 26 + 7:261 shift + 42:286,target 50 + 40:283 reduce + 39:283 reduce + 7:262 shift + 12:281,target 20 + 40:285 goto + 10:280 shift + 39:286 goto + 0:269,target 4 + 11:276,target 19 + 17:280,target 42 + 24:283,target 40 + 26:0 reduce + 48:283 reduce + 47:0 reduce + 13:283,target 27 + 18:281 shift + 18:282 shift + 12:278,target 20 + 18:282,target 12 + 1:0 reduce + 47:283,target 9 + 4:283,target 23 + 7:283 reduce + 18:290 goto + 7:284 goto + 23:0 reduce + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 36:283,target 41 + 55:0,target 30 + 12:276,target 20 + 47:0,target 9 + 36:283 reduce + 40:0,target 8 + 39:0,target 10 + 4:263 shift + 9:k,target 37 + 16:292,target 41 + 25:283,target 39 + 32:0,target 7 + 0:265,target 2 + 6:268,target 25 + 24:0,target 40 + 16:0,target 21 + 19:0 reduce + 20:0 reduce + 45:283 reduce + 42:279,target 45 + 48:283,target 35 + 5:283,target 25 + 54:283 reduce + 6:266,target 24 + 16:0 reduce + 4:283 shift + 37:283,target 43 + 37:0 reduce + 14:281,target 11 + 24:283 reduce + 0:282,target 12 + 26:283,target 34 + 33:283 reduce + 13:0 reduce + 42:279 shift + 55:0 reduce + 52:0,target 16 + 12:276 reduce + 44:0,target 12 + 42:283 reduce + 12:277 reduce + 36:0,target 41 + 12:278 reduce + 50:283,target 38 + 0:280,target 10 + 28:0,target 5 + 42:286 goto + 12:281 reduce + 21:0,target 32 + 12:282 reduce + 13:0,target 27 + 51:283 reduce + 38:283,target 33 + 31:0 reduce + 1:283 reduce + 8:290,target 34 + 52:0 reduce + 3:270,target 20 + 21:283 reduce + 27:283,target 2 + 5:0 reduce +} + +array set twomass::rules { + 9,l 285 + 11,l 286 + 32,l 293 + 6,l 284 + 28,l 293 + 3,l 284 + 25,l 293 + 0,l 296 + 22,l 292 + 43,l 295 + 18,l 289 + 40,l 294 + 39,l 294 + 15,l 288 + 36,l 293 + 12,l 287 + 33,l 293 + 7,l 284 + 29,l 293 + 30,l 293 + 4,l 284 + 26,l 293 + 1,l 284 + 23,l 291 + 19,l 290 + 20,l 290 + 41,l 295 + 16,l 289 + 37,l 293 + 13,l 287 + 34,l 293 + 8,l 285 + 10,l 286 + 31,l 293 + 5,l 284 + 27,l 293 + 2,l 284 + 24,l 293 + 21,l 291 + 42,l 295 + 17,l 289 + 38,l 293 + 14,l 288 + 35,l 293 +} + +array set twomass::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 4 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 22,dc 0 + 36,dc 3 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 2 +} + +array set twomass::rules { + 41,line 147 + 7,line 88 + 37,line 139 + 4,line 85 + 34,line 135 + 1,line 82 + 31,line 131 + 27,line 126 + 24,line 123 + 21,line 119 + 17,line 112 + 22,e 1 + 14,line 107 + 11,line 100 + 43,line 149 + 9,line 96 + 40,line 144 + 39,line 143 + 6,line 87 + 36,line 138 + 3,line 84 + 33,line 133 + 29,line 128 + 30,line 130 + 26,line 125 + 23,line 120 + 19,line 115 + 20,line 116 + 16,line 111 + 13,line 104 + 10,line 99 + 42,line 148 + 8,line 95 + 38,line 140 + 5,line 86 + 35,line 136 + 2,line 83 + 32,line 132 + 28,line 127 + 25,line 124 + 22,line 119 + 18,line 113 + 15,line 108 + 12,line 103 +} + +array set twomass::lr1_table { + 35 {{42 {0 283} 1}} + 14,trans {{281 40} {282 41} {290 42}} + 36 {{41 {0 283} 1}} + 33,trans {} + 37 {{43 {0 283} 1}} + 52,trans {} + 38 {{33 {0 283} 2}} + 40 {{19 {0 276} 1}} + 39 {{36 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} + 18,trans {{281 40} {282 41} {290 45}} + 41 {{20 {0 276} 1}} + 1,trans {} + 37,trans {} + 42 {{35 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 56,trans {} + 43 {{23 0 2}} + 44 {{38 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 23,trans {} + 45 {{37 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 5,trans {} + 42,trans {{276 51} {285 52}} + 46 {{19 {0 276 277 278} 1}} + 47 {{20 {0 276 277 278} 1}} + 48 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 50 {{36 {0 283} 3}} + 49 {{11 {0 283} 1}} + 27,trans {} + 9,trans {{h 35} {j 36} {k 37} {295 38}} + 46,trans {} + 51 {{9 {0 283} 1}} + 52 {{35 {0 283} 3}} + 53 {{23 0 3}} + 13,trans {} + 54 {{38 {0 283} 4}} + 32,trans {} + 51,trans {} + 55 {{37 {0 283} 4}} + 56 {{16 {0 283} 1}} + 57 {{17 {0 283} 1}} + 17,trans {{280 44}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {275 9} {280 10} {281 11} {282 12} {283 13} {290 14} {291 15} {293 16}} + 58 {{18 {0 283} 1}} + 36,trans {} + 55,trans {} + 60 {{13 {0 283} 1}} + 59 {{30 {0 283} 4}} + 22,trans {} + 4,trans {{263 22} {283 23}} + 41,trans {} + 60,trans {} + 59,trans {} + 26,trans {} + 8,trans {{281 11} {282 12} {290 34}} + 45,trans {{276 51} {285 55}} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {{292 43}} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {{267 19} {270 20} {288 21}} + 40,trans {} + 39,trans {{279 49} {286 50}} + 58,trans {} + 10 {{36 {0 283} 1}} + 11 {{19 {281 282} 1}} + 25,trans {} + 12 {{20 {281 282} 1}} + 7,trans {{257 27} {258 28} {259 29} {260 30} {261 31} {262 32} {284 33}} + 44,trans {{279 49} {286 54}} + 13 {{27 {0 283} 1}} + 14 {{35 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 11,trans {} + 15 {{0 0 1}} + 30,trans {} + 29,trans {} + 16 {{21 0 1} {23 0 1} {22 283 0}} + 48,trans {{276 56} {277 57} {278 58} {287 59} {289 60}} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {38 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{38 {0 283} 2}} + 1 {{26 {0 283} 1}} + 18 {{37 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 15,trans {} + 2 {{37 {0 283} 1} {38 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{15 {0 283} 1}} + 20 {{14 {0 283} 1}} + 34,trans {{281 46} {282 47} {290 48}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{32 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{28 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{29 {0 283} 2}} + 20,trans {} + 19,trans {} + 6 {{34 {0 283} 1} {39 {0 283} 0} {40 {0 283} 0}} + 2,trans {{280 17} {281 11} {282 12} {290 18}} + 24 {{40 {0 283} 1}} + 38,trans {} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{39 {0 283} 1}} + 57,trans {} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{34 {0 283} 2}} + 9 {{33 {0 283} 1} {41 {0 283} 0} {42 {0 283} 0} {43 {0 283} 0}} + 27 {{2 {0 283} 1}} + 24,trans {} + 6,trans {{266 24} {268 25} {294 26}} + 28 {{5 {0 283} 1}} + 43,trans {{283 53}} + 29 {{3 {0 283} 1}} + 30 {{6 {0 283} 1}} + 31 {{4 {0 283} 1}} + 10,trans {{280 39}} + 32 {{7 {0 283} 1}} + 28,trans {} + 33 {{31 {0 283} 2}} + 47,trans {} + 34 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} +} + +array set twomass::token_id_table { + 286,t 1 + 286 sex + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 292,line 119 + 287 sizeOpt + 270,t 0 + 269,t 0 + 288 frame + 290 numeric + 289 rformat + 276,line 28 + 265,title COORD + 291,t 1 + 291 command + 284,title {} + 292 @PSEUDO1 + 274,t 0 + 261,line 11 + 293 twomass + 288,line 106 + 257,t 0 + 294 update + 270,title NEW + 269,title NAME + 295,t 1 + 295 survey + 288,title {} + 273,line 24 + 296 start' + 278,t 0 + j,t 0 + 257,line 7 + 262,t 0 + 285,line 94 + 274,title SIZE + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + h,title {} + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 142 + 283,title string + 292,t 1 + 278,line 30 + error,line 80 + 275,t 0 + 268,title FRAME + k,line 148 + 287,title {} + 258,t 0 + 263,line 14 + 291,line 118 + error,title {} + 296,t 1 + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + k,t 0 + 292,title {} + 263,t 0 + h,line 147 + 259,line 9 + 260,line 10 + 287,line 102 + 258,title NO + 284,t 1 + 277,title ARCMIN + 296,title {} + 272,line 23 + 267,t 0 + k,title {} + 263,title CLEAR + 288,t 1 + 284,line 81 + 282,title float + 272,t 0 + 268,line 19 + 296,line 150 + 267,title CURRENT + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + h,t 0 + h h + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + j j + 293,line 122 + 291,title {} + 262 FALSE_ + k k + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + j,line 146 + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 290,line 114 + 289,line 110 + 285,t 1 + 267 CURRENT_ + j,title {} + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + error,t 0 + 271 OPEN_ + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 98 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title {} + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 281 INT_ + 267,line 18 + 295,line 146 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 yesno + 280,line 34 + 279,line 32 + 285 deg + 261,title TRUE +} + +proc twomass::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dtwomass 1 } + 26 { ARDestroy dtwomass } + 27 { ProcessCmdSet dtwomass name $1 "IMGSVRApply dtwomass 1" } + 28 { ProcessCmdSet dtwomass name {} } + 29 { ProcessCmdSet dtwomass name $2 "IMGSVRApply dtwomass 1" } + 30 { ProcessCmdSet4 dtwomass width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet dtwomass save $2 } + 32 { ProcessCmdSet dtwomass mode $2 } + 33 { ProcessCmdSet dtwomass survey $2 } + 35 { ProcessCmdSet4 dtwomass x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dtwomass 1" } + 36 { ProcessCmdSet4 dtwomass x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dtwomass 1" } + 37 { ProcessCmdSet4 dtwomass x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dtwomass 1" } + 38 { ProcessCmdSet4 dtwomass x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dtwomass 1" } + 39 { IMGSVRUpdate dtwomass; IMGSVRApply dtwomass 1 } + 40 { IMGSVRCrosshair dtwomass; IMGSVRApply dtwomass 1 } + 41 { set _ $1 } + 42 { set _ $1 } + 43 { set _ $1 } + } + 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 twomass::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/twomasssendlex.tcl b/ds9/parsers/twomasssendlex.tcl new file mode 100644 index 0000000..87d6d47 --- /dev/null +++ b/ds9/parsers/twomasssendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval twomasssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc twomasssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc twomasssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc twomasssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc twomasssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc twomasssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc twomasssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc twomasssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc twomasssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc twomasssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/twomasssendparser.tab.tcl b/ds9/parsers/twomasssendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/twomasssendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/twomasssendparser.tcl b/ds9/parsers/twomasssendparser.tcl new file mode 100644 index 0000000..357935c --- /dev/null +++ b/ds9/parsers/twomasssendparser.tcl @@ -0,0 +1,324 @@ +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 twomasssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc twomasssend::YYABORT {} { + return -code return 1 +} + +proc twomasssend::YYACCEPT {} { + return -code return 0 +} + +proc twomasssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc twomasssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc twomasssend::yyerror {s} { + puts stderr $s +} + +proc twomasssend::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 twomasssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set twomasssend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 accept + 0:258 shift + 5:0,target 6 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 0 + 0:258,target 2 + 0:262 shift + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 7 + 4:0,target 3 + 0:0 reduce + 6:0,target 5 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 7 + 5:0 reduce + 0:262,target 6 +} + +array set twomasssend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 + 7,l 263 +} + +array set twomasssend::rules { + 5,dc 1 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set twomasssend::rules { + 5,line 24 + 7,line 26 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set twomasssend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0}} + 1 {{7 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7}} + 5 {{6 0 1}} + 1,trans {} + 6 {{5 0 1}} + 2,trans {} + 7 {{0 0 1}} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} + 7,trans {} +} + +array set twomasssend::token_id_table { + 264,line 27 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 twomasssend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc twomasssend::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 { ProcessSendCmdGet dtwomass name } + 2 { ProcessSendCmdGet dtwomass name } + 3 { ProcessSendCmdYesNo dtwomass save } + 4 { ProcessSendCmdGet dtwomass mode } + 5 { ProcessSendCmdGet dtwomass survey } + 6 { ProcessSendCmdGet3 dtwomass width height rformat } + 7 { ProcessSendCmdGet3 dtwomass x y skyformat } + } + 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 twomasssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/updatelex.tcl b/ds9/parsers/updatelex.tcl new file mode 100644 index 0000000..6106457 --- /dev/null +++ b/ds9/parsers/updatelex.tcl @@ -0,0 +1,374 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval update { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc update::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc update::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc update::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc update::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc update::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc update::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc update::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc update::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc update::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set NOW_ 265 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: now + if {[regexp -start $index_ -indices -line -nocase -- {\A(now)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $NOW_ + } + 1 { +return $YES_ + } + 2 { +return $NO_ + } + 3 { +return $ON_ + } + 4 { +return $OFF_ + } + 5 { +return $TRUE_ + } + 6 { +return $FALSE_ + } + 7 { +set yylval $yytext; return $INT_ + } + 8 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval $yytext; return $STRING_ + } + 12 { +# ignore whitespace + } + 13 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/updateparser.tab.tcl b/ds9/parsers/updateparser.tab.tcl new file mode 100644 index 0000000..379c7ea --- /dev/null +++ b/ds9/parsers/updateparser.tab.tcl @@ -0,0 +1,9 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set NOW_ 265 diff --git a/ds9/parsers/updateparser.tcl b/ds9/parsers/updateparser.tcl new file mode 100644 index 0000000..2dbcbe6 --- /dev/null +++ b/ds9/parsers/updateparser.tcl @@ -0,0 +1,474 @@ +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 update { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc update::YYABORT {} { + return -code return 1 +} + +proc update::YYACCEPT {} { + return -code return 0 +} + +proc update::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc update::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc update::yyerror {s} { + puts stderr $s +} + +proc update::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 update::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set update::table { + 11:264 reduce + 0:257 shift + 13:263 shift + 0:258 shift + 0:259 shift + 0:260 shift + 5:0,target 4 + 20:264,target 12 + 15:263 shift + 9:0 reduce + 0:266,target 9 + 0:261 shift + 2:264,target 5 + 11:268 goto + 11:0 reduce + 0:262 shift + 0:263 shift + 14:264,target 17 + 0:264 reduce + 19:263 shift + 7:263,target 12 + 0:265 shift + 20:264 reduce + 0:266 goto + 2:264 reduce + 0:267 goto + 22:264 reduce + 19:263,target 21 + 0:265,target 8 + 4:264 reduce + 6:0,target 7 + 0:269 goto + 20:0 reduce + 6:264 reduce + 2:0 reduce + 8:263 shift + 8:264 reduce + 5:264,target 4 + 6:0 reduce + 0:264,target 11 + 17:0,target 10 + 0:0,target 11 + 10:0,target 0 + 0:263,target 7 + 8:264,target 13 + 12:263,target 15 + 3:264,target 3 + 8:0,target 13 + 3:0 reduce + 1:0,target 2 + 11:268,target 14 + 11:0,target 8 + 0:262,target 6 + 12:263 shift + 8:263,target 13 + 21:263,target 22 + 14:264 shift + 16:263 shift + 18:263 shift + 15:263,target 18 + 9:0,target 15 + 0:261,target 5 + 20:0,target 12 + 6:264,target 7 + 1:264 reduce + 2:0,target 5 + 21:263 shift + 3:264 reduce + 17:0 reduce + 0:0 reduce + 1:264,target 2 + 5:264 reduce + 7:263 shift + 0:259,target 3 + 0:260,target 4 + 22:0 reduce + 0:269,target 11 + 4:0 reduce + 9:264 reduce + 3:0,target 3 + 18:263,target 20 + 9:264,target 15 + 8:0 reduce + 10:0 accept + 13:263,target 16 + 0:258,target 2 + 22:264,target 14 + 4:264,target 6 + 22:0,target 14 + 4:0,target 6 + 11:264,target 9 + 0:257,target 1 + 1:0 reduce + 0:267,target 10 + 16:263,target 19 + 5:0 reduce +} + +array set update::rules { + 9,l 268 + 11,l 269 + 15,l 269 + 2,l 266 + 6,l 266 + 12,l 269 + 3,l 266 + 7,l 266 + 13,l 269 + 0,l 270 + 4,l 266 + 8,l 267 + 10,l 267 + 14,l 269 + 1,l 266 + 5,l 266 +} + +array set update::rules { + 5,dc 1 + 0,dc 1 + 12,dc 5 + 8,dc 1 + 3,dc 1 + 15,dc 1 + 10,dc 3 + 6,dc 1 + 1,dc 0 + 13,dc 1 + 9,dc 0 + 4,dc 1 + 11,dc 0 + 7,dc 1 + 2,dc 1 + 14,dc 6 +} + +array set update::rules { + 13,line 48 + 7,line 39 + 10,line 43 + 4,line 36 + 1,line 33 + 15,line 51 + 9,line 42 + 12,line 47 + 6,line 38 + 3,line 35 + 14,line 50 + 8,line 42 + 11,line 46 + 5,line 37 + 2,line 34 + 9,e 1 +} + +array set update::lr1_table { + 17 {{10 0 3}} + 13,trans {{263 16}} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 264} 0} {12 {0 264} 0} {13 {0 264} 0} {14 {0 264} 0} {15 {0 264} 0} {1 {0 264} 0} {2 {0 264} 0} {3 {0 264} 0} {4 {0 264} 0} {5 {0 264} 0} {6 {0 264} 0} {7 {0 264} 0}} + 18 {{12 {0 264} 4}} + 14,trans {{264 17}} + 1 {{2 {0 264} 1}} + 20 {{12 {0 264} 5}} + 19 {{14 {0 264} 4}} + 15,trans {{263 18}} + 2 {{5 {0 264} 1}} + 21 {{14 {0 264} 5}} + 16,trans {{263 19}} + 3 {{3 {0 264} 1}} + 22 {{14 {0 264} 6}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {265 8} {266 9} {267 10} {269 11}} + 4 {{6 {0 264} 1}} + 18,trans {{263 20}} + 1,trans {} + 5 {{4 {0 264} 1}} + 20,trans {} + 19,trans {{263 21}} + 2,trans {} + 6 {{7 {0 264} 1}} + 21,trans {{263 22}} + 3,trans {} + 7 {{12 {0 264} 1}} + 22,trans {} + 4,trans {} + 8 {{13 {0 264} 1} {14 {0 264} 1}} + 5,trans {} + 9 {{15 {0 264} 1}} + 10 {{0 0 1}} + 6,trans {} + 11 {{8 0 1} {10 0 1} {9 264 0}} + 7,trans {{263 12}} + 12 {{12 {0 264} 2}} + 8,trans {{263 13}} + 13 {{14 {0 264} 2}} + 14 {{10 0 2}} + 10,trans {} + 9,trans {} + 15 {{12 {0 264} 3}} + 11,trans {{268 14}} + 16 {{14 {0 264} 3}} + 12,trans {{263 15}} +} + +array set update::token_id_table { + 264,line 16 + 270,t 1 + 269,t 1 + 265,title NOW + 261,line 11 + 257,t 0 + 270,title {} + 269,title {} + 257,line 7 + 262,t 0 + 270,line 52 + 269,line 45 + 259,title ON + 260,title OFF + 266,t 1 + 264,title string + error error + 266,line 32 + 268,title {} + error,line 31 + 258,t 0 + 263,line 14 + error,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 267,t 1 + 263,title integer + 268,line 42 + 267,title {} + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 261 TRUE_ + 265,line 20 + 262 FALSE_ + 263 INT_ + 257,title YES + 264 STRING_ + 264,t 0 + 265 NOW_ + 262,line 12 + 266 yesno + 267 command + 268,t 1 + 268 @PSEUDO1 + 262,title FALSE + 0 {$} + 0,t 0 + 270 start' + 269 update + error,t 0 + 258,line 8 + 266,title {} + 261,t 0 + 267,line 41 + 265,t 0 + 261,title TRUE +} + +proc update::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { UpdateCmd } + 12 { UpdateCmd $1 $2 $3 $4 $5 } + 13 { UpdateCmdNow } + 14 { UpdateCmdNow $2 $3 $4 $5 $6 } + } + 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 update::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/urlfitslex.tcl b/ds9/parsers/urlfitslex.tcl new file mode 100644 index 0000000..29d37ef --- /dev/null +++ b/ds9/parsers/urlfitslex.tcl @@ -0,0 +1,319 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval urlfits { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc urlfits::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc urlfits::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc urlfits::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc urlfits::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc urlfits::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc urlfits::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc urlfits::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc urlfits::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc urlfits::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set SLICE_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: mask + if {[regexp -start $index_ -indices -line -nocase -- {\A(mask)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: slice + if {[regexp -start $index_ -indices -line -nocase -- {\A(slice)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $MASK_ + } + 1 { +return $NEW_ + } + 2 { +return $SLICE_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 5 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 6 { +set yylval $yytext; return $STRING_ + } + 7 { +# ignore whitespace + } + 8 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/urlfitsparser.tab.tcl b/ds9/parsers/urlfitsparser.tab.tcl new file mode 100644 index 0000000..4d5b356 --- /dev/null +++ b/ds9/parsers/urlfitsparser.tab.tcl @@ -0,0 +1,4 @@ +set STRING_ 257 +set MASK_ 258 +set NEW_ 259 +set SLICE_ 260 diff --git a/ds9/parsers/urlfitsparser.tcl b/ds9/parsers/urlfitsparser.tcl new file mode 100644 index 0000000..3938618 --- /dev/null +++ b/ds9/parsers/urlfitsparser.tcl @@ -0,0 +1,346 @@ +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 urlfits { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc urlfits::YYABORT {} { + return -code return 1 +} + +proc urlfits::YYACCEPT {} { + return -code return 0 +} + +proc urlfits::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc urlfits::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc urlfits::yyerror {s} { + puts stderr $s +} + +proc urlfits::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 urlfits::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set urlfits::table { + 3:0,target 1 + 0:257 reduce + 6:257,target 8 + 4:260,target 7 + 1:257 reduce + 0:258 reduce + 8:0 reduce + 5:0,target 2 + 1:258 reduce + 0:259 shift + 0:260 reduce + 10:0 reduce + 6:260,target 9 + 1:260 reduce + 0:261 goto + 11:0 reduce + 4:257 shift + 1:257,target 7 + 0:262 goto + 0:258,target 6 + 4:258 shift + 0:263 goto + 10:0,target 4 + 6:257 shift + 4:260 shift + 1:260,target 7 + 0:261,target 2 + 7:257 shift + 2:0,target 0 + 6:260 shift + 4:258,target 6 + 0:263,target 4 + 9:257 shift + 7:257,target 10 + 0:257,target 6 + 9:257,target 11 + 2:0 accept + 8:0,target 3 + 3:0 reduce + 1:258,target 7 + 0:259,target 1 + 0:260,target 6 + 11:0,target 5 + 5:0 reduce + 4:257,target 5 + 0:262,target 3 +} + +array set urlfits::rules { + 0,l 264 + 1,l 261 + 2,l 262 + 3,l 262 + 4,l 262 + 5,l 262 + 6,l 263 + 7,l 263 +} + +array set urlfits::rules { + 5,dc 4 + 7,dc 1 + 0,dc 1 + 2,dc 2 + 4,dc 3 + 6,dc 0 + 1,dc 1 + 3,dc 3 +} + +array set urlfits::rules { + 5,line 25 + 7,line 29 + 2,line 22 + 4,line 24 + 6,line 28 + 1,line 19 + 3,line 23 +} + +array set urlfits::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 {257 258 260} 0} {7 {257 258 260} 0}} + 1 {{7 {257 258 260} 1}} + 2 {{0 0 1}} + 3 {{1 0 1}} + 4 {{2 0 1} {3 0 1} {4 0 1} {5 0 1}} + 0,trans {{259 1} {261 2} {262 3} {263 4}} + 1,trans {} + 5 {{2 0 2}} + 2,trans {} + 6 {{3 0 2} {5 0 2}} + 3,trans {} + 7 {{4 0 2}} + 8 {{3 0 3}} + 4,trans {{257 5} {258 6} {260 7}} + 10 {{4 0 3}} + 9 {{5 0 3}} + 5,trans {} + 11 {{5 0 4}} + 6,trans {{257 8} {260 9}} + 7,trans {{257 10}} + 8,trans {} + 10,trans {} + 9,trans {{257 11}} + 11,trans {} +} + +array set urlfits::token_id_table { + 264,line 30 + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 11 + 261,line 18 + error,line 16 + 257 STRING_ + 257,t 0 + 263,line 27 + 258 MASK_ + 258,t 0 + error,title {} + 260,t 0 + 260 SLICE_ + 259 NEW_ + 259,t 0 + 261,t 1 + 261 command + 262,t 1 + 262 urlfits + 257,line 7 + 263,t 1 + 263 new + 264,t 1 + 264 start' + 260,line 13 + 257,title string + 259,line 12 + 258,title MASK + 262,line 21 + 260,title SLICE + 259,title NEW + 261,title {} +} + +proc urlfits::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 { + 2 { LoadURLFits $2 {} {} } + 3 { LoadURLFits $3 mask {} } + 4 { LoadURLFits $3 {} slice } + 5 { LoadURLFits $4 mask slice } + 7 { CreateFrame } + } + 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 urlfits::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/viewlex.tcl b/ds9/parsers/viewlex.tcl new file mode 100644 index 0000000..577a956 --- /dev/null +++ b/ds9/parsers/viewlex.tcl @@ -0,0 +1,966 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval view { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc view::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc view::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc view::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc view::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc view::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc view::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc view::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc view::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc view::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set STRING_ 294 +set BLUE_ 295 +set BUTTONS_ 296 +set COLORBAR_ 297 +set COLORBARNUMERICS_ 298 +set FILENAME_ 299 +set FRAME_ 300 +set GRAPH_ 301 +set GREEN_ 302 +set HORIZONTAL_ 303 +set HORZGRAPH_ 304 +set INFO_ 305 +set KEYVALUE_ 306 +set KEYWORD_ 307 +set LAYOUT_ 308 +set LOWHIGH_ 309 +set MAGNIFIER_ 310 +set MINMAX_ 311 +set OBJECT_ 312 +set PANNER_ 313 +set RED_ 314 +set UNITS_ 315 +set VERTICAL_ 316 +set VERTGRAPH_ 317 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: buttons + if {[regexp -start $index_ -indices -line -nocase -- {\A(buttons)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: colorbarnumerics + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbarnumerics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: graph + if {[regexp -start $index_ -indices -line -nocase -- {\A(graph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: green + if {[regexp -start $index_ -indices -line -nocase -- {\A(green)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: horz + if {[regexp -start $index_ -indices -line -nocase -- {\A(horz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: horizontal + if {[regexp -start $index_ -indices -line -nocase -- {\A(horizontal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: horzgraph + if {[regexp -start $index_ -indices -line -nocase -- {\A(horzgraph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: info + if {[regexp -start $index_ -indices -line -nocase -- {\A(info)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: keyvalue + if {[regexp -start $index_ -indices -line -nocase -- {\A(keyvalue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: keyword + if {[regexp -start $index_ -indices -line -nocase -- {\A(keyword)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: layout + if {[regexp -start $index_ -indices -line -nocase -- {\A(layout)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: lowhigh + if {[regexp -start $index_ -indices -line -nocase -- {\A(lowhigh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: magnifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(magnifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: minmax + if {[regexp -start $index_ -indices -line -nocase -- {\A(minmax)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: object + if {[regexp -start $index_ -indices -line -nocase -- {\A(object)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: panner + if {[regexp -start $index_ -indices -line -nocase -- {\A(panner)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: red + if {[regexp -start $index_ -indices -line -nocase -- {\A(red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: units + if {[regexp -start $index_ -indices -line -nocase -- {\A(units)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: vert + if {[regexp -start $index_ -indices -line -nocase -- {\A(vert)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: vertical + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: vertgraph + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertgraph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + # rule 58: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 58 + } + # rule 59: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 59 + } + # rule 60: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 60 + } + # rule 61: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 61 + } + # rule 62: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 62 + } + # rule 63: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 63 + } + # rule 64: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 64 + } + # rule 65: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 65 + } + # rule 66: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 66 + } + # rule 67: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 67 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BLUE_ + } + 1 { +return $BUTTONS_ + } + 2 { +return $COLORBAR_ + } + 3 { +return $COLORBARNUMERICS_ + } + 4 { +return $FILENAME_ + } + 5 { +return $FRAME_ + } + 6 { +return $GRAPH_ + } + 7 { +return $GREEN_ + } + 8 { +return $HORIZONTAL_ + } + 9 { +return $HORIZONTAL_ + } + 10 { +return $HORZGRAPH_ + } + 11 { +return $INFO_ + } + 12 { +return $KEYVALUE_ + } + 13 { +return $KEYWORD_ + } + 14 { +return $LAYOUT_ + } + 15 { +return $LOWHIGH_ + } + 16 { +return $MAGNIFIER_ + } + 17 { +return $MINMAX_ + } + 18 { +return $OBJECT_ + } + 19 { +return $PANNER_ + } + 20 { +return $RED_ + } + 21 { +return $UNITS_ + } + 22 { +return $VERTICAL_ + } + 23 { +return $VERTICAL_ + } + 24 { +return $VERTGRAPH_ + } + 25 { +return $YES_ + } + 26 { +return $NO_ + } + 27 { +return $ON_ + } + 28 { +return $OFF_ + } + 29 { +return $TRUE_ + } + 30 { +return $FALSE_ + } + 31 { +return $IMAGE_ + } + 32 { +return $PHYSICAL_ + } + 33 { +return $AMPLIFIER_ + } + 34 { +return $DETECTOR_ + } + 35 { +return $WCS_ + } + 36 { +return $WCSA_ + } + 37 { +return $WCSB_ + } + 38 { +return $WCSC_ + } + 39 { +return $WCSD_ + } + 40 { +return $WCSE_ + } + 41 { +return $WCSF_ + } + 42 { +return $WCSG_ + } + 43 { +return $WCSH_ + } + 44 { +return $WCSI_ + } + 45 { +return $WCSJ_ + } + 46 { +return $WCSK_ + } + 47 { +return $WCSL_ + } + 48 { +return $WCSM_ + } + 49 { +return $WCSN_ + } + 50 { +return $WCSO_ + } + 51 { +return $WCSP_ + } + 52 { +return $WCSQ_ + } + 53 { +return $WCSR_ + } + 54 { +return $WCSS_ + } + 55 { +return $WCST_ + } + 56 { +return $WCSU_ + } + 57 { +return $WCSV_ + } + 58 { +return $WCSW_ + } + 59 { +return $WCSX_ + } + 60 { +return $WCSY_ + } + 61 { +return $WCSZ_ + } + 62 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 63 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 64 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 65 { +set yylval $yytext; return $STRING_ + } + 66 { +# ignore whitespace + } + 67 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/viewparser.tab.tcl b/ds9/parsers/viewparser.tab.tcl new file mode 100644 index 0000000..4a72d11 --- /dev/null +++ b/ds9/parsers/viewparser.tab.tcl @@ -0,0 +1,61 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set IMAGE_ 263 +set PHYSICAL_ 264 +set AMPLIFIER_ 265 +set DETECTOR_ 266 +set WCS_ 267 +set WCSA_ 268 +set WCSB_ 269 +set WCSC_ 270 +set WCSD_ 271 +set WCSE_ 272 +set WCSF_ 273 +set WCSG_ 274 +set WCSH_ 275 +set WCSI_ 276 +set WCSJ_ 277 +set WCSK_ 278 +set WCSL_ 279 +set WCSM_ 280 +set WCSN_ 281 +set WCSO_ 282 +set WCSP_ 283 +set WCSQ_ 284 +set WCSR_ 285 +set WCSS_ 286 +set WCST_ 287 +set WCSU_ 288 +set WCSV_ 289 +set WCSW_ 290 +set WCSX_ 291 +set WCSY_ 292 +set WCSZ_ 293 +set STRING_ 294 +set BLUE_ 295 +set BUTTONS_ 296 +set COLORBAR_ 297 +set COLORBARNUMERICS_ 298 +set FILENAME_ 299 +set FRAME_ 300 +set GRAPH_ 301 +set GREEN_ 302 +set HORIZONTAL_ 303 +set HORZGRAPH_ 304 +set INFO_ 305 +set KEYVALUE_ 306 +set KEYWORD_ 307 +set LAYOUT_ 308 +set LOWHIGH_ 309 +set MAGNIFIER_ 310 +set MINMAX_ 311 +set OBJECT_ 312 +set PANNER_ 313 +set RED_ 314 +set UNITS_ 315 +set VERTICAL_ 316 +set VERTGRAPH_ 317 diff --git a/ds9/parsers/viewparser.tcl b/ds9/parsers/viewparser.tcl new file mode 100644 index 0000000..f5695f5 --- /dev/null +++ b/ds9/parsers/viewparser.tcl @@ -0,0 +1,2071 @@ +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 view { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc view::YYABORT {} { + return -code return 1 +} + +proc view::YYACCEPT {} { + return -code return 0 +} + +proc view::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc view::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc view::yyerror {s} { + puts stderr $s +} + +proc view::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 view::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set view::table { + 76:294,target 52 + 56:257 shift + 6:259,target 13 + 6:260,target 13 + 56:258 shift + 33:261,target 64 + 56:260 shift + 56:259 shift + 56:261 shift + 48:0 reduce + 56:262 shift + 26:257 reduce + 15:257,target 22 + 26:258 reduce + 26:259 reduce + 26:260 reduce + 0:275,target 13 + 26:261 reduce + 51:318 goto + 26:262 reduce + 1:258,target 8 + 27:259,target 34 + 27:260,target 34 + 73:260,target 69 + 73:259,target 69 + 64:0,target 4 + 33:0,target 1 + 39:262,target 65 + 22:258,target 29 + 32:294,target 1 + 77:294,target 45 + 7:259,target 14 + 7:260,target 14 + 21:0 reduce + 34:261,target 64 + 86:294 reduce + 0:292,target 30 + 0:302,target 39 + 16:257,target 23 + 63:0 reduce + 56:294 reduce + 2:258,target 9 + 28:259,target 35 + 28:260,target 35 + 74:260,target 63 + 74:259,target 62 + 41:262,target 65 + 32:257 shift + 32:258 shift + 32:259 shift + 32:260 shift + 92:0,target 51 + 32:261 shift + 56:318 goto + 23:258,target 30 + 32:262 shift + 33:294,target 1 + 78:294,target 44 + 61:0,target 5 + 8:259,target 15 + 8:260,target 15 + 35:261,target 64 + 29:0,target 36 + 30:0,target 37 + 35:0 reduce + 17:257,target 24 + 3:258,target 10 + 77:0 reduce + 29:259,target 36 + 29:260,target 36 + 30:259,target 37 + 30:260,target 37 + 0:266,target 4 + 9:0 reduce + 92:294 reduce + 42:262,target 65 + 62:294 reduce + 24:258,target 31 + 34:294,target 1 + 80:294,target 43 + 79:294,target 56 + 9:259,target 16 + 9:260,target 16 + 32:294 reduce + 36:261,target 64 + 37:257 shift + 37:258 shift + 18:257,target 25 + 37:259 shift + 37:260 shift + 88:0,target 53 + 37:261 shift + 37:262 shift + 50:0 reduce + 49:0 reduce + 4:258,target 11 + 57:0,target 0 + 31:259,target 38 + 31:260,target 38 + 0:283,target 21 + 32:318 goto + 92:0 reduce + 26:0,target 33 + 25:258,target 32 + 35:294,target 1 + 81:294,target 58 + 37:261,target 64 + 19:257,target 26 + 20:257,target 27 + 67:294 reduce + 22:0 reduce + 5:258,target 12 + 0:310,target 47 + 0:299,target 36 + 0:309,target 46 + 73:257 reduce + 32:259,target 62 + 32:260,target 63 + 73:258 reduce + 37:294 reduce + 73:260 reduce + 73:259 reduce + 64:0 reduce + 73:261 reduce + 73:262 reduce + 44:262,target 65 + 85:0,target 46 + 13:257 reduce + 26:258,target 33 + 72:258,target 68 + 13:258 reduce + 36:294,target 1 + 82:294,target 47 + 54:0,target 1 + 13:259 reduce + 13:260 reduce + 13:261 reduce + 13:262 reduce + 37:318 goto + 2:257 reduce + 23:0,target 30 + 2:258 reduce + 2:260 reduce + 2:259 reduce + 2:261 reduce + 2:262 reduce + 21:257,target 28 + 6:258,target 13 + 33:259,target 62 + 33:260,target 63 + 36:0 reduce + 78:0 reduce + 0:274,target 12 + 1:257,target 8 + 27:258,target 34 + 73:258,target 69 + 37:294,target 1 + 83:294,target 57 + 43:294 shift + 39:261,target 64 + 48:257 shift + 48:258 shift + 8:0,target 15 + 48:260 shift + 48:259 shift + 82:0,target 47 + 48:261 shift + 22:257,target 29 + 48:262 shift + 18:257 reduce + 18:258 reduce + 51:0,target 1 + 7:258,target 14 + 18:259 reduce + 18:260 reduce + 18:261 reduce + 34:259,target 62 + 34:260,target 63 + 18:262 reduce + 7:257 reduce + 19:0,target 26 + 20:0,target 27 + 51:0 reduce + 7:258 reduce + 46:262,target 65 + 0:291,target 29 + 0:301,target 38 + 7:259 reduce + 7:260 reduce + 7:261 reduce + 7:262 reduce + 2:257,target 9 + 93:0 reduce + 28:258,target 35 + 74:258,target 61 + 84:294,target 55 + 41:261,target 64 + 78:294 reduce + 23:257,target 30 + 8:258,target 15 + 48:294 reduce + 35:259,target 62 + 35:260,target 63 + 23:0 reduce + 0:317,target 54 + 54:257 shift + 54:258 shift + 47:262,target 65 + 5:0,target 12 + 54:260 shift + 54:259 shift + 78:0,target 44 + 54:261 shift + 65:0 reduce + 54:262 shift + 3:257,target 10 + 24:257 reduce + 24:258 reduce + 29:258,target 36 + 30:258,target 37 + 47:0,target 1 + 24:259 reduce + 24:260 reduce + 39:294,target 1 + 40:294,target 66 + 85:294,target 46 + 24:261 reduce + 48:318 goto + 0:265,target 3 + 24:262 reduce + 16:0,target 23 + 42:261,target 64 + 24:257,target 31 + 9:258,target 16 + 36:259,target 62 + 36:260,target 63 + 48:262,target 65 + 37:0 reduce + 84:294 reduce + 4:257,target 11 + 31:258,target 38 + 0:282,target 20 + 41:294,target 1 + 86:294,target 63 + 80:0 reduce + 79:0 reduce + 54:294 reduce + 2:0,target 9 + 75:0,target 64 + 25:257,target 32 + 29:257 reduce + 30:257 reduce + 29:258 reduce + 30:258 reduce + 29:259 reduce + 29:260 reduce + 30:259 reduce + 30:260 reduce + 44:0,target 1 + 29:261 reduce + 30:261 reduce + 54:318 goto + 29:262 reduce + 30:262 reduce + 37:259,target 62 + 37:260,target 63 + 13:0,target 20 + 10:0 reduce + 74:318,target 92 + 50:262,target 65 + 49:262,target 65 + 5:257,target 12 + 0:308,target 45 + 0:298,target 35 + 52:0 reduce + 32:258,target 61 + 42:294,target 1 + 87:294,target 59 + 44:261,target 64 + 90:294 reduce + 89:294 reduce + 26:257,target 33 + 72:257,target 68 + 60:294 reduce + 59:294 reduce + 51:262,target 65 + 72:0,target 68 + 24:0 reduce + 35:257 shift + 6:257,target 13 + 35:258 shift + 33:258,target 61 + 35:259 shift + 35:260 shift + 41:0,target 1 + 35:261 shift + 43:294,target 78 + 88:294,target 53 + 35:262 shift + 66:0 reduce + 10:0,target 17 + 0:273,target 11 + 27:257,target 34 + 73:257,target 69 + 39:259,target 62 + 39:260,target 63 + 52:262,target 65 + 7:257,target 14 + 34:258,target 61 + 65:294 reduce + 44:294,target 1 + 90:294,target 61 + 89:294,target 60 + 0:290,target 28 + 0:289,target 27 + 0:300,target 37 + 46:261,target 64 + 35:294 reduce + 81:0 reduce + 68:0,target 49 + 28:257,target 35 + 41:257 shift + 74:257,target 60 + 38:303,target 72 + 41:258 shift + 37:0,target 1 + 41:259 shift + 41:260 shift + 41:261 shift + 41:262 shift + 11:257 reduce + 41:259,target 62 + 41:260,target 63 + 11:258 reduce + 11:259 reduce + 11:260 reduce + 11:261 reduce + 11:262 reduce + 32:318,target 66 + 35:318 goto + 8:257,target 15 + 11:0 reduce + 35:258,target 61 + 0:263 shift + 91:294,target 93 + 0:264 shift + 0:265 shift + 0:316,target 53 + 0:266 shift + 47:261,target 64 + 0:267 shift + 53:0 reduce + 0:268 shift + 0:270 shift + 0:269 shift + 0:271 shift + 0:272 shift + 0:273 shift + 29:257,target 36 + 30:257,target 37 + 0:274 shift + 0:275 shift + 71:294 reduce + 0:276 shift + 0:264,target 2 + 0:277 shift + 0:278 shift + 42:259,target 62 + 42:260,target 63 + 0:280 shift + 0:279 shift + 0:281 shift + 0:282 shift + 41:294 reduce + 0:283 shift + 33:318,target 67 + 65:0,target 7 + 54:262,target 65 + 0:284 shift + 0:285 shift + 0:286 shift + 46:257 shift + 0:287 shift + 46:258 shift + 0:288 shift + 9:257,target 16 + 34:0,target 1 + 46:259 shift + 46:260 shift + 0:290 shift + 0:289 shift + 0:300 shift + 36:258,target 61 + 46:261 shift + 0:291 shift + 0:301 shift + 46:294,target 1 + 46:262 shift + 92:294,target 51 + 0:292 shift + 0:302 shift + 16:257 reduce + 0:293 shift + 0:303 shift + 16:258 reduce + 0:304 shift + 16:259 reduce + 16:260 reduce + 25:0 reduce + 48:261,target 64 + 0:295 shift + 0:305 shift + 16:261 reduce + 0:306 shift + 0:296 shift + 16:262 reduce + 41:318 goto + 0:297 shift + 0:307 shift + 5:257 reduce + 0:308 shift + 0:298 shift + 5:258 reduce + 0:310 shift + 0:299 shift + 0:309 shift + 67:0 reduce + 5:260 reduce + 5:259 reduce + 0:311 shift + 31:257,target 38 + 5:261 reduce + 0:281,target 19 + 0:312 shift + 5:262 reduce + 0:313 shift + 0:314 shift + 0:315 shift + 0:316 shift + 0:317 shift + 0:319 goto + 0:320 goto + 0:321 goto + 10:262,target 17 + 34:318,target 68 + 55:262,target 65 + 0:323 goto + 0:324 goto + 76:294 reduce + 37:258,target 61 + 47:294,target 1 + 93:0,target 41 + 50:261,target 64 + 49:261,target 64 + 46:294 reduce + 62:0,target 3 + 39:0 reduce + 40:0 reduce + 52:257 shift + 0:297,target 34 + 0:307,target 44 + 52:258 shift + 32:257,target 60 + 52:260 shift + 52:259 shift + 31:0,target 38 + 52:261 shift + 52:262 shift + 82:0 reduce + 22:257 reduce + 22:258 reduce + 44:259,target 62 + 44:260,target 63 + 22:259 reduce + 22:260 reduce + 22:261 reduce + 22:262 reduce + 46:318 goto + 11:262,target 18 + 35:318,target 69 + 56:262,target 65 + 48:294,target 1 + 51:261,target 64 + 12:0 reduce + 0:324,target 59 + 33:257,target 60 + 82:294 reduce + 54:0 reduce + 90:0,target 61 + 89:0,target 60 + 52:294 reduce + 0:272,target 10 + 58:0,target 39 + 12:262,target 19 + 36:318,target 70 + 27:0,target 34 + 39:258,target 61 + 50:294,target 1 + 49:294,target 1 + 27:257 reduce + 27:258 reduce + 27:259 reduce + 27:260 reduce + 27:261 reduce + 52:261,target 64 + 52:318 goto + 27:262 reduce + 26:0 reduce + 34:257,target 60 + 0:288,target 26 + 46:259,target 62 + 46:260,target 63 + 68:0 reduce + 1:0 reduce + 13:262,target 20 + 37:318,target 71 + 87:294 reduce + 41:258,target 61 + 51:294,target 1 + 86:0,target 63 + 55:0,target 1 + 24:0,target 31 + 35:257,target 60 + 45:303,target 40 + 0:315,target 52 + 33:257 shift + 33:258 shift + 41:0 reduce + 47:260,target 63 + 47:259,target 62 + 33:259 shift + 33:260 shift + 33:261 shift + 33:262 shift + 14:262,target 21 + 83:0 reduce + 0:263,target 1 + 42:258,target 61 + 52:294,target 1 + 54:261,target 64 + 36:257,target 60 + 9:0,target 16 + 13:0 reduce + 83:0,target 57 + 48:260,target 63 + 48:259,target 62 + 63:294 reduce + 55:0 reduce + 52:0,target 1 + 15:262,target 22 + 39:318,target 75 + 0:280,target 18 + 0:279,target 17 + 33:294 reduce + 21:0,target 28 + 53:294,target 67 + 10:261,target 17 + 55:261,target 64 + 33:318 goto + 37:257,target 60 + 58:322,target 91 + 50:260,target 63 + 50:259,target 62 + 49:260,target 63 + 49:259,target 62 + 27:0 reduce + 0:306,target 43 + 0:296,target 33 + 16:262,target 23 + 41:318,target 76 + 70:0 reduce + 69:0 reduce + 6:0,target 13 + 2:0 reduce + 44:258,target 61 + 80:0,target 43 + 79:0,target 56 + 54:294,target 1 + 68:294 reduce + 11:261,target 18 + 56:261,target 64 + 48:0,target 1 + 74:257 shift + 38:303 shift + 74:258 shift + 74:260 shift + 74:259 shift + 17:0,target 24 + 74:261 shift + 74:262 shift + 44:257 shift + 44:258 shift + 44:259 shift + 44:260 shift + 51:260,target 63 + 51:259,target 62 + 44:261 shift + 44:262 shift + 0:323,target 58 + 14:257 reduce + 14:258 reduce + 14:259 reduce + 14:260 reduce + 17:262,target 24 + 38:316 shift + 42:318,target 77 + 14:261 reduce + 42:0 reduce + 14:262 reduce + 3:257 reduce + 3:258 reduce + 3:260 reduce + 3:259 reduce + 84:0 reduce + 55:294,target 1 + 3:261 reduce + 3:262 reduce + 0:271,target 9 + 38:325 goto + 12:261,target 19 + 39:257,target 60 + 3:0,target 10 + 76:0,target 52 + 74:294 reduce + 52:260,target 63 + 52:259,target 62 + 14:0 reduce + 18:262,target 25 + 44:294 reduce + 14:0,target 21 + 56:0 reduce + 50:257 shift + 49:257 shift + 50:258 shift + 49:258 shift + 0:287,target 25 + 46:258,target 61 + 56:294,target 1 + 50:260 shift + 50:259 shift + 49:260 shift + 49:259 shift + 50:261 shift + 49:261 shift + 74:318 goto + 50:262 shift + 49:262 shift + 13:261,target 20 + 19:257 reduce + 20:257 reduce + 19:258 reduce + 20:258 reduce + 19:259 reduce + 19:260 reduce + 20:259 reduce + 20:260 reduce + 19:261 reduce + 20:261 reduce + 19:262 reduce + 20:262 reduce + 44:318 goto + 8:257 reduce + 41:257,target 60 + 8:258 reduce + 8:259 reduce + 8:260 reduce + 8:261 reduce + 8:262 reduce + 19:262,target 26 + 20:262,target 27 + 44:318,target 79 + 28:0 reduce + 0:314,target 51 + 73:0,target 69 + 47:258,target 61 + 80:294 reduce + 79:294 reduce + 71:0 reduce + 14:261,target 21 + 42:0,target 1 + 3:0 reduce + 50:294 reduce + 49:294 reduce + 11:0,target 18 + 42:257,target 60 + 55:257 shift + 55:258 shift + 55:260 shift + 55:259 shift + 55:261 shift + 55:262 shift + 54:260,target 63 + 54:259,target 62 + 25:257 reduce + 25:258 reduce + 25:259 reduce + 25:260 reduce + 21:262,target 28 + 25:261 reduce + 50:318 goto + 49:318 goto + 25:262 reduce + 48:258,target 61 + 58:294,target 40 + 15:261,target 22 + 0:278,target 16 + 85:0 reduce + 1:262,target 8 + 70:0,target 54 + 69:0,target 50 + 85:294 reduce + 10:259,target 17 + 10:260,target 17 + 55:260,target 63 + 55:259,target 62 + 55:294 reduce + 22:262,target 29 + 46:318,target 81 + 15:0 reduce + 50:258,target 61 + 49:258,target 61 + 60:294,target 2 + 59:294,target 42 + 31:257 reduce + 0:295,target 32 + 0:305,target 42 + 16:261,target 23 + 31:258 reduce + 57:0 accept + 31:259 reduce + 31:260 reduce + 31:261 reduce + 55:318 goto + 31:262 reduce + 2:262,target 9 + 44:257,target 60 + 11:259,target 18 + 11:260,target 18 + 56:260,target 63 + 56:259,target 62 + 47:318,target 82 + 23:262,target 30 + 66:0,target 65 + 51:258,target 61 + 91:294 shift + 61:294,target 5 + 29:0 reduce + 30:0 reduce + 35:0,target 1 + 17:261,target 24 + 61:294 reduce + 3:262,target 10 + 38:325,target 74 + 72:0 reduce + 4:0 reduce + 0:270,target 8 + 0:269,target 7 + 12:259,target 19 + 12:260,target 19 + 36:257 shift + 36:258 shift + 36:259 shift + 36:260 shift + 36:261 shift + 48:318,target 83 + 24:262,target 31 + 36:262 shift + 52:258,target 61 + 62:294,target 3 + 18:261,target 25 + 44:0 reduce + 4:262,target 11 + 0:286,target 24 + 46:257,target 60 + 63:0,target 6 + 86:0 reduce + 13:259,target 20 + 13:260,target 20 + 32:0,target 1 + 66:294 reduce + 50:318,target 85 + 49:318,target 84 + 25:262,target 32 + 72:257 reduce + 72:258 reduce + 36:294 reduce + 72:260 reduce + 72:259 reduce + 72:261 reduce + 72:262 reduce + 63:294,target 6 + 42:257 shift + 42:258 shift + 19:261,target 26 + 20:261,target 27 + 42:259 shift + 42:260 shift + 16:0 reduce + 42:261 shift + 42:262 shift + 12:257 reduce + 5:262,target 12 + 0:313,target 50 + 12:258 reduce + 12:259 reduce + 12:260 reduce + 47:257,target 60 + 12:261 reduce + 58:0 reduce + 12:262 reduce + 36:318 goto + 1:257 reduce + 1:258 reduce + 14:259,target 21 + 14:260,target 21 + 38:316,target 73 + 1:260 reduce + 1:259 reduce + 1:261 reduce + 1:262 reduce + 51:318,target 86 + 26:262,target 33 + 72:262,target 68 + 60:0,target 2 + 59:0,target 42 + 54:258,target 61 + 64:294,target 4 + 28:0,target 35 + 21:261,target 28 + 6:262,target 13 + 31:0 reduce + 48:257,target 60 + 42:294 reduce + 47:257 shift + 15:259,target 22 + 15:260,target 22 + 73:0 reduce + 47:258 shift + 47:260 shift + 47:259 shift + 0:277,target 15 + 47:261 shift + 47:262 shift + 5:0 reduce + 1:261,target 8 + 52:318,target 87 + 17:257 reduce + 27:262,target 34 + 73:262,target 69 + 17:258 reduce + 17:259 reduce + 17:260 reduce + 17:261 reduce + 17:262 reduce + 42:318 goto + 10:258,target 17 + 55:258,target 61 + 6:257 reduce + 65:294,target 7 + 6:258 reduce + 6:259 reduce + 6:260 reduce + 6:261 reduce + 6:262 reduce + 22:261,target 29 + 87:0,target 59 + 7:262,target 14 + 56:0,target 1 + 50:257,target 60 + 49:257,target 60 + 0:304,target 41 + 16:259,target 23 + 16:260,target 23 + 25:0,target 32 + 77:294 reduce + 2:261,target 9 + 87:0 reduce + 28:262,target 35 + 74:262,target 65 + 47:294 reduce + 11:258,target 18 + 56:258,target 61 + 66:294,target 65 + 23:261,target 30 + 23:257 reduce + 23:258 reduce + 8:262,target 15 + 23:259 reduce + 23:260 reduce + 23:261 reduce + 51:257,target 60 + 47:318 goto + 23:262 reduce + 17:0 reduce + 0:321,target 57 + 17:259,target 24 + 17:260,target 24 + 60:0 reduce + 59:0 reduce + 84:0,target 55 + 3:261,target 10 + 54:318,target 88 + 29:262,target 36 + 30:262,target 37 + 53:0,target 67 + 0:268,target 6 + 12:258,target 19 + 67:294,target 48 + 22:0,target 29 + 83:294 reduce + 24:261,target 31 + 9:262,target 16 + 53:294 reduce + 52:257,target 60 + 18:259,target 25 + 18:260,target 25 + 32:0 reduce + 4:261,target 11 + 28:257 reduce + 55:318,target 89 + 28:258 reduce + 31:262,target 38 + 0:285,target 23 + 28:259 reduce + 28:260 reduce + 74:0 reduce + 28:261 reduce + 28:262 reduce + 6:0 reduce + 13:258,target 20 + 68:294,target 49 + 7:0,target 14 + 25:261,target 32 + 81:0,target 58 + 50:0,target 1 + 49:0,target 1 + 18:0,target 25 + 19:259,target 26 + 19:260,target 26 + 20:259,target 27 + 20:260,target 27 + 88:294 reduce + 5:261,target 12 + 0:312,target 49 + 56:318,target 90 + 32:262,target 65 + 46:0 reduce + 58:294 reduce + 14:258,target 21 + 88:0 reduce + 70:294,target 54 + 69:294,target 50 + 26:261,target 33 + 72:261,target 68 + 34:257 shift + 34:258 shift + 34:259 shift + 34:260 shift + 34:261 shift + 34:262 shift + 54:257,target 60 + 58:322 goto + 21:259,target 28 + 21:260,target 28 + 45:316,target 53 + 4:0,target 11 + 77:0,target 45 + 18:0 reduce + 6:261,target 13 + 33:262,target 65 + 46:0,target 1 + 61:0 reduce + 15:258,target 22 + 15:0,target 22 + 71:294,target 62 + 0:276,target 14 + 1:260,target 8 + 1:259,target 8 + 27:261,target 34 + 73:261,target 69 + 64:294 reduce + 10:257,target 17 + 55:257,target 60 + 34:294 reduce + 22:259,target 29 + 22:260,target 29 + 39:257 shift + 7:261,target 14 + 39:258 shift + 34:262,target 65 + 39:259 shift + 39:260 shift + 39:261 shift + 33:0 reduce + 39:262 shift + 10:257 reduce + 10:258 reduce + 0:293,target 31 + 0:303,target 40 + 10:259 reduce + 10:260 reduce + 16:258,target 23 + 10:261 reduce + 10:262 reduce + 34:318 goto + 75:0 reduce + 1:0,target 8 + 2:260,target 9 + 2:259,target 9 + 74:0,target 1 + 28:261,target 35 + 74:261,target 64 + 7:0 reduce + 11:257,target 18 + 56:257,target 60 + 12:0,target 19 + 23:259,target 30 + 23:260,target 30 + 8:261,target 15 + 35:262,target 65 + 70:294 reduce + 69:294 reduce + 0:319,target 55 + 0:320,target 56 + 17:258,target 24 + 47:0 reduce + 39:294 reduce + 40:294 reduce + 3:260,target 10 + 3:259,target 10 + 29:261,target 36 + 30:261,target 37 + 90:0 reduce + 89:0 reduce + 0:267,target 5 + 12:257,target 19 + 15:257 reduce + 15:258 reduce + 15:259 reduce + 15:260 reduce + 15:261 reduce + 15:262 reduce + 39:318 goto + 24:259,target 31 + 24:260,target 31 + 4:257 reduce + 71:0,target 62 + 4:258 reduce + 4:260 reduce + 4:259 reduce + 4:261 reduce + 9:261,target 16 + 45:324,target 80 + 4:262 reduce + 36:262,target 65 + 39:0,target 1 + 40:0,target 66 + 19:0 reduce + 20:0 reduce + 18:258,target 25 + 74:294,target 1 + 4:260,target 11 + 4:259,target 11 + 62:0 reduce + 31:261,target 38 + 0:284,target 22 + 75:294 reduce + 13:257,target 20 + 45:303 shift + 25:259,target 32 + 25:260,target 32 + 51:257 shift + 51:258 shift + 51:260 shift + 51:259 shift + 51:261 shift + 37:262,target 65 + 51:262 shift + 21:257 reduce + 21:258 reduce + 21:259 reduce + 21:260 reduce + 45:316 shift + 19:258,target 26 + 20:258,target 27 + 21:261 reduce + 21:262 reduce + 75:294,target 64 + 9:257 reduce + 34:0 reduce + 67:0,target 48 + 5:260,target 12 + 5:259,target 12 + 0:311,target 48 + 9:258 reduce + 9:259 reduce + 9:260 reduce + 32:261,target 64 + 9:261 reduce + 45:324 goto + 9:262 reduce + 36:0,target 1 + 76:0 reduce + 14:257,target 21 + 8:0 reduce + 26:259,target 33 + 26:260,target 33 + 72:260,target 68 + 72:259,target 68 + 81:294 reduce + 51:294 reduce + 21:258,target 28 +} + +array set view::rules { + 9,l 319 + 11,l 319 + 32,l 320 + 53,l 323 + 6,l 318 + 28,l 320 + 50,l 323 + 49,l 323 + 3,l 318 + 25,l 320 + 46,l 323 + 67,l 324 + 0,l 326 + 22,l 320 + 43,l 323 + 64,l 323 + 18,l 320 + 40,l 322 + 39,l 321 + 61,l 323 + 15,l 320 + 36,l 320 + 57,l 323 + 12,l 320 + 33,l 320 + 54,l 323 + 7,l 318 + 29,l 320 + 30,l 320 + 51,l 323 + 4,l 318 + 26,l 320 + 47,l 323 + 68,l 325 + 1,l 318 + 23,l 320 + 44,l 323 + 65,l 323 + 19,l 320 + 20,l 320 + 41,l 321 + 62,l 323 + 16,l 320 + 37,l 320 + 58,l 323 + 13,l 320 + 34,l 320 + 55,l 323 + 8,l 319 + 10,l 319 + 31,l 320 + 52,l 323 + 5,l 318 + 27,l 320 + 48,l 323 + 69,l 325 + 2,l 318 + 24,l 320 + 45,l 323 + 66,l 324 + 21,l 320 + 42,l 323 + 63,l 323 + 17,l 320 + 38,l 320 + 60,l 323 + 59,l 323 + 14,l 320 + 35,l 320 + 56,l 323 +} + +array set view::rules { + 63,dc 2 + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 3 + 55,dc 2 + 69,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 2 + 62,dc 2 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 0 + 39,dc 1 + 54,dc 2 + 68,dc 1 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 2 + 61,dc 2 + 10,dc 1 + 24,dc 1 + 1,dc 0 + 38,dc 1 + 53,dc 2 + 67,dc 1 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 2 + 60,dc 2 + 59,dc 2 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 2 + 66,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 2 + 58,dc 2 + 22,dc 1 + 36,dc 1 + 51,dc 3 + 65,dc 2 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 2 + 57,dc 2 + 21,dc 1 + 35,dc 1 + 50,dc 2 + 49,dc 2 + 64,dc 2 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 2 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 2 +} + +array set view::rules { + 41,line 162 + 7,line 125 + 37,line 157 + 4,line 122 + 34,line 154 + 1,line 119 + 31,line 151 + 27,line 147 + 24,line 144 + 21,line 141 + 17,line 137 + 14,line 134 + 69,line 202 + 11,line 130 + 66,line 197 + 63,line 192 + 40,e 1 + 60,line 189 + 59,line 188 + 56,line 185 + 53,line 182 + 50,line 176 + 49,line 174 + 46,line 169 + 43,line 166 + 9,line 128 + 40,line 161 + 39,line 161 + 6,line 124 + 36,line 156 + 3,line 121 + 33,line 153 + 29,line 149 + 30,line 150 + 26,line 146 + 23,line 143 + 19,line 139 + 20,line 140 + 16,line 136 + 13,line 133 + 68,line 201 + 10,line 129 + 65,line 194 + 62,line 191 + 58,line 187 + 55,line 184 + 52,line 180 + 48,line 171 + 45,line 168 + 42,line 165 + 8,line 127 + 38,line 158 + 5,line 123 + 35,line 155 + 2,line 120 + 32,line 152 + 28,line 148 + 25,line 145 + 22,line 142 + 18,line 138 + 15,line 135 + 12,line 132 + 67,line 198 + 64,line 193 + 61,line 190 + 57,line 186 + 54,line 183 + 51,line 179 + 47,line 170 + 44,line 167 +} + +array set view::lr1_table { + 66,trans {} + 35 {{50 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 85,trans {} + 14,trans {} + 36 {{54 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 33,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 67}} + 37 {{62 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 52,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 87}} + 38 {{51 {0 294} 1} {68 {0 257 258 259 260 261 262} 0} {69 {0 257 258 259 260 261 262} 0}} + 71,trans {} + 39 {{64 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 40 {{66 {0 294} 1}} + 90,trans {} + 89,trans {} + 18,trans {} + 1,trans {} + 41 {{52 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 37,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 71}} + 42 {{45 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 56,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 90}} + 43 {{44 {0 294} 1}} + 75,trans {} + 44 {{56 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 23,trans {} + 5,trans {} + 45 {{43 {0 294} 1} {66 {0 294} 0} {67 {0 294} 0}} + 42,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 77}} + 46 {{58 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 61,trans {} + 47 {{47 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 80,trans {} + 79,trans {} + 48 {{57 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 27,trans {} + 9,trans {} + 50 {{46 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 49 {{55 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 46,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 81}} + 51 {{63 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 65,trans {} + 52 {{59 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 84,trans {} + 13,trans {} + 53 {{67 {0 294} 1}} + 32,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 66}} + 54 {{53 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 51,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 86}} + 55 {{60 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 70,trans {} + 69,trans {} + 56 {{61 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 88,trans {} + 17,trans {} + 0,trans {{263 1} {264 2} {265 3} {266 4} {267 5} {268 6} {269 7} {270 8} {271 9} {272 10} {273 11} {274 12} {275 13} {276 14} {277 15} {278 16} {279 17} {280 18} {281 19} {282 20} {283 21} {284 22} {285 23} {286 24} {287 25} {288 26} {289 27} {290 28} {291 29} {292 30} {293 31} {295 32} {296 33} {297 34} {298 35} {299 36} {300 37} {301 38} {302 39} {303 40} {304 41} {305 42} {306 43} {307 44} {308 45} {309 46} {310 47} {311 48} {312 49} {313 50} {314 51} {315 52} {316 53} {317 54} {319 55} {320 56} {321 57} {323 58} {324 59}} + 57 {{0 0 1}} + 36,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 70}} + 58 {{39 0 1} {41 0 1} {40 294 0}} + 55,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 89}} + 60 {{2 {0 294} 1}} + 59 {{42 {0 294} 1}} + 74,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 92}} + 61 {{5 {0 294} 1}} + 93,trans {} + 62 {{3 {0 294} 1}} + 22,trans {} + 4,trans {} + 41,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 76}} + 63 {{6 {0 294} 1}} + 60,trans {} + 59,trans {} + 64 {{4 {0 294} 1}} + 78,trans {} + 65 {{7 {0 294} 1}} + 66 {{65 {0 294} 2}} + 26,trans {} + 8,trans {} + 45,trans {{303 40} {316 53} {324 80}} + 67 {{48 {0 294} 2}} + 64,trans {} + 68 {{49 {0 294} 2}} + 83,trans {} + 70 {{54 {0 294} 2}} + 69 {{50 {0 294} 2}} + 12,trans {} + 71 {{62 {0 294} 2}} + 31,trans {} + 50,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 85}} + 49,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 84}} + 72 {{68 {0 257 258 259 260 261 262} 1}} + 68,trans {} + 73 {{69 {0 257 258 259 260 261 262} 1}} + 87,trans {} + 74 {{51 {0 294} 2} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 16,trans {} + 75 {{64 {0 294} 2}} + 35,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 69}} + 54,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 88}} + 76 {{52 {0 294} 2}} + 73,trans {} + 77 {{45 {0 294} 2}} + 92,trans {} + 78 {{44 {0 294} 2}} + 21,trans {} + 3,trans {} + 80 {{43 {0 294} 2}} + 79 {{56 {0 294} 2}} + 40,trans {} + 39,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 75}} + 58,trans {{322 91}} + 81 {{58 {0 294} 2}} + 10 {{17 {0 257 258 259 260 261 262} 1}} + 77,trans {} + 82 {{47 {0 294} 2}} + 11 {{18 {0 257 258 259 260 261 262} 1}} + 83 {{57 {0 294} 2}} + 25,trans {} + 7,trans {} + 12 {{19 {0 257 258 259 260 261 262} 1}} + 84 {{55 {0 294} 2}} + 44,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 79}} + 13 {{20 {0 257 258 259 260 261 262} 1}} + 63,trans {} + 85 {{46 {0 294} 2}} + 14 {{21 {0 257 258 259 260 261 262} 1}} + 82,trans {} + 86 {{63 {0 294} 2}} + 11,trans {} + 15 {{22 {0 257 258 259 260 261 262} 1}} + 87 {{59 {0 294} 2}} + 30,trans {} + 29,trans {} + 16 {{23 {0 257 258 259 260 261 262} 1}} + 88 {{53 {0 294} 2}} + 48,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 83}} + 0 {{0 0 0} {39 0 0} {41 0 0} {42 {0 294} 0} {43 {0 294} 0} {44 {0 294} 0} {45 {0 294} 0} {46 {0 294} 0} {47 {0 294} 0} {48 {0 294} 0} {49 {0 294} 0} {50 {0 294} 0} {51 {0 294} 0} {52 {0 294} 0} {53 {0 294} 0} {54 {0 294} 0} {55 {0 294} 0} {56 {0 294} 0} {57 {0 294} 0} {58 {0 294} 0} {59 {0 294} 0} {60 {0 294} 0} {61 {0 294} 0} {62 {0 294} 0} {63 {0 294} 0} {64 {0 294} 0} {65 {0 294} 0} {66 {0 294} 0} {67 {0 294} 0} {8 {0 257 258 259 260 261 262} 0} {9 {0 257 258 259 260 261 262} 0} {10 {0 257 258 259 260 261 262} 0} {11 {0 257 258 259 260 261 262} 0} {12 {0 257 258 259 260 261 262} 0} {13 {0 257 258 259 260 261 262} 0} {14 {0 257 258 259 260 261 262} 0} {15 {0 257 258 259 260 261 262} 0} {16 {0 257 258 259 260 261 262} 0} {17 {0 257 258 259 260 261 262} 0} {18 {0 257 258 259 260 261 262} 0} {19 {0 257 258 259 260 261 262} 0} {20 {0 257 258 259 260 261 262} 0} {21 {0 257 258 259 260 261 262} 0} {22 {0 257 258 259 260 261 262} 0} {23 {0 257 258 259 260 261 262} 0} {24 {0 257 258 259 260 261 262} 0} {25 {0 257 258 259 260 261 262} 0} {26 {0 257 258 259 260 261 262} 0} {27 {0 257 258 259 260 261 262} 0} {28 {0 257 258 259 260 261 262} 0} {29 {0 257 258 259 260 261 262} 0} {30 {0 257 258 259 260 261 262} 0} {31 {0 257 258 259 260 261 262} 0} {32 {0 257 258 259 260 261 262} 0} {33 {0 257 258 259 260 261 262} 0} {34 {0 257 258 259 260 261 262} 0} {35 {0 257 258 259 260 261 262} 0} {36 {0 257 258 259 260 261 262} 0} {37 {0 257 258 259 260 261 262} 0} {38 {0 257 258 259 260 261 262} 0}} + 17 {{24 {0 257 258 259 260 261 262} 1}} + 67,trans {} + 90 {{61 {0 294} 2}} + 89 {{60 {0 294} 2}} + 1 {{8 {0 257 258 259 260 261 262} 1}} + 18 {{25 {0 257 258 259 260 261 262} 1}} + 86,trans {} + 91 {{41 0 2}} + 15,trans {} + 2 {{9 {0 257 258 259 260 261 262} 1}} + 19 {{26 {0 257 258 259 260 261 262} 1}} + 20 {{27 {0 257 258 259 260 261 262} 1}} + 92 {{51 {0 294} 3}} + 34,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 68}} + 3 {{10 {0 257 258 259 260 261 262} 1}} + 21 {{28 {0 257 258 259 260 261 262} 1}} + 93 {{41 0 3}} + 53,trans {} + 4 {{11 {0 257 258 259 260 261 262} 1}} + 22 {{29 {0 257 258 259 260 261 262} 1}} + 72,trans {} + 5 {{12 {0 257 258 259 260 261 262} 1}} + 23 {{30 {0 257 258 259 260 261 262} 1}} + 91,trans {{294 93}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{13 {0 257 258 259 260 261 262} 1}} + 24 {{31 {0 257 258 259 260 261 262} 1}} + 38,trans {{303 72} {316 73} {325 74}} + 7 {{14 {0 257 258 259 260 261 262} 1}} + 25 {{32 {0 257 258 259 260 261 262} 1}} + 57,trans {} + 8 {{15 {0 257 258 259 260 261 262} 1}} + 26 {{33 {0 257 258 259 260 261 262} 1}} + 76,trans {} + 9 {{16 {0 257 258 259 260 261 262} 1}} + 27 {{34 {0 257 258 259 260 261 262} 1}} + 24,trans {} + 6,trans {} + 28 {{35 {0 257 258 259 260 261 262} 1}} + 43,trans {{294 78}} + 29 {{36 {0 257 258 259 260 261 262} 1}} + 30 {{37 {0 257 258 259 260 261 262} 1}} + 62,trans {} + 31 {{38 {0 257 258 259 260 261 262} 1}} + 81,trans {} + 10,trans {} + 32 {{65 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 28,trans {} + 33 {{48 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} + 47,trans {{257 60} {258 61} {259 62} {260 63} {261 64} {262 65} {318 82}} + 34 {{49 {0 294} 1} {1 {0 294} 0} {2 {0 294} 0} {3 {0 294} 0} {4 {0 294} 0} {5 {0 294} 0} {6 {0 294} 0} {7 {0 294} 0}} +} + +array set view::token_id_table { + 286 WCSS_ + 286,t 0 + 287 WCST_ + 292,line 44 + 302,line 58 + 288 WCSU_ + 317,t 0 + 265,title AMPLIFIER + 289 WCSV_ + 290 WCSW_ + 300 FRAME_ + 284,title WCSQ + 291 WCSX_ + 301 GRAPH_ + 313,title PANNER + 292 WCSY_ + 302 GREEN_ + 288,line 40 + 293 WCSZ_ + 303 HORIZONTAL_ + 294 STRING_ + 304 HORZGRAPH_ + 305 INFO_ + 295 BLUE_ + 306 KEYVALUE_ + 296 BUTTONS_ + 307 KEYWORD_ + 262,t 0 + 297 COLORBAR_ + 308 LAYOUT_ + 285,line 37 + 298 COLORBARNUMERICS_ + 310 MAGNIFIER_ + 309 LOWHIGH_ + 299 FILENAME_ + 311 MINMAX_ + 283,t 0 + 312 OBJECT_ + 313 PANNER_ + 314,t 0 + 314 RED_ + 282,line 34 + 315 UNITS_ + 316 VERTICAL_ + 264,title PHYSICAL + 317 VERTGRAPH_ + 283,title WCSP + 318 yesno + 312,title OBJECT + 320 wcssys + 319 coordsys + 278,line 30 + 321 command + error,line 117 + 322 @PSEUDO1 + 258,t 0 + 323 view + 324 layout + 325 orient + 275,line 27 + 279,t 0 + 280,t 0 + 326 start' + 311,t 0 + 272,line 24 + 263,title IMAGE + 282,title WCSO + 311,title MINMAX + 268,line 20 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 12 + 0,t 0 + 0 {$} + 262,title FALSE + 281,title WCSN + error,t 0 + 310,title MAGNIFIER + 309,title LOWHIGH + 299,title FILENAME + 258,line 8 + 273,t 0 + 324,line 196 + 294,t 0 + 304,t 0 + 325,t 1 + 321,line 160 + 317,line 73 + 261,title TRUE + 279,title WCSL + 280,title WCSM + 308,title LAYOUT + 269,t 0 + 270,t 0 + 298,title COLORBARNUMERICS + 314,line 70 + 291,t 0 + 301,t 0 + 322,t 1 + 311,line 67 + 307,line 63 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 53 + 278,title WCSK + 307,title KEYWORD + 297,title COLORBAR + 326,title {} + 287,t 0 + 294,line 47 + 304,line 60 + 318,t 1 + error,title {} + 291,line 43 + 301,line 57 + 263,t 0 + 258,title NO + 287,line 39 + 277,title WCSJ + 284,t 0 + 306,title KEYVALUE + 296,title BUTTONS + 325,title {} + 315,t 0 + 284,line 36 + 281,line 33 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title YES + 277,line 29 + 276,title WCSI + 312,t 0 + 305,title INFO + 295,title BLUE + 324,title {} + 274,line 26 + 271,line 23 + 277,t 0 + 308,t 0 + 267,line 19 + 298,t 0 + 275,title WCSH + 294,title string + 304,title HORZGRAPH + 323,title {} + 264,line 15 + 261,line 11 + 274,t 0 + 326,line 203 + 305,t 0 + 295,t 0 + 257,line 7 + 326,t 1 + 274,title WCSG + 323,line 164 + 293,title WCSZ + 303,title HORIZONTAL + 322,title {} + 320,line 131 + 319,line 126 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 72 + 323,t 1 + 273,title WCSF + 313,line 69 + 292,title WCSY + 302,title GREEN + 321,title {} + 267,t 0 + 310,line 66 + 309,line 65 + 299,line 55 + 288,t 0 + 320,t 1 + 319,t 1 + 306,line 62 + 296,line 52 + 272,title WCSE + 291,title WCSX + 293,line 45 + 301,title GRAPH + 303,line 59 + 320,title {} + 319,title {} + 264,t 0 + 285,t 0 + 289,line 41 + 290,line 42 + 300,line 56 + 316,t 0 + 286,line 38 + 271,title WCSD + 261,t 0 + 283,line 35 + 289,title WCSV + 290,title WCSW + 300,title FRAME + 318,title {} + 282,t 0 + 279,line 31 + 280,line 32 + 313,t 0 + 276,line 28 + 257,t 0 + 269,title WCSB + 270,title WCSC + 273,line 25 + 288,title WCSU + 317,title VERTGRAPH + 278,t 0 + 310,t 0 + 309,t 0 + 299,t 0 + 269,line 21 + 270,line 22 + 266,line 17 + 268,title WCSA + 275,t 0 + 263,line 14 + 287,title WCST + 316,title VERTICAL + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 325,line 200 + 322,line 161 + 272,t 0 + 267,title WCS + 257 YES_ + 286,title WCSS + 293,t 0 + 303,t 0 + 315,title UNITS + 258 NO_ + 318,line 118 + 260 OFF_ + 259 ON_ + 324,t 1 + 261 TRUE_ + 262 FALSE_ + 263 IMAGE_ + 264 PHYSICAL_ + 315,line 71 + 265 AMPLIFIER_ + 266 DETECTOR_ + 267 WCS_ + 268,t 0 + 268 WCSA_ + 269 WCSB_ + 270 WCSC_ + 312,line 68 + 271 WCSD_ + 272 WCSE_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title DETECTOR + 273 WCSF_ + 274 WCSG_ + 285,title WCSR + 321,t 1 + 314,title RED + 275 WCSH_ + 308,line 64 + 276 WCSI_ + 298,line 54 + 277 WCSJ_ + 278 WCSK_ + 279 WCSL_ + 280 WCSM_ + 281 WCSN_ + 305,line 61 + 282 WCSO_ + 295,line 51 + 265,t 0 + 283 WCSP_ + 284 WCSQ_ + 285 WCSR_ +} + +proc view::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ image } + 9 { set _ physical } + 10 { set _ amplifier } + 11 { set _ detector } + 12 { set _ wcs } + 13 { set _ wcsa } + 14 { set _ wcsb } + 15 { set _ wcsc } + 16 { set _ wcsd } + 17 { set _ wcse } + 18 { set _ wcsf } + 19 { set _ wcsg } + 20 { set _ wcsh } + 21 { set _ wcsi } + 22 { set _ wcsj } + 23 { set _ wcsk } + 24 { set _ wcsl } + 25 { set _ wcsm } + 26 { set _ wcsn } + 27 { set _ wcso } + 28 { set _ wcsp } + 29 { set _ wcsq } + 30 { set _ wcsr } + 31 { set _ wcss } + 32 { set _ wcst } + 33 { set _ wcsu } + 34 { set _ wcsv } + 35 { set _ wcsw } + 36 { set _ wcsx } + 37 { set _ wcsy } + 38 { set _ wcsz } + 40 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 44 { ProcessCmdSet view info,keyvalue $2 UpdateView } + 45 { ProcessCmdSet view info $2 UpdateView } + 46 { ProcessCmdSet view panner $2 UpdateView } + 47 { ProcessCmdSet view magnifier $2 UpdateView } + 48 { ProcessCmdSet view buttons $2 UpdateView } + 49 { ProcessCmdSet view colorbar $2 UpdateView } + 50 { ColorbarCmdSet numerics $2 UpdateView } + 51 { ProcessCmdSet view graph,$2 $3 UpdateView } + 52 { ProcessCmdSet view graph,horz $2 UpdateView } + 53 { ProcessCmdSet view graph,vert $2 UpdateView } + 54 { ProcessCmdSet view info,filename $2 UpdateView } + 55 { ProcessCmdSet view info,object $2 UpdateView } + 56 { ProcessCmdSet view info,keyword $2 UpdateView } + 57 { ProcessCmdSet view info,minmax $2 UpdateView } + 58 { ProcessCmdSet view info,lowhigh $2 UpdateView } + 59 { ProcessCmdSet view info,bunit $2 UpdateView } + 60 { ProcessCmdSet view info,$1 $2 UpdateView } + 61 { ProcessCmdSet view info,$1 $2 UpdateView } + 62 { ProcessCmdSet view info,frame $2 UpdateView } + 63 { ProcessCmdSet rgb red $2 RGBView } + 64 { ProcessCmdSet rgb green $2 RGBView } + 65 { ProcessCmdSet rgb blue $2 RGBView } + 66 { ProcessCmdSet view layout horizontal ViewHorzCmd } + 67 { ProcessCmdSet view layout vertical ViewVertCmd } + 68 { set _ horz } + 69 { set _ vert } + } + 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 view::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/viewsendlex.tcl b/ds9/parsers/viewsendlex.tcl new file mode 100644 index 0000000..cc71ab5 --- /dev/null +++ b/ds9/parsers/viewsendlex.tcl @@ -0,0 +1,856 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval viewsend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc viewsend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc viewsend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc viewsend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc viewsend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc viewsend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc viewsend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc viewsend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc viewsend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc viewsend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set BUTTONS_ 288 +set COLORBAR_ 289 +set COLORBARNUMERICS_ 290 +set FILENAME_ 291 +set FRAME_ 292 +set GRAPH_ 293 +set HORIZONTAL_ 294 +set HORZGRAPH_ 295 +set INFO_ 296 +set KEYWORD_ 297 +set KEYVALUE_ 298 +set LAYOUT_ 299 +set LOWHIGH_ 300 +set MAGNIFIER_ 301 +set MINMAX_ 302 +set OBJECT_ 303 +set PANNER_ 304 +set UNITS_ 305 +set VERTGRAPH_ 306 +set VERTICAL_ 307 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: blue + if {[regexp -start $index_ -indices -line -nocase -- {\A(blue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: buttons + if {[regexp -start $index_ -indices -line -nocase -- {\A(buttons)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: colorbar + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbar)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: colorbarnumerics + if {[regexp -start $index_ -indices -line -nocase -- {\A(colorbarnumerics)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: filename + if {[regexp -start $index_ -indices -line -nocase -- {\A(filename)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: graph + if {[regexp -start $index_ -indices -line -nocase -- {\A(graph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: green + if {[regexp -start $index_ -indices -line -nocase -- {\A(green)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: horz + if {[regexp -start $index_ -indices -line -nocase -- {\A(horz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: horizontal + if {[regexp -start $index_ -indices -line -nocase -- {\A(horizontal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: horzgraph + if {[regexp -start $index_ -indices -line -nocase -- {\A(horzgraph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: info + if {[regexp -start $index_ -indices -line -nocase -- {\A(info)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: keyvalue + if {[regexp -start $index_ -indices -line -nocase -- {\A(keyvalue)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: keyword + if {[regexp -start $index_ -indices -line -nocase -- {\A(keyword)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: layout + if {[regexp -start $index_ -indices -line -nocase -- {\A(layout)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: lowhigh + if {[regexp -start $index_ -indices -line -nocase -- {\A(lowhigh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: magnifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(magnifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: minmax + if {[regexp -start $index_ -indices -line -nocase -- {\A(minmax)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: object + if {[regexp -start $index_ -indices -line -nocase -- {\A(object)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: panner + if {[regexp -start $index_ -indices -line -nocase -- {\A(panner)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: red + if {[regexp -start $index_ -indices -line -nocase -- {\A(red)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: units + if {[regexp -start $index_ -indices -line -nocase -- {\A(units)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: vert + if {[regexp -start $index_ -indices -line -nocase -- {\A(vert)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: vertical + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: vertgraph + if {[regexp -start $index_ -indices -line -nocase -- {\A(vertgraph)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: image + if {[regexp -start $index_ -indices -line -nocase -- {\A(image)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: physical + if {[regexp -start $index_ -indices -line -nocase -- {\A(physical)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: amplifier + if {[regexp -start $index_ -indices -line -nocase -- {\A(amplifier)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: detector + if {[regexp -start $index_ -indices -line -nocase -- {\A(detector)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BLUE_ + } + 1 { +return $BUTTONS_ + } + 2 { +return $COLORBAR_ + } + 3 { +return $COLORBARNUMERICS_ + } + 4 { +return $FILENAME_ + } + 5 { +return $FRAME_ + } + 6 { +return $GRAPH_ + } + 7 { +return $GREEN_ + } + 8 { +return $HORIZONTAL_ + } + 9 { +return $HORIZONTAL_ + } + 10 { +return $HORZGRAPH_ + } + 11 { +return $INFO_ + } + 12 { +return $KEYVALUE_ + } + 13 { +return $KEYWORD_ + } + 14 { +return $LAYOUT_ + } + 15 { +return $LOWHIGH_ + } + 16 { +return $MAGNIFIER_ + } + 17 { +return $MINMAX_ + } + 18 { +return $OBJECT_ + } + 19 { +return $PANNER_ + } + 20 { +return $RED_ + } + 21 { +return $UNITS_ + } + 22 { +return $VERTICAL_ + } + 23 { +return $VERTICAL_ + } + 24 { +return $VERTGRAPH_ + } + 25 { +return $IMAGE_ + } + 26 { +return $PHYSICAL_ + } + 27 { +return $AMPLIFIER_ + } + 28 { +return $DETECTOR_ + } + 29 { +return $WCS_ + } + 30 { +return $WCSA_ + } + 31 { +return $WCSB_ + } + 32 { +return $WCSC_ + } + 33 { +return $WCSD_ + } + 34 { +return $WCSE_ + } + 35 { +return $WCSF_ + } + 36 { +return $WCSG_ + } + 37 { +return $WCSH_ + } + 38 { +return $WCSI_ + } + 39 { +return $WCSJ_ + } + 40 { +return $WCSK_ + } + 41 { +return $WCSL_ + } + 42 { +return $WCSM_ + } + 43 { +return $WCSN_ + } + 44 { +return $WCSO_ + } + 45 { +return $WCSP_ + } + 46 { +return $WCSQ_ + } + 47 { +return $WCSR_ + } + 48 { +return $WCSS_ + } + 49 { +return $WCST_ + } + 50 { +return $WCSU_ + } + 51 { +return $WCSV_ + } + 52 { +return $WCSW_ + } + 53 { +return $WCSX_ + } + 54 { +return $WCSY_ + } + 55 { +return $WCSZ_ + } + 56 { +# ignore whitespace + } + 57 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/viewsendparser.tab.tcl b/ds9/parsers/viewsendparser.tab.tcl new file mode 100644 index 0000000..1c1336e --- /dev/null +++ b/ds9/parsers/viewsendparser.tab.tcl @@ -0,0 +1,51 @@ +set IMAGE_ 257 +set PHYSICAL_ 258 +set AMPLIFIER_ 259 +set DETECTOR_ 260 +set WCS_ 261 +set WCSA_ 262 +set WCSB_ 263 +set WCSC_ 264 +set WCSD_ 265 +set WCSE_ 266 +set WCSF_ 267 +set WCSG_ 268 +set WCSH_ 269 +set WCSI_ 270 +set WCSJ_ 271 +set WCSK_ 272 +set WCSL_ 273 +set WCSM_ 274 +set WCSN_ 275 +set WCSO_ 276 +set WCSP_ 277 +set WCSQ_ 278 +set WCSR_ 279 +set WCSS_ 280 +set WCST_ 281 +set WCSU_ 282 +set WCSV_ 283 +set WCSW_ 284 +set WCSX_ 285 +set WCSY_ 286 +set WCSZ_ 287 +set BUTTONS_ 288 +set COLORBAR_ 289 +set COLORBARNUMERICS_ 290 +set FILENAME_ 291 +set FRAME_ 292 +set GRAPH_ 293 +set HORIZONTAL_ 294 +set HORZGRAPH_ 295 +set INFO_ 296 +set KEYWORD_ 297 +set KEYVALUE_ 298 +set LAYOUT_ 299 +set LOWHIGH_ 300 +set MAGNIFIER_ 301 +set MINMAX_ 302 +set OBJECT_ 303 +set PANNER_ 304 +set UNITS_ 305 +set VERTGRAPH_ 306 +set VERTICAL_ 307 diff --git a/ds9/parsers/viewsendparser.tcl b/ds9/parsers/viewsendparser.tcl new file mode 100644 index 0000000..18544a3 --- /dev/null +++ b/ds9/parsers/viewsendparser.tcl @@ -0,0 +1,993 @@ +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 viewsend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc viewsend::YYABORT {} { + return -code return 1 +} + +proc viewsend::YYACCEPT {} { + return -code return 0 +} + +proc viewsend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc viewsend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc viewsend::yyerror {s} { + puts stderr $s +} + +proc viewsend::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 viewsend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set viewsend::table { + 37:307,target 54 + 27:0 reduce + 48:0 reduce + 0:306,target 49 + 0:296,target 39 + 0:275,target 19 + 6:0,target 6 + 2:0 reduce + 24:0 reduce + 48:0,target 49 + 41:0,target 34 + 45:0 reduce + 33:0,target 39 + 0:304,target 47 + 25:0,target 25 + 17:0,target 17 + 10:0,target 10 + 0:273,target 17 + 21:0 reduce + 42:0 reduce + 0:292,target 36 + 0:302,target 45 + 0:271,target 15 + 17:0 reduce + 38:0 reduce + 0:300,target 43 + 0:290,target 34 + 0:289,target 33 + 3:0,target 3 + 53:0,target 54 + 0:268,target 12 + 45:0,target 47 + 14:0 reduce + 37:0,target 53 + 29:0,target 29 + 30:0,target 30 + 22:0,target 22 + 14:0,target 14 + 35:0 reduce + 0:287,target 31 + 0:257 shift + 0:258 shift + 0:259 shift + 0:260 shift + 0:261 shift + 0:266,target 10 + 9:0 reduce + 0:262 shift + 11:0 reduce + 0:263 shift + 0:264 shift + 0:265 shift + 32:0 reduce + 0:266 shift + 0:267 shift + 53:0 reduce + 0:268 shift + 0:269 shift + 0:270 shift + 0:271 shift + 0:285,target 29 + 0:272 shift + 0:273 shift + 0:274 shift + 0:275 shift + 6:0 reduce + 0:264,target 8 + 0:276 shift + 0:277 shift + 0:278 shift + 0:279 shift + 0:280 shift + 7:0,target 7 + 28:0 reduce + 0:0,target 32 + 0:281 shift + 0:282 shift + 50:0 reduce + 49:0 reduce + 0:283 shift + 0:284 shift + 0:285 shift + 50:0,target 50 + 49:0,target 43 + 0:283,target 27 + 0:286 shift + 42:0,target 33 + 0:287 shift + 0:288 shift + 34:0,target 40 + 0:300 shift + 0:290 shift + 0:289 shift + 3:0 reduce + 26:0,target 26 + 0:291 shift + 0:301 shift + 18:0,target 18 + 0:292 shift + 0:302 shift + 0:262,target 6 + 11:0,target 11 + 0:303 shift + 0:293 shift + 0:304 shift + 25:0 reduce + 0:305 shift + 0:295 shift + 0:306 shift + 0:296 shift + 46:0 reduce + 0:297 shift + 0:308 goto + 0:298 shift + 0:309 goto + 0:310 goto + 0:299 shift + 0:281,target 25 + 0:0 reduce + 37:311,target 55 + 0:259,target 3 + 0:260,target 4 + 22:0 reduce + 43:0 reduce + 0:309,target 51 + 0:310,target 52 + 0:299,target 42 + 37:294 shift + 0:278,target 22 + 37:307 shift + 4:0,target 4 + 37:311 goto + 0:257,target 1 + 18:0 reduce + 54:0,target 55 + 39:0 reduce + 40:0 reduce + 46:0,target 45 + 0:297,target 40 + 38:0,target 42 + 31:0,target 31 + 23:0,target 23 + 15:0,target 15 + 0:276,target 20 + 15:0 reduce + 36:0 reduce + 0:305,target 48 + 0:295,target 38 + 0:274,target 18 + 12:0 reduce + 37:294,target 53 + 33:0 reduce + 54:0 reduce + 0:303,target 46 + 0:293,target 37 + 8:0,target 8 + 1:0,target 1 + 0:272,target 16 + 7:0 reduce + 51:0,target 51 + 43:0,target 48 + 29:0 reduce + 30:0 reduce + 35:0,target 44 + 27:0,target 27 + 19:0,target 19 + 20:0,target 20 + 51:0 reduce + 12:0,target 12 + 0:291,target 35 + 0:301,target 44 + 0:269,target 13 + 0:270,target 14 + 4:0 reduce + 26:0 reduce + 47:0 reduce + 0:288,target 32 + 1:0 reduce + 0:267,target 11 + 23:0 reduce + 44:0 reduce + 5:0,target 5 + 0:286,target 30 + 55:0,target 41 + 47:0,target 36 + 40:0,target 46 + 39:0,target 35 + 0:265,target 9 + 32:0,target 38 + 24:0,target 24 + 16:0,target 16 + 19:0 reduce + 20:0 reduce + 41:0 reduce + 0:284,target 28 + 0:263,target 7 + 16:0 reduce + 37:0 reduce + 0:282,target 26 + 0:261,target 5 + 9:0,target 9 + 13:0 reduce + 2:0,target 2 + 34:0 reduce + 55:0 reduce + 52:0,target 0 + 44:0,target 37 + 36:0,target 52 + 0:279,target 23 + 0:280,target 24 + 28:0,target 28 + 21:0,target 21 + 13:0,target 13 + 8:0 reduce + 10:0 reduce + 0:258,target 2 + 31:0 reduce + 0:308,target 50 + 0:298,target 41 + 52:0 accept + 0:277,target 21 + 5:0 reduce +} + +array set viewsend::rules { + 9,l 309 + 11,l 309 + 32,l 310 + 53,l 311 + 6,l 309 + 28,l 309 + 50,l 310 + 49,l 310 + 3,l 308 + 25,l 309 + 46,l 310 + 0,l 312 + 22,l 309 + 43,l 310 + 18,l 309 + 40,l 310 + 39,l 310 + 15,l 309 + 36,l 310 + 12,l 309 + 33,l 310 + 54,l 311 + 7,l 309 + 29,l 309 + 30,l 309 + 51,l 310 + 4,l 308 + 26,l 309 + 47,l 310 + 1,l 308 + 23,l 309 + 44,l 310 + 19,l 309 + 20,l 309 + 41,l 310 + 16,l 309 + 37,l 310 + 13,l 309 + 34,l 310 + 55,l 311 + 8,l 309 + 10,l 309 + 31,l 309 + 52,l 310 + 5,l 309 + 27,l 309 + 48,l 310 + 2,l 308 + 24,l 309 + 45,l 310 + 21,l 309 + 42,l 310 + 17,l 309 + 38,l 310 + 14,l 309 + 35,l 310 +} + +array set viewsend::rules { + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 2 + 55,dc 1 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 1 + 17,dc 1 + 32,dc 0 + 8,dc 1 + 46,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 1 + 38,dc 1 + 53,dc 0 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 1 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 21,dc 1 + 35,dc 1 + 50,dc 1 + 49,dc 1 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set viewsend::rules { + 41,line 144 + 7,line 106 + 37,line 138 + 4,line 102 + 34,line 135 + 1,line 99 + 31,line 130 + 27,line 126 + 24,line 123 + 21,line 120 + 17,line 116 + 14,line 113 + 11,line 110 + 53,line 162 + 50,line 156 + 49,line 155 + 46,line 151 + 43,line 148 + 9,line 108 + 40,line 142 + 39,line 141 + 6,line 105 + 36,line 137 + 3,line 101 + 33,line 134 + 29,line 128 + 30,line 129 + 26,line 125 + 23,line 122 + 19,line 118 + 20,line 119 + 16,line 115 + 13,line 112 + 10,line 109 + 55,line 164 + 52,line 159 + 48,line 153 + 45,line 150 + 42,line 146 + 8,line 107 + 38,line 139 + 5,line 104 + 35,line 136 + 2,line 100 + 32,line 133 + 28,line 127 + 25,line 124 + 22,line 121 + 18,line 117 + 15,line 114 + 12,line 111 + 54,line 163 + 51,line 158 + 47,line 152 + 44,line 149 +} + +array set viewsend::lr1_table { + 35 {{44 0 1}} + 14,trans {} + 36 {{52 0 1}} + 33,trans {} + 37 {{41 0 1} {53 0 0} {54 0 0} {55 0 0}} + 52,trans {} + 38 {{42 0 1}} + 39 {{35 0 1}} + 40 {{46 0 1}} + 18,trans {} + 1,trans {} + 41 {{34 0 1}} + 37,trans {{294 53} {307 54} {311 55}} + 42 {{33 0 1}} + 43 {{48 0 1}} + 44 {{37 0 1}} + 23,trans {} + 5,trans {} + 45 {{47 0 1}} + 42,trans {} + 46 {{45 0 1}} + 47 {{36 0 1}} + 48 {{49 0 1}} + 27,trans {} + 9,trans {} + 50 {{50 0 1}} + 49 {{43 0 1}} + 46,trans {} + 51 {{51 0 1}} + 52 {{0 0 1}} + 53 {{54 0 1}} + 13,trans {} + 54 {{55 0 1}} + 32,trans {} + 51,trans {} + 55 {{41 0 2}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7} {264 8} {265 9} {266 10} {267 11} {268 12} {269 13} {270 14} {271 15} {272 16} {273 17} {274 18} {275 19} {276 20} {277 21} {278 22} {279 23} {280 24} {281 25} {282 26} {283 27} {284 28} {285 29} {286 30} {287 31} {288 32} {289 33} {290 34} {291 35} {292 36} {293 37} {295 38} {296 39} {297 40} {298 41} {299 42} {300 43} {301 44} {302 45} {303 46} {304 47} {305 48} {306 49} {308 50} {309 51} {310 52}} + 36,trans {} + 55,trans {} + 22,trans {} + 4,trans {} + 41,trans {} + 26,trans {} + 8,trans {} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 10 {{10 0 1}} + 11 {{11 0 1}} + 25,trans {} + 7,trans {} + 12 {{12 0 1}} + 44,trans {} + 13 {{13 0 1}} + 14 {{14 0 1}} + 11,trans {} + 15 {{15 0 1}} + 30,trans {} + 29,trans {} + 16 {{16 0 1}} + 48,trans {} + 0 {{0 0 0} {32 0 0} {33 0 0} {34 0 0} {35 0 0} {36 0 0} {37 0 0} {38 0 0} {39 0 0} {40 0 0} {41 0 0} {42 0 0} {43 0 0} {44 0 0} {45 0 0} {46 0 0} {47 0 0} {48 0 0} {49 0 0} {50 0 0} {51 0 0} {52 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0} {8 0 0} {9 0 0} {10 0 0} {11 0 0} {12 0 0} {13 0 0} {14 0 0} {15 0 0} {16 0 0} {17 0 0} {18 0 0} {19 0 0} {20 0 0} {21 0 0} {22 0 0} {23 0 0} {24 0 0} {25 0 0} {26 0 0} {27 0 0} {28 0 0} {29 0 0} {30 0 0} {31 0 0}} + 17 {{17 0 1}} + 1 {{1 0 1}} + 18 {{18 0 1}} + 15,trans {} + 2 {{2 0 1}} + 19 {{19 0 1}} + 20 {{20 0 1}} + 34,trans {} + 3 {{3 0 1}} + 21 {{21 0 1}} + 53,trans {} + 4 {{4 0 1}} + 22 {{22 0 1}} + 5 {{5 0 1}} + 23 {{23 0 1}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{6 0 1}} + 24 {{24 0 1}} + 38,trans {} + 7 {{7 0 1}} + 25 {{25 0 1}} + 8 {{8 0 1}} + 26 {{26 0 1}} + 9 {{9 0 1}} + 27 {{27 0 1}} + 24,trans {} + 6,trans {} + 28 {{28 0 1}} + 43,trans {} + 29 {{29 0 1}} + 30 {{30 0 1}} + 31 {{31 0 1}} + 10,trans {} + 32 {{38 0 1}} + 28,trans {} + 33 {{39 0 1}} + 47,trans {} + 34 {{40 0 1}} +} + +array set viewsend::token_id_table { + 286 WCSY_ + 286,t 0 + 287 WCSZ_ + 292,line 46 + 302,line 56 + 288 BUTTONS_ + 265,title WCSD + 289 COLORBAR_ + 290 COLORBARNUMERICS_ + 300 LOWHIGH_ + 284,title WCSW + 291 FILENAME_ + 301 MAGNIFIER_ + 292 FRAME_ + 302 MINMAX_ + 288,line 42 + 293 GRAPH_ + 303 OBJECT_ + 294 HORIZONTAL_ + 304 PANNER_ + 305 UNITS_ + 295 HORZGRAPH_ + 306 VERTGRAPH_ + 296 INFO_ + 307 VERTICAL_ + 262,t 0 + 297 KEYWORD_ + 308 coordsys + 285,line 36 + 298 KEYVALUE_ + 310 viewsend + 309 wcssys + 299 LAYOUT_ + 311 graph + 283,t 0 + 312 start' + 282,line 33 + 264,title WCSC + 283,title WCSV + 312,title {} + 278,line 29 + error,line 97 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCSB + 282,title WCSU + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 13 + 0,t 0 + 0 {$} + 262,title WCSA + 281,title WCST + 310,title {} + 309,title {} + error,t 0 + 299,title LAYOUT + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 261,title WCS + 279,title WCSR + 280,title WCSS + 308,title {} + 269,t 0 + 270,t 0 + 298,title KEYVALUE + 291,t 0 + 301,t 0 + 311,line 161 + 307,line 61 + 266,t 0 + 260,title DETECTOR + 259,title AMPLIFIER + 297,line 51 + 278,title WCSQ + 307,title VERTICAL + 297,title KEYWORD + 287,t 0 + 294,line 48 + 304,line 58 + error,title {} + 291,line 45 + 301,line 55 + 263,t 0 + 258,title PHYSICAL + 287,line 38 + 277,title WCSP + 284,t 0 + 306,title VERTGRAPH + 296,title INFO + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title IMAGE + 277,line 28 + 276,title WCSO + 312,t 1 + 305,title UNITS + 295,title HORZGRAPH + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 1 + 267,line 18 + 298,t 0 + 275,title WCSN + 294,title HORIZONTAL + 304,title PANNER + 264,line 15 + 261,line 12 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSM + 293,title GRAPH + 303,title OBJECT + error error + 271,t 0 + 292,t 0 + 302,t 0 + 273,title WCSL + 292,title FRAME + 302,title MINMAX + 267,t 0 + 310,line 132 + 309,line 103 + 299,line 53 + 288,t 0 + 306,line 60 + 296,line 50 + 272,title WCSK + 291,title FILENAME + 293,line 47 + 301,title MAGNIFIER + 303,line 57 + 264,t 0 + 285,t 0 + 289,line 43 + 290,line 44 + 300,line 54 + 286,line 37 + 271,title WCSJ + 261,t 0 + 283,line 34 + 289,title COLORBAR + 290,title COLORBARNUMERICS + 300,title LOWHIGH + 282,t 0 + 279,line 30 + 280,line 31 + 276,line 27 + 257,t 0 + 269,title WCSH + 270,title WCSI + 273,line 24 + 288,title BUTTONS + 278,t 0 + 310,t 1 + 309,t 1 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSG + 275,t 0 + 263,line 14 + 287,title WCSZ + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSF + 257 IMAGE_ + 286,title WCSY + 293,t 0 + 303,t 0 + 258 PHYSICAL_ + 260 DETECTOR_ + 259 AMPLIFIER_ + 261 WCS_ + 262 WCSA_ + 263 WCSB_ + 264 WCSC_ + 265 WCSD_ + 266 WCSE_ + 267 WCSF_ + 268,t 0 + 268 WCSG_ + 269 WCSH_ + 270 WCSI_ + 312,line 165 + 271 WCSJ_ + 272 WCSK_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSE + 273 WCSL_ + 274 WCSM_ + 285,title WCSX + 275 WCSN_ + 308,line 98 + 276 WCSO_ + 298,line 52 + 277 WCSP_ + 278 WCSQ_ + 279 WCSR_ + 280 WCSS_ + 281 WCST_ + 305,line 59 + 282 WCSU_ + 295,line 49 + 265,t 0 + 283 WCSV_ + 284 WCSW_ + 285 WCSX_ +} + +proc viewsend::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 _ image } + 2 { set _ physical } + 3 { set _ amplifier } + 4 { set _ detector } + 5 { set _ wcs } + 6 { set _ wcsa } + 7 { set _ wcsb } + 8 { set _ wcsc } + 9 { set _ wcsd } + 10 { set _ wcse } + 11 { set _ wcsf } + 12 { set _ wcsg } + 13 { set _ wcsh } + 14 { set _ wcsi } + 15 { set _ wcsj } + 16 { set _ wcsk } + 17 { set _ wcsl } + 18 { set _ wcsm } + 19 { set _ wcsn } + 20 { set _ wcso } + 21 { set _ wcsp } + 22 { set _ wcsq } + 23 { set _ wcsr } + 24 { set _ wcss } + 25 { set _ wcst } + 26 { set _ wcsu } + 27 { set _ wcsv } + 28 { set _ wcsw } + 29 { set _ wcsx } + 30 { set _ wcsy } + 31 { set _ wcsz } + 33 { ProcessSendCmdGet view layout } + 34 { ProcessSendCmdGet view info,keyvalue } + 35 { ProcessSendCmdYesNo view info } + 36 { ProcessSendCmdYesNo view panner } + 37 { ProcessSendCmdYesNo view magnifier } + 38 { ProcessSendCmdYesNo view buttons } + 39 { ProcessSendCmdYesNo view colorbar } + 40 { ProcessSendCmdYesNo colorbar numerics } + 42 { ProcessSendCmdYesNo view graph,horz } + 43 { ProcessSendCmdYesNo view graph,graph } + 44 { ProcessSendCmdYesNo view info,filename } + 45 { ProcessSendCmdYesNo view info,object } + 46 { ProcessSendCmdYesNo view info,keyword } + 47 { ProcessSendCmdYesNo view info,minmax } + 48 { ProcessSendCmdYesNo view info,lowhigh } + 49 { ProcessSendCmdYesNo view info,bunit } + 50 { ProcessSendCmdYesNo view info,$1 } + 51 { ProcessSendCmdYesNo view info,$1 } + 52 { ProcessSendCmdYesNo view info,frame } + 54 { ProcessSendCmdYesNo view graph,horz } + 55 { ProcessSendCmdYesNo view graph,vert } + } + 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 viewsend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/vlalex.tcl b/ds9/parsers/vlalex.tcl new file mode 100644 index 0000000..9a9e334 --- /dev/null +++ b/ds9/parsers/vlalex.tcl @@ -0,0 +1,610 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval vla { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc vla::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc vla::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc vla::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc vla::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc vla::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc vla::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc vla::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc vla::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc vla::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set STRIPE82_ 284 +set FIRST_ 285 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: stripe82 + if {[regexp -start $index_ -indices -line -nocase -- {\A(stripe82)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: first + if {[regexp -start $index_ -indices -line -nocase -- {\A(first)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $STRIPE82_ + } + 1 { +return $FIRST_ + } + 2 { +return $YES_ + } + 3 { +return $NO_ + } + 4 { +return $ON_ + } + 5 { +return $OFF_ + } + 6 { +return $TRUE_ + } + 7 { +return $FALSE_ + } + 8 { +return $CLEAR_ + } + 9 { +return $CLOSE_ + } + 10 { +return $COORD_ + } + 11 { +return $CROSSHAIR_ + } + 12 { +return $CURRENT_ + } + 13 { +return $FRAME_ + } + 14 { +return $NAME_ + } + 15 { +return $NEW_ + } + 16 { +return $OPEN_ + } + 17 { +return $SAVE_ + } + 18 { +return $SIZE_ + } + 19 { +return $SURVEY_ + } + 20 { +return $UPDATE_ + } + 21 { +return $DEGREES_ + } + 22 { +return $ARCMIN_ + } + 23 { +return $ARCSEC_ + } + 24 { +return $SEXAGESIMAL_ + } + 25 - + 26 { +set yylval $yytext; return $SEXSTR_ + } + 27 { +set yylval $yytext; return $INT_ + } + 28 - + 29 { +set yylval $yytext; return $REAL_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 32 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 33 { +set yylval $yytext; return $STRING_ + } + 34 { +# ignore whitespace + } + 35 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/vlaparser.tab.tcl b/ds9/parsers/vlaparser.tab.tcl new file mode 100644 index 0000000..ffc36e6 --- /dev/null +++ b/ds9/parsers/vlaparser.tab.tcl @@ -0,0 +1,29 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 +set STRIPE82_ 284 +set FIRST_ 285 diff --git a/ds9/parsers/vlaparser.tcl b/ds9/parsers/vlaparser.tcl new file mode 100644 index 0000000..59c2626 --- /dev/null +++ b/ds9/parsers/vlaparser.tcl @@ -0,0 +1,991 @@ +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 vla { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc vla::YYABORT {} { + return -code return 1 +} + +proc vla::YYACCEPT {} { + return -code return 0 +} + +proc vla::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc vla::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc vla::yyerror {s} { + puts stderr $s +} + +proc vla::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 vla::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set vla::table { + 10:280,target 38 + 9:284 shift + 16:283,target 22 + 30:283 reduce + 9:285 shift + 29:283 reduce + 27:0 reduce + 48:0 reduce + 38:279 shift + 3:267,target 19 + 51:283,target 16 + 7:283,target 1 + 38:283 reduce + 0:275,target 9 + 11:282,target 19 + 9:297 goto + 40:283,target 48 + 39:283,target 8 + 6:266 shift + 7:262,target 32 + 38:288 goto + 6:268 shift + 24:0 reduce + 48:0,target 23 + 47:283 reduce + 41:0,target 10 + 45:0 reduce + 33:0,target 31 + 2:282,target 12 + 17:280 shift + 25:0,target 39 + 28:283,target 5 + 34:282,target 12 + 0:273,target 7 + 7:259,target 29 + 7:260,target 30 + 21:0 reduce + 26:283 reduce + 42:0 reduce + 52:283,target 17 + 2:280,target 17 + 0:292,target 14 + 42:287,target 50 + 12:282,target 20 + 41:283,target 10 + 35:283 reduce + 0:271,target 5 + 11:277,target 19 + 6:296 goto + 7:257,target 27 + 3:267 shift + 38:0 reduce + 30:283,target 6 + 29:283,target 3 + 9:285,target 36 + 3:270 shift + 44:283 reduce + 43:289,target 54 + 8:281,target 11 + 14:281 shift + 14:282 shift + 53:0,target 18 + 0:268,target 3 + 45:0,target 36 + 53:283 reduce + 37:0,target 33 + 39:276,target 46 + 30:0,target 6 + 29:0,target 3 + 22:0,target 28 + 53:283,target 18 + 35:0 reduce + 4:263,target 22 + 14:292 goto + 23:283 reduce + 42:283,target 8 + 3:290 goto + 12:277,target 20 + 18:281,target 11 + 32:283 reduce + 11:0 reduce + 31:283,target 4 + 0:264 shift + 32:0 reduce + 0:265 shift + 41:279 shift + 53:0 reduce + 0:268 shift + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 19:283,target 15 + 20:283,target 14 + 0:272 shift + 11:278 reduce + 0:273 shift + 0:274 shift + 11:281 reduce + 0:275 shift + 11:282 reduce + 41:288 goto + 0:264,target 1 + 38:288,target 45 + 54:283,target 30 + 50:283 reduce + 49:283 reduce + 2:292,target 18 + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 0:282 shift + 14:282,target 12 + 50:0 reduce + 49:0 reduce + 0:283 shift + 43:283,target 12 + 34:292,target 43 + 19:283 reduce + 20:283 reduce + 50:0,target 37 + 49:0,target 38 + 0:283,target 13 + 42:0,target 8 + 8:281 shift + 26:0,target 34 + 8:282 shift + 32:283,target 7 + 0:292 goto + 11:0,target 19 + 0:293 goto + 9:297,target 37 + 25:0 reduce + 28:283 reduce + 0:295 goto + 46:0 reduce + 21:283,target 32 + 8:292 goto + 0:281,target 11 + 37:283 reduce + 42:276,target 46 + 0:0 reduce + 55:283,target 13 + 22:0 reduce + 46:283 reduce + 43:0 reduce + 44:283,target 11 + 1:283,target 26 + 7:286,target 33 + 43:278,target 53 + 16:283 reduce + 33:283,target 31 + 55:283 reduce + 3:290,target 21 + 5:283 reduce + 54:0,target 30 + 39:0 reduce + 22:283,target 28 + 25:283 reduce + 46:0,target 9 + 38:0,target 10 + 16:294 goto + 31:0,target 4 + 23:0,target 29 + 43:276,target 51 + 15:0,target 0 + 41:288,target 49 + 34:281 shift + 34:282 shift + 43:276 shift + 15:0 accept + 43:277 shift + 43:278 shift + 38:279,target 44 + 45:283,target 36 + 36:0 reduce + 0:295,target 16 + 43:283 reduce + 34:292 goto + 0:274,target 8 + 11:281,target 19 + 13:283 reduce + 43:289 goto + 43:291 goto + 7:261,target 31 + 12:0 reduce + 52:283 reduce + 2:280 shift + 2:281 shift + 14:292,target 39 + 23:283,target 29 + 33:0 reduce + 2:282 shift + 2:281,target 11 + 54:0 reduce + 0:293,target 15 + 22:283 reduce + 6:296,target 26 + 1:0,target 26 + 34:281,target 11 + 0:272,target 6 + 11:278,target 19 + 2:292 goto + 7:0 reduce + 51:0,target 16 + 31:283 reduce + 7:258,target 28 + 46:283,target 9 + 43:0,target 12 + 39:276 shift + 35:0,target 41 + 30:0 reduce + 29:0 reduce + 27:0,target 2 + 7:257 shift + 19:0,target 15 + 20:0,target 14 + 51:0 reduce + 43:291,target 55 + 7:258 shift + 12:0,target 20 + 7:259 shift + 7:260 shift + 8:282,target 12 + 35:283,target 41 + 7:261 shift + 40:283 shift + 39:283 reduce + 7:262 shift + 12:281,target 20 + 10:280 shift + 0:269,target 4 + 11:276,target 19 + 39:287 goto + 17:280,target 41 + 24:283,target 40 + 26:0 reduce + 9:284,target 35 + 47:0 reduce + 13:283,target 27 + 18:281 shift + 18:282 shift + 12:278,target 20 + 18:282,target 12 + 1:0 reduce + 16:294,target 40 + 41:279,target 44 + 47:283,target 35 + 4:283,target 23 + 7:283 reduce + 23:0 reduce + 18:292 goto + 27:283 reduce + 7:286 goto + 44:0 reduce + 5:0,target 25 + 36:283,target 42 + 55:0,target 13 + 12:276,target 20 + 47:0,target 35 + 36:283 reduce + 39:0,target 8 + 4:263 shift + 25:283,target 39 + 32:0,target 7 + 0:265,target 2 + 6:268,target 25 + 24:0,target 40 + 16:0,target 21 + 19:0 reduce + 20:0 reduce + 41:0 reduce + 45:283 reduce + 5:283,target 25 + 54:283 reduce + 6:266,target 24 + 16:0 reduce + 4:283 shift + 37:283,target 33 + 37:0 reduce + 14:281,target 11 + 24:283 reduce + 0:282,target 12 + 26:283,target 34 + 33:283 reduce + 13:0 reduce + 42:276 shift + 8:292,target 34 + 55:0 reduce + 52:0,target 17 + 12:276 reduce + 44:0,target 11 + 42:283 reduce + 12:277 reduce + 36:0,target 42 + 12:278 reduce + 50:283,target 37 + 49:283,target 38 + 0:280,target 10 + 28:0,target 5 + 12:281 reduce + 21:0,target 32 + 42:287 goto + 12:282 reduce + 13:0,target 27 + 39:287,target 47 + 51:283 reduce + 38:283,target 10 + 31:0 reduce + 1:283 reduce + 52:0 reduce + 3:270,target 20 + 21:283 reduce + 18:292,target 42 + 27:283,target 2 + 43:277,target 52 + 5:0 reduce +} + +array set vla::rules { + 9,l 287 + 11,l 288 + 32,l 295 + 6,l 286 + 28,l 295 + 3,l 286 + 25,l 295 + 0,l 298 + 22,l 294 + 18,l 291 + 40,l 296 + 39,l 296 + 15,l 290 + 36,l 295 + 12,l 289 + 33,l 295 + 7,l 286 + 29,l 295 + 30,l 295 + 4,l 286 + 26,l 295 + 1,l 286 + 23,l 293 + 19,l 292 + 20,l 292 + 41,l 297 + 16,l 291 + 37,l 295 + 13,l 289 + 34,l 295 + 8,l 287 + 10,l 288 + 31,l 295 + 5,l 286 + 27,l 295 + 2,l 286 + 24,l 295 + 21,l 293 + 42,l 297 + 17,l 291 + 38,l 295 + 14,l 290 + 35,l 295 +} + +array set vla::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 4 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 22,dc 0 + 36,dc 3 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 21,dc 1 + 35,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 2 +} + +array set vla::rules { + 41,line 150 + 7,line 91 + 37,line 142 + 4,line 88 + 34,line 138 + 1,line 85 + 31,line 134 + 27,line 129 + 24,line 126 + 21,line 122 + 17,line 115 + 22,e 1 + 14,line 110 + 11,line 103 + 9,line 99 + 40,line 147 + 39,line 146 + 6,line 90 + 36,line 141 + 3,line 87 + 33,line 136 + 29,line 131 + 30,line 133 + 26,line 128 + 23,line 123 + 19,line 118 + 20,line 119 + 16,line 114 + 13,line 107 + 10,line 102 + 42,line 151 + 8,line 98 + 38,line 143 + 5,line 89 + 35,line 139 + 2,line 86 + 32,line 135 + 28,line 130 + 25,line 127 + 22,line 122 + 18,line 116 + 15,line 111 + 12,line 106 +} + +array set vla::lr1_table { + 35 {{41 {0 283} 1}} + 14,trans {{281 39} {282 40} {292 41}} + 36 {{42 {0 283} 1}} + 33,trans {} + 37 {{33 {0 283} 2}} + 52,trans {} + 38 {{36 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} + 40 {{20 {0 276} 1}} + 39 {{19 {0 276} 1}} + 18,trans {{281 39} {282 40} {292 44}} + 41 {{35 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 1,trans {} + 37,trans {} + 42 {{23 0 2}} + 56,trans {} + 43 {{38 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 44 {{37 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 45 {{19 {0 276 277 278} 1}} + 23,trans {} + 5,trans {} + 42,trans {{283 52}} + 46 {{20 {0 276 277 278} 1}} + 47 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 48 {{11 {0 283} 1}} + 50 {{9 {0 283} 1}} + 49 {{36 {0 283} 3}} + 27,trans {} + 9,trans {{284 35} {285 36} {297 37}} + 46,trans {} + 51 {{35 {0 283} 3}} + 52 {{23 0 3}} + 53 {{38 {0 283} 4}} + 13,trans {} + 54 {{37 {0 283} 4}} + 32,trans {} + 51,trans {} + 55 {{16 {0 283} 1}} + 56 {{17 {0 283} 1}} + 57 {{18 {0 283} 1}} + 17,trans {{280 43}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {275 9} {280 10} {281 11} {282 12} {283 13} {292 14} {293 15} {295 16}} + 58 {{30 {0 283} 4}} + 36,trans {} + 55,trans {} + 59 {{13 {0 283} 1}} + 22,trans {} + 4,trans {{263 22} {283 23}} + 41,trans {{276 50} {287 51}} + 59,trans {} + 26,trans {} + 8,trans {{281 11} {282 12} {292 34}} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {{294 42}} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {{267 19} {270 20} {290 21}} + 40,trans {} + 39,trans {} + 58,trans {} + 10 {{36 {0 283} 1}} + 11 {{19 {281 282} 1}} + 25,trans {} + 12 {{20 {281 282} 1}} + 7,trans {{257 27} {258 28} {259 29} {260 30} {261 31} {262 32} {286 33}} + 44,trans {{276 50} {287 54}} + 13 {{27 {0 283} 1}} + 14 {{35 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 11,trans {} + 15 {{0 0 1}} + 30,trans {} + 29,trans {} + 16 {{21 0 1} {23 0 1} {22 283 0}} + 48,trans {} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {38 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{38 {0 283} 2}} + 1 {{26 {0 283} 1}} + 18 {{37 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 15,trans {} + 2 {{37 {0 283} 1} {38 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{15 {0 283} 1}} + 20 {{14 {0 283} 1}} + 34,trans {{281 45} {282 46} {292 47}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{32 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{28 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{29 {0 283} 2}} + 20,trans {} + 19,trans {} + 6 {{34 {0 283} 1} {39 {0 283} 0} {40 {0 283} 0}} + 2,trans {{280 17} {281 11} {282 12} {292 18}} + 24 {{40 {0 283} 1}} + 38,trans {{279 48} {288 49}} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{39 {0 283} 1}} + 57,trans {} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{34 {0 283} 2}} + 9 {{33 {0 283} 1} {41 {0 283} 0} {42 {0 283} 0}} + 27 {{2 {0 283} 1}} + 24,trans {} + 6,trans {{266 24} {268 25} {296 26}} + 28 {{5 {0 283} 1}} + 43,trans {{279 48} {288 53}} + 29 {{3 {0 283} 1}} + 30 {{6 {0 283} 1}} + 31 {{4 {0 283} 1}} + 10,trans {{280 38}} + 32 {{7 {0 283} 1}} + 28,trans {} + 33 {{31 {0 283} 2}} + 47,trans {{276 55} {277 56} {278 57} {289 58} {291 59}} + 34 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} +} + +array set vla::token_id_table { + 286,t 1 + 286 yesno + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 298,title {} + 292,line 117 + 287 deg + 270,t 0 + 269,t 0 + 288 sex + 290 frame + 289 sizeOpt + 276,line 28 + 265,title COORD + 291,t 1 + 291 rformat + 284,title STRIPE82 + 292 numeric + 274,t 0 + 261,line 11 + 293 command + 288,line 101 + 257,t 0 + 294 @PSEUDO1 + 270,title NEW + 269,title NAME + 295,t 1 + 295 vla + 288,title {} + 273,line 24 + 296 update + 278,t 0 + 297 survey + 257,line 7 + 262,t 0 + 298 start' + 285,line 44 + 274,title SIZE + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 297,line 149 + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 297,title {} + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 122 + 283,title string + 292,t 1 + 278,line 30 + error,line 83 + 275,t 0 + 268,title FRAME + 287,title {} + 258,t 0 + 263,line 14 + 291,line 113 + error,title {} + 296,t 1 + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 97 + 258,title NO + 284,t 0 + 277,title ARCMIN + 296,title {} + 272,line 23 + 267,t 0 + 263,title CLEAR + 288,t 1 + 284,line 43 + 282,title float + 272,t 0 + 268,line 19 + 296,line 145 + 267,title CURRENT + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + 297,t 1 + 293,line 121 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 290,line 109 + 289,line 105 + 285,t 0 + 267 CURRENT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + error,t 0 + 271 OPEN_ + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 84 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title FIRST + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 298,line 152 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 298,t 1 + 281 INT_ + 267,line 18 + 295,line 125 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 STRIPE82_ + 280,line 34 + 279,line 32 + 285 FIRST_ + 261,title TRUE +} + +proc vla::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dvla 1 } + 26 { ARDestroy dvla } + 27 { ProcessCmdSet dvla name $1 "IMGSVRApply dvla 1" } + 28 { ProcessCmdSet dvla name {} } + 29 { ProcessCmdSet dvla name $2 "IMGSVRApply dvla 1" } + 30 { ProcessCmdSet4 dvla width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet dvla save $2 } + 32 { ProcessCmdSet dvla mode $2 } + 33 { ProcessCmdSet dvla survey $2 } + 35 { ProcessCmdSet4 dvla x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dvla 1" } + 36 { ProcessCmdSet4 dvla x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dvla 1" } + 37 { ProcessCmdSet4 dvla x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dvla 1" } + 38 { ProcessCmdSet4 dvla x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dvla 1" } + 39 { IMGSVRUpdate dvla; IMGSVRApply dvla 1 } + 40 { IMGSVRCrosshair dvla; IMGSVRApply dvla 1 } + 41 { set _ stripe82 } + 42 { set _ first } + } + 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 vla::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/vlasendlex.tcl b/ds9/parsers/vlasendlex.tcl new file mode 100644 index 0000000..0bd1549 --- /dev/null +++ b/ds9/parsers/vlasendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval vlasend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc vlasend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc vlasend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc vlasend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc vlasend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc vlasend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc vlasend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc vlasend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc vlasend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc vlasend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/vlasendparser.tab.tcl b/ds9/parsers/vlasendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/vlasendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/vlasendparser.tcl b/ds9/parsers/vlasendparser.tcl new file mode 100644 index 0000000..bea7c6a --- /dev/null +++ b/ds9/parsers/vlasendparser.tcl @@ -0,0 +1,324 @@ +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 vlasend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc vlasend::YYABORT {} { + return -code return 1 +} + +proc vlasend::YYACCEPT {} { + return -code return 0 +} + +proc vlasend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc vlasend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc vlasend::yyerror {s} { + puts stderr $s +} + +proc vlasend::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 vlasend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set vlasend::table { + 6:0 reduce + 3:0,target 2 + 0:257 shift + 7:0 accept + 0:258 shift + 5:0,target 6 + 0:259 shift + 0:260 shift + 0:261 shift + 7:0,target 0 + 0:258,target 2 + 0:262 shift + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 7 + 4:0,target 3 + 0:0 reduce + 6:0,target 5 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 7 + 5:0 reduce + 0:262,target 6 +} + +array set vlasend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 + 7,l 263 +} + +array set vlasend::rules { + 5,dc 1 + 7,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set vlasend::rules { + 5,line 24 + 7,line 26 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set vlasend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0} {7 0 0}} + 1 {{7 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {263 7}} + 5 {{6 0 1}} + 1,trans {} + 6 {{5 0 1}} + 2,trans {} + 7 {{0 0 1}} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} + 7,trans {} +} + +array set vlasend::token_id_table { + 264,line 27 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 vlasend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc vlasend::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 { ProcessSendCmdGet dvla name } + 2 { ProcessSendCmdGet dvla name } + 3 { ProcessSendCmdYesNo dvla save } + 4 { ProcessSendCmdGet dvla mode } + 5 { ProcessSendCmdGet dvla survey } + 6 { ProcessSendCmdGet3 dvla width height rformat } + 7 { ProcessSendCmdGet3 dvla x y skyformat } + } + 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 vlasend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/vlsslex.tcl b/ds9/parsers/vlsslex.tcl new file mode 100644 index 0000000..fe1899b --- /dev/null +++ b/ds9/parsers/vlsslex.tcl @@ -0,0 +1,588 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval vlss { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc vlss::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc vlss::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc vlss::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc vlss::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc vlss::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc vlss::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc vlss::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc vlss::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc vlss::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: crosshair + if {[regexp -start $index_ -indices -line -nocase -- {\A(crosshair)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: current + if {[regexp -start $index_ -indices -line -nocase -- {\A(current)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: update + if {[regexp -start $index_ -indices -line -nocase -- {\A(update)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: arcmin + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcmin)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: arcsec + if {[regexp -start $index_ -indices -line -nocase -- {\A(arcsec)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: [+-]?{D}+:{D}+:{D}+\.? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])+\.?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: [+-]?{D}+:{D}+:{D}*\.{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+:([0-9])+:([0-9])*\.([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $YES_ + } + 1 { +return $NO_ + } + 2 { +return $ON_ + } + 3 { +return $OFF_ + } + 4 { +return $TRUE_ + } + 5 { +return $FALSE_ + } + 6 { +return $CLEAR_ + } + 7 { +return $CLOSE_ + } + 8 { +return $COORD_ + } + 9 { +return $CROSSHAIR_ + } + 10 { +return $CURRENT_ + } + 11 { +return $FRAME_ + } + 12 { +return $NAME_ + } + 13 { +return $NEW_ + } + 14 { +return $OPEN_ + } + 15 { +return $SAVE_ + } + 16 { +return $SIZE_ + } + 17 { +return $SURVEY_ + } + 18 { +return $UPDATE_ + } + 19 { +return $DEGREES_ + } + 20 { +return $ARCMIN_ + } + 21 { +return $ARCSEC_ + } + 22 { +return $SEXAGESIMAL_ + } + 23 - + 24 { +set yylval $yytext; return $SEXSTR_ + } + 25 { +set yylval $yytext; return $INT_ + } + 26 - + 27 { +set yylval $yytext; return $REAL_ + } + 28 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 29 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 30 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 31 { +set yylval $yytext; return $STRING_ + } + 32 { +# ignore whitespace + } + 33 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/vlssparser.tab.tcl b/ds9/parsers/vlssparser.tab.tcl new file mode 100644 index 0000000..0eda1ee --- /dev/null +++ b/ds9/parsers/vlssparser.tab.tcl @@ -0,0 +1,27 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set CLEAR_ 263 +set CLOSE_ 264 +set COORD_ 265 +set CROSSHAIR_ 266 +set CURRENT_ 267 +set FRAME_ 268 +set NAME_ 269 +set NEW_ 270 +set OPEN_ 271 +set UPDATE_ 272 +set SAVE_ 273 +set SIZE_ 274 +set SURVEY_ 275 +set DEGREES_ 276 +set ARCMIN_ 277 +set ARCSEC_ 278 +set SEXAGESIMAL_ 279 +set SEXSTR_ 280 +set INT_ 281 +set REAL_ 282 +set STRING_ 283 diff --git a/ds9/parsers/vlssparser.tcl b/ds9/parsers/vlssparser.tcl new file mode 100644 index 0000000..76aeccb --- /dev/null +++ b/ds9/parsers/vlssparser.tcl @@ -0,0 +1,939 @@ +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 vlss { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc vlss::YYABORT {} { + return -code return 1 +} + +proc vlss::YYACCEPT {} { + return -code return 0 +} + +proc vlss::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc vlss::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc vlss::yyerror {s} { + puts stderr $s +} + +proc vlss::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 vlss::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set vlss::table { + 3:288,target 20 + 29:283 reduce + 30:283 reduce + 27:0 reduce + 38:276 shift + 48:0 reduce + 3:267,target 18 + 51:283,target 13 + 7:283,target 1 + 38:283 reduce + 11:282,target 20 + 38:285 goto + 40:283,target 11 + 39:283,target 12 + 6:266 shift + 7:262,target 31 + 10:277,target 19 + 6:268 shift + 24:0 reduce + 48:0,target 17 + 47:283 reduce + 41:0,target 35 + 45:0 reduce + 2:282,target 11 + 25:0,target 33 + 28:283,target 3 + 17:281 shift + 10:0,target 19 + 17:282 shift + 0:273,target 7 + 7:259,target 28 + 7:260,target 29 + 17:290 goto + 21:0 reduce + 38:276,target 42 + 26:283 reduce + 42:0 reduce + 35:276 shift + 2:280,target 16 + 34:279,target 40 + 41:283,target 35 + 35:283 reduce + 0:271,target 5 + 6:294 goto + 11:277,target 20 + 17:281,target 10 + 35:285 goto + 39:278,target 49 + 7:257,target 26 + 3:267 shift + 38:0 reduce + 30:283,target 4 + 29:283,target 6 + 3:270 shift + 0:290,target 13 + 8:281,target 10 + 18:283,target 15 + 0:268,target 3 + 45:0,target 37 + 37:0,target 10 + 14:0 accept + 39:276,target 47 + 29:0,target 6 + 30:0,target 4 + 22:0,target 29 + 35:0 reduce + 14:0,target 0 + 4:263,target 21 + 23:283 reduce + 13:282,target 11 + 3:288 goto + 42:283,target 9 + 32:283 reduce + 11:0 reduce + 31:283,target 7 + 0:264 shift + 37:286,target 45 + 32:0 reduce + 0:265 shift + 0:268 shift + 0:269 shift + 11:276 reduce + 41:283 reduce + 0:271 shift + 11:277 reduce + 19:283,target 14 + 20:283,target 32 + 0:272 shift + 11:278 reduce + 33:290,target 39 + 0:273 shift + 0:274 shift + 11:281 reduce + 11:282 reduce + 0:264,target 1 + 50:283 reduce + 49:283 reduce + 0:280 shift + 7:0,target 1 + 28:0 reduce + 0:281 shift + 0:0,target 24 + 0:282 shift + 50:0 reduce + 49:0 reduce + 0:283 shift + 43:283,target 34 + 19:283 reduce + 20:283 reduce + 50:0,target 30 + 49:0,target 18 + 0:283,target 12 + 42:0,target 9 + 34:0,target 10 + 0:290 goto + 8:281 shift + 26:0,target 2 + 0:291 goto + 8:282 shift + 18:0,target 15 + 32:283,target 31 + 11:0,target 20 + 0:293 goto + 25:0 reduce + 28:283 reduce + 2:290,target 17 + 46:0 reduce + 8:290 goto + 21:283,target 28 + 37:279 shift + 0:281,target 10 + 37:283 reduce + 0:0 reduce + 37:286 goto + 22:0 reduce + 46:283 reduce + 43:0 reduce + 37:279,target 40 + 1:283,target 26 + 16:280 shift + 10:281,target 19 + 18:0 reduce + 5:283 reduce + 40:0 reduce + 39:0 reduce + 22:283,target 29 + 25:283 reduce + 46:0,target 36 + 38:0,target 8 + 31:0,target 7 + 7:284,target 32 + 23:0,target 39 + 34:279 shift + 15:0,target 21 + 34:283 reduce + 33:281,target 10 + 10:278,target 19 + 15:0 reduce + 34:286 goto + 45:283,target 37 + 13:290,target 35 + 43:283 reduce + 34:283,target 10 + 13:281 shift + 0:274,target 8 + 11:281,target 20 + 13:282 shift + 7:261,target 30 + 10:276,target 19 + 12:0 reduce + 2:280 shift + 16:280,target 37 + 2:281 shift + 23:283,target 39 + 2:282 shift + 13:290 goto + 2:281,target 10 + 0:293,target 15 + 22:283 reduce + 35:285,target 43 + 12:283,target 27 + 1:0,target 26 + 2:290 goto + 0:272,target 6 + 11:278,target 20 + 7:0 reduce + 17:282,target 11 + 51:0,target 13 + 31:283 reduce + 7:258,target 27 + 46:283,target 36 + 43:0,target 34 + 39:276 shift + 35:0,target 8 + 29:0 reduce + 30:0 reduce + 39:277 shift + 27:0,target 5 + 39:278 shift + 7:257 shift + 19:0,target 14 + 20:0,target 32 + 51:0 reduce + 7:258 shift + 12:0,target 27 + 0:291,target 14 + 7:259 shift + 7:260 shift + 8:282,target 11 + 35:283,target 8 + 6:294,target 25 + 7:261 shift + 10:276 reduce + 40:283 reduce + 39:283 reduce + 7:262 shift + 10:277 reduce + 10:278 reduce + 0:269,target 4 + 10:281 reduce + 11:276,target 20 + 39:287 goto + 10:282 reduce + 15:292,target 36 + 24:283,target 38 + 39:277,target 48 + 39:289 goto + 26:0 reduce + 48:283 reduce + 47:0 reduce + 18:283 reduce + 1:0 reduce + 47:283,target 16 + 4:283,target 22 + 7:283 reduce + 7:284 goto + 23:0 reduce + 27:283 reduce + 44:0 reduce + 5:0,target 25 + 36:283,target 44 + 13:281,target 10 + 47:0,target 16 + 36:283 shift + 40:0,target 11 + 39:0,target 12 + 4:263 shift + 25:283,target 33 + 32:0,target 31 + 0:265,target 2 + 6:268,target 24 + 24:0,target 38 + 19:0 reduce + 20:0 reduce + 41:0 reduce + 45:283 reduce + 9:280,target 34 + 35:276,target 42 + 15:283 reduce + 48:283,target 17 + 5:283,target 25 + 6:266,target 23 + 4:283 shift + 37:283,target 10 + 37:0 reduce + 15:292 goto + 24:283 reduce + 0:282,target 11 + 26:283,target 2 + 33:281 shift + 39:289,target 51 + 33:282 shift + 38:285,target 46 + 15:283,target 22 + 34:0 reduce + 33:290 goto + 44:0,target 23 + 42:283 reduce + 50:283,target 30 + 49:283,target 18 + 0:280,target 9 + 28:0,target 3 + 17:290,target 38 + 21:0,target 28 + 39:287,target 50 + 10:282,target 19 + 12:283 reduce + 10:0 reduce + 51:283 reduce + 38:283,target 8 + 31:0 reduce + 1:283 reduce + 8:290,target 33 + 3:270,target 19 + 21:283 reduce + 27:283,target 5 + 34:286,target 41 + 9:280 shift + 33:282,target 11 + 5:0 reduce +} + +array set vlss::rules { + 9,l 285 + 11,l 286 + 32,l 293 + 6,l 284 + 28,l 293 + 3,l 284 + 25,l 293 + 0,l 295 + 22,l 292 + 18,l 289 + 39,l 294 + 15,l 288 + 36,l 293 + 12,l 287 + 33,l 293 + 7,l 284 + 29,l 293 + 30,l 293 + 4,l 284 + 26,l 293 + 1,l 284 + 23,l 291 + 19,l 290 + 20,l 290 + 16,l 289 + 37,l 293 + 13,l 287 + 34,l 293 + 8,l 285 + 10,l 286 + 31,l 293 + 5,l 284 + 27,l 293 + 2,l 284 + 24,l 293 + 21,l 291 + 17,l 289 + 38,l 294 + 14,l 288 + 35,l 293 +} + +array set vlss::rules { + 12,dc 0 + 26,dc 1 + 3,dc 1 + 18,dc 1 + 33,dc 2 + 9,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 39,dc 1 + 17,dc 1 + 32,dc 2 + 8,dc 0 + 10,dc 0 + 24,dc 0 + 1,dc 0 + 38,dc 1 + 16,dc 1 + 31,dc 2 + 7,dc 1 + 23,dc 3 + 0,dc 1 + 37,dc 4 + 15,dc 1 + 29,dc 2 + 30,dc 4 + 6,dc 1 + 22,dc 0 + 36,dc 4 + 14,dc 1 + 28,dc 2 + 5,dc 1 + 21,dc 1 + 35,dc 3 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 3 +} + +array set vlss::rules { + 7,line 88 + 37,line 139 + 4,line 85 + 34,line 135 + 1,line 82 + 31,line 131 + 27,line 126 + 24,line 123 + 21,line 119 + 17,line 112 + 22,e 1 + 14,line 107 + 11,line 100 + 9,line 96 + 39,line 143 + 6,line 87 + 36,line 138 + 3,line 84 + 33,line 134 + 29,line 128 + 30,line 130 + 26,line 125 + 23,line 120 + 19,line 115 + 20,line 116 + 16,line 111 + 13,line 104 + 10,line 99 + 8,line 95 + 38,line 142 + 5,line 86 + 35,line 137 + 2,line 83 + 32,line 132 + 28,line 127 + 25,line 124 + 22,line 119 + 18,line 113 + 15,line 108 + 12,line 103 +} + +array set vlss::lr1_table { + 35 {{19 {0 276} 1}} + 14,trans {} + 36 {{20 {0 276} 1}} + 33,trans {{281 41} {282 42} {290 43}} + 37 {{34 {0 283} 2} {8 {0 283} 0} {9 {0 283} 0}} + 52,trans {} + 38 {{23 0 2}} + 40 {{36 {0 283} 3} {8 {0 283} 0} {9 {0 283} 0}} + 39 {{37 {0 283} 3} {10 {0 283} 0} {11 {0 283} 0}} + 41 {{19 {0 276 277 278} 1}} + 18,trans {} + 1,trans {} + 37,trans {{276 46} {285 47}} + 42 {{20 {0 276 277 278} 1}} + 43 {{30 {0 283} 3} {12 {0 283} 0} {13 {0 283} 0} {16 {0 283} 0} {17 {0 283} 0} {18 {0 283} 0}} + 44 {{11 {0 283} 1}} + 45 {{35 {0 283} 3}} + 23,trans {} + 5,trans {} + 42,trans {} + 46 {{9 {0 283} 1}} + 47 {{34 {0 283} 3}} + 48 {{23 0 3}} + 50 {{36 {0 283} 4}} + 49 {{37 {0 283} 4}} + 27,trans {} + 9,trans {{280 34}} + 46,trans {} + 51 {{16 {0 283} 1}} + 52 {{17 {0 283} 1}} + 53 {{18 {0 283} 1}} + 13,trans {{281 35} {282 36} {290 37}} + 54 {{30 {0 283} 4}} + 32,trans {} + 51,trans {} + 55 {{13 {0 283} 1}} + 17,trans {{281 35} {282 36} {290 40}} + 0,trans {{264 1} {265 2} {268 3} {269 4} {271 5} {272 6} {273 7} {274 8} {280 9} {281 10} {282 11} {283 12} {290 13} {291 14} {293 15}} + 36,trans {} + 55,trans {} + 22,trans {} + 4,trans {{263 21} {283 22}} + 41,trans {} + 26,trans {} + 8,trans {{281 10} {282 11} {290 33}} + 45,trans {} + 12,trans {} + 31,trans {} + 50,trans {} + 49,trans {} + 16,trans {{280 39}} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {{267 18} {270 19} {288 20}} + 40,trans {{276 46} {285 50}} + 39,trans {{279 44} {286 49}} + 10 {{19 {281 282} 1}} + 11 {{20 {281 282} 1}} + 25,trans {} + 12 {{27 {0 283} 1}} + 7,trans {{257 26} {258 27} {259 28} {260 29} {261 30} {262 31} {284 32}} + 44,trans {} + 13 {{34 {0 283} 1} {19 {0 276} 0} {20 {0 276} 0}} + 14 {{0 0 1}} + 15 {{21 0 1} {23 0 1} {22 283 0}} + 11,trans {} + 30,trans {} + 29,trans {} + 16 {{37 {0 283} 2}} + 48,trans {} + 0 {{0 0 0} {21 0 0} {23 0 0} {24 {0 283} 0} {25 {0 283} 0} {26 {0 283} 0} {27 {0 283} 0} {28 {0 283} 0} {29 {0 283} 0} {30 {0 283} 0} {31 {0 283} 0} {32 {0 283} 0} {33 {0 283} 0} {34 {0 283} 0} {35 {0 283} 0} {36 {0 283} 0} {37 {0 283} 0} {19 {281 282} 0} {20 {281 282} 0}} + 17 {{36 {0 283} 2} {19 {0 276} 0} {20 {0 276} 0}} + 1 {{26 {0 283} 1}} + 18 {{15 {0 283} 1}} + 15,trans {{292 38}} + 2 {{36 {0 283} 1} {37 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 19 {{14 {0 283} 1}} + 20 {{32 {0 283} 2}} + 34,trans {{279 44} {286 45}} + 3 {{32 {0 283} 1} {14 {0 283} 0} {15 {0 283} 0}} + 21 {{28 {0 283} 2}} + 53,trans {} + 4 {{28 {0 283} 1} {29 {0 283} 1}} + 22 {{29 {0 283} 2}} + 5 {{25 {0 283} 1}} + 23 {{39 {0 283} 1}} + 20,trans {} + 19,trans {} + 6 {{33 {0 283} 1} {38 {0 283} 0} {39 {0 283} 0}} + 2,trans {{280 16} {281 10} {282 11} {290 17}} + 24 {{38 {0 283} 1}} + 38,trans {{283 48}} + 7 {{31 {0 283} 1} {1 {0 283} 0} {2 {0 283} 0} {3 {0 283} 0} {4 {0 283} 0} {5 {0 283} 0} {6 {0 283} 0} {7 {0 283} 0}} + 25 {{33 {0 283} 2}} + 8 {{30 {0 283} 1} {19 {281 282} 0} {20 {281 282} 0}} + 26 {{2 {0 283} 1}} + 9 {{35 {0 283} 1}} + 27 {{5 {0 283} 1}} + 24,trans {} + 6,trans {{266 23} {268 24} {294 25}} + 28 {{3 {0 283} 1}} + 43,trans {{276 51} {277 52} {278 53} {287 54} {289 55}} + 29 {{6 {0 283} 1}} + 30 {{4 {0 283} 1}} + 31 {{7 {0 283} 1}} + 32 {{31 {0 283} 2}} + 10,trans {} + 28,trans {} + 33 {{30 {0 283} 2} {19 {0 276 277 278} 0} {20 {0 276 277 278} 0}} + 47,trans {} + 34 {{35 {0 283} 2} {10 {0 283} 0} {11 {0 283} 0}} +} + +array set vlss::token_id_table { + 286,t 1 + 286 sex + 280,title SEXSTR + 279,title SEXAGESIMAL + 264,line 15 + 292,line 119 + 287 sizeOpt + 270,t 0 + 269,t 0 + 288 frame + 290 numeric + 289 rformat + 276,line 28 + 265,title COORD + 291,t 1 + 291 command + 284,title {} + 292 @PSEUDO1 + 274,t 0 + 261,line 11 + 293 vlss + 288,line 106 + 257,t 0 + 294 update + 270,title NEW + 269,title NAME + 295,t 1 + 295 start' + 288,title {} + 273,line 24 + 278,t 0 + 257,line 7 + 262,t 0 + 285,line 94 + 274,title SIZE + 293,title {} + 283,t 0 + 270,line 21 + 269,line 20 + 259,title ON + 260,title OFF + 266,t 0 + 278,title ARCSEC + 282,line 37 + 287,t 1 + error error + 271,t 0 + 264,title CLOSE + 266,line 17 + 294,line 141 + 283,title string + 292,t 1 + 278,line 30 + error,line 80 + 275,t 0 + 268,title FRAME + 287,title {} + 258,t 0 + 263,line 14 + 291,line 118 + error,title {} + 280,t 0 + 279,t 0 + 275,line 26 + 273,title SAVE + 292,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 287,line 102 + 258,title NO + 284,t 1 + 277,title ARCMIN + 272,line 23 + 267,t 0 + 263,title CLEAR + 288,t 1 + 284,line 81 + 282,title float + 272,t 0 + 268,line 19 + 267,title CURRENT + 293,t 1 + 286,title {} + 257 YES_ + 281,line 36 + 276,t 0 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UPDATE + 261 TRUE_ + 265,line 16 + 293,line 122 + 291,title {} + 262 FALSE_ + 281,t 0 + 263 CLEAR_ + 277,line 29 + 257,title YES + 264 CLOSE_ + 264,t 0 + 276,title DEGREES + 265 COORD_ + 295,title {} + 262,line 12 + 266 CROSSHAIR_ + 290,line 114 + 289,line 110 + 285,t 1 + 267 CURRENT_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 FRAME_ + 268,t 0 + 281,title integer + 274,line 25 + 270 NEW_ + 269 NAME_ + error,t 0 + 271 OPEN_ + 290,t 1 + 289,t 1 + 272 UPDATE_ + 258,line 8 + 286,line 98 + 273,t 0 + 273 SAVE_ + 266,title CROSSHAIR + 285,title {} + 274 SIZE_ + 275 SURVEY_ + 271,line 22 + 294,t 1 + 276 DEGREES_ + 277,t 0 + 277 ARCMIN_ + 271,title OPEN + 290,title {} + 289,title {} + 283,line 39 + 278 ARCSEC_ + 261,t 0 + 280 SEXSTR_ + 279 SEXAGESIMAL_ + 281 INT_ + 267,line 18 + 295,line 144 + 282,t 0 + 282 REAL_ + 275,title SURVEY + 294,title {} + 283 STRING_ + 265,t 0 + 284 yesno + 280,line 34 + 279,line 32 + 285 deg + 261,title TRUE +} + +proc vlss::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ degrees } + 9 { set _ degrees } + 10 { set _ sexagesimal } + 11 { set _ sexagesimal } + 12 { set _ degrees } + 13 { set _ $1 } + 14 { set _ new } + 15 { set _ current } + 16 { set _ degrees } + 17 { set _ arcmin } + 18 { set _ arcsec } + 19 { set _ $1 } + 20 { set _ $1 } + 22 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 24 { IMGSVRApply dvlss 1 } + 26 { ARDestroy dvlss } + 27 { ProcessCmdSet dvlss name $1 "IMGSVRApply dvlss 1" } + 28 { ProcessCmdSet dvlss name {} } + 29 { ProcessCmdSet dvlss name $2 "IMGSVRApply dvlss 1" } + 30 { ProcessCmdSet4 dvlss width $2 height $3 rformat $4 rformat,msg $4 } + 31 { ProcessCmdSet dvlss save $2 } + 32 { ProcessCmdSet dvlss mode $2 } + 34 { ProcessCmdSet4 dvlss x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dvlss 1" } + 35 { ProcessCmdSet4 dvlss x $1 y $2 skyformat $3 skyformat,msg $3 "IMGSVRApply dvlss 1" } + 36 { ProcessCmdSet4 dvlss x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dvlss 1" } + 37 { ProcessCmdSet4 dvlss x $2 y $3 skyformat $4 skyformat,msg $4 "IMGSVRApply dvlss 1" } + 38 { IMGSVRUpdate dvlss; IMGSVRApply dvlss 1 } + 39 { IMGSVRCrosshair dvlss; IMGSVRApply dvlss 1 } + } + 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 vlss::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/vlsssendlex.tcl b/ds9/parsers/vlsssendlex.tcl new file mode 100644 index 0000000..b2132fd --- /dev/null +++ b/ds9/parsers/vlsssendlex.tcl @@ -0,0 +1,311 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval vlsssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc vlsssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc vlsssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc vlsssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc vlsssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc vlsssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc vlsssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc vlsssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc vlsssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc vlsssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: coord + if {[regexp -start $index_ -indices -line -nocase -- {\A(coord)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: frame + if {[regexp -start $index_ -indices -line -nocase -- {\A(frame)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: name + if {[regexp -start $index_ -indices -line -nocase -- {\A(name)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: save + if {[regexp -start $index_ -indices -line -nocase -- {\A(save)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: size + if {[regexp -start $index_ -indices -line -nocase -- {\A(size)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: survey + if {[regexp -start $index_ -indices -line -nocase -- {\A(survey)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $COORD_ + } + 1 { +return $FRAME_ + } + 2 { +return $NAME_ + } + 3 { +return $SAVE_ + } + 4 { +return $SIZE_ + } + 5 { +return $SURVEY_ + } + 6 { +# ignore whitespace + } + 7 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/vlsssendparser.tab.tcl b/ds9/parsers/vlsssendparser.tab.tcl new file mode 100644 index 0000000..de626e1 --- /dev/null +++ b/ds9/parsers/vlsssendparser.tab.tcl @@ -0,0 +1,6 @@ +set COORD_ 257 +set FRAME_ 258 +set NAME_ 259 +set SAVE_ 260 +set SIZE_ 261 +set SURVEY_ 262 diff --git a/ds9/parsers/vlsssendparser.tcl b/ds9/parsers/vlsssendparser.tcl new file mode 100644 index 0000000..6178d3c --- /dev/null +++ b/ds9/parsers/vlsssendparser.tcl @@ -0,0 +1,314 @@ +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 vlsssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc vlsssend::YYABORT {} { + return -code return 1 +} + +proc vlsssend::YYACCEPT {} { + return -code return 0 +} + +proc vlsssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc vlsssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc vlsssend::yyerror {s} { + puts stderr $s +} + +proc vlsssend::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 vlsssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set vlsssend::table { + 6:0 accept + 3:0,target 2 + 0:257 shift + 0:258 shift + 5:0,target 5 + 0:259 shift + 0:260 shift + 0:261 shift + 0:258,target 2 + 0:263 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 0:263,target 6 + 4:0,target 3 + 0:0 reduce + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 6 + 5:0 reduce +} + +array set vlsssend::rules { + 0,l 264 + 1,l 263 + 2,l 263 + 3,l 263 + 4,l 263 + 5,l 263 + 6,l 263 +} + +array set vlsssend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set vlsssend::rules { + 5,line 24 + 2,line 21 + 4,line 23 + 6,line 25 + 1,line 20 + 3,line 22 +} + +array set vlsssend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0}} + 1 {{6 0 1}} + 2 {{4 0 1}} + 3 {{2 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {263 6}} + 5 {{5 0 1}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} +} + +array set vlsssend::token_id_table { + 264,line 26 + 0,t 0 + 0 {$} + 262,title SURVEY + 263,title {} + 264,title {} + error,t 0 + error error + 258,line 8 + 261,line 11 + error,line 18 + 257 COORD_ + 257,t 0 + 263,line 19 + 258 FRAME_ + 258,t 0 + error,title {} + 260,t 0 + 260 SAVE_ + 259 NAME_ + 259,t 0 + 261,t 0 + 261 SIZE_ + 262,t 0 + 262 SURVEY_ + 257,line 7 + 263,t 1 + 263 vlsssend + 264,t 1 + 264 start' + 260,line 10 + 257,title COORD + 259,line 9 + 258,title FRAME + 262,line 12 + 260,title SAVE + 259,title NAME + 261,title SIZE +} + +proc vlsssend::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 { ProcessSendCmdGet dvlss name } + 2 { ProcessSendCmdGet dvlss name } + 3 { ProcessSendCmdYesNo dvlss save } + 4 { ProcessSendCmdGet dvlss mode } + 5 { ProcessSendCmdGet3 dvlss width height rformat } + 6 { ProcessSendCmdGet3 dvlss x y skyformat } + } + 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 vlsssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/volex.tcl b/ds9/parsers/volex.tcl new file mode 100644 index 0000000..0dab613 --- /dev/null +++ b/ds9/parsers/volex.tcl @@ -0,0 +1,473 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval vo { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc vo::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc vo::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc vo::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc vo::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc vo::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc vo::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc vo::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc vo::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc vo::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set CLOSE_ 265 +set CONNECT_ 266 +set DELAY_ 267 +set DISCONNECT_ 268 +set INTERNAL_ 269 +set METHOD_ 270 +set MIME_ 271 +set OPEN_ 272 +set SERVER_ 273 +set XPA_ 274 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: connect + if {[regexp -start $index_ -indices -line -nocase -- {\A(connect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: delay + if {[regexp -start $index_ -indices -line -nocase -- {\A(delay)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: disconnect + if {[regexp -start $index_ -indices -line -nocase -- {\A(disconnect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: internal + if {[regexp -start $index_ -indices -line -nocase -- {\A(internal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: method + if {[regexp -start $index_ -indices -line -nocase -- {\A(method)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: mime + if {[regexp -start $index_ -indices -line -nocase -- {\A(mime)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: server + if {[regexp -start $index_ -indices -line -nocase -- {\A(server)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: xpa + if {[regexp -start $index_ -indices -line -nocase -- {\A(xpa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $CONNECT_ + } + 2 { +return $DELAY_ + } + 3 { +return $DISCONNECT_ + } + 4 { +return $INTERNAL_ + } + 5 { +return $METHOD_ + } + 6 { +return $MIME_ + } + 7 { +return $OPEN_ + } + 8 { +return $SERVER_ + } + 9 { +return $XPA_ + } + 10 { +return $YES_ + } + 11 { +return $NO_ + } + 12 { +return $ON_ + } + 13 { +return $OFF_ + } + 14 { +return $TRUE_ + } + 15 { +return $FALSE_ + } + 16 { +set yylval $yytext; return $INT_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 20 { +set yylval $yytext; return $STRING_ + } + 21 { +# ignore whitespace + } + 22 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/voparser.tab.tcl b/ds9/parsers/voparser.tab.tcl new file mode 100644 index 0000000..87f2509 --- /dev/null +++ b/ds9/parsers/voparser.tab.tcl @@ -0,0 +1,18 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set STRING_ 264 +set CLOSE_ 265 +set CONNECT_ 266 +set DELAY_ 267 +set DISCONNECT_ 268 +set INTERNAL_ 269 +set METHOD_ 270 +set MIME_ 271 +set OPEN_ 272 +set SERVER_ 273 +set XPA_ 274 diff --git a/ds9/parsers/voparser.tcl b/ds9/parsers/voparser.tcl new file mode 100644 index 0000000..c12a764 --- /dev/null +++ b/ds9/parsers/voparser.tcl @@ -0,0 +1,587 @@ +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 vo { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc vo::YYABORT {} { + return -code return 1 +} + +proc vo::YYACCEPT {} { + return -code return 0 +} + +proc vo::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc vo::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc vo::yyerror {s} { + puts stderr $s +} + +proc vo::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 vo::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set vo::table { + 25:264,target 14 + 11:264 reduce + 7:274,target 23 + 23:0,target 20 + 13:264 reduce + 27:0 reduce + 20:264,target 7 + 19:264,target 4 + 15:0,target 2 + 6:260,target 18 + 0:266,target 3 + 2:264,target 12 + 6:259,target 17 + 15:264 reduce + 11:0 reduce + 0:276,target 10 + 17:264 reduce + 14:264,target 18 + 0:264 shift + 6:257 shift + 6:258 shift + 0:265 shift + 20:264 reduce + 19:264 reduce + 15:0 reduce + 6:260 shift + 0:266 shift + 2:264 reduce + 6:259 shift + 0:267 shift + 4:263 shift + 6:261 shift + 22:264 reduce + 6:262 shift + 6:258,target 16 + 0:265,target 2 + 0:268 shift + 24:0,target 13 + 0:270 shift + 0:269 shift + 6:0,target 1 + 24:264 reduce + 20:0 reduce + 19:0 reduce + 16:0,target 5 + 11:277 goto + 2:0 reduce + 6:264 reduce + 0:272 shift + 26:264 shift + 23:264,target 20 + 8:264 reduce + 0:273 shift + 5:264,target 14 + 24:0 reduce + 6:0 reduce + 17:264,target 3 + 0:276 goto + 0:264,target 1 + 6:257,target 15 + 0:278 goto + 25:0,target 14 + 12:264,target 17 + 17:0,target 3 + 12:0 reduce + 10:0,target 0 + 7:271,target 22 + 6:275 goto + 26:264,target 27 + 16:0 reduce + 8:264,target 11 + 0:273,target 9 + 21:264,target 15 + 3:264,target 12 + 21:0 reduce + 8:0,target 11 + 18:0,target 6 + 7:279,target 24 + 1:0,target 19 + 15:264,target 2 + 11:0,target 8 + 0:272,target 8 + 25:0 reduce + 12:264 reduce + 6:275,target 21 + 14:264 reduce + 16:264 reduce + 27:0,target 10 + 13:0 reduce + 24:264,target 13 + 20:0,target 7 + 19:0,target 4 + 18:264 reduce + 11:277,target 26 + 1:264 reduce + 2:0,target 12 + 6:264,target 1 + 12:0,target 17 + 21:264 reduce + 3:264 shift + 18:264,target 6 + 17:0 reduce + 1:264,target 19 + 23:264 reduce + 5:264 shift + 25:264 reduce + 13:264,target 16 + 22:0 reduce + 0:270,target 7 + 0:269,target 6 + 9:264 shift + 21:0,target 15 + 13:0,target 16 + 9:264,target 25 + 8:0 reduce + 10:0 accept + 7:271 shift + 22:264,target 21 + 6:262,target 20 + 0:268,target 5 + 7:274 shift + 0:278,target 11 + 14:0 reduce + 16:264,target 5 + 22:0,target 21 + 14:0,target 18 + 18:0 reduce + 11:264,target 9 + 7:279 goto + 1:0 reduce + 6:261,target 19 + 0:267,target 4 + 4:263,target 13 + 23:0 reduce +} + +array set vo::rules { + 9,l 277 + 11,l 278 + 15,l 278 + 20,l 279 + 19,l 278 + 2,l 275 + 6,l 275 + 12,l 278 + 16,l 278 + 21,l 279 + 3,l 275 + 7,l 275 + 13,l 278 + 0,l 280 + 17,l 278 + 4,l 275 + 8,l 276 + 10,l 276 + 14,l 278 + 18,l 278 + 1,l 275 + 5,l 275 +} + +array set vo::rules { + 5,dc 1 + 0,dc 1 + 17,dc 2 + 12,dc 1 + 8,dc 1 + 21,dc 1 + 3,dc 1 + 15,dc 2 + 10,dc 3 + 6,dc 1 + 18,dc 2 + 1,dc 0 + 13,dc 2 + 9,dc 0 + 4,dc 1 + 16,dc 2 + 11,dc 1 + 7,dc 1 + 20,dc 1 + 19,dc 1 + 2,dc 1 + 14,dc 2 +} + +array set vo::rules { + 13,line 57 + 7,line 48 + 10,line 52 + 4,line 45 + 18,line 62 + 1,line 42 + 15,line 59 + 9,line 51 + 12,line 56 + 6,line 47 + 21,line 67 + 3,line 44 + 17,line 61 + 14,line 58 + 8,line 51 + 11,line 55 + 5,line 46 + 20,line 66 + 19,line 63 + 2,line 43 + 9,e 1 + 16,line 60 +} + +array set vo::lr1_table { + 14,trans {} + 1,trans {} + 18,trans {} + 23,trans {} + 5,trans {{264 14}} + 27,trans {} + 9,trans {{264 25}} + 13,trans {} + 0,trans {{264 1} {265 2} {266 3} {267 4} {268 5} {269 6} {270 7} {272 8} {273 9} {276 10} {278 11}} + 17,trans {} + 22,trans {} + 4,trans {{263 13}} + 26,trans {{264 27}} + 8,trans {} + 12,trans {} + 16,trans {} + 21,trans {} + 3,trans {{264 12}} + 10 {{0 0 1}} + 11 {{8 0 1} {10 0 1} {9 264 0}} + 25,trans {} + 12 {{17 {0 264} 2}} + 7,trans {{271 22} {274 23} {279 24}} + 13 {{16 {0 264} 2}} + 14 {{18 {0 264} 2}} + 15 {{2 {0 264} 1}} + 11,trans {{277 26}} + 16 {{5 {0 264} 1}} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 264} 0} {12 {0 264} 0} {13 {0 264} 0} {14 {0 264} 0} {15 {0 264} 0} {16 {0 264} 0} {17 {0 264} 0} {18 {0 264} 0} {19 {0 264} 0}} + 17 {{3 {0 264} 1}} + 1 {{19 {0 264} 1}} + 18 {{6 {0 264} 1}} + 2 {{12 {0 264} 1}} + 19 {{4 {0 264} 1}} + 20 {{7 {0 264} 1}} + 15,trans {} + 3 {{17 {0 264} 1}} + 21 {{15 {0 264} 2}} + 4 {{16 {0 264} 1}} + 22 {{21 {0 264} 1}} + 5 {{18 {0 264} 1}} + 23 {{20 {0 264} 1}} + 6 {{15 {0 264} 1} {1 {0 264} 0} {2 {0 264} 0} {3 {0 264} 0} {4 {0 264} 0} {5 {0 264} 0} {6 {0 264} 0} {7 {0 264} 0}} + 2,trans {} + 24 {{13 {0 264} 2}} + 19,trans {} + 20,trans {} + 7 {{13 {0 264} 1} {20 {0 264} 0} {21 {0 264} 0}} + 25 {{14 {0 264} 2}} + 8 {{11 {0 264} 1}} + 26 {{10 0 2}} + 27 {{10 0 3}} + 9 {{14 {0 264} 1}} + 24,trans {} + 6,trans {{257 15} {258 16} {259 17} {260 18} {261 19} {262 20} {275 21}} + 10,trans {} +} + +array set vo::token_id_table { + 280,title {} + 279,title {} + 264,line 16 + 270,t 0 + 269,t 0 + 276,line 50 + 265,title CLOSE + 274,t 0 + 261,line 11 + 257,t 0 + 270,title METHOD + 269,title INTERNAL + 273,line 28 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title XPA + 270,line 25 + 269,line 24 + 259,title ON + 260,title OFF + 266,t 0 + 278,title {} + error error + 271,t 0 + 264,title string + 266,line 21 + 278,line 54 + 275,t 1 + error,line 40 + 268,title DISCONNECT + 258,t 0 + 263,line 14 + error,title {} + 280,t 1 + 279,t 1 + 275,line 41 + 273,title SERVER + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 277,title {} + 272,line 27 + 267,t 0 + 263,title integer + 272,t 0 + 268,line 23 + 267,title DELAY + 257 YES_ + 276,t 1 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title OPEN + 261 TRUE_ + 265,line 20 + 262 FALSE_ + 263 INT_ + 277,line 51 + 257,title YES + 264 STRING_ + 264,t 0 + 276,title {} + 265 CLOSE_ + 262,line 12 + 266 CONNECT_ + 267 DELAY_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 DISCONNECT_ + 268,t 0 + 274,line 29 + 270 METHOD_ + 269 INTERNAL_ + error,t 0 + 271 MIME_ + 272 OPEN_ + 258,line 8 + 273,t 0 + 273 SERVER_ + 266,title CONNECT + 274 XPA_ + 275 yesno + 271,line 26 + 276 command + 277,t 1 + 277 @PSEUDO1 + 271,title MIME + 278 vo + 261,t 0 + 280 start' + 279 method + 267,line 22 + 275,title {} + 265,t 0 + 280,line 68 + 279,line 65 + 261,title TRUE +} + +proc vo::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { VODialog } + 12 { VODestroy voi } + 13 { ProcessCmdSet pvo method $2 } + 14 { ProcessCmdSet pvo server $2 } + 15 { ProcessCmdSet pvo hv $2 } + 16 { ProcessCmdSet pvo delay $2 } + 17 { VOCmdConnect $2 } + 18 { VOCmdDisconnect $2 } + 19 { VOCmdConnect $1 } + 20 { set _ xpa } + 21 { set _ mime } + } + 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 vo::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/vosendlex.tcl b/ds9/parsers/vosendlex.tcl new file mode 100644 index 0000000..ca33669 --- /dev/null +++ b/ds9/parsers/vosendlex.tcl @@ -0,0 +1,300 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval vosend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc vosend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc vosend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc vosend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc vosend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc vosend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc vosend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc vosend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc vosend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc vosend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set CONNECT_ 257 +set DELAY_ 258 +set INTERNAL_ 259 +set METHOD_ 260 +set SERVER_ 261 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: connect + if {[regexp -start $index_ -indices -line -nocase -- {\A(connect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: delay + if {[regexp -start $index_ -indices -line -nocase -- {\A(delay)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: internal + if {[regexp -start $index_ -indices -line -nocase -- {\A(internal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: method + if {[regexp -start $index_ -indices -line -nocase -- {\A(method)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: server + if {[regexp -start $index_ -indices -line -nocase -- {\A(server)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CONNECT_ + } + 1 { +return $DELAY_ + } + 2 { +return $INTERNAL_ + } + 3 { +return $METHOD_ + } + 4 { +return $SERVER_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/vosendparser.tab.tcl b/ds9/parsers/vosendparser.tab.tcl new file mode 100644 index 0000000..e120487 --- /dev/null +++ b/ds9/parsers/vosendparser.tab.tcl @@ -0,0 +1,5 @@ +set CONNECT_ 257 +set DELAY_ 258 +set INTERNAL_ 259 +set METHOD_ 260 +set SERVER_ 261 diff --git a/ds9/parsers/vosendparser.tcl b/ds9/parsers/vosendparser.tcl new file mode 100644 index 0000000..e12a00e --- /dev/null +++ b/ds9/parsers/vosendparser.tcl @@ -0,0 +1,310 @@ +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 vosend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc vosend::YYABORT {} { + return -code return 1 +} + +proc vosend::YYACCEPT {} { + return -code return 0 +} + +proc vosend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc vosend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc vosend::yyerror {s} { + puts stderr $s +} + +proc vosend::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 vosend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set vosend::table { + 6:0 accept + 3:0,target 4 + 0:257 shift + 0:258 shift + 5:0,target 3 + 0:260 shift + 0:259 shift + 0:261 shift + 0:258,target 2 + 0:262 goto + 0:0,target 1 + 0:261,target 5 + 2:0,target 5 + 4:0,target 2 + 0:0 reduce + 6:0,target 0 + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 reduce + 1:0,target 6 + 5:0 reduce + 0:262,target 6 +} + +array set vosend::rules { + 0,l 263 + 1,l 262 + 2,l 262 + 3,l 262 + 4,l 262 + 5,l 262 + 6,l 262 +} + +array set vosend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 6,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set vosend::rules { + 5,line 21 + 2,line 18 + 4,line 20 + 6,line 22 + 1,line 17 + 3,line 19 +} + +array set vosend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0} {6 0 0}} + 1 {{6 0 1}} + 2 {{5 0 1}} + 3 {{4 0 1}} + 4 {{2 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6}} + 5 {{3 0 1}} + 1,trans {} + 6 {{0 0 1}} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} + 6,trans {} +} + +array set vosend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + 263,title {} + error,t 0 + error error + 258,line 9 + 261,line 12 + error,line 15 + 257 CONNECT_ + 257,t 0 + 263,line 23 + 258 DELAY_ + 258,t 0 + error,title {} + 260,t 0 + 260 METHOD_ + 259 INTERNAL_ + 259,t 0 + 261,t 0 + 261 SERVER_ + 262,t 1 + 262 vosend + 257,line 8 + 263,t 1 + 263 start' + 260,line 11 + 257,title CONNECT + 259,line 10 + 258,title DELAY + 262,line 16 + 260,title METHOD + 259,title INTERNAL + 261,title SERVER +} + +proc vosend::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 { VOSendCmdConnect 1 } + 2 { ProcessSendCmdGet pvo method } + 3 { ProcessSendCmdGet pvo server } + 4 { ProcessSendCmdYesNo pvo hv } + 5 { ProcessSendCmdGet pvo delay } + 6 { VOSendCmdConnect } + } + 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 vosend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/wcslex.tcl b/ds9/parsers/wcslex.tcl new file mode 100644 index 0000000..4cb37c7 --- /dev/null +++ b/ds9/parsers/wcslex.tcl @@ -0,0 +1,858 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval wcs { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc wcs::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc wcs::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc wcs::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc wcs::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc wcs::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc wcs::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc wcs::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc wcs::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc wcs::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set WCS_ 263 +set WCSA_ 264 +set WCSB_ 265 +set WCSC_ 266 +set WCSD_ 267 +set WCSE_ 268 +set WCSF_ 269 +set WCSG_ 270 +set WCSH_ 271 +set WCSI_ 272 +set WCSJ_ 273 +set WCSK_ 274 +set WCSL_ 275 +set WCSM_ 276 +set WCSN_ 277 +set WCSO_ 278 +set WCSP_ 279 +set WCSQ_ 280 +set WCSR_ 281 +set WCSS_ 282 +set WCST_ 283 +set WCSU_ 284 +set WCSV_ 285 +set WCSW_ 286 +set WCSX_ 287 +set WCSY_ 288 +set WCSZ_ 289 +set FK4_ 290 +set B1950_ 291 +set FK5_ 292 +set J2000_ 293 +set ICRS_ 294 +set GALACTIC_ 295 +set ECLIPTIC_ 296 +set DEGREES_ 297 +set SEXAGESIMAL_ 298 +set INT_ 299 +set STRING_ 300 +set ALIGN_ 301 +set APPEND_ 302 +set CLOSE_ 303 +set OPEN_ 304 +set REPLACE_ 305 +set RESET_ 306 +set SKY_ 307 +set SKYFORMAT_ 308 +set SYSTEM_ 309 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: align + if {[regexp -start $index_ -indices -line -nocase -- {\A(align)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: append + if {[regexp -start $index_ -indices -line -nocase -- {\A(append)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: replace + if {[regexp -start $index_ -indices -line -nocase -- {\A(replace)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: reset + if {[regexp -start $index_ -indices -line -nocase -- {\A(reset)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: wcs + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: wcsa + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsa)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: wcsb + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsb)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: wcsc + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsc)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: wcsd + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsd)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: wcse + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcse)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: wcsf + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsf)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + # rule 22: wcsg + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsg)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 22 + } + # rule 23: wcsh + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsh)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 23 + } + # rule 24: wcsi + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsi)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 24 + } + # rule 25: wcsj + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsj)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 25 + } + # rule 26: wcsk + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsk)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 26 + } + # rule 27: wcsl + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 27 + } + # rule 28: wcsm + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsm)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 28 + } + # rule 29: wcsn + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsn)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 29 + } + # rule 30: wcso + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcso)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 30 + } + # rule 31: wcsp + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsp)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 31 + } + # rule 32: wcsq + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsq)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 32 + } + # rule 33: wcsr + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsr)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 33 + } + # rule 34: wcss + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcss)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 34 + } + # rule 35: wcst + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcst)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 35 + } + # rule 36: wcsu + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsu)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 36 + } + # rule 37: wcsv + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsv)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 37 + } + # rule 38: wcsw + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsw)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 38 + } + # rule 39: wcsx + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsx)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 39 + } + # rule 40: wcsy + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsy)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 40 + } + # rule 41: wcsz + if {[regexp -start $index_ -indices -line -nocase -- {\A(wcsz)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 41 + } + # rule 42: fk4 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk4)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 42 + } + # rule 43: b1950 + if {[regexp -start $index_ -indices -line -nocase -- {\A(b1950)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 43 + } + # rule 44: fk5 + if {[regexp -start $index_ -indices -line -nocase -- {\A(fk5)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 44 + } + # rule 45: j2000 + if {[regexp -start $index_ -indices -line -nocase -- {\A(j2000)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 45 + } + # rule 46: icrs + if {[regexp -start $index_ -indices -line -nocase -- {\A(icrs)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 46 + } + # rule 47: galactic + if {[regexp -start $index_ -indices -line -nocase -- {\A(galactic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 47 + } + # rule 48: ecliptic + if {[regexp -start $index_ -indices -line -nocase -- {\A(ecliptic)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 48 + } + # rule 49: degrees + if {[regexp -start $index_ -indices -line -nocase -- {\A(degrees)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 49 + } + # rule 50: sexagesimal + if {[regexp -start $index_ -indices -line -nocase -- {\A(sexagesimal)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 50 + } + # rule 51: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 51 + } + # rule 52: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 52 + } + # rule 53: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 53 + } + # rule 54: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 54 + } + # rule 55: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 55 + } + # rule 56: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 56 + } + # rule 57: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 57 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ALIGN_ + } + 1 { +return $APPEND_ + } + 2 { +return $CLOSE_ + } + 3 { +return $OPEN_ + } + 4 { +return $REPLACE_ + } + 5 { +return $RESET_ + } + 6 { +return $SKY_ + } + 7 { +return $SKYFORMAT_ + } + 8 { +return $SYSTEM_ + } + 9 { +return $YES_ + } + 10 { +return $NO_ + } + 11 { +return $ON_ + } + 12 { +return $OFF_ + } + 13 { +return $TRUE_ + } + 14 { +return $FALSE_ + } + 15 { +return $WCS_ + } + 16 { +return $WCSA_ + } + 17 { +return $WCSB_ + } + 18 { +return $WCSC_ + } + 19 { +return $WCSD_ + } + 20 { +return $WCSE_ + } + 21 { +return $WCSF_ + } + 22 { +return $WCSG_ + } + 23 { +return $WCSH_ + } + 24 { +return $WCSI_ + } + 25 { +return $WCSJ_ + } + 26 { +return $WCSK_ + } + 27 { +return $WCSL_ + } + 28 { +return $WCSM_ + } + 29 { +return $WCSN_ + } + 30 { +return $WCSO_ + } + 31 { +return $WCSP_ + } + 32 { +return $WCSQ_ + } + 33 { +return $WCSR_ + } + 34 { +return $WCSS_ + } + 35 { +return $WCST_ + } + 36 { +return $WCSU_ + } + 37 { +return $WCSV_ + } + 38 { +return $WCSW_ + } + 39 { +return $WCSX_ + } + 40 { +return $WCSY_ + } + 41 { +return $WCSZ_ + } + 42 { +return $FK4_ + } + 43 { +return $FK4_ + } + 44 { +return $FK5_ + } + 45 { +return $FK5_ + } + 46 { +return $ICRS_ + } + 47 { +return $GALACTIC_ + } + 48 { +return $ECLIPTIC_ + } + 49 { +return $DEGREES_ + } + 50 { +return $SEXAGESIMAL_ + } + 51 { +set yylval $yytext; return $INT_ + } + 52 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 53 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 54 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 55 { +set yylval $yytext; return $STRING_ + } + 56 { +# ignore whitespace + } + 57 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/wcsparser.tab.tcl b/ds9/parsers/wcsparser.tab.tcl new file mode 100644 index 0000000..d33d2e8 --- /dev/null +++ b/ds9/parsers/wcsparser.tab.tcl @@ -0,0 +1,53 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set WCS_ 263 +set WCSA_ 264 +set WCSB_ 265 +set WCSC_ 266 +set WCSD_ 267 +set WCSE_ 268 +set WCSF_ 269 +set WCSG_ 270 +set WCSH_ 271 +set WCSI_ 272 +set WCSJ_ 273 +set WCSK_ 274 +set WCSL_ 275 +set WCSM_ 276 +set WCSN_ 277 +set WCSO_ 278 +set WCSP_ 279 +set WCSQ_ 280 +set WCSR_ 281 +set WCSS_ 282 +set WCST_ 283 +set WCSU_ 284 +set WCSV_ 285 +set WCSW_ 286 +set WCSX_ 287 +set WCSY_ 288 +set WCSZ_ 289 +set FK4_ 290 +set B1950_ 291 +set FK5_ 292 +set J2000_ 293 +set ICRS_ 294 +set GALACTIC_ 295 +set ECLIPTIC_ 296 +set DEGREES_ 297 +set SEXAGESIMAL_ 298 +set INT_ 299 +set STRING_ 300 +set ALIGN_ 301 +set APPEND_ 302 +set CLOSE_ 303 +set OPEN_ 304 +set REPLACE_ 305 +set RESET_ 306 +set SKY_ 307 +set SKYFORMAT_ 308 +set SYSTEM_ 309 diff --git a/ds9/parsers/wcsparser.tcl b/ds9/parsers/wcsparser.tcl new file mode 100644 index 0000000..677dea2 --- /dev/null +++ b/ds9/parsers/wcsparser.tcl @@ -0,0 +1,1349 @@ +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 wcs { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc wcs::YYABORT {} { + return -code return 1 +} + +proc wcs::YYACCEPT {} { + return -code return 0 +} + +proc wcs::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc wcs::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc wcs::yyerror {s} { + puts stderr $s +} + +proc wcs::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 wcs::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set wcs::table { + 21:300 reduce + 60:300 reduce + 59:300 reduce + 30:300,target 37 + 29:300,target 36 + 27:0 reduce + 45:284,target 22 + 43:296,target 34 + 48:0 reduce + 0:306,target 42 + 0:296,target 34 + 9:300 reduce + 30:300 reduce + 29:300 reduce + 70:0 reduce + 69:0 reduce + 45:263,target 1 + 18:300,target 25 + 64:300,target 57 + 68:300 shift + 0:275,target 13 + 6:0,target 13 + 38:299,target 58 + 2:0 reduce + 64:0,target 57 + 56:0,target 7 + 53:300,target 3 + 44:298,target 36 + 38:300 shift + 24:0 reduce + 48:0,target 53 + 9:300,target 16 + 45:282,target 20 + 41:0,target 60 + 43:294,target 32 + 33:0,target 40 + 25:0,target 32 + 0:304,target 40 + 0:294,target 32 + 17:0,target 24 + 66:0 reduce + 42:300,target 56 + 10:0,target 17 + 47:300 reduce + 38:299 shift + 0:273,target 11 + 45:311,target 67 + 31:300,target 38 + 17:300 reduce + 21:0 reduce + 56:300 reduce + 45:280,target 18 + 45:279,target 17 + 42:0 reduce + 43:292,target 30 + 38:318 goto + 0:302,target 38 + 0:292,target 30 + 19:300,target 26 + 20:300,target 27 + 65:300,target 52 + 63:0 reduce + 6:300 reduce + 26:300 reduce + 0:271,target 9 + 65:300 reduce + 54:300,target 6 + 17:0 reduce + 38:0 reduce + 35:300 reduce + 45:277,target 15 + 43:290,target 28 + 60:0 reduce + 59:0 reduce + 0:289,target 27 + 0:290,target 28 + 3:0,target 10 + 61:0,target 61 + 53:0,target 3 + 32:300,target 39 + 0:268,target 6 + 37:0,target 1 + 14:0 reduce + 30:0,target 37 + 29:0,target 36 + 22:0,target 29 + 35:0 reduce + 14:0,target 21 + 14:300 reduce + 21:300,target 28 + 66:300,target 54 + 45:275,target 13 + 44:297 shift + 56:0 reduce + 53:300 reduce + 44:298 shift + 41:299,target 61 + 0:287,target 25 + 3:300 reduce + 44:313 goto + 10:300,target 17 + 55:300,target 4 + 23:300 reduce + 0:266,target 4 + 9:0 reduce + 11:0 reduce + 62:300 reduce + 0:263 shift + 0:264 shift + 32:0 reduce + 0:265 shift + 0:316,target 50 + 0:266 shift + 0:267 shift + 1:300,target 8 + 53:0 reduce + 45:273,target 11 + 32:300 reduce + 0:268 shift + 0:270 shift + 0:269 shift + 0:271 shift + 0:285,target 23 + 0:272 shift + 33:300,target 40 + 0:273 shift + 0:274 shift + 0:275 shift + 6:0 reduce + 0:264,target 2 + 0:276 shift + 41:300 shift + 37:257 shift + 0:277 shift + 37:258 shift + 0:278 shift + 37:260 shift + 37:259 shift + 28:0 reduce + 0:279 shift + 0:280 shift + 7:0,target 14 + 22:300,target 29 + 67:300,target 50 + 37:261 shift + 0:314,target 49 + 0:281 shift + 37:262 shift + 0:282 shift + 50:0 reduce + 49:0 accept + 42:299,target 64 + 0:283 shift + 11:300 reduce + 65:0,target 52 + 45:271,target 9 + 0:284 shift + 57:0,target 55 + 0:285 shift + 71:0 reduce + 50:300 reduce + 50:0,target 44 + 49:0,target 0 + 0:283,target 21 + 0:286 shift + 11:300,target 18 + 56:300,target 7 + 42:0,target 56 + 41:299 shift + 0:287 shift + 34:0,target 41 + 0:288 shift + 26:0,target 33 + 0:289 shift + 0:290 shift + 3:0 reduce + 0:301 shift + 0:291 shift + 18:0,target 25 + 0:302 shift + 0:292 shift + 11:0,target 18 + 19:300 reduce + 20:300 reduce + 0:303 shift + 0:293 shift + 45:289,target 27 + 25:0 reduce + 0:304 shift + 0:294 shift + 58:300 shift + 43:312,target 65 + 41:317 goto + 0:305 shift + 0:295 shift + 2:300,target 9 + 50:315,target 68 + 0:306 shift + 0:312,target 47 + 0:296 shift + 46:0 reduce + 0:307 shift + 0:297 shift + 0:308 shift + 0:298 shift + 8:300 reduce + 45:268,target 6 + 0:309 shift + 67:0 reduce + 34:300,target 41 + 28:300 reduce + 0:311 goto + 50:315 goto + 37:261,target 55 + 0:312 goto + 0:281,target 19 + 0:313 goto + 67:300 reduce + 0:314 goto + 0:316 goto + 23:300,target 30 + 68:300,target 71 + 22:0 reduce + 45:287,target 25 + 37:300 reduce + 0:309,target 45 + 12:300,target 19 + 64:0 reduce + 57:300,target 55 + 45:266,target 4 + 37:258,target 52 + 0:278,target 16 + 46:300 reduce + 37:310 goto + 4:0,target 11 + 46:300,target 49 + 3:300,target 10 + 18:0 reduce + 70:0,target 63 + 69:0,target 67 + 16:300 reduce + 62:0,target 62 + 45:285,target 23 + 54:0,target 6 + 40:0 reduce + 39:0 reduce + 55:300 reduce + 46:0,target 49 + 0:307,target 43 + 0:297,target 35 + 38:0,target 64 + 35:300,target 42 + 61:0 reduce + 31:0,target 38 + 45:264,target 2 + 5:300 reduce + 23:0,target 30 + 15:0,target 22 + 25:300 reduce + 0:276,target 14 + 24:300,target 31 + 70:300,target 63 + 69:300,target 67 + 64:300 reduce + 15:0 reduce + 45:283,target 21 + 36:0 reduce + 43:295,target 33 + 34:300 reduce + 13:300,target 20 + 58:300,target 69 + 41:317,target 63 + 0:305,target 41 + 0:295,target 33 + 57:0 reduce + 0:274,target 12 + 47:300,target 51 + 43:290 shift + 4:300,target 11 + 43:291 shift + 12:0 reduce + 43:292 shift + 44:297,target 35 + 43:293 shift + 43:294 shift + 33:0 reduce + 45:281,target 19 + 43:295 shift + 36:300,target 43 + 13:300 reduce + 43:296 shift + 43:293,target 31 + 54:0 reduce + 0:303,target 39 + 0:293,target 31 + 52:300 reduce + 8:0,target 15 + 1:0,target 8 + 43:312 goto + 25:300,target 32 + 2:300 reduce + 0:272,target 10 + 66:0,target 54 + 7:0 reduce + 22:300 reduce + 58:0,target 65 + 51:0,target 2 + 61:300 shift + 35:0,target 42 + 30:0 reduce + 29:0 reduce + 14:300,target 21 + 60:300,target 59 + 59:300,target 66 + 27:0,target 34 + 45:278,target 16 + 19:0,target 26 + 20:0,target 27 + 51:0 reduce + 43:291,target 29 + 12:0,target 19 + 31:300 reduce + 0:301,target 37 + 0:291,target 29 + 70:300 reduce + 69:300 reduce + 48:300,target 53 + 5:300,target 12 + 0:270,target 8 + 0:269,target 7 + 4:0 reduce + 40:300 reduce + 39:300 reduce + 37:300,target 1 + 26:0 reduce + 47:0 reduce + 45:276,target 14 + 10:300 reduce + 0:288,target 26 + 26:300,target 33 + 48:300 reduce + 1:0 reduce + 0:267,target 5 + 45:263 shift + 15:300,target 22 + 18:300 reduce + 61:300,target 70 + 45:264 shift + 23:0 reduce + 45:265 shift + 57:300 reduce + 45:266 shift + 45:267 shift + 5:0,target 12 + 45:274,target 12 + 45:268 shift + 45:270 shift + 45:269 shift + 7:300 reduce + 71:0,target 46 + 65:0 reduce + 50:300,target 45 + 45:271 shift + 0:286,target 24 + 63:0,target 58 + 45:272 shift + 27:300 reduce + 6:300,target 13 + 55:0,target 4 + 45:273 shift + 47:0,target 51 + 45:274 shift + 66:300 reduce + 45:275 shift + 40:0,target 47 + 39:0,target 48 + 45:276 shift + 32:0,target 39 + 0:265,target 3 + 45:277 shift + 38:300,target 59 + 24:0,target 31 + 45:278 shift + 16:0,target 23 + 19:0 reduce + 20:0 reduce + 45:280 shift + 45:279 shift + 45:281 shift + 36:300 reduce + 45:282 shift + 41:0 reduce + 45:283 shift + 45:284 shift + 45:272,target 10 + 27:300,target 34 + 62:0 reduce + 45:285 shift + 45:286 shift + 0:284,target 22 + 45:287 shift + 38:318,target 60 + 45:288 shift + 45:289 shift + 16:300,target 23 + 62:300,target 62 + 0:263,target 1 + 16:0 reduce + 15:300 reduce + 37:0 reduce + 0:313,target 48 + 54:300 reduce + 51:300,target 2 + 58:0 reduce + 45:270,target 8 + 45:269,target 7 + 7:300,target 14 + 45:311 goto + 37:262,target 56 + 0:282,target 20 + 4:300 reduce + 24:300 reduce + 40:300,target 47 + 39:300,target 48 + 63:300 reduce + 9:0,target 16 + 13:0 reduce + 2:0,target 9 + 45:288,target 26 + 34:0 reduce + 67:0,target 50 + 28:300,target 35 + 0:311,target 46 + 60:0,target 59 + 59:0,target 66 + 33:300 reduce + 55:0 reduce + 52:0,target 5 + 45:267,target 5 + 36:0,target 43 + 37:260,target 54 + 37:259,target 53 + 28:0,target 35 + 0:279,target 17 + 0:280,target 18 + 17:300,target 24 + 21:0,target 28 + 63:300,target 58 + 13:0,target 20 + 8:0 reduce + 42:300 reduce + 37:310,target 57 + 10:0 reduce + 44:313,target 66 + 45:286,target 24 + 31:0 reduce + 52:300,target 5 + 0:308,target 44 + 0:298,target 36 + 8:300,target 15 + 12:300 reduce + 52:0 reduce + 51:300 reduce + 45:265,target 3 + 42:299 shift + 41:300,target 62 + 37:257,target 51 + 0:277,target 15 + 1:300 reduce + 5:0 reduce +} + +array set wcs::rules { + 9,l 311 + 11,l 311 + 32,l 311 + 53,l 316 + 6,l 310 + 28,l 311 + 50,l 316 + 49,l 316 + 3,l 310 + 25,l 311 + 46,l 314 + 67,l 318 + 0,l 319 + 22,l 311 + 43,l 313 + 64,l 318 + 18,l 311 + 40,l 312 + 39,l 312 + 61,l 317 + 15,l 311 + 36,l 312 + 57,l 316 + 12,l 311 + 33,l 311 + 54,l 316 + 7,l 310 + 29,l 311 + 30,l 311 + 51,l 316 + 4,l 310 + 26,l 311 + 47,l 316 + 1,l 310 + 23,l 311 + 44,l 314 + 65,l 318 + 19,l 311 + 20,l 311 + 41,l 312 + 62,l 317 + 16,l 311 + 37,l 312 + 58,l 316 + 13,l 311 + 34,l 311 + 55,l 316 + 8,l 311 + 10,l 311 + 31,l 311 + 52,l 316 + 5,l 310 + 27,l 311 + 48,l 316 + 2,l 310 + 24,l 311 + 45,l 315 + 66,l 318 + 21,l 311 + 42,l 313 + 63,l 317 + 17,l 311 + 38,l 312 + 60,l 317 + 59,l 316 + 14,l 311 + 35,l 312 + 56,l 316 +} + +array set wcs::rules { + 63,dc 2 + 12,dc 1 + 26,dc 1 + 3,dc 1 + 41,dc 1 + 55,dc 2 + 18,dc 1 + 33,dc 1 + 9,dc 1 + 47,dc 1 + 62,dc 1 + 11,dc 1 + 25,dc 1 + 2,dc 1 + 40,dc 1 + 39,dc 1 + 54,dc 2 + 17,dc 1 + 32,dc 1 + 8,dc 1 + 46,dc 3 + 61,dc 1 + 10,dc 1 + 24,dc 1 + 1,dc 0 + 38,dc 1 + 53,dc 1 + 67,dc 2 + 16,dc 1 + 31,dc 1 + 7,dc 1 + 45,dc 0 + 60,dc 0 + 59,dc 2 + 23,dc 1 + 0,dc 1 + 37,dc 1 + 52,dc 2 + 66,dc 1 + 15,dc 1 + 29,dc 1 + 30,dc 1 + 6,dc 1 + 44,dc 1 + 58,dc 2 + 22,dc 1 + 36,dc 1 + 51,dc 1 + 65,dc 1 + 14,dc 1 + 28,dc 1 + 5,dc 1 + 43,dc 1 + 57,dc 2 + 21,dc 1 + 35,dc 1 + 50,dc 2 + 49,dc 1 + 64,dc 0 + 13,dc 1 + 27,dc 1 + 4,dc 1 + 42,dc 1 + 56,dc 1 + 19,dc 1 + 20,dc 1 + 34,dc 1 + 48,dc 1 +} + +array set wcs::rules { + 41,line 162 + 7,line 126 + 37,line 158 + 4,line 123 + 34,line 154 + 1,line 120 + 31,line 151 + 27,line 147 + 24,line 144 + 21,line 141 + 17,line 137 + 14,line 134 + 11,line 131 + 66,line 196 + 63,line 191 + 60,line 188 + 59,line 185 + 56,line 182 + 53,line 179 + 50,line 176 + 49,line 175 + 46,line 170 + 43,line 165 + 9,line 129 + 40,line 161 + 39,line 160 + 6,line 125 + 36,line 157 + 3,line 122 + 33,line 153 + 29,line 149 + 30,line 150 + 26,line 146 + 23,line 143 + 19,line 139 + 20,line 140 + 16,line 136 + 13,line 133 + 10,line 130 + 65,line 195 + 62,line 190 + 58,line 184 + 55,line 181 + 52,line 178 + 48,line 174 + 45,line 169 + 42,line 164 + 8,line 128 + 38,line 159 + 5,line 124 + 35,line 156 + 2,line 121 + 32,line 152 + 28,line 148 + 25,line 145 + 22,line 142 + 45,e 1 + 18,line 138 + 15,line 135 + 12,line 132 + 67,line 197 + 64,line 194 + 61,line 189 + 57,line 183 + 54,line 180 + 51,line 177 + 47,line 173 + 44,line 169 +} + +array set wcs::lr1_table { + 66,trans {} + 35 {{42 {0 300} 1}} + 14,trans {} + 36 {{43 {0 300} 1}} + 33,trans {} + 37 {{55 {0 300} 1} {1 {0 300} 0} {2 {0 300} 0} {3 {0 300} 0} {4 {0 300} 0} {5 {0 300} 0} {6 {0 300} 0} {7 {0 300} 0}} + 52,trans {} + 38 {{59 {0 300} 1} {64 {0 300} 0} {65 {0 300} 0} {66 {0 300} 0} {67 {0 300} 0}} + 71,trans {} + 39 {{48 {0 300} 1}} + 40 {{47 {0 300} 1}} + 18,trans {} + 1,trans {} + 41 {{58 {0 300} 1} {60 {0 300} 0} {61 {0 300} 0} {62 {0 300} 0} {63 {0 300} 0}} + 37,trans {{257 51} {258 52} {259 53} {260 54} {261 55} {262 56} {310 57}} + 42 {{56 {0 300} 1} {57 {0 300} 1}} + 56,trans {} + 43 {{52 {0 300} 1} {35 {0 300} 0} {36 {0 300} 0} {37 {0 300} 0} {38 {0 300} 0} {39 {0 300} 0} {40 {0 300} 0} {41 {0 300} 0}} + 44 {{54 {0 300} 1} {42 {0 300} 0} {43 {0 300} 0}} + 23,trans {} + 5,trans {} + 45 {{50 {0 300} 1} {8 {0 300} 0} {9 {0 300} 0} {10 {0 300} 0} {11 {0 300} 0} {12 {0 300} 0} {13 {0 300} 0} {14 {0 300} 0} {15 {0 300} 0} {16 {0 300} 0} {17 {0 300} 0} {18 {0 300} 0} {19 {0 300} 0} {20 {0 300} 0} {21 {0 300} 0} {22 {0 300} 0} {23 {0 300} 0} {24 {0 300} 0} {25 {0 300} 0} {26 {0 300} 0} {27 {0 300} 0} {28 {0 300} 0} {29 {0 300} 0} {30 {0 300} 0} {31 {0 300} 0} {32 {0 300} 0} {33 {0 300} 0} {34 {0 300} 0}} + 42,trans {{299 64}} + 46 {{49 {0 300} 1}} + 61,trans {{300 70}} + 47 {{51 {0 300} 1}} + 48 {{53 {0 300} 1}} + 27,trans {} + 9,trans {} + 50 {{44 0 1} {46 0 1} {45 300 0}} + 49 {{0 0 1}} + 46,trans {} + 51 {{2 {0 300} 1}} + 65,trans {} + 52 {{5 {0 300} 1}} + 53 {{3 {0 300} 1}} + 13,trans {} + 54 {{6 {0 300} 1}} + 32,trans {} + 51,trans {} + 55 {{4 {0 300} 1}} + 70,trans {} + 69,trans {} + 56 {{7 {0 300} 1}} + 57 {{55 {0 300} 2}} + 17,trans {} + 0,trans {{263 1} {264 2} {265 3} {266 4} {267 5} {268 6} {269 7} {270 8} {271 9} {272 10} {273 11} {274 12} {275 13} {276 14} {277 15} {278 16} {279 17} {280 18} {281 19} {282 20} {283 21} {284 22} {285 23} {286 24} {287 25} {288 26} {289 27} {290 28} {291 29} {292 30} {293 31} {294 32} {295 33} {296 34} {297 35} {298 36} {301 37} {302 38} {303 39} {304 40} {305 41} {306 42} {307 43} {308 44} {309 45} {311 46} {312 47} {313 48} {314 49} {316 50}} + 58 {{65 {0 300} 1} {67 {0 300} 1}} + 36,trans {} + 55,trans {} + 60 {{59 {0 300} 2}} + 59 {{66 {0 300} 1}} + 61 {{61 {0 300} 1} {63 {0 300} 1}} + 62 {{62 {0 300} 1}} + 22,trans {} + 4,trans {} + 41,trans {{299 61} {300 62} {317 63}} + 63 {{58 {0 300} 2}} + 60,trans {} + 59,trans {} + 64 {{57 {0 300} 2}} + 65 {{52 {0 300} 2}} + 66 {{54 {0 300} 2}} + 26,trans {} + 8,trans {} + 45,trans {{263 1} {264 2} {265 3} {266 4} {267 5} {268 6} {269 7} {270 8} {271 9} {272 10} {273 11} {274 12} {275 13} {276 14} {277 15} {278 16} {279 17} {280 18} {281 19} {282 20} {283 21} {284 22} {285 23} {286 24} {287 25} {288 26} {289 27} {311 67}} + 67 {{50 {0 300} 2}} + 64,trans {} + 68 {{46 0 2}} + 70 {{63 {0 300} 2}} + 69 {{67 {0 300} 2}} + 12,trans {} + 71 {{46 0 3}} + 31,trans {} + 50,trans {{315 68}} + 49,trans {} + 68,trans {{300 71}} + 16,trans {} + 35,trans {} + 54,trans {} + 21,trans {} + 3,trans {} + 40,trans {} + 39,trans {} + 58,trans {{300 69}} + 10 {{17 {0 300} 1}} + 11 {{18 {0 300} 1}} + 25,trans {} + 7,trans {} + 12 {{19 {0 300} 1}} + 44,trans {{297 35} {298 36} {313 66}} + 13 {{20 {0 300} 1}} + 63,trans {} + 14 {{21 {0 300} 1}} + 11,trans {} + 15 {{22 {0 300} 1}} + 30,trans {} + 29,trans {} + 16 {{23 {0 300} 1}} + 48,trans {} + 0 {{0 0 0} {44 0 0} {46 0 0} {47 {0 300} 0} {48 {0 300} 0} {49 {0 300} 0} {50 {0 300} 0} {51 {0 300} 0} {52 {0 300} 0} {53 {0 300} 0} {54 {0 300} 0} {55 {0 300} 0} {56 {0 300} 0} {57 {0 300} 0} {58 {0 300} 0} {59 {0 300} 0} {8 {0 300} 0} {9 {0 300} 0} {10 {0 300} 0} {11 {0 300} 0} {12 {0 300} 0} {13 {0 300} 0} {14 {0 300} 0} {15 {0 300} 0} {16 {0 300} 0} {17 {0 300} 0} {18 {0 300} 0} {19 {0 300} 0} {20 {0 300} 0} {21 {0 300} 0} {22 {0 300} 0} {23 {0 300} 0} {24 {0 300} 0} {25 {0 300} 0} {26 {0 300} 0} {27 {0 300} 0} {28 {0 300} 0} {29 {0 300} 0} {30 {0 300} 0} {31 {0 300} 0} {32 {0 300} 0} {33 {0 300} 0} {34 {0 300} 0} {35 {0 300} 0} {36 {0 300} 0} {37 {0 300} 0} {38 {0 300} 0} {39 {0 300} 0} {40 {0 300} 0} {41 {0 300} 0} {42 {0 300} 0} {43 {0 300} 0}} + 17 {{24 {0 300} 1}} + 67,trans {} + 1 {{8 {0 300} 1}} + 18 {{25 {0 300} 1}} + 15,trans {} + 2 {{9 {0 300} 1}} + 19 {{26 {0 300} 1}} + 20 {{27 {0 300} 1}} + 34,trans {} + 3 {{10 {0 300} 1}} + 21 {{28 {0 300} 1}} + 53,trans {} + 4 {{11 {0 300} 1}} + 22 {{29 {0 300} 1}} + 5 {{12 {0 300} 1}} + 23 {{30 {0 300} 1}} + 20,trans {} + 19,trans {} + 2,trans {} + 6 {{13 {0 300} 1}} + 24 {{31 {0 300} 1}} + 38,trans {{299 58} {300 59} {318 60}} + 7 {{14 {0 300} 1}} + 25 {{32 {0 300} 1}} + 57,trans {} + 8 {{15 {0 300} 1}} + 26 {{33 {0 300} 1}} + 9 {{16 {0 300} 1}} + 27 {{34 {0 300} 1}} + 24,trans {} + 6,trans {} + 28 {{35 {0 300} 1}} + 43,trans {{290 28} {291 29} {292 30} {293 31} {294 32} {295 33} {296 34} {312 65}} + 29 {{36 {0 300} 1}} + 30 {{37 {0 300} 1}} + 62,trans {} + 31 {{38 {0 300} 1}} + 10,trans {} + 32 {{39 {0 300} 1}} + 28,trans {} + 33 {{40 {0 300} 1}} + 47,trans {} + 34 {{41 {0 300} 1}} +} + +array set wcs::token_id_table { + 286 WCSW_ + 286,t 0 + 287 WCSX_ + 292,line 44 + 302,line 60 + 288 WCSY_ + 317,t 1 + 265,title WCSB + 289 WCSZ_ + 290 FK4_ + 300 STRING_ + 284,title WCSU + 291 B1950_ + 301 ALIGN_ + 313,title {} + 292 FK5_ + 302 APPEND_ + 288,line 39 + 293 J2000_ + 303 CLOSE_ + 294 ICRS_ + 304 OPEN_ + 305 REPLACE_ + 295 GALACTIC_ + 306 RESET_ + 296 ECLIPTIC_ + 307 SKY_ + 262,t 0 + 297 DEGREES_ + 308 SKYFORMAT_ + 285,line 36 + 298 SEXAGESIMAL_ + 310 yesno + 309 SYSTEM_ + 299 INT_ + 311 wcssys + 283,t 0 + 312 skyframe + 313 skyformat + 314,t 1 + 314 command + 282,line 33 + 315 @PSEUDO1 + 316 wcs + 264,title WCSA + 317 replace + 283,title WCST + 318 append + 312,title {} + 319 start' + 278,line 29 + error,line 118 + 258,t 0 + 275,line 26 + 279,t 0 + 280,t 0 + 311,t 1 + 272,line 23 + 263,title WCS + 282,title WCSS + 311,title {} + 268,line 19 + 276,t 0 + 265,line 16 + 307,t 0 + 297,t 0 + 262,line 12 + 0,t 0 + 0 {$} + 262,title FALSE + 281,title WCSR + 310,title {} + error,t 0 + 309,title SYSTEM + 299,title integer + 258,line 8 + 273,t 0 + 294,t 0 + 304,t 0 + 317,line 187 + 261,title TRUE + 279,title WCSP + 280,title WCSQ + 308,title SKYFORMAT + 269,t 0 + 270,t 0 + 298,title SEXAGESIMAL + 314,line 168 + 291,t 0 + 301,t 0 + 311,line 127 + 307,line 65 + 266,t 0 + 260,title OFF + 259,title ON + 297,line 50 + 278,title WCSO + 307,title SKY + 297,title DEGREES + 287,t 0 + 294,line 46 + 304,line 62 + 318,t 1 + error,title {} + 291,line 43 + 301,line 59 + 263,t 0 + 258,title NO + 287,line 38 + 277,title WCSN + 284,t 0 + 306,title RESET + 296,title ECLIPTIC + 315,t 1 + 284,line 35 + 281,line 32 + 260,t 0 + 259,t 0 + 281,t 0 + 257,title YES + 277,line 28 + 276,title WCSM + 312,t 1 + 305,title REPLACE + 295,title GALACTIC + 274,line 25 + 271,line 22 + 277,t 0 + 308,t 0 + 267,line 18 + 298,t 0 + 275,title WCSL + 294,title ICRS + 304,title OPEN + 264,line 15 + 261,line 11 + 274,t 0 + 305,t 0 + 295,t 0 + 257,line 7 + 274,title WCSK + 293,title J2000 + 303,title CLOSE + 319,line 198 + error error + 271,t 0 + 292,t 0 + 302,t 0 + 316,line 172 + 273,title WCSJ + 313,line 163 + 292,title FK5 + 302,title APPEND + 267,t 0 + 310,line 119 + 309,line 67 + 299,line 53 + 288,t 0 + 319,t 1 + 306,line 64 + 296,line 48 + 272,title WCSI + 291,title B1950 + 293,line 45 + 301,title ALIGN + 303,line 61 + 319,title {} + 264,t 0 + 285,t 0 + 289,line 40 + 290,line 42 + 300,line 55 + 316,t 1 + 286,line 37 + 271,title WCSH + 261,t 0 + 283,line 34 + 289,title WCSZ + 290,title FK4 + 300,title string + 318,title {} + 282,t 0 + 279,line 30 + 280,line 31 + 313,t 1 + 276,line 27 + 257,t 0 + 269,title WCSF + 270,title WCSG + 273,line 24 + 288,title WCSY + 317,title {} + 278,t 0 + 310,t 1 + 309,t 0 + 299,t 0 + 269,line 20 + 270,line 21 + 266,line 17 + 268,title WCSE + 275,t 0 + 263,line 14 + 287,title WCSX + 316,title {} + 306,t 0 + 296,t 0 + 260,line 10 + 259,line 9 + 272,t 0 + 267,title WCSD + 257 YES_ + 286,title WCSW + 293,t 0 + 303,t 0 + 315,title {} + 258 NO_ + 318,line 193 + 260 OFF_ + 259 ON_ + 261 TRUE_ + 262 FALSE_ + 263 WCS_ + 264 WCSA_ + 315,line 169 + 265 WCSB_ + 266 WCSC_ + 267 WCSD_ + 268,t 0 + 268 WCSE_ + 269 WCSF_ + 270 WCSG_ + 312,line 155 + 271 WCSH_ + 272 WCSI_ + 289,t 0 + 290,t 0 + 300,t 0 + 266,title WCSC + 273 WCSJ_ + 274 WCSK_ + 285,title WCSV + 314,title {} + 275 WCSL_ + 308,line 66 + 276 WCSM_ + 298,line 51 + 277 WCSN_ + 278 WCSO_ + 279 WCSP_ + 280 WCSQ_ + 281 WCSR_ + 305,line 63 + 282 WCSS_ + 295,line 47 + 265,t 0 + 283 WCST_ + 284 WCSU_ + 285 WCSV_ +} + +proc wcs::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ wcs } + 9 { set _ wcsa } + 10 { set _ wcsb } + 11 { set _ wcsc } + 12 { set _ wcsd } + 13 { set _ wcse } + 14 { set _ wcsf } + 15 { set _ wcsg } + 16 { set _ wcsh } + 17 { set _ wcsi } + 18 { set _ wcsj } + 19 { set _ wcsk } + 20 { set _ wcsl } + 21 { set _ wcsm } + 22 { set _ wcsn } + 23 { set _ wcso } + 24 { set _ wcsp } + 25 { set _ wcsq } + 26 { set _ wcsr } + 27 { set _ wcss } + 28 { set _ wcst } + 29 { set _ wcsu } + 30 { set _ wcsv } + 31 { set _ wcsw } + 32 { set _ wcsx } + 33 { set _ wcsy } + 34 { set _ wcsz } + 35 { set _ fk4 } + 36 { set _ fk4 } + 37 { set _ fk5 } + 38 { set _ fk5 } + 39 { set _ icrs } + 40 { set _ galactic } + 41 { set _ ecliptic } + 42 { set _ degrees } + 43 { set _ sexagesimal } + 45 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 47 { WCSDialog } + 48 { WCSDestroyDialog } + 49 { ProcessCmdSet wcs system $1 UpdateWCS } + 50 { ProcessCmdSet wcs system $2 UpdateWCS } + 51 { ProcessCmdSet wcs sky $1 UpdateWCS } + 52 { ProcessCmdSet wcs sky $2 UpdateWCS } + 53 { ProcessCmdSet wcs skyformat $1 UpdateWCS } + 54 { ProcessCmdSet wcs skyformat $2 UpdateWCS } + 55 { ProcessCmdSet current align $2 AlignWCSFrame } + 56 { WCSCmdReset 1 } + 57 { WCSCmdReset $2 } + 60 { WCSCmdLoad replace 1 } + 61 { WCSCmdLoad replace $1 } + 62 { WCSCmdLoadFn replace 1 $1 } + 63 { WCSCmdLoadFn replace $1 $2 } + 64 { WCSCmdLoad append 1 } + 65 { WCSCmdLoad append $1 } + 66 { WCSCmdLoadFn append 1 $1 } + 67 { WCSCmdLoadFn append $1 $2 } + } + 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 wcs::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/wcssendlex.tcl b/ds9/parsers/wcssendlex.tcl new file mode 100644 index 0000000..8a58fd3 --- /dev/null +++ b/ds9/parsers/wcssendlex.tcl @@ -0,0 +1,289 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval wcssend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc wcssend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc wcssend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc wcssend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc wcssend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc wcssend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc wcssend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc wcssend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc wcssend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc wcssend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set ALIGN_ 257 +set SKY_ 258 +set SKYFORMAT_ 259 +set SYSTEM_ 260 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: align + if {[regexp -start $index_ -indices -line -nocase -- {\A(align)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: sky + if {[regexp -start $index_ -indices -line -nocase -- {\A(sky)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: skyformat + if {[regexp -start $index_ -indices -line -nocase -- {\A(skyformat)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: system + if {[regexp -start $index_ -indices -line -nocase -- {\A(system)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $ALIGN_ + } + 1 { +return $SKY_ + } + 2 { +return $SKYFORMAT_ + } + 3 { +return $SYSTEM_ + } + 4 { +# ignore whitespace + } + 5 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/wcssendparser.tab.tcl b/ds9/parsers/wcssendparser.tab.tcl new file mode 100644 index 0000000..89bc7e3 --- /dev/null +++ b/ds9/parsers/wcssendparser.tab.tcl @@ -0,0 +1,4 @@ +set ALIGN_ 257 +set SKY_ 258 +set SKYFORMAT_ 259 +set SYSTEM_ 260 diff --git a/ds9/parsers/wcssendparser.tcl b/ds9/parsers/wcssendparser.tcl new file mode 100644 index 0000000..18f9f84 --- /dev/null +++ b/ds9/parsers/wcssendparser.tcl @@ -0,0 +1,296 @@ +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 wcssend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc wcssend::YYABORT {} { + return -code return 1 +} + +proc wcssend::YYACCEPT {} { + return -code return 0 +} + +proc wcssend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc wcssend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc wcssend::yyerror {s} { + puts stderr $s +} + +proc wcssend::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 wcssend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set wcssend::table { + 3:0,target 5 + 0:257 shift + 0:258 shift + 5:0,target 0 + 0:260 shift + 0:259 shift + 0:261 goto + 0:258,target 2 + 0:0,target 1 + 0:261,target 5 + 2:0,target 4 + 4:0,target 3 + 0:0 reduce + 1:0 reduce + 0:257,target 1 + 2:0 reduce + 3:0 reduce + 0:259,target 3 + 0:260,target 4 + 4:0 reduce + 1:0,target 2 + 5:0 accept +} + +array set wcssend::rules { + 0,l 262 + 1,l 261 + 2,l 261 + 3,l 261 + 4,l 261 + 5,l 261 +} + +array set wcssend::rules { + 5,dc 1 + 0,dc 1 + 2,dc 1 + 4,dc 1 + 1,dc 0 + 3,dc 1 +} + +array set wcssend::rules { + 5,line 20 + 2,line 17 + 4,line 19 + 1,line 16 + 3,line 18 +} + +array set wcssend::lr1_table { + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0} {4 0 0} {5 0 0}} + 1 {{2 0 1}} + 2 {{4 0 1}} + 3 {{5 0 1}} + 4 {{3 0 1}} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5}} + 5 {{0 0 1}} + 1,trans {} + 2,trans {} + 3,trans {} + 4,trans {} + 5,trans {} +} + +array set wcssend::token_id_table { + 262,title {} + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 9 + 261,line 15 + error,line 14 + 257 ALIGN_ + 257,t 0 + 258 SKY_ + 258,t 0 + error,title {} + 260,t 0 + 260 SYSTEM_ + 259 SKYFORMAT_ + 259,t 0 + 261,t 1 + 261 wcssend + 262,t 1 + 262 start' + 257,line 8 + 260,line 11 + 257,title ALIGN + 259,line 10 + 258,title SKY + 262,line 21 + 260,title SYSTEM + 259,title SKYFORMAT + 261,title {} +} + +proc wcssend::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 { ProcessSendCmdGet wcs system } + 2 { ProcessSendCmdYesNo current align } + 3 { ProcessSendCmdGet wcs system } + 4 { ProcessSendCmdGet wcs sky } + 5 { ProcessSendCmdGet wcs skyformat } + } + 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 wcssend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/weblex.tcl b/ds9/parsers/weblex.tcl new file mode 100644 index 0000000..84643b4 --- /dev/null +++ b/ds9/parsers/weblex.tcl @@ -0,0 +1,385 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval web { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc web::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc web::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc web::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc web::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc web::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc web::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc web::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc web::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc web::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 +set BACK_ 259 +set CLEAR_ 260 +set CLICK_ 261 +set CLOSE_ 262 +set FORWARD_ 263 +set NEW_ 264 +set RELOAD_ 265 +set STOP_ 266 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: back + if {[regexp -start $index_ -indices -line -nocase -- {\A(back)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: clear + if {[regexp -start $index_ -indices -line -nocase -- {\A(clear)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: click + if {[regexp -start $index_ -indices -line -nocase -- {\A(click)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: forward + if {[regexp -start $index_ -indices -line -nocase -- {\A(forward)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: new + if {[regexp -start $index_ -indices -line -nocase -- {\A(new)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: reload + if {[regexp -start $index_ -indices -line -nocase -- {\A(reload)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: stop + if {[regexp -start $index_ -indices -line -nocase -- {\A(stop)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $BACK_ + } + 1 { +return $CLEAR_ + } + 2 { +return $CLICK_ + } + 3 { +return $CLOSE_ + } + 4 { +return $FORWARD_ + } + 5 { +return $NEW_ + } + 6 { +return $RELOAD_ + } + 7 { +return $STOP_ + } + 8 { +set yylval $yytext; return $INT_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 12 { +set yylval $yytext; return $STRING_ + } + 13 { +# ignore whitespace + } + 14 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/webparser.tab.tcl b/ds9/parsers/webparser.tab.tcl new file mode 100644 index 0000000..8e389ce --- /dev/null +++ b/ds9/parsers/webparser.tab.tcl @@ -0,0 +1,10 @@ +set INT_ 257 +set STRING_ 258 +set BACK_ 259 +set CLEAR_ 260 +set CLICK_ 261 +set CLOSE_ 262 +set FORWARD_ 263 +set NEW_ 264 +set RELOAD_ 265 +set STOP_ 266 diff --git a/ds9/parsers/webparser.tcl b/ds9/parsers/webparser.tcl new file mode 100644 index 0000000..7ca2c50 --- /dev/null +++ b/ds9/parsers/webparser.tcl @@ -0,0 +1,522 @@ +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 web { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc web::YYABORT {} { + return -code return 1 +} + +proc web::YYACCEPT {} { + return -code return 0 +} + +proc web::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc web::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc web::yyerror {s} { + puts stderr $s +} + +proc web::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 web::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set web::table { + 1:271,target 6 + 17:258 reduce + 0:258 shift + 0:260 reduce + 20:258 reduce + 19:258 reduce + 15:0,target 3 + 9:0 reduce + 6:260,target 9 + 0:261 reduce + 2:258 shift + 11:0 reduce + 0:262 reduce + 4:258 reduce + 0:264 shift + 1:260,target 9 + 15:0 reduce + 6:260 shift + 8:258 shift + 6:261 shift + 0:267 goto + 6:262 shift + 0:270 goto + 0:269 goto + 20:0 reduce + 19:0 reduce + 16:0,target 18 + 10:257,target 16 + 18:258,target 15 + 1:258,target 5 + 4:268 goto + 13:258,target 10 + 0:264,target 2 + 6:272 goto + 10:266,target 20 + 17:0,target 14 + 12:0 reduce + 9:258,target 12 + 0:0,target 4 + 4:258,target 2 + 16:0 reduce + 10:257 shift + 4:268,target 8 + 16:258,target 18 + 10:265,target 19 + 10:259 shift + 12:258 reduce + 5:262,target 11 + 21:0 reduce + 3:0 accept + 5:272,target 12 + 18:0,target 15 + 14:258 reduce + 11:258,target 13 + 10:263 shift + 1:0,target 5 + 11:0,target 13 + 0:262,target 7 + 16:258 reduce + 10:265 shift + 10:266 shift + 18:258 reduce + 1:258 reduce + 7:258,target 14 + 1:260 reduce + 5:261,target 10 + 21:258 reduce + 1:261 reduce + 1:262 reduce + 20:258,target 16 + 19:258,target 17 + 13:0 reduce + 9:0,target 12 + 0:261,target 7 + 2:258,target 7 + 20:0,target 16 + 19:0,target 17 + 10:273 goto + 5:260 shift + 12:0,target 8 + 7:258 shift + 5:261 shift + 14:258,target 6 + 10:263,target 18 + 5:262 shift + 17:0 reduce + 10:273,target 21 + 9:258 reduce + 0:0 reduce + 5:260,target 9 + 0:260,target 7 + 1:271 goto + 0:269,target 4 + 0:270,target 5 + 4:0 reduce + 21:0,target 11 + 3:0,target 0 + 13:0,target 10 + 5:272 goto + 17:258,target 14 + 0:258,target 1 + 6:262,target 11 + 6:272,target 13 + 14:0 reduce + 12:258,target 8 + 1:262,target 9 + 4:0,target 1 + 14:0,target 6 + 18:0 reduce + 11:258 reduce + 1:0 reduce + 8:258,target 15 + 6:261,target 10 + 0:267,target 3 + 13:258 reduce + 10:259,target 17 + 21:258,target 11 + 1:261,target 9 +} + +array set web::rules { + 9,l 271 + 11,l 272 + 15,l 273 + 2,l 268 + 6,l 269 + 12,l 272 + 16,l 273 + 3,l 267 + 7,l 270 + 13,l 272 + 0,l 274 + 17,l 273 + 4,l 269 + 8,l 269 + 10,l 269 + 14,l 273 + 18,l 273 + 1,l 267 + 5,l 269 +} + +array set web::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 2 + 3,dc 3 + 15,dc 1 + 10,dc 3 + 6,dc 3 + 18,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 0 + 4,dc 0 + 16,dc 1 + 11,dc 2 + 7,dc 0 + 2,dc 0 + 14,dc 1 +} + +array set web::rules { + 13,line 39 + 2,e 1 + 7,line 32 + 10,line 34 + 4,line 29 + 18,line 46 + 1,line 25 + 15,line 43 + 9,line 33 + 12,line 38 + 7,e 0 + 6,line 32 + 3,line 26 + 17,line 45 + 14,line 42 + 8,line 33 + 11,line 37 + 5,line 30 + 2,line 25 + 9,e 1 + 16,line 44 +} + +array set web::lr1_table { + 13,trans {} + 17 {{14 {0 258} 1}} + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0} {5 {0 258} 0} {6 {0 258} 0} {8 {0 258} 0} {10 {0 258} 0} {7 {260 261 262} 0}} + 14,trans {} + 18 {{15 {0 258} 1}} + 1 {{5 {0 258} 1} {10 {0 258} 1} {9 {260 261 262} 0}} + 15,trans {} + 20 {{16 {0 258} 1}} + 19 {{17 {0 258} 1}} + 2 {{6 {0 258} 1}} + 16,trans {} + 21 {{11 {0 258} 2}} + 3 {{0 0 1}} + 17,trans {} + 4 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{258 1} {264 2} {267 3} {269 4} {270 5}} + 18,trans {} + 5 {{8 {0 258} 1} {11 {0 258} 0} {12 {0 258} 0} {13 {0 258} 0}} + 1,trans {{271 6}} + 20,trans {} + 19,trans {} + 6 {{10 {0 258} 2} {11 {0 258} 0} {12 {0 258} 0} {13 {0 258} 0}} + 2,trans {{258 7}} + 21,trans {} + 7 {{6 {0 258} 2}} + 3,trans {} + 4,trans {{268 8}} + 8 {{3 0 2}} + 5,trans {{260 9} {261 10} {262 11} {272 12}} + 10 {{11 {0 258} 1} {14 {0 258} 0} {15 {0 258} 0} {16 {0 258} 0} {17 {0 258} 0} {18 {0 258} 0}} + 9 {{12 {0 258} 1}} + 6,trans {{260 9} {261 10} {262 11} {272 13}} + 11 {{13 {0 258} 1}} + 7,trans {{258 14}} + 12 {{8 {0 258} 2}} + 8,trans {{258 15}} + 13 {{10 {0 258} 3}} + 10,trans {{257 16} {259 17} {263 18} {265 19} {266 20} {273 21}} + 9,trans {} + 14 {{6 {0 258} 3}} + 11,trans {} + 15 {{3 0 3}} + 12,trans {} + 16 {{18 {0 258} 1}} +} + +array set web::token_id_table { + 264,line 18 + 270,t 1 + 269,t 1 + 265,title RELOAD + 274,t 1 + 261,line 15 + 257,t 0 + 270,title {} + 269,title {} + 273,line 41 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 32 + 269,line 28 + 259,title BACK + 260,title CLEAR + 266,t 0 + 271,t 1 + 264,title NEW + 266,line 20 + error error + 268,title {} + error,line 23 + 258,t 0 + 263,line 17 + error,title {} + 273,title {} + 263,t 0 + 259,line 13 + 260,line 14 + 258,title string + 272,line 36 + 267,t 1 + 263,title FORWARD + 272,t 1 + 268,line 25 + 267,title {} + 257 INT_ + 258 STRING_ + 259,t 0 + 259 BACK_ + 260 CLEAR_ + 260,t 0 + 272,title {} + 261 CLICK_ + 265,line 19 + 262 CLOSE_ + 263 FORWARD_ + 257,title integer + 264 NEW_ + 264,t 0 + 265 RELOAD_ + 262,line 16 + 266 STOP_ + 267 command + 268,t 1 + 268 @PSEUDO1 + 262,title CLOSE + 0 {$} + 0,t 0 + 274,line 47 + 270 @PSEUDO2 + 269 web + 271 @PSEUDO3 + error,t 0 + 272 webCmd + 258,line 9 + 273,t 1 + 273 click + 266,title STOP + 274 start' + 271,line 33 + 271,title {} + 261,t 0 + 267,line 24 + 265,t 0 + 261,title CLICK +} + +proc web::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { WebCmdNew {} } + 5 { WebCmdNew $1 } + 6 { WebCmdNew $3 $2 } + 7 { if {![WebCmdCheck]} {web::YYABORT} } + 9 { if {![WebCmdRef $1]} {web::YYABORT} } + 12 { ProcessCmdCVAR0 HVClearCmd } + 13 { ProcessCmdCVAR0 HVDestroy } + 14 { ProcessCmdCVAR0 HVBackCmd } + 15 { ProcessCmdCVAR0 HVForwardCmd } + 16 { ProcessCmdCVAR0 HVStopCmd } + 17 { ProcessCmdCVAR0 HVReloadCmd } + 18 { WebCmdClick $1 } + } + 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 web::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/widthlex.tcl b/ds9/parsers/widthlex.tcl new file mode 100644 index 0000000..e8b6ea6 --- /dev/null +++ b/ds9/parsers/widthlex.tcl @@ -0,0 +1,297 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval width { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc width::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc width::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc width::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc width::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc width::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc width::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc width::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc width::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc width::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set STRING_ 258 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +set yylval $yytext; return $INT_ + } + 1 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 2 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 3 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 4 { +set yylval $yytext; return $STRING_ + } + 5 { +# ignore whitespace + } + 6 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/widthparser.tab.tcl b/ds9/parsers/widthparser.tab.tcl new file mode 100644 index 0000000..e736960 --- /dev/null +++ b/ds9/parsers/widthparser.tab.tcl @@ -0,0 +1,2 @@ +set INT_ 257 +set STRING_ 258 diff --git a/ds9/parsers/widthparser.tcl b/ds9/parsers/widthparser.tcl new file mode 100644 index 0000000..a2d6a43 --- /dev/null +++ b/ds9/parsers/widthparser.tcl @@ -0,0 +1,291 @@ +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 width { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc width::YYABORT {} { + return -code return 1 +} + +proc width::YYACCEPT {} { + return -code return 0 +} + +proc width::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc width::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc width::yyerror {s} { + puts stderr $s +} + +proc width::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 width::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set width::table { + 3:0,target 1 + 0:257 shift + 5:0,target 3 + 0:259 goto + 1:258 reduce + 0:261 goto + 3:258 reduce + 4:258 shift + 3:260 goto + 0:261,target 3 + 2:0,target 0 + 4:258,target 5 + 3:260,target 4 + 0:257,target 1 + 1:0 reduce + 2:0 accept + 3:0 reduce + 0:259,target 2 + 1:258,target 4 + 1:0,target 4 + 5:0 reduce + 3:258,target 2 +} + +array set width::rules { + 0,l 262 + 1,l 259 + 2,l 260 + 3,l 259 + 4,l 261 +} + +array set width::rules { + 0,dc 1 + 2,dc 0 + 4,dc 1 + 1,dc 1 + 3,dc 3 +} + +array set width::rules { + 2,e 1 + 2,line 16 + 4,line 20 + 1,line 16 + 3,line 17 +} + +array set width::lr1_table { + 0 {{0 0 0} {1 0 0} {3 0 0} {4 {0 258} 0}} + 1 {{4 {0 258} 1}} + 2 {{0 0 1}} + 3 {{1 0 1} {3 0 1} {2 258 0}} + 0,trans {{257 1} {259 2} {261 3}} + 4 {{3 0 2}} + 1,trans {} + 5 {{3 0 3}} + 2,trans {} + 3,trans {{260 4}} + 4,trans {{258 5}} + 5,trans {} +} + +array set width::token_id_table { + 262,title {} + 0 {$} + 0,t 0 + error,t 0 + error error + 258,line 9 + 261,line 19 + error,line 14 + 257 INT_ + 257,t 0 + 258 STRING_ + 258,t 0 + 260,t 1 + 260 @PSEUDO1 + 259,t 1 + 259 command + error,title {} + 261,t 1 + 261 width + 262,t 1 + 262 start' + 257,line 7 + 260,line 16 + 259,line 15 + 257,title integer + 258,title string + 262,line 21 + 260,title {} + 259,title {} + 261,title {} +} + +proc width::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 { + 2 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 4 { ProcessCmdSet canvas width $1 UpdateView } + } + 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 width::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/xpafirstlex.tcl b/ds9/parsers/xpafirstlex.tcl new file mode 100644 index 0000000..8bcb999 --- /dev/null +++ b/ds9/parsers/xpafirstlex.tcl @@ -0,0 +1,461 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval xpafirst { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc xpafirst::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc xpafirst::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc xpafirst::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc xpafirst::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc xpafirst::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc xpafirst::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc xpafirst::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc xpafirst::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc xpafirst::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set CONNECT_ 264 +set DISCONNECT_ 265 +set INET_ 266 +set INFO_ 267 +set LOCAL_ 268 +set LOCALHOST_ 269 +set NOXPANS_ 270 +set TCL_ 271 +set UNIX_ 272 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: connect + if {[regexp -start $index_ -indices -line -nocase -- {\A(connect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: disconnect + if {[regexp -start $index_ -indices -line -nocase -- {\A(disconnect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: inet + if {[regexp -start $index_ -indices -line -nocase -- {\A(inet)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: info + if {[regexp -start $index_ -indices -line -nocase -- {\A(info)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: local + if {[regexp -start $index_ -indices -line -nocase -- {\A(local)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: localhost + if {[regexp -start $index_ -indices -line -nocase -- {\A(localhost)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: noxpans + if {[regexp -start $index_ -indices -line -nocase -- {\A(noxpans)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: tcl + if {[regexp -start $index_ -indices -line -nocase -- {\A(tcl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: unix + if {[regexp -start $index_ -indices -line -nocase -- {\A(unix)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $CONNECT_ + } + 2 { +return $DISCONNECT_ + } + 3 { +return $INET_ + } + 4 { +return $INFO_ + } + 5 { +return $LOCAL_ + } + 6 { +return $LOCALHOST_ + } + 7 { +return $NOXPANS_ + } + 8 { +return $TCL_ + } + 9 { +return $UNIX_ + } + 10 { +return $YES_ + } + 11 { +return $NO_ + } + 12 { +return $ON_ + } + 13 { +return $OFF_ + } + 14 { +return $TRUE_ + } + 15 { +return $FALSE_ + } + 16 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval $yytext; return $STRING_ + } + 20 { +# ignore whitespace + } + 21 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/xpafirstparser.tab.tcl b/ds9/parsers/xpafirstparser.tab.tcl new file mode 100644 index 0000000..b5a60ae --- /dev/null +++ b/ds9/parsers/xpafirstparser.tab.tcl @@ -0,0 +1,16 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set CONNECT_ 264 +set DISCONNECT_ 265 +set INET_ 266 +set INFO_ 267 +set LOCAL_ 268 +set LOCALHOST_ 269 +set NOXPANS_ 270 +set TCL_ 271 +set UNIX_ 272 diff --git a/ds9/parsers/xpafirstparser.tcl b/ds9/parsers/xpafirstparser.tcl new file mode 100644 index 0000000..34e9e6e --- /dev/null +++ b/ds9/parsers/xpafirstparser.tcl @@ -0,0 +1,551 @@ +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 xpafirst { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc xpafirst::YYABORT {} { + return -code return 1 +} + +proc xpafirst::YYACCEPT {} { + return -code return 0 +} + +proc xpafirst::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc xpafirst::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc xpafirst::yyerror {s} { + puts stderr $s +} + +proc xpafirst::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 xpafirst::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set xpafirst::table { + 0:257 shift + 13:263 reduce + 0:258 shift + 11:263,target 20 + 5:0,target 4 + 0:259 shift + 0:260 shift + 15:263 reduce + 15:0,target 18 + 9:0 reduce + 0:261 shift + 0:266,target 9 + 11:0 reduce + 0:276,target 18 + 0:262 shift + 0:263 reduce + 0:264 shift + 20:263 shift + 19:263 reduce + 7:263,target 14 + 2:263 reduce + 0:265 shift + 15:0 reduce + 0:266 shift + 4:263 reduce + 0:267 shift + 20:263,target 21 + 19:263,target 12 + 2:263,target 5 + 0:265,target 8 + 0:268 shift + 6:263 reduce + 6:0,target 7 + 0:270 shift + 0:269 shift + 19:0 reduce + 16:0,target 11 + 0:271 shift + 2:0 reduce + 14:263,target 17 + 8:263 reduce + 0:272 shift + 0:273 goto + 0:274 goto + 6:0 reduce + 0:276 goto + 0:264,target 7 + 0:277 goto + 0:274,target 17 + 7:0,target 14 + 17:0,target 0 + 12:0 reduce + 5:263,target 4 + 0:0,target 1 + 10:0,target 16 + 0:263,target 1 + 16:0 reduce + 0:273,target 16 + 12:263,target 21 + 21:0 reduce + 8:0,target 15 + 3:0 reduce + 18:0,target 8 + 10:263 reduce + 1:0,target 2 + 11:0,target 20 + 0:262,target 6 + 12:263 reduce + 8:263,target 15 + 0:272,target 15 + 7:0 reduce + 14:263 reduce + 3:263,target 3 + 18:275,target 20 + 16:263 reduce + 18:263 reduce + 15:263,target 18 + 13:0 reduce + 9:0,target 19 + 0:261,target 5 + 1:263 reduce + 19:0,target 12 + 2:0,target 5 + 0:271,target 14 + 12:0,target 21 + 3:263 reduce + 10:263,target 16 + 17:0 accept + 5:263 reduce + 0:0 reduce + 7:263 reduce + 0:259,target 3 + 0:260,target 4 + 9:263 reduce + 6:263,target 7 + 4:0 reduce + 0:270,target 13 + 0:269,target 12 + 21:0,target 10 + 3:0,target 3 + 18:263,target 9 + 18:275 goto + 13:0,target 13 + 1:263,target 2 + 8:0 reduce + 10:0 reduce + 13:263,target 13 + 0:258,target 2 + 0:268,target 11 + 14:0 reduce + 9:263,target 19 + 4:0,target 6 + 14:0,target 17 + 18:0 reduce + 0:257,target 1 + 1:0 reduce + 4:263,target 6 + 0:267,target 10 + 0:277,target 19 + 16:263,target 11 + 11:263 reduce + 5:0 reduce +} + +array set xpafirst::rules { + 9,l 275 + 11,l 276 + 15,l 276 + 20,l 277 + 19,l 277 + 2,l 273 + 6,l 273 + 12,l 276 + 16,l 276 + 21,l 277 + 3,l 273 + 7,l 273 + 13,l 276 + 0,l 278 + 17,l 276 + 4,l 273 + 8,l 274 + 10,l 274 + 14,l 276 + 18,l 277 + 1,l 273 + 5,l 273 +} + +array set xpafirst::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 1 + 21,dc 1 + 3,dc 1 + 15,dc 1 + 10,dc 3 + 6,dc 1 + 18,dc 1 + 1,dc 0 + 13,dc 1 + 9,dc 0 + 4,dc 1 + 16,dc 1 + 11,dc 1 + 7,dc 1 + 20,dc 1 + 19,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set xpafirst::rules { + 13,line 55 + 7,line 45 + 10,line 49 + 4,line 42 + 18,line 63 + 1,line 39 + 15,line 57 + 9,line 48 + 12,line 53 + 6,line 44 + 21,line 66 + 3,line 41 + 17,line 60 + 14,line 56 + 8,line 48 + 11,line 52 + 5,line 43 + 20,line 65 + 19,line 64 + 2,line 40 + 9,e 1 + 16,line 59 +} + +array set xpafirst::lr1_table { + 13,trans {} + 17 {{0 0 1}} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 263} 0} {12 {0 263} 0} {13 {0 263} 0} {14 {0 263} 0} {15 {0 263} 0} {16 {0 263} 0} {17 {0 263} 0} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0} {18 {0 263} 0} {19 {0 263} 0} {20 {0 263} 0} {21 {0 263} 0}} + 14,trans {} + 18 {{8 0 1} {10 0 1} {9 263 0}} + 1 {{2 {0 263} 1}} + 20 {{10 0 2}} + 15,trans {} + 19 {{12 {0 263} 1}} + 2 {{5 {0 263} 1}} + 21 {{10 0 3}} + 16,trans {} + 3 {{3 {0 263} 1}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {266 9} {267 10} {268 11} {269 12} {270 13} {271 14} {272 15} {273 16} {274 17} {276 18} {277 19}} + 4 {{6 {0 263} 1}} + 18,trans {{275 20}} + 1,trans {} + 5 {{4 {0 263} 1}} + 20,trans {{263 21}} + 19,trans {} + 2,trans {} + 6 {{7 {0 263} 1}} + 21,trans {} + 3,trans {} + 7 {{14 {0 263} 1}} + 4,trans {} + 8 {{15 {0 263} 1}} + 5,trans {} + 9 {{19 {0 263} 1}} + 10 {{16 {0 263} 1}} + 6,trans {} + 11 {{20 {0 263} 1}} + 7,trans {} + 12 {{21 {0 263} 1}} + 8,trans {} + 13 {{13 {0 263} 1}} + 10,trans {} + 9,trans {} + 14 {{17 {0 263} 1}} + 11,trans {} + 15 {{18 {0 263} 1}} + 12,trans {} + 16 {{11 {0 263} 1}} +} + +array set xpafirst::token_id_table { + 264,line 18 + 270,t 0 + 269,t 0 + 276,line 51 + 265,title DISCONNECT + 274,t 1 + 261,line 11 + 257,t 0 + 270,title NOXPANS + 269,title LOCALHOST + 273,line 38 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 24 + 269,line 23 + 259,title ON + 260,title OFF + 266,t 0 + 278,title {} + error error + 271,t 0 + 264,title CONNECT + 266,line 20 + 278,line 67 + 275,t 1 + error,line 37 + 268,title LOCAL + 258,t 0 + 263,line 14 + error,title {} + 275,line 48 + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 277,title {} + 272,line 26 + 267,t 0 + 263,title string + 272,t 0 + 268,line 22 + 267,title INFO + 257 YES_ + 276,t 1 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UNIX + 261 TRUE_ + 265,line 19 + 262 FALSE_ + 263 STRING_ + 277,line 62 + 257,title YES + 264 CONNECT_ + 264,t 0 + 276,title {} + 265 DISCONNECT_ + 262,line 12 + 266 INET_ + 267 INFO_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 LOCAL_ + 268,t 0 + 274,line 47 + 270 NOXPANS_ + 269 LOCALHOST_ + error,t 0 + 271 TCL_ + 272 UNIX_ + 258,line 8 + 273,t 1 + 273 yesno + 266,title INET + 274 command + 275 @PSEUDO1 + 271,line 25 + 276 xpa + 277,t 1 + 277 method + 271,title TCL + 278 start' + 261,t 0 + 267,line 21 + 275,title {} + 265,t 0 + 261,title TRUE +} + +proc xpafirst::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 11 { ProcessCmdSet pds9 xpa $1 } + 12 { ProcessCmdSet env XPA_METHOD $1 } + 13 { ProcessCmdSet env XPA_NSREGISTER false } + 18 { set _ unix } + 19 { set _ inet } + 20 { set _ local } + 21 { set _ localhost } + } + 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 xpa::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/xpalex.tcl b/ds9/parsers/xpalex.tcl new file mode 100644 index 0000000..158fe79 --- /dev/null +++ b/ds9/parsers/xpalex.tcl @@ -0,0 +1,461 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval xpa { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc xpa::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc xpa::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc xpa::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc xpa::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc xpa::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc xpa::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc xpa::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc xpa::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc xpa::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set CONNECT_ 264 +set DISCONNECT_ 265 +set INET_ 266 +set INFO_ 267 +set LOCAL_ 268 +set LOCALHOST_ 269 +set NOXPANS_ 270 +set TCL_ 271 +set UNIX_ 272 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: connect + if {[regexp -start $index_ -indices -line -nocase -- {\A(connect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: disconnect + if {[regexp -start $index_ -indices -line -nocase -- {\A(disconnect)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: inet + if {[regexp -start $index_ -indices -line -nocase -- {\A(inet)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: info + if {[regexp -start $index_ -indices -line -nocase -- {\A(info)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: local + if {[regexp -start $index_ -indices -line -nocase -- {\A(local)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: localhost + if {[regexp -start $index_ -indices -line -nocase -- {\A(localhost)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: noxpans + if {[regexp -start $index_ -indices -line -nocase -- {\A(noxpans)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: tcl + if {[regexp -start $index_ -indices -line -nocase -- {\A(tcl)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: unix + if {[regexp -start $index_ -indices -line -nocase -- {\A(unix)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + # rule 18: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 18 + } + # rule 19: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 19 + } + # rule 20: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 20 + } + # rule 21: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 21 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $CONNECT_ + } + 2 { +return $DISCONNECT_ + } + 3 { +return $INET_ + } + 4 { +return $INFO_ + } + 5 { +return $LOCAL_ + } + 6 { +return $LOCALHOST_ + } + 7 { +return $NOXPANS_ + } + 8 { +return $TCL_ + } + 9 { +return $UNIX_ + } + 10 { +return $YES_ + } + 11 { +return $NO_ + } + 12 { +return $ON_ + } + 13 { +return $OFF_ + } + 14 { +return $TRUE_ + } + 15 { +return $FALSE_ + } + 16 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 17 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 18 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 19 { +set yylval $yytext; return $STRING_ + } + 20 { +# ignore whitespace + } + 21 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/xpaparser.tab.tcl b/ds9/parsers/xpaparser.tab.tcl new file mode 100644 index 0000000..b5a60ae --- /dev/null +++ b/ds9/parsers/xpaparser.tab.tcl @@ -0,0 +1,16 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set STRING_ 263 +set CONNECT_ 264 +set DISCONNECT_ 265 +set INET_ 266 +set INFO_ 267 +set LOCAL_ 268 +set LOCALHOST_ 269 +set NOXPANS_ 270 +set TCL_ 271 +set UNIX_ 272 diff --git a/ds9/parsers/xpaparser.tcl b/ds9/parsers/xpaparser.tcl new file mode 100644 index 0000000..a398ad6 --- /dev/null +++ b/ds9/parsers/xpaparser.tcl @@ -0,0 +1,551 @@ +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 xpa { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc xpa::YYABORT {} { + return -code return 1 +} + +proc xpa::YYACCEPT {} { + return -code return 0 +} + +proc xpa::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc xpa::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc xpa::yyerror {s} { + puts stderr $s +} + +proc xpa::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 xpa::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set xpa::table { + 0:257 shift + 13:263 reduce + 0:258 shift + 11:263,target 20 + 5:0,target 4 + 0:259 shift + 0:260 shift + 15:263 reduce + 15:0,target 18 + 9:0 reduce + 0:261 shift + 0:266,target 9 + 11:0 reduce + 0:276,target 18 + 0:262 shift + 0:263 reduce + 0:264 shift + 20:263 shift + 19:263 reduce + 7:263,target 14 + 2:263 reduce + 0:265 shift + 15:0 reduce + 0:266 shift + 4:263 reduce + 0:267 shift + 20:263,target 21 + 19:263,target 12 + 2:263,target 5 + 0:265,target 8 + 0:268 shift + 6:263 reduce + 6:0,target 7 + 0:270 shift + 0:269 shift + 19:0 reduce + 16:0,target 11 + 0:271 shift + 2:0 reduce + 14:263,target 17 + 8:263 reduce + 0:272 shift + 0:273 goto + 0:274 goto + 6:0 reduce + 0:276 goto + 0:264,target 7 + 0:277 goto + 0:274,target 17 + 7:0,target 14 + 17:0,target 0 + 12:0 reduce + 5:263,target 4 + 0:0,target 1 + 10:0,target 16 + 0:263,target 1 + 16:0 reduce + 0:273,target 16 + 12:263,target 21 + 21:0 reduce + 8:0,target 15 + 3:0 reduce + 18:0,target 8 + 10:263 reduce + 1:0,target 2 + 11:0,target 20 + 0:262,target 6 + 12:263 reduce + 8:263,target 15 + 0:272,target 15 + 7:0 reduce + 14:263 reduce + 3:263,target 3 + 18:275,target 20 + 16:263 reduce + 18:263 reduce + 15:263,target 18 + 13:0 reduce + 9:0,target 19 + 0:261,target 5 + 1:263 reduce + 19:0,target 12 + 2:0,target 5 + 0:271,target 14 + 12:0,target 21 + 3:263 reduce + 10:263,target 16 + 17:0 accept + 5:263 reduce + 0:0 reduce + 7:263 reduce + 0:259,target 3 + 0:260,target 4 + 9:263 reduce + 6:263,target 7 + 4:0 reduce + 0:270,target 13 + 0:269,target 12 + 21:0,target 10 + 3:0,target 3 + 18:263,target 9 + 18:275 goto + 13:0,target 13 + 1:263,target 2 + 8:0 reduce + 10:0 reduce + 13:263,target 13 + 0:258,target 2 + 0:268,target 11 + 14:0 reduce + 9:263,target 19 + 4:0,target 6 + 14:0,target 17 + 18:0 reduce + 0:257,target 1 + 1:0 reduce + 4:263,target 6 + 0:267,target 10 + 0:277,target 19 + 16:263,target 11 + 11:263 reduce + 5:0 reduce +} + +array set xpa::rules { + 9,l 275 + 11,l 276 + 15,l 276 + 20,l 277 + 19,l 277 + 2,l 273 + 6,l 273 + 12,l 276 + 16,l 276 + 21,l 277 + 3,l 273 + 7,l 273 + 13,l 276 + 0,l 278 + 17,l 276 + 4,l 273 + 8,l 274 + 10,l 274 + 14,l 276 + 18,l 277 + 1,l 273 + 5,l 273 +} + +array set xpa::rules { + 5,dc 1 + 0,dc 1 + 17,dc 1 + 12,dc 1 + 8,dc 1 + 21,dc 1 + 3,dc 1 + 15,dc 1 + 10,dc 3 + 6,dc 1 + 18,dc 1 + 1,dc 0 + 13,dc 1 + 9,dc 0 + 4,dc 1 + 16,dc 1 + 11,dc 1 + 7,dc 1 + 20,dc 1 + 19,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set xpa::rules { + 13,line 55 + 7,line 45 + 10,line 49 + 4,line 42 + 18,line 63 + 1,line 39 + 15,line 57 + 9,line 48 + 12,line 53 + 6,line 44 + 21,line 66 + 3,line 41 + 17,line 60 + 14,line 56 + 8,line 48 + 11,line 52 + 5,line 43 + 20,line 65 + 19,line 64 + 2,line 40 + 9,e 1 + 16,line 59 +} + +array set xpa::lr1_table { + 13,trans {} + 17 {{0 0 1}} + 0 {{0 0 0} {8 0 0} {10 0 0} {11 {0 263} 0} {12 {0 263} 0} {13 {0 263} 0} {14 {0 263} 0} {15 {0 263} 0} {16 {0 263} 0} {17 {0 263} 0} {1 {0 263} 0} {2 {0 263} 0} {3 {0 263} 0} {4 {0 263} 0} {5 {0 263} 0} {6 {0 263} 0} {7 {0 263} 0} {18 {0 263} 0} {19 {0 263} 0} {20 {0 263} 0} {21 {0 263} 0}} + 14,trans {} + 18 {{8 0 1} {10 0 1} {9 263 0}} + 1 {{2 {0 263} 1}} + 20 {{10 0 2}} + 15,trans {} + 19 {{12 {0 263} 1}} + 2 {{5 {0 263} 1}} + 21 {{10 0 3}} + 16,trans {} + 3 {{3 {0 263} 1}} + 17,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4} {261 5} {262 6} {264 7} {265 8} {266 9} {267 10} {268 11} {269 12} {270 13} {271 14} {272 15} {273 16} {274 17} {276 18} {277 19}} + 4 {{6 {0 263} 1}} + 18,trans {{275 20}} + 1,trans {} + 5 {{4 {0 263} 1}} + 20,trans {{263 21}} + 19,trans {} + 2,trans {} + 6 {{7 {0 263} 1}} + 21,trans {} + 3,trans {} + 7 {{14 {0 263} 1}} + 4,trans {} + 8 {{15 {0 263} 1}} + 5,trans {} + 9 {{19 {0 263} 1}} + 10 {{16 {0 263} 1}} + 6,trans {} + 11 {{20 {0 263} 1}} + 7,trans {} + 12 {{21 {0 263} 1}} + 8,trans {} + 13 {{13 {0 263} 1}} + 10,trans {} + 9,trans {} + 14 {{17 {0 263} 1}} + 11,trans {} + 15 {{18 {0 263} 1}} + 12,trans {} + 16 {{11 {0 263} 1}} +} + +array set xpa::token_id_table { + 264,line 18 + 270,t 0 + 269,t 0 + 276,line 51 + 265,title DISCONNECT + 274,t 1 + 261,line 11 + 257,t 0 + 270,title NOXPANS + 269,title LOCALHOST + 273,line 38 + 278,t 1 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 24 + 269,line 23 + 259,title ON + 260,title OFF + 266,t 0 + 278,title {} + error error + 271,t 0 + 264,title CONNECT + 266,line 20 + 278,line 67 + 275,t 1 + error,line 37 + 268,title LOCAL + 258,t 0 + 263,line 14 + error,title {} + 275,line 48 + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 277,title {} + 272,line 26 + 267,t 0 + 263,title string + 272,t 0 + 268,line 22 + 267,title INFO + 257 YES_ + 276,t 1 + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title UNIX + 261 TRUE_ + 265,line 19 + 262 FALSE_ + 263 STRING_ + 277,line 62 + 257,title YES + 264 CONNECT_ + 264,t 0 + 276,title {} + 265 DISCONNECT_ + 262,line 12 + 266 INET_ + 267 INFO_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 LOCAL_ + 268,t 0 + 274,line 47 + 270 NOXPANS_ + 269 LOCALHOST_ + error,t 0 + 271 TCL_ + 272 UNIX_ + 258,line 8 + 273,t 1 + 273 yesno + 266,title INET + 274 command + 275 @PSEUDO1 + 271,line 25 + 276 xpa + 277,t 1 + 277 method + 271,title TCL + 278 start' + 261,t 0 + 267,line 21 + 275,title {} + 265,t 0 + 261,title TRUE +} + +proc xpa::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 9 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 14 { XPAConnect } + 15 { XPADisconnect } + 16 { XPAInfo } + 18 { set _ unix } + 19 { set _ inet } + 20 { set _ local } + 21 { set _ localhost } + } + 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 xpa::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/xpasendlex.tcl b/ds9/parsers/xpasendlex.tcl new file mode 100644 index 0000000..f1ee2a3 --- /dev/null +++ b/ds9/parsers/xpasendlex.tcl @@ -0,0 +1,256 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval xpasend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc xpasend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc xpasend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc xpasend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc xpasend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc xpasend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc xpasend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc xpasend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc xpasend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc xpasend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INFO_ 257 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: info + if {[regexp -start $index_ -indices -line -nocase -- {\A(info)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $INFO_ + } + 1 { +# ignore whitespace + } + 2 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/xpasendparser.tab.tcl b/ds9/parsers/xpasendparser.tab.tcl new file mode 100644 index 0000000..d689f6d --- /dev/null +++ b/ds9/parsers/xpasendparser.tab.tcl @@ -0,0 +1 @@ +set INFO_ 257 diff --git a/ds9/parsers/xpasendparser.tcl b/ds9/parsers/xpasendparser.tcl new file mode 100644 index 0000000..06bc6a4 --- /dev/null +++ b/ds9/parsers/xpasendparser.tcl @@ -0,0 +1,254 @@ +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 xpasend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc xpasend::YYABORT {} { + return -code return 1 +} + +proc xpasend::YYACCEPT {} { + return -code return 0 +} + +proc xpasend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc xpasend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc xpasend::yyerror {s} { + puts stderr $s +} + +proc xpasend::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 xpasend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set xpasend::table { + 2:0 accept + 0:257 shift + 0:258,target 2 + 0:0,target 1 + 0:258 goto + 1:0,target 2 + 0:0 reduce + 2:0,target 0 + 1:0 reduce + 0:257,target 1 +} + +array set xpasend::rules { + 0,l 259 + 1,l 258 + 2,l 258 +} + +array set xpasend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 0 +} + +array set xpasend::rules { + 2,line 14 + 1,line 13 +} + +array set xpasend::lr1_table { + 0,trans {{257 1} {258 2}} + 0 {{0 0 0} {1 0 0} {2 0 0}} + 1,trans {} + 1 {{2 0 1}} + 2,trans {} + 2 {{0 0 1}} +} + +array set xpasend::token_id_table { + 0 {$} + 0,t 0 + error error + error,t 0 + 258,line 12 + 257 INFO_ + 257,t 0 + error,line 11 + 258,t 1 + 258 xpasend + 259,t 1 + 259 start' + error,title {} + 257,line 8 + 259,line 15 + 257,title INFO + 258,title {} + 259,title {} +} + +proc xpasend::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 { ProcessSendCmd XPAInfoResult } + 2 { ProcessSendCmd XPAInfoResult } + } + 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 xpasend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/zoomlex.tcl b/ds9/parsers/zoomlex.tcl new file mode 100644 index 0000000..1a6376f --- /dev/null +++ b/ds9/parsers/zoomlex.tcl @@ -0,0 +1,382 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval zoom { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc zoom::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc zoom::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc zoom::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc zoom::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc zoom::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc zoom::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc zoom::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc zoom::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc zoom::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set CLOSE_ 260 +set IN_ 261 +set FIT_ 262 +set OPEN_ 263 +set OUT_ 264 +set TO_ 265 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: close + if {[regexp -start $index_ -indices -line -nocase -- {\A(close)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: in + if {[regexp -start $index_ -indices -line -nocase -- {\A(in)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: fit + if {[regexp -start $index_ -indices -line -nocase -- {\A(fit)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: open + if {[regexp -start $index_ -indices -line -nocase -- {\A(open)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: out + if {[regexp -start $index_ -indices -line -nocase -- {\A(out)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: to + if {[regexp -start $index_ -indices -line -nocase -- {\A(to)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CLOSE_ + } + 1 { +return $IN_ + } + 2 { +return $FIT_ + } + 3 { +return $OPEN_ + } + 4 { +return $OUT_ + } + 5 { +return $TO_ + } + 6 { +set yylval $yytext; return $INT_ + } + 7 - + 8 { +set yylval $yytext; return $REAL_ + } + 9 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 10 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 11 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 12 { +set yylval $yytext; return $STRING_ + } + 13 { +# ignore whitespace + } + 14 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/zoomparser.tab.tcl b/ds9/parsers/zoomparser.tab.tcl new file mode 100644 index 0000000..fae6919 --- /dev/null +++ b/ds9/parsers/zoomparser.tab.tcl @@ -0,0 +1,9 @@ +set INT_ 257 +set REAL_ 258 +set STRING_ 259 +set CLOSE_ 260 +set IN_ 261 +set FIT_ 262 +set OPEN_ 263 +set OUT_ 264 +set TO_ 265 diff --git a/ds9/parsers/zoomparser.tcl b/ds9/parsers/zoomparser.tcl new file mode 100644 index 0000000..cf75110 --- /dev/null +++ b/ds9/parsers/zoomparser.tcl @@ -0,0 +1,486 @@ +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 zoom { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc zoom::YYABORT {} { + return -code return 1 +} + +proc zoom::YYACCEPT {} { + return -code return 0 +} + +proc zoom::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc zoom::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc zoom::yyerror {s} { + puts stderr $s +} + +proc zoom::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 zoom::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set zoom::table { + 15:259 shift + 0:257 shift + 0:258 shift + 0:260 shift + 2:257 reduce + 5:0,target 6 + 9:0 accept + 8:257,target 1 + 6:259,target 9 + 0:261 shift + 0:266,target 8 + 2:258 reduce + 11:0 reduce + 2:259 reduce + 0:263 shift + 12:266,target 16 + 10:268,target 15 + 0:264 shift + 1:259,target 1 + 4:259 reduce + 0:265 shift + 8:257 shift + 6:259 reduce + 0:266 goto + 13:259,target 10 + 8:258 shift + 0:267 goto + 8:259 reduce + 0:265,target 7 + 8:266,target 14 + 6:0,target 9 + 0:269 goto + 16:0,target 15 + 2:0 reduce + 1:258,target 1 + 7:262,target 11 + 8:266 goto + 6:0 reduce + 0:264,target 6 + 4:259,target 8 + 16:259,target 15 + 1:257,target 1 + 17:0,target 5 + 12:0 reduce + 10:0,target 3 + 11:259,target 13 + 0:263,target 5 + 16:0 reduce + 12:257 shift + 10:259 reduce + 12:258 shift + 12:259 reduce + 8:0,target 11 + 7:270,target 13 + 3:0 reduce + 1:0,target 1 + 14:259 reduce + 11:0,target 13 + 2:259,target 2 + 16:259 reduce + 1:257 reduce + 14:259,target 12 + 1:258 reduce + 12:266 goto + 10:268 goto + 7:258,target 2 + 1:259 reduce + 3:259 reduce + 13:0 reduce + 9:0,target 0 + 0:261,target 4 + 2:258,target 2 + 7:257 shift + 2:0,target 2 + 5:259 reduce + 12:0,target 14 + 7:258 shift + 17:0 reduce + 7:257,target 1 + 5:259,target 6 + 7:262 shift + 0:260,target 3 + 2:257,target 2 + 0:269,target 10 + 4:0 reduce + 7:266 goto + 12:259,target 14 + 3:0,target 7 + 13:0,target 10 + 8:0 reduce + 7:266,target 12 + 7:270 goto + 10:0 reduce + 0:258,target 2 + 8:259,target 11 + 14:0 reduce + 12:258,target 2 + 3:259,target 7 + 4:0,target 8 + 14:0,target 12 + 15:259,target 17 + 0:257,target 1 + 1:0 reduce + 11:259 reduce + 8:258,target 2 + 0:267,target 9 + 13:259 reduce + 12:257,target 1 + 10:259,target 4 + 5:0 reduce +} + +array set zoom::rules { + 9,l 269 + 11,l 269 + 15,l 270 + 2,l 266 + 6,l 269 + 12,l 269 + 3,l 267 + 7,l 269 + 13,l 270 + 0,l 271 + 4,l 268 + 8,l 269 + 10,l 269 + 14,l 270 + 1,l 266 + 5,l 267 +} + +array set zoom::rules { + 5,dc 3 + 0,dc 1 + 12,dc 2 + 8,dc 1 + 3,dc 1 + 15,dc 2 + 10,dc 2 + 6,dc 1 + 1,dc 1 + 13,dc 1 + 9,dc 1 + 4,dc 0 + 11,dc 1 + 7,dc 1 + 2,dc 1 + 14,dc 1 +} + +array set zoom::rules { + 13,line 44 + 7,line 36 + 10,line 39 + 4,line 31 + 1,line 27 + 15,line 46 + 9,line 38 + 12,line 41 + 6,line 35 + 3,line 31 + 4,e 1 + 14,line 45 + 8,line 37 + 11,line 40 + 5,line 32 + 2,line 28 +} + +array set zoom::lr1_table { + 13,trans {} + 17 {{5 0 2}} + 0 {{0 0 0} {3 0 0} {5 0 0} {6 {0 259} 0} {7 {0 259} 0} {8 {0 259} 0} {9 {0 259} 0} {10 {0 259} 0} {11 {0 259} 0} {12 {0 259} 0} {1 {0 257 258 259} 0} {2 {0 257 258 259} 0}} + 14,trans {} + 18 {{15 {0 259} 2}} + 1 {{1 {0 257 258 259} 1}} + 19 {{5 0 3}} + 15,trans {} + 2 {{2 {0 257 258 259} 1}} + 16,trans {} + 3 {{7 {0 259} 1}} + 17,trans {{259 19}} + 4 {{8 {0 259} 1}} + 0,trans {{257 1} {258 2} {260 3} {261 4} {263 5} {264 6} {265 7} {266 8} {267 9} {269 10}} + 18,trans {} + 1,trans {} + 5 {{6 {0 259} 1}} + 19,trans {} + 2,trans {} + 6 {{9 {0 259} 1}} + 3,trans {} + 7 {{10 {0 259} 1} {13 {0 259} 0} {14 {0 259} 0} {15 {0 259} 0} {1 {0 257 258 259} 0} {2 {0 257 258 259} 0}} + 4,trans {} + 8 {{11 {0 259} 1} {12 {0 259} 1} {1 {0 259} 0} {2 {0 259} 0}} + 5,trans {} + 9 {{0 0 1}} + 10 {{3 0 1} {5 0 1} {4 259 0}} + 11 {{13 {0 259} 1}} + 6,trans {} + 7,trans {{257 1} {258 2} {262 11} {266 12} {270 13}} + 12 {{14 {0 259} 1} {15 {0 259} 1} {1 {0 259} 0} {2 {0 259} 0}} + 8,trans {{257 14} {258 15} {266 16}} + 13 {{10 {0 259} 2}} + 10,trans {{268 17}} + 9,trans {} + 14 {{1 {0 259} 1}} + 11,trans {} + 15 {{2 {0 259} 1}} + 12,trans {{257 14} {258 15} {266 18}} + 16 {{12 {0 259} 2}} +} + +array set zoom::token_id_table { + 264,line 18 + 270,t 1 + 269,t 1 + 265,title TO + 261,line 15 + 257,t 0 + 270,title {} + 269,title {} + 257,line 7 + 262,t 0 + 270,line 43 + 269,line 34 + 259,title string + 260,title CLOSE + 266,t 1 + 271,t 1 + 264,title OUT + error error + 266,line 26 + 268,title {} + error,line 25 + 258,t 0 + 263,line 17 + error,title {} + 263,t 0 + 259,line 10 + 260,line 14 + 258,title float + 267,t 1 + 263,title OPEN + 268,line 31 + 267,title {} + 257 INT_ + 258 REAL_ + 259,t 0 + 259 STRING_ + 260 CLOSE_ + 260,t 0 + 261 IN_ + 265,line 19 + 262 FIT_ + 263 OPEN_ + 257,title integer + 264 OUT_ + 264,t 0 + 265 TO_ + 262,line 16 + 266 numeric + 267 command + 268,t 1 + 268 @PSEUDO1 + 262,title FIT + 0 {$} + 0,t 0 + 270 zoomTo + 269 zoom + 271 start' + error,t 0 + 258,line 8 + 266,title {} + 271,line 47 + 271,title {} + 261,t 0 + 267,line 30 + 265,t 0 + 261,title IN +} + +proc zoom::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 _ $1 } + 2 { set _ $1 } + 4 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 6 { PanZoomDialog } + 7 { PanZoomDestroyDialog } + 8 { Zoom 2 2 } + 9 { Zoom .5 .5 } + 11 { Zoom $1 $1 } + 12 { Zoom $1 $2 } + 13 { ZoomToFit } + 14 { ZoomTo $1 $1 } + 15 { ZoomTo $1 $2 } + } + 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 zoom::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/zscalelex.tcl b/ds9/parsers/zscalelex.tcl new file mode 100644 index 0000000..715551a --- /dev/null +++ b/ds9/parsers/zscalelex.tcl @@ -0,0 +1,415 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval zscale { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc zscale::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc zscale::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc zscale::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc zscale::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc zscale::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc zscale::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc zscale::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc zscale::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc zscale::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set CONTRAST_ 266 +set SAMPLE_ 267 +set LINE_ 268 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: contrast + if {[regexp -start $index_ -indices -line -nocase -- {\A(contrast)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: sample + if {[regexp -start $index_ -indices -line -nocase -- {\A(sample)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: line + if {[regexp -start $index_ -indices -line -nocase -- {\A(line)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: yes + if {[regexp -start $index_ -indices -line -nocase -- {\A(yes)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: no + if {[regexp -start $index_ -indices -line -nocase -- {\A(no)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + # rule 5: on + if {[regexp -start $index_ -indices -line -nocase -- {\A(on)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 5 + } + # rule 6: off + if {[regexp -start $index_ -indices -line -nocase -- {\A(off)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 6 + } + # rule 7: true + if {[regexp -start $index_ -indices -line -nocase -- {\A(true)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 7 + } + # rule 8: false + if {[regexp -start $index_ -indices -line -nocase -- {\A(false)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 8 + } + # rule 9: [+-]?{D}+ + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 9 + } + # rule 10: [+-]?{D}+\.?({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])+\.?(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 10 + } + # rule 11: [+-]?{D}*\.{D}+({E})? + if {[regexp -start $index_ -indices -line -nocase -- {\A([+-]?([0-9])*\.([0-9])+(([Ee][+-]?([0-9])+))?)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 11 + } + # rule 12: \"[^\"]*\" + if {[regexp -start $index_ -indices -line -nocase -- {\A(\"[^\"]*\")} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 12 + } + # rule 13: \'[^\']*\' + if {[regexp -start $index_ -indices -line -nocase -- {\A(\'[^\']*\')} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 13 + } + # rule 14: \{[^\}]*\} + if {[regexp -start $index_ -indices -line -nocase -- {\A(\{[^\}]*\})} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 14 + } + # rule 15: \S+\S+ + if {[regexp -start $index_ -indices -line -nocase -- {\A(\S+\S+)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 15 + } + # rule 16: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 16 + } + # rule 17: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 17 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CONTRAST_ + } + 1 { +return $SAMPLE_ + } + 2 { +return $LINE_ + } + 3 { +return $YES_ + } + 4 { +return $NO_ + } + 5 { +return $ON_ + } + 6 { +return $OFF_ + } + 7 { +return $TRUE_ + } + 8 { +return $FALSE_ + } + 9 { +set yylval $yytext; return $INT_ + } + 10 - + 11 { +set yylval $yytext; return $REAL_ + } + 12 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 13 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 14 { +set yylval [string range $yytext 1 end-1]; return $STRING_ + } + 15 { +set yylval $yytext; return $STRING_ + } + 16 { +# ignore whitespace + } + 17 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/zscaleparser.tab.tcl b/ds9/parsers/zscaleparser.tab.tcl new file mode 100644 index 0000000..16be119 --- /dev/null +++ b/ds9/parsers/zscaleparser.tab.tcl @@ -0,0 +1,12 @@ +set YES_ 257 +set NO_ 258 +set ON_ 259 +set OFF_ 260 +set TRUE_ 261 +set FALSE_ 262 +set INT_ 263 +set REAL_ 264 +set STRING_ 265 +set CONTRAST_ 266 +set SAMPLE_ 267 +set LINE_ 268 diff --git a/ds9/parsers/zscaleparser.tcl b/ds9/parsers/zscaleparser.tcl new file mode 100644 index 0000000..d3b216c --- /dev/null +++ b/ds9/parsers/zscaleparser.tcl @@ -0,0 +1,435 @@ +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 zscale { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc zscale::YYABORT {} { + return -code return 1 +} + +proc zscale::YYACCEPT {} { + return -code return 0 +} + +proc zscale::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc zscale::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc zscale::yyerror {s} { + puts stderr $s +} + +proc zscale::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 zscale::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set zscale::table { + 11:265 shift + 5:0,target 10 + 0:266,target 1 + 9:0 reduce + 0:265 reduce + 1:270,target 8 + 2:263 shift + 5:265,target 11 + 0:266 shift + 0:267 shift + 0:265,target 13 + 0:268 shift + 2:263,target 9 + 6:0,target 8 + 0:271 goto + 6:265 reduce + 0:273 goto + 8:265 reduce + 6:0 reduce + 8:265,target 14 + 7:0,target 9 + 12:0 reduce + 0:0,target 13 + 10:0,target 16 + 0:273,target 5 + 10:265,target 16 + 5:272,target 11 + 8:0,target 14 + 10:265 reduce + 6:265,target 8 + 7:0 reduce + 3:263,target 10 + 1:263 shift + 9:0,target 15 + 0:271,target 4 + 1:264 shift + 12:0,target 12 + 3:263 shift + 0:0 reduce + 1:264,target 7 + 9:265,target 15 + 1:270 goto + 5:265 reduce + 4:0 accept + 7:265 reduce + 9:265 reduce + 1:263,target 6 + 5:272 goto + 8:0 reduce + 10:0 reduce + 11:265,target 12 + 0:268,target 3 + 4:0,target 0 + 7:265,target 9 + 0:267,target 2 + 5:0 reduce +} + +array set zscale::rules { + 9,l 270 + 11,l 272 + 15,l 273 + 2,l 269 + 6,l 269 + 12,l 271 + 16,l 273 + 3,l 269 + 7,l 269 + 13,l 273 + 0,l 274 + 4,l 269 + 8,l 270 + 10,l 271 + 14,l 273 + 1,l 269 + 5,l 269 +} + +array set zscale::rules { + 5,dc 1 + 0,dc 1 + 12,dc 3 + 8,dc 1 + 3,dc 1 + 15,dc 2 + 10,dc 1 + 6,dc 1 + 1,dc 0 + 13,dc 0 + 9,dc 1 + 4,dc 1 + 16,dc 2 + 11,dc 0 + 7,dc 1 + 2,dc 1 + 14,dc 2 +} + +array set zscale::rules { + 13,line 55 + 7,line 45 + 10,line 51 + 4,line 42 + 1,line 39 + 15,line 57 + 9,line 48 + 12,line 52 + 6,line 44 + 3,line 41 + 14,line 56 + 8,line 47 + 11,line 51 + 5,line 43 + 2,line 40 + 16,line 58 + 11,e 1 +} + +array set zscale::lr1_table { + 0 {{0 0 0} {10 0 0} {12 0 0} {13 {0 265} 0} {14 {0 265} 0} {15 {0 265} 0} {16 {0 265} 0}} + 1 {{14 {0 265} 1} {8 {0 265} 0} {9 {0 265} 0}} + 2 {{15 {0 265} 1}} + 3 {{16 {0 265} 1}} + 4 {{0 0 1}} + 0,trans {{266 1} {267 2} {268 3} {271 4} {273 5}} + 5 {{10 0 1} {12 0 1} {11 265 0}} + 1,trans {{263 6} {264 7} {270 8}} + 2,trans {{263 9}} + 6 {{8 {0 265} 1}} + 3,trans {{263 10}} + 7 {{9 {0 265} 1}} + 4,trans {} + 8 {{14 {0 265} 2}} + 5,trans {{272 11}} + 10 {{16 {0 265} 2}} + 9 {{15 {0 265} 2}} + 6,trans {} + 11 {{12 0 2}} + 12 {{12 0 3}} + 7,trans {} + 8,trans {} + 10,trans {} + 9,trans {} + 11,trans {{265 12}} + 12,trans {} +} + +array set zscale::token_id_table { + 264,line 15 + 270,t 1 + 269,t 1 + 265,title string + 274,t 1 + 261,line 11 + 257,t 0 + 270,title {} + 269,title {} + 273,line 54 + 257,line 7 + 262,t 0 + 274,title {} + 270,line 46 + 269,line 38 + 259,title ON + 260,title OFF + 266,t 0 + 271,t 1 + error error + 264,title float + 266,line 21 + error,line 37 + 268,title LINE + 258,t 0 + 263,line 14 + error,title {} + 273,title {} + 263,t 0 + 259,line 9 + 260,line 10 + 258,title NO + 272,line 51 + 267,t 0 + 263,title integer + 272,t 1 + 268,line 23 + 267,title SAMPLE + 257 YES_ + 258 NO_ + 259,t 0 + 259 ON_ + 260 OFF_ + 260,t 0 + 272,title {} + 261 TRUE_ + 265,line 17 + 262 FALSE_ + 263 INT_ + 257,title YES + 264 REAL_ + 264,t 0 + 265 STRING_ + 262,line 12 + 266 CONTRAST_ + 267 SAMPLE_ + 0,t 0 + 0 {$} + 262,title FALSE + 268 LINE_ + 268,t 0 + 274,line 59 + 270 numeric + 269 yesno + 271 command + error,t 0 + 272 @PSEUDO1 + 258,line 8 + 273,t 1 + 273 zscale + 266,title CONTRAST + 274 start' + 271,line 50 + 271,title {} + 261,t 0 + 267,line 22 + 265,t 0 + 261,title TRUE +} + +proc zscale::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 _ 1 } + 2 { set _ 1 } + 3 { set _ 1 } + 4 { set _ 1 } + 5 { set _ 0 } + 6 { set _ 0 } + 7 { set _ 0 } + 8 { set _ $1 } + 9 { set _ $1 } + 11 { global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT} } + 13 { ProcessCmdSet scale mode zscale ChangeScaleMode } + 14 { ProcessCmdSet zscale contrast $2 ChangeZScale } + 15 { ProcessCmdSet zscale sample $2 ChangeZScale } + 16 { ProcessCmdSet zscale line $2 ChangeZScale } + } + 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 zscale::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} diff --git a/ds9/parsers/zscalesendlex.tcl b/ds9/parsers/zscalesendlex.tcl new file mode 100644 index 0000000..32c3ef0 --- /dev/null +++ b/ds9/parsers/zscalesendlex.tcl @@ -0,0 +1,278 @@ +package provide DS9 1.0 + +###### +# Begin autogenerated fickle (version 2.1) routines. +# Although fickle 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/fickle for other details. +###### + +namespace eval zscalesend { + variable yylval + + variable yytext {} + variable yyleng 0 + variable yyin stdin + variable yyout stdout + variable yy_current_buffer {} + + variable yylineno 1 + + variable index_ 0 + variable done_ 0 +} + +# ECHO copies yytext to the scanner's output if no arguments are +# given. The scanner writes its ECHO output to the yyout global +# (default, stdout), which may be redefined by the user simply by +# assigning it to some other channel. +# -- from the flex(1) man page +proc zscalesend::ECHO {{s ""}} { + variable yytext + variable yyout + + if {$s == ""} { + puts -nonewline $yyout $yytext + } else { + puts -nonewline $yyout $s + } +} + +# YY_FLUSH_BUFFER flushes the scanner's internal buffer so that the +# next time the scanner attempts to match a token, it will first +# refill the buffer using YY_INPUT. +# -- from the flex(1) man page +proc zscalesend::YY_FLUSH_BUFFER {} { + variable yy_current_buffer + variable index_ + variable done_ + + set yy_current_buffer "" + set index_ 0 + set done_ 0 +} + +# yyrestart(new_file) may be called to point yyin at the new input +# file. The switch-over to the new file is immediate (any previously +# buffered-up input is lost). Note that calling yyrestart with yyin +# as an argument thus throws away the current input buffer and +# continues scanning the same input file. +# -- from the flex(1) man page +proc zscalesend::yyrestart {new_file} { + variable yyin + + set yyin $new_file + YY_FLUSH_BUFFER +} + +# The nature of how it gets its input can be controlled by defining +# the YY_INPUT macro. YY_INPUT's calling sequence is +# "YY_INPUT(buf,result,max_size)". Its action is to place up to +# max_size characters in the character array buf and return in the +# integer variable result either the number of characters read or the +# constant YY_NULL (0 on Unix systems) to indicate EOF. The default +# YY_INPUT reads from the global file-pointer "yyin". +# -- from the flex(1) man page +proc zscalesend::YY_INPUT {buf result max_size} { + variable yyin + + upvar $result ret_val + upvar $buf new_data + if {$yyin != ""} { + set new_data [read $yyin $max_size] + set ret_val [string length $new_data] + } else { + set new_data "" + set ret_val 0 + } +} + +# yy_scan_string sets up input buffers for scanning in-memory +# strings instead of files. Note that switching input sources does +# not change the start condition. +# -- from the flex(1) man page +proc zscalesend::yy_scan_string {str} { + variable yy_current_buffer + variable yyin + + append yy_current_buffer $str + set yyin "" +} + +# unput(c) puts the character c back onto the input stream. It will +# be the next character scanned. +# -- from the flex(1) man page +proc zscalesend::unput {c} { + variable yy_current_buffer + variable index_ + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s $c + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] +} + +# Returns all but the first n characters of the current token back to +# the input stream, where they will be rescanned when the scanner +# looks for the next match. yytext and yyleng are adjusted +# appropriately. +# -- from the flex(1) man page +proc zscalesend::yyless {n} { + variable yy_current_buffer + variable index_ + variable yytext + variable yyleng + + set s [string range $yy_current_buffer 0 [expr {$index_ - 1}]] + append s [string range $yytext $n end] + set yy_current_buffer [append s [string range $yy_current_buffer $index_ end]] + set yytext [string range $yytext 0 [expr {$n - 1}]] + set yyleng [string length $yytext] +} + +# input() reads the next character from the input stream. +# -- from the flex(1) man page +proc zscalesend::input {} { + variable yy_current_buffer + variable index_ + variable done_ + + if {[string length $yy_current_buffer] - $index_ < 1024} { + set new_buffer "" + set new_buffer_size 0 + if {$done_ == 0} { + YY_INPUT new_buffer new_buffer_size 1024 + append yy_current_buffer $new_buffer + if {$new_buffer_size == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + return {} + } + } + } + set c [string index $yy_current_buffer $index_] + incr index_ + return $c +} + +###### +# autogenerated yylex function created by fickle +###### + +# Whenever yylex() is called, it scans tokens from the global input +# file yyin (which defaults to stdin). It continues until it either +# reaches an end-of-file (at which point it returns the value 0) or +# one of its actions executes a return statement. +# -- from the flex(1) man page +proc zscalesend::yylex {} { + variable yylval + + variable yytext + variable yylineno + variable yyleng + variable yy_current_buffer + variable yy_flex_debug + + variable index_ + variable done_ + variable state_table_ + +set CONTRAST_ 257 +set SAMPLE_ 258 +set LINE_ 259 + + while {1} { + if {[string length $yy_current_buffer] - $index_ < 1024} { + if {$done_ == 0} { + set buffer_size 0 + set new_buffer "" + YY_INPUT new_buffer buffer_size 1024 + append yy_current_buffer $new_buffer + if {$buffer_size == 0 && \ + [string length $yy_current_buffer] - $index_ == 0} { + set done_ 1 + } + } + if $done_ { + if {[string length $yy_current_buffer] - $index_ == 0} { + break + } + } + } + set yyleng 0 + set matched_rule -1 + # rule 0: contrast + if {[regexp -start $index_ -indices -line -nocase -- {\A(contrast)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 0 + } + # rule 1: sample + if {[regexp -start $index_ -indices -line -nocase -- {\A(sample)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 1 + } + # rule 2: line + if {[regexp -start $index_ -indices -line -nocase -- {\A(line)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 2 + } + # rule 3: \s + if {[regexp -start $index_ -indices -line -nocase -- {\A(\s)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 3 + } + # rule 4: . + if {[regexp -start $index_ -indices -line -nocase -- {\A(.)} $yy_current_buffer match] > 0 && \ + [lindex $match 1] - $index_ + 1 > $yyleng} { + set yytext [string range $yy_current_buffer $index_ [lindex $match 1]] + set yyleng [string length $yytext] + set matched_rule 4 + } + if {$matched_rule == -1} { + set yytext [string index $yy_current_buffer $index_] + set yyleng 1 + } + incr index_ $yyleng + # workaround for Tcl's circumflex behavior + if {[string index $yytext end] == "\n"} { + set yy_current_buffer [string range $yy_current_buffer $index_ end] + set index_ 0 + } + set numlines [expr {[llength [split $yytext "\n"]] - 1}] + switch -- $matched_rule { + 0 { +return $CONTRAST_ + } + 1 { +return $SAMPLE_ + } + 2 { +return $LINE_ + } + 3 { +# ignore whitespace + } + 4 { +set yylval $yytext; return $yylval + } + default + { puts stderr "unmatched token: $yytext"; exit -1 } + } + incr yylineno $numlines + } + return 0 +} +###### +# end autogenerated fickle functions +###### + diff --git a/ds9/parsers/zscalesendparser.tab.tcl b/ds9/parsers/zscalesendparser.tab.tcl new file mode 100644 index 0000000..266303b --- /dev/null +++ b/ds9/parsers/zscalesendparser.tab.tcl @@ -0,0 +1,3 @@ +set CONTRAST_ 257 +set SAMPLE_ 258 +set LINE_ 259 diff --git a/ds9/parsers/zscalesendparser.tcl b/ds9/parsers/zscalesendparser.tcl new file mode 100644 index 0000000..07d31fb --- /dev/null +++ b/ds9/parsers/zscalesendparser.tcl @@ -0,0 +1,276 @@ +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 zscalesend { + variable yylval {} + variable table + variable rules + variable token {} + variable yycnt 0 + variable yyerr 0 + variable save_state 0 + + namespace export yylex +} + +proc zscalesend::YYABORT {} { + return -code return 1 +} + +proc zscalesend::YYACCEPT {} { + return -code return 0 +} + +proc zscalesend::YYERROR {} { + variable yyerr + set yyerr 1 +} + +proc zscalesend::yyclearin {} { + variable token + variable yycnt + set token {} + incr yycnt -1 +} + +proc zscalesend::yyerror {s} { + puts stderr $s +} + +proc zscalesend::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 zscalesend::unsetupvalues {numsyms} { + for {set i 1} {$i <= $numsyms} {incr i} { + upvar 1 $i y + unset y + } +} + +array set zscalesend::table { + 3:0,target 3 + 0:257 shift + 0:258 shift + 0:260 goto + 0:259 shift + 0:258,target 2 + 2:0,target 2 + 4:0,target 0 + 0:257,target 1 + 1:0 reduce + 2:0 reduce + 3:0 reduce + 0:260,target 4 + 0:259,target 3 + 4:0 accept + 1:0,target 1 +} + +array set zscalesend::rules { + 0,l 261 + 1,l 260 + 2,l 260 + 3,l 260 +} + +array set zscalesend::rules { + 0,dc 1 + 2,dc 1 + 1,dc 1 + 3,dc 1 +} + +array set zscalesend::rules { + 2,line 16 + 1,line 15 + 3,line 17 +} + +array set zscalesend::lr1_table { + 4,trans {} + 0,trans {{257 1} {258 2} {259 3} {260 4}} + 4 {{0 0 1}} + 0 {{0 0 0} {1 0 0} {2 0 0} {3 0 0}} + 1,trans {} + 1 {{1 0 1}} + 2,trans {} + 2 {{2 0 1}} + 3,trans {} + 3 {{3 0 1}} +} + +array set zscalesend::token_id_table { + 0,t 0 + 0 {$} + error,t 0 + error error + 258,line 9 + 261,line 18 + error,line 13 + 257 CONTRAST_ + 257,t 0 + 258 SAMPLE_ + 258,t 0 + 260,t 1 + 260 zscalesend + error,title {} + 259 LINE_ + 259,t 0 + 261,t 1 + 261 start' + 257,line 8 + 260,line 14 + 257,title CONTRAST + 259,line 10 + 258,title SAMPLE + 260,title {} + 259,title LINE + 261,title {} +} + +proc zscalesend::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 { ProcessSendCmdGet zscale contrast } + 2 { ProcessSendCmdGet zscale sample } + 3 { ProcessSendCmdGet zscale line } + } + 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 zscalesend::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} -- cgit v0.12