From 6eac06049e2a6911ba9e6c36a1ba624fe0956b39 Mon Sep 17 00:00:00 2001 From: William Joye Date: Tue, 6 Mar 2018 16:25:45 -0500 Subject: add ds9 parsers --- ds9/library/error.tcl | 2 +- ds9/parsers/base.trl | 4 ++++ ds9/parsers/coords.trl | 28 ++++++++++++---------------- ds9/parsers/panparser.tac | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ds9/library/error.tcl b/ds9/library/error.tcl index fac9b8a..9a9311e 100644 --- a/ds9/library/error.tcl +++ b/ds9/library/error.tcl @@ -62,9 +62,9 @@ proc ParserError {msg yycnt yy_current_buffer index_} { Error "$msg: [lindex $yy_current_buffer [expr $yycnt-1]]" } default { - puts stderr "$msg:" puts stderr "$yy_current_buffer" puts stderr [format "%*s" $index_ ^] + puts stderr "$msg:" QuitDS9 } } diff --git a/ds9/parsers/base.trl b/ds9/parsers/base.trl index db44bfa..2399afd 100644 --- a/ds9/parsers/base.trl +++ b/ds9/parsers/base.trl @@ -1,3 +1,7 @@ numeric : INT_ {set _ $1} | REAL_ {set _ $1} + | error { + yyerror "must be: integer or float" + YYABORT + } ; diff --git a/ds9/parsers/coords.trl b/ds9/parsers/coords.trl index 0acc063..c055be1 100644 --- a/ds9/parsers/coords.trl +++ b/ds9/parsers/coords.trl @@ -2,13 +2,12 @@ coordsys : IMAGE_ {set _ image} | PHYSICAL_ {set _ physical} | AMPLIFIER_ {set _ amplifier} | DETECTOR_ {set _ detector} + | error { + yyerror "must be: image|physical|amplifier|detector" + YYABORT + } ; -#| error { -# yyerror "must be: image|physical|amplifier|detector" -# YYABORT -# } - wcssys : WCS_ {set _ wcs} | WCSA_ {set _ wcsa} | WCSB_ {set _ wcsb} @@ -36,13 +35,12 @@ wcssys : WCS_ {set _ wcs} | WCSX_ {set _ wcsx} | WCSY_ {set _ wcsy} | WCSZ_ {set _ wcsz} + | error { + yyerror "must be: wcs|wcsa...wcsz" + YYABORT + } ; -# | error { -# yyerror "must be: wcs|wcsa...wcsz" -# YYABORT -# } - skyframe : FK4_ {set _ fk4} | B1950_ {set _ fk4} | FK5_ {set _ fk5} @@ -50,10 +48,8 @@ skyframe : FK4_ {set _ fk4} | ICRS_ {set _ icrs} | GALACTIC_ {set _ galactic} | ECLIPTIC_ {set _ ecliptic} + | error { + yyerror "must be: fk4|fk5|icrs|galactic|ecliptic" + YYABORT + } ; - -# | error { -# yyerror "must be: fk4|fk5|icrs|galactic|ecliptic" -# YYABORT -# } - diff --git a/ds9/parsers/panparser.tac b/ds9/parsers/panparser.tac index d1c8df9..d76d6d5 100644 --- a/ds9/parsers/panparser.tac +++ b/ds9/parsers/panparser.tac @@ -33,7 +33,7 @@ pan : OPEN_ {PanZoomDialog} | SEXSTR_ SEXSTR_ wcssys skyframe {Pan $1 $2 $3 $4} ; -panto : numeric numeric {PanTo $1 $2 physical fk5} +panto : | numeric numeric {PanTo $1 $2 physical fk5} | numeric numeric coordsys {PanTo $1 $2 $3 fk5} | numeric numeric wcssys {PanTo $1 $2 $3 fk5} | numeric numeric skyframe {PanTo $1 $2 wcs $3} -- cgit v0.12