diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-03-28 17:53:23 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-03-28 17:53:23 (GMT) |
commit | 3f3cb3715d17725b7f2151ab4365331948968f9b (patch) | |
tree | 525dc28f86bee6f9c4d212d00388512d0220d31c /ds9 | |
parent | ef45c9f49f99dc783c8535898104c56205eb2e76 (diff) | |
download | blt-3f3cb3715d17725b7f2151ab4365331948968f9b.zip blt-3f3cb3715d17725b7f2151ab4365331948968f9b.tar.gz blt-3f3cb3715d17725b7f2151ab4365331948968f9b.tar.bz2 |
add ds9 plot parser
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/plotprocess.tcl | 8 | ||||
-rw-r--r-- | ds9/library/source.tcl | 2 | ||||
-rw-r--r-- | ds9/parsers/catparser.tac | 8 | ||||
-rw-r--r-- | ds9/parsers/plotlex.fcl | 66 | ||||
-rw-r--r-- | ds9/parsers/plotparser.tac | 173 |
5 files changed, 253 insertions, 4 deletions
diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index b4dcd6b..bfe02a6 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -100,6 +100,13 @@ proc PrefsDialogPlot {} { } proc ProcessPlotCmd {xarname iname buf fn} { + global debug + if {$debug(tcl,parser)} { + plot::YY_FLUSH_BUFFER + plot::yy_scan_string [lrange $var $i end] + plot::yyparse + incr i [expr $plot::yycnt-1] + } else { upvar $xarname xar upvar $iname i @@ -433,6 +440,7 @@ proc ProcessPlotCmd {xarname iname buf fn} { # force update update idletasks } +} proc ProcessPlotNew {varname xarname iname buf} { upvar #0 $varname var diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index c6df433..e3e1ca0 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -218,6 +218,8 @@ source $ds9(root)/library/nvssparser.tcl source $ds9(root)/library/nvsslex.tcl source $ds9(root)/library/panparser.tcl source $ds9(root)/library/panlex.tcl +source $ds9(root)/library/plotparser.tcl +source $ds9(root)/library/plotlex.tcl source $ds9(root)/library/skyviewparser.tcl source $ds9(root)/library/skyviewlex.tcl source $ds9(root)/library/threedparser.tcl diff --git a/ds9/parsers/catparser.tac b/ds9/parsers/catparser.tac index 42d65b9..bbe1d26 100644 --- a/ds9/parsers/catparser.tac +++ b/ds9/parsers/catparser.tac @@ -118,15 +118,15 @@ catalog : {CATTool} | LOAD_ STRING_ {CatalogCmdLoad $2 VOTRead} | IMPORT_ reader STRING_ {CatalogCmdLoad $3 $2} - | {CatalogCmdCheck} cat + | {CatalogCmdCheck} catCmd | STRING_ {CatalogCmdRef $1} - | STRING_ {CatalogCmdRef $1} cat + | STRING_ {CatalogCmdRef $1} catCmd # backward compatibility | CDS_ STRING_ {CatalogCmdRef $2} - | CDS_ STRING_ {CatalogCmdRef $2} cat + | CDS_ STRING_ {CatalogCmdRef $2} catCmd ; -cat : coordinate +catCmd : coordinate | ALLCOLS_ yesno {CatalogCmdCat allcols $2} | ALLROWS_ yesno {CatalogCmdCat allrows $2} | CANCEL_ {global cvarname; ARCancel $cvarname} diff --git a/ds9/parsers/plotlex.fcl b/ds9/parsers/plotlex.fcl new file mode 100644 index 0000000..7f661cb --- /dev/null +++ b/ds9/parsers/plotlex.fcl @@ -0,0 +1,66 @@ +#tab plotparser.tab.tcl + +%{ +%} + +#include defs.fin + +%% + +a4 {return $A4_} +axis {return $AXIS_} +bar {return $BAR_} +barmode {return $BARMODE_} +clear {return $CLEAR_} +close {return $CLOSE_} +color {return $COLOR_} +command {return $COMMAND_} +dash {return $DASH_} +data {return $DATA_} +destination {return $DESTINATION_} +duplicate {return $DUPLICATE_} +error {return $ERROR_} +file {return $FILE_} +filename {return $FILENAME_} +font {return $FONT_} +gray {return $GRAY_} +landscape {return $LANDSCAPE_} +legal {return $LEGAL_} +legend {return $LEGEND_} +letter {return $LETTER_} +line {return $LINE_} +list {return $LIST_} +load {return $LOAD_} +loadconfig {return $LOADCONFIG_} +mode {return $MODE_} +name {return $NAME_} +new {return $NEW_} +orient {return $ORIENT_} +pagesetup {return $PAGESETUP_} +portrait {return $PORTRAIT_} +poster {return $POSTER_} +print {return $PRINT_} +printer {return $PRINTER_} +rgb {return $RGB_} +save {return $SAVE_} +saveconfig {return $SAVECONFIG_} +scatter {return $SCATTER_} +select {return $SELECT_} +shape {return $SHAPE_} +show {return $SHOW_} +size {return $SIZE_} +smooth {return $SMOOTH_} +stats {return $STATS_} +tabloid {return $TABLOID_} +title {return $TITLE_} +width {return $WIDTH_} + +xy {return $XY_} +xyex {return $XYEX_} +xyey {return $XYEY_} +xyexey {return $XYEXEY_} + +#include numeric.fin +#include string.fin + +%% diff --git a/ds9/parsers/plotparser.tac b/ds9/parsers/plotparser.tac new file mode 100644 index 0000000..feba93c --- /dev/null +++ b/ds9/parsers/plotparser.tac @@ -0,0 +1,173 @@ +%{ +%} + +#include numeric.tin +#include string.tin + +%start command + +%token A4_ +%token AXIS_ +%token BAR_ +%token BARMODE_ +%token CLEAR_ +%token CLOSE_ +%token COLOR_ +%token COMMAND_ +%token DASH_ +%token DATA_ +%token DESTINATION_ +%token DUPLICATE_ +%token ERROR_ +%token FILE_ +%token FILENAME_ +%token FONT_ +%token GRAY_ +%token LANDSCAPE_ +%token LEGAL_ +%token LEGEND_ +%token LETTER_ +%token LINE_ +%token LIST_ +%token LOAD_ +%token LOADCONFIG_ +%token MODE_ +%token NAME_ +%token NEW_ +%token ORIENT_ +%token PAGESETUP_ +%token PORTRAIT_ +%token POSTER_ +%token PRINT_ +%token PRINTER_ +%token RGB_ +%token SAVE_ +%token SAVECONFIG_ +%token SCATTER_ +%token SELECT_ +%token SHAPE_ +%token SHOW_ +%token SIZE_ +%token SMOOTH_ +%token STATS_ +%token TABLOID_ +%token TITLE_ +%token WIDTH_ + +%token XY_ +%token XYEX_ +%token XYEY_ +%token XYEXEY_ + +%% + +#include numeric.trl + +command : plot + | plot {yyclearin; YYACCEPT} STRING_ + ; + +plot : new + | NEW_ new + | {PlotCmdCheck} plotCmd + | STRING_ {PlotCmdRef $1} + | STRING_ {PlotCmdRef $1} plotCmd + ; + +plotCmd : DATA_ dim + + | LOAD_ load + | SAVE_ STRING_ + | CLEAR_ + | DUPLICATE_ + | STATS_ + | LIST_ + | LOADCONFIG_ STRING_ + | SAVECONFIG_ STRING_ + | PAGESETUP_ pagesetup + | PRINT_ print + | CLOSE_ + + | MODE_ + + | AXIS_ + | LEGEND_ + | FONT_ + | TITLE_ + | BARMODE_ + + | SHOW_ + | SHAPE_ + | SMOOTH_ + | COLOR_ + | WIDTH_ + | DASH_ + | ERROR_ + | NAME_ + + | SELECT_ + ; + +new : line + | LINE_ line + | BAR_ bar + | SCATTER_ scatter + ; + +line : {PlotCmdLine {} {} {} {} xy} + ; + +bar : {PlotCmdBar {} {} {} {} xy} + ; + +scatter : {PlotCmdScatter {} {} {} {} xy} + ; + +dim : XY_ {set _ xy} + | XYEX_ {set _ xyex} + | XYEY_ {set _ xyey} + | XYEXEY_ {set _ xyexey} + ; + +load : STRING_ + | STRING_ dim + ; + +pagesetup : ORIENT_ pageOrient + | SIZE_ pageSize + ; + +pageOrient : PORTRAIT_ + | LANDSCAPE_ + ; + +pageSize : LETTER_ + | LEGAL_ + | TABLOID_ + | POSTER_ + | A4_ + ; + +print : DESTINATION_ printDest + | COMMAND_ STRING_ + | FILENAME_ STRING_ + | COLOR_ printColor + ; + +printDest : PRINTER_ + | FILE_ + ; + +printColor : RGB_ + | GRAY_ + ; + +%% + +proc plot::yyerror {msg} { + variable yycnt + variable yy_current_buffer + variable index_ + + ParserError $msg $yycnt $yy_current_buffer $index_ +} |