From b334d7f6c99078dae9f0ba702a9194f4fd148a77 Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 13 Mar 2018 15:15:30 -0400 Subject: update ds9 parsers --- ds9/parsers/base.fin | 23 ----------------------- ds9/parsers/base.tin | 3 --- ds9/parsers/base.trl | 8 -------- ds9/parsers/binlex.fcl | 3 ++- ds9/parsers/binparser.tac | 5 +++-- ds9/parsers/blocklex.fcl | 3 ++- ds9/parsers/blockparser.tac | 5 +++-- ds9/parsers/cmaplex.fcl | 3 ++- ds9/parsers/cmapparser.tac | 5 +++-- ds9/parsers/colorbarlex.fcl | 3 ++- ds9/parsers/colorbarparser.tac | 5 +++-- ds9/parsers/croplex.fcl | 3 ++- ds9/parsers/cropparser.tac | 5 +++-- ds9/parsers/dssesolex.fcl | 3 ++- ds9/parsers/dssesoparser.tac | 5 +++-- ds9/parsers/dsssaolex.fcl | 3 ++- ds9/parsers/dsssaoparser.tac | 5 +++-- ds9/parsers/dssstscilex.fcl | 3 ++- ds9/parsers/dssstsciparser.tac | 5 +++-- ds9/parsers/numeric.fin | 7 +++++++ ds9/parsers/numeric.tin | 2 ++ ds9/parsers/numeric.trl | 8 ++++++++ ds9/parsers/nvsslex.fcl | 3 ++- ds9/parsers/nvssparser.tac | 5 +++-- ds9/parsers/panlex.fcl | 3 ++- ds9/parsers/panparser.tac | 5 +++-- ds9/parsers/skyviewlex.fcl | 3 ++- ds9/parsers/skyviewparser.tac | 5 +++-- ds9/parsers/string.fin | 16 ++++++++++++++++ ds9/parsers/string.tin | 1 + ds9/parsers/threedlex.fcl | 3 ++- ds9/parsers/threedparser.tac | 5 +++-- ds9/parsers/tilelex.fcl | 2 +- ds9/parsers/tileparser.tac | 6 +++--- ds9/parsers/twomasslex.fcl | 3 ++- ds9/parsers/twomassparser.tac | 5 +++-- ds9/parsers/vlalex.fcl | 3 ++- ds9/parsers/vlaparser.tac | 5 +++-- ds9/parsers/vlsslex.fcl | 3 ++- ds9/parsers/vlssparser.tac | 5 +++-- ds9/parsers/zoomlex.fcl | 3 ++- ds9/parsers/zoomparser.tac | 5 +++-- ds9/parsers/zscalelex.fcl | 3 ++- ds9/parsers/zscaleparser.tac | 11 ++++++----- 44 files changed, 126 insertions(+), 92 deletions(-) delete mode 100644 ds9/parsers/base.fin delete mode 100644 ds9/parsers/base.tin delete mode 100644 ds9/parsers/base.trl create mode 100644 ds9/parsers/numeric.fin create mode 100644 ds9/parsers/numeric.tin create mode 100644 ds9/parsers/numeric.trl create mode 100644 ds9/parsers/string.fin create mode 100644 ds9/parsers/string.tin diff --git a/ds9/parsers/base.fin b/ds9/parsers/base.fin deleted file mode 100644 index 6a63cac..0000000 --- a/ds9/parsers/base.fin +++ /dev/null @@ -1,23 +0,0 @@ -# INT -[+-]?{D}+ {set yylval $yytext; return $INT_} - -# REAL -[+-]?{D}+"."?({E})? | -[+-]?{D}*"."{D}+({E})? {set yylval $yytext; return $REAL_} - -# Quoted STRING -\"[^\"]*\" {set yylval [string range $yytext 1 end-1]; return $STRING_} - -# Quoted STRING -\'[^\']*\' {set yylval [string range $yytext 1 end-1]; return $STRING_} - -# Quoted STRING -\{[^\}]*\} {set yylval [string range $yytext 1 end-1]; return $STRING_} - -# STRING -\S+\S+ {set yylval $yytext; return $STRING_} - -\s # ignore whitespace - -. {set yylval $yytext; return $yylval} - diff --git a/ds9/parsers/base.tin b/ds9/parsers/base.tin deleted file mode 100644 index f885055..0000000 --- a/ds9/parsers/base.tin +++ /dev/null @@ -1,3 +0,0 @@ -%token INT_ -%token REAL_ -%token STRING_ diff --git a/ds9/parsers/base.trl b/ds9/parsers/base.trl deleted file mode 100644 index be68c70..0000000 --- a/ds9/parsers/base.trl +++ /dev/null @@ -1,8 +0,0 @@ -numeric : INT_ {set _ $1} - | REAL_ {set _ $1} - ; - -# | error { -# yyerror "must be: integer or float" -# YYABORT -# } diff --git a/ds9/parsers/binlex.fcl b/ds9/parsers/binlex.fcl index f1ebadd..76054e8 100644 --- a/ds9/parsers/binlex.fcl +++ b/ds9/parsers/binlex.fcl @@ -28,6 +28,7 @@ sum {return $SUM_} to {return $TO_} #include yesno.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/binparser.tac b/ds9/parsers/binparser.tac index dc04007..a9dfc9d 100644 --- a/ds9/parsers/binparser.tac +++ b/ds9/parsers/binparser.tac @@ -2,7 +2,8 @@ %} #include yesno.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -29,7 +30,7 @@ %% #include yesno.trl -#include base.trl +#include numeric.trl command : bin | bin {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/blocklex.fcl b/ds9/parsers/blocklex.fcl index 272cecb..a5acde7 100644 --- a/ds9/parsers/blocklex.fcl +++ b/ds9/parsers/blocklex.fcl @@ -17,6 +17,7 @@ out {return $OUT_} to {return $TO_} #include yesno.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/blockparser.tac b/ds9/parsers/blockparser.tac index b77aaad..b3d5eef 100644 --- a/ds9/parsers/blockparser.tac +++ b/ds9/parsers/blockparser.tac @@ -2,7 +2,8 @@ %} #include yesno.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -18,7 +19,7 @@ %% #include yesno.trl -#include base.trl +#include numeric.trl command : block | block {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/cmaplex.fcl b/ds9/parsers/cmaplex.fcl index 75c0a10..da55b06 100644 --- a/ds9/parsers/cmaplex.fcl +++ b/ds9/parsers/cmaplex.fcl @@ -20,6 +20,7 @@ tag {return $TAG_} value {return $VALUE_} #include yesno.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/cmapparser.tac b/ds9/parsers/cmapparser.tac index 5e48072..5327ff6 100644 --- a/ds9/parsers/cmapparser.tac +++ b/ds9/parsers/cmapparser.tac @@ -2,7 +2,8 @@ %} #include yesno.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -21,7 +22,7 @@ %% #include yesno.trl -#include base.trl +#include numeric.trl command : cmap | cmap {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/colorbarlex.fcl b/ds9/parsers/colorbarlex.fcl index c996be6..b243abe 100644 --- a/ds9/parsers/colorbarlex.fcl +++ b/ds9/parsers/colorbarlex.fcl @@ -21,6 +21,7 @@ vertical {return $VERTICAL_} #include yesno.fin #include font.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/colorbarparser.tac b/ds9/parsers/colorbarparser.tac index eeffc11..2fbc473 100644 --- a/ds9/parsers/colorbarparser.tac +++ b/ds9/parsers/colorbarparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include font.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -23,7 +24,7 @@ #include yesno.trl #include font.trl -#include base.trl +#include numeric.trl command : colorbar | colorbar {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/croplex.fcl b/ds9/parsers/croplex.fcl index 6825dfe..d1a02b7 100644 --- a/ds9/parsers/croplex.fcl +++ b/ds9/parsers/croplex.fcl @@ -18,7 +18,8 @@ reset {return $RESET_} #include skyformat.fin #include skyframe.fin #include coords.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/cropparser.tac b/ds9/parsers/cropparser.tac index 7977311..bf5026b 100644 --- a/ds9/parsers/cropparser.tac +++ b/ds9/parsers/cropparser.tac @@ -4,7 +4,8 @@ #include skyformat.tin #include skyframe.tin #include coords.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -21,7 +22,7 @@ #include skyformat.trl #include skyframe.trl #include coords.trl -#include base.trl +#include numeric.trl command : crop | crop {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/dssesolex.fcl b/ds9/parsers/dssesolex.fcl index 554d012..bad1e7f 100644 --- a/ds9/parsers/dssesolex.fcl +++ b/ds9/parsers/dssesolex.fcl @@ -14,6 +14,7 @@ dss2-infrared {return $DSS2INFRARED_} #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/dssesoparser.tac b/ds9/parsers/dssesoparser.tac index fe26c0a..c51517a 100644 --- a/ds9/parsers/dssesoparser.tac +++ b/ds9/parsers/dssesoparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -16,7 +17,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : dsseso | dsseso {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/dsssaolex.fcl b/ds9/parsers/dsssaolex.fcl index 843fd2f..c3359c3 100644 --- a/ds9/parsers/dsssaolex.fcl +++ b/ds9/parsers/dsssaolex.fcl @@ -9,6 +9,7 @@ #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/dsssaoparser.tac b/ds9/parsers/dsssaoparser.tac index a41ee1e..9b4cff3 100644 --- a/ds9/parsers/dsssaoparser.tac +++ b/ds9/parsers/dsssaoparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -11,7 +12,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : dsssao | dsssao {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/dssstscilex.fcl b/ds9/parsers/dssstscilex.fcl index f02f926..bbecd3a 100644 --- a/ds9/parsers/dssstscilex.fcl +++ b/ds9/parsers/dssstscilex.fcl @@ -19,6 +19,7 @@ phase2_gsc1 {return $GSC1_} #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/dssstsciparser.tac b/ds9/parsers/dssstsciparser.tac index e8b15dc..38e6792 100644 --- a/ds9/parsers/dssstsciparser.tac +++ b/ds9/parsers/dssstsciparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -21,7 +22,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : dssstsci | dssstsci {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/numeric.fin b/ds9/parsers/numeric.fin new file mode 100644 index 0000000..1efd552 --- /dev/null +++ b/ds9/parsers/numeric.fin @@ -0,0 +1,7 @@ +# INT +[+-]?{D}+ {set yylval $yytext; return $INT_} + +# REAL +[+-]?{D}+"."?({E})? | +[+-]?{D}*"."{D}+({E})? {set yylval $yytext; return $REAL_} + diff --git a/ds9/parsers/numeric.tin b/ds9/parsers/numeric.tin new file mode 100644 index 0000000..95ac7f9 --- /dev/null +++ b/ds9/parsers/numeric.tin @@ -0,0 +1,2 @@ +%token INT_ +%token REAL_ diff --git a/ds9/parsers/numeric.trl b/ds9/parsers/numeric.trl new file mode 100644 index 0000000..be68c70 --- /dev/null +++ b/ds9/parsers/numeric.trl @@ -0,0 +1,8 @@ +numeric : INT_ {set _ $1} + | REAL_ {set _ $1} + ; + +# | error { +# yyerror "must be: integer or float" +# YYABORT +# } diff --git a/ds9/parsers/nvsslex.fcl b/ds9/parsers/nvsslex.fcl index f809d83..977e916 100644 --- a/ds9/parsers/nvsslex.fcl +++ b/ds9/parsers/nvsslex.fcl @@ -9,6 +9,7 @@ #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/nvssparser.tac b/ds9/parsers/nvssparser.tac index 34add74..ccd9be0 100644 --- a/ds9/parsers/nvssparser.tac +++ b/ds9/parsers/nvssparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -11,7 +12,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : nvss | nvss {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/panlex.fcl b/ds9/parsers/panlex.fcl index 31f18b1..e6b6738 100644 --- a/ds9/parsers/panlex.fcl +++ b/ds9/parsers/panlex.fcl @@ -13,7 +13,8 @@ to {return $TO_} #include skyframe.fin #include coords.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/panparser.tac b/ds9/parsers/panparser.tac index 900275d..487ce0c 100644 --- a/ds9/parsers/panparser.tac +++ b/ds9/parsers/panparser.tac @@ -3,7 +3,8 @@ #include skyframe.tin #include coords.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -15,7 +16,7 @@ #include skyframe.trl #include coords.trl -#include base.trl +#include numeric.trl command : pan | pan {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/skyviewlex.fcl b/ds9/parsers/skyviewlex.fcl index 15af544..415463f 100644 --- a/ds9/parsers/skyviewlex.fcl +++ b/ds9/parsers/skyviewlex.fcl @@ -23,6 +23,7 @@ update {return $UPDATE_} #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/skyviewparser.tac b/ds9/parsers/skyviewparser.tac index e9da994..cd052fb 100644 --- a/ds9/parsers/skyviewparser.tac +++ b/ds9/parsers/skyviewparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -13,7 +14,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : skyview | skyview {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/string.fin b/ds9/parsers/string.fin new file mode 100644 index 0000000..5f02bf8 --- /dev/null +++ b/ds9/parsers/string.fin @@ -0,0 +1,16 @@ +# Quoted STRING +\"[^\"]*\" {set yylval [string range $yytext 1 end-1]; return $STRING_} + +# Quoted STRING +\'[^\']*\' {set yylval [string range $yytext 1 end-1]; return $STRING_} + +# Quoted STRING +\{[^\}]*\} {set yylval [string range $yytext 1 end-1]; return $STRING_} + +# STRING +\S+\S+ {set yylval $yytext; return $STRING_} + +\s # ignore whitespace + +. {set yylval $yytext; return $yylval} + diff --git a/ds9/parsers/string.tin b/ds9/parsers/string.tin new file mode 100644 index 0000000..fefa662 --- /dev/null +++ b/ds9/parsers/string.tin @@ -0,0 +1 @@ +%token STRING_ diff --git a/ds9/parsers/threedlex.fcl b/ds9/parsers/threedlex.fcl index 0a568fb..ecfe7e3 100644 --- a/ds9/parsers/threedlex.fcl +++ b/ds9/parsers/threedlex.fcl @@ -30,6 +30,7 @@ view {return $VIEW_} vp {return $VIEW_} #include yesno.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/threedparser.tac b/ds9/parsers/threedparser.tac index 564adf9..54c95d8 100644 --- a/ds9/parsers/threedparser.tac +++ b/ds9/parsers/threedparser.tac @@ -2,7 +2,8 @@ %} #include yesno.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -27,7 +28,7 @@ %% #include yesno.trl -#include base.trl +#include numeric.trl command : 3d | 3d {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/tilelex.fcl b/ds9/parsers/tilelex.fcl index afcddca..8c94187 100644 --- a/ds9/parsers/tilelex.fcl +++ b/ds9/parsers/tilelex.fcl @@ -18,6 +18,6 @@ mode {return $MODE_} row {return $ROW_} #include yesno.fin -#include base.fin +#include string.fin %% diff --git a/ds9/parsers/tileparser.tac b/ds9/parsers/tileparser.tac index 9276a05..4ef0cef 100644 --- a/ds9/parsers/tileparser.tac +++ b/ds9/parsers/tileparser.tac @@ -2,7 +2,8 @@ %} #include yesno.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -19,8 +20,7 @@ %% #include yesno.trl -#include base.trl - +#include numeric.trl yes : YES_ {set _ 1} | ON_ {set _ 1} diff --git a/ds9/parsers/twomasslex.fcl b/ds9/parsers/twomasslex.fcl index 2a0d497..833b1b1 100644 --- a/ds9/parsers/twomasslex.fcl +++ b/ds9/parsers/twomasslex.fcl @@ -9,6 +9,7 @@ #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/twomassparser.tac b/ds9/parsers/twomassparser.tac index c43ac8b..00f8fbb 100644 --- a/ds9/parsers/twomassparser.tac +++ b/ds9/parsers/twomassparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -11,7 +12,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : 2mass | 2mass {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/vlalex.fcl b/ds9/parsers/vlalex.fcl index a7629e8..b772010 100644 --- a/ds9/parsers/vlalex.fcl +++ b/ds9/parsers/vlalex.fcl @@ -12,6 +12,7 @@ first {return $FIRST_} #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/vlaparser.tac b/ds9/parsers/vlaparser.tac index d44d77e..b2a7ca8 100644 --- a/ds9/parsers/vlaparser.tac +++ b/ds9/parsers/vlaparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -14,7 +15,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : vla | vla {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/vlsslex.fcl b/ds9/parsers/vlsslex.fcl index 93bba40..1408972 100644 --- a/ds9/parsers/vlsslex.fcl +++ b/ds9/parsers/vlsslex.fcl @@ -9,6 +9,7 @@ #include yesno.fin #include imgsvr.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/vlssparser.tac b/ds9/parsers/vlssparser.tac index cbf7ab6..6fcaf1f 100644 --- a/ds9/parsers/vlssparser.tac +++ b/ds9/parsers/vlssparser.tac @@ -3,7 +3,8 @@ #include yesno.tin #include imgsvr.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -11,7 +12,7 @@ #include yesno.trl #include imgsvr.trl -#include base.trl +#include numeric.trl command : vlss | vlss {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/zoomlex.fcl b/ds9/parsers/zoomlex.fcl index f2cfd2c..8a505d4 100644 --- a/ds9/parsers/zoomlex.fcl +++ b/ds9/parsers/zoomlex.fcl @@ -14,6 +14,7 @@ open {return $OPEN_} out {return $OUT_} to {return $TO_} -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/zoomparser.tac b/ds9/parsers/zoomparser.tac index 41ad906..df3f7a1 100644 --- a/ds9/parsers/zoomparser.tac +++ b/ds9/parsers/zoomparser.tac @@ -1,7 +1,8 @@ %{ %} -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -14,7 +15,7 @@ %% -#include base.trl +#include numeric.trl command : zoom | zoom {yyclearin; YYACCEPT} STRING_ diff --git a/ds9/parsers/zscalelex.fcl b/ds9/parsers/zscalelex.fcl index cc30329..062e49f 100644 --- a/ds9/parsers/zscalelex.fcl +++ b/ds9/parsers/zscalelex.fcl @@ -12,6 +12,7 @@ sample {return $SAMPLE_} line {return $LINE_} #include yesno.fin -#include base.fin +#include numeric.fin +#include string.fin %% diff --git a/ds9/parsers/zscaleparser.tac b/ds9/parsers/zscaleparser.tac index 90a4cf6..573674a 100644 --- a/ds9/parsers/zscaleparser.tac +++ b/ds9/parsers/zscaleparser.tac @@ -2,7 +2,8 @@ %} #include yesno.tin -#include base.tin +#include numeric.tin +#include string.tin %start command @@ -13,16 +14,16 @@ %% #include yesno.trl -#include base.trl +#include numeric.trl command : zscale | zscale {yyclearin; YYACCEPT} STRING_ ; zscale : yesno {global scale; set scale(mode) zscale; ChangeScaleMode} - | CONTRAST_ {global zscale; set zscale(contrast) zscale; ChangeZScale} - | SAMPLE_ {global zscale; set zscale(sample) zscale; ChangeZScale} - | LINE_ {global zscale; set zscale(line) zscale; ChangeZScale} + | CONTRAST_ numeric {global zscale; set zscale(contrast) $2; ChangeZScale} + | SAMPLE_ INT_ {global zscale; set zscale(sample) $2; ChangeZScale} + | LINE_ INT_ {global zscale; set zscale(line) $2; ChangeZScale} ; %% -- cgit v0.12