summaryrefslogtreecommitdiffstats
path: root/ds9/parsers
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-04-18 21:27:09 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-04-18 21:27:09 (GMT)
commit12e5a42f7ba80ba930a5c3cc2cf29c98651bc590 (patch)
tree06d4fe242b3c46ea3cb5bf9c5f2119d403b7217f /ds9/parsers
parentbbd309cf4ad6a9aec2bf1dca5e5c2bd29765e9c9 (diff)
downloadblt-12e5a42f7ba80ba930a5c3cc2cf29c98651bc590.zip
blt-12e5a42f7ba80ba930a5c3cc2cf29c98651bc590.tar.gz
blt-12e5a42f7ba80ba930a5c3cc2cf29c98651bc590.tar.bz2
add ds9 pagesetup parser
Diffstat (limited to 'ds9/parsers')
-rw-r--r--ds9/parsers/pagesetuplex.fcl27
-rw-r--r--ds9/parsers/pagesetupparser.tac54
-rw-r--r--ds9/parsers/precisionlex.fcl9
3 files changed, 82 insertions, 8 deletions
diff --git a/ds9/parsers/pagesetuplex.fcl b/ds9/parsers/pagesetuplex.fcl
new file mode 100644
index 0000000..9ca4730
--- /dev/null
+++ b/ds9/parsers/pagesetuplex.fcl
@@ -0,0 +1,27 @@
+#tab pagesetupparser.tab.tcl
+
+%{
+%}
+
+#include defs.fin
+
+%%
+
+orient {return $ORIENT_}
+scale {return $SCALE_}
+size {return $SIZE_}
+
+portrait {return $PORTRAIT_}
+landscape {return $LANDSCAPE_}
+
+letter {return $LETTER_}
+legal {return $LEGAL_}
+tabloid {return $TABLOID_}
+poster {return $POSTER_}
+a4 {return $A4_}
+
+
+#include numeric.fin
+#include string.fin
+
+%%
diff --git a/ds9/parsers/pagesetupparser.tac b/ds9/parsers/pagesetupparser.tac
new file mode 100644
index 0000000..5025c00
--- /dev/null
+++ b/ds9/parsers/pagesetupparser.tac
@@ -0,0 +1,54 @@
+%{
+%}
+
+#include numeric.tin
+#include string.tin
+
+%start command
+
+%token ORIENT_
+%token SCALE_
+%token SIZE_
+
+%token PORTRAIT_
+%token LANDSCAPE_
+
+%token LETTER_
+%token LEGAL_
+%token TABLOID_
+%token POSTER_
+%token A4_
+
+%%
+
+#include numeric.trl
+
+command : pagesetup
+ | pagesetup {yyclearin; YYACCEPT} STRING_
+ ;
+
+pagesetup : ORIENT_ orient {PSCmdSet orient $2}
+ | SCALE_ numeric {PSCmdSet scale $2}
+ | SIZE_ size {PSCmdSet size $2}
+ ;
+
+orient : PORTRAIT_ {set _ portrait}
+ | LANDSCAPE_ {set _ landscape}
+ ;
+
+size : LETTER_ {set _ letter}
+ | LEGAL_ {set _ legal}
+ | TABLOID_ {set _ tabloid}
+ | POSTER_ {set _ poster}
+ | A4_ {set _ a4}
+ ;
+
+%%
+
+proc pagesetup::yyerror {msg} {
+ variable yycnt
+ variable yy_current_buffer
+ variable index_
+
+ ParserError $msg $yycnt $yy_current_buffer $index_
+}
diff --git a/ds9/parsers/precisionlex.fcl b/ds9/parsers/precisionlex.fcl
index 8a505d4..ab5d199 100644
--- a/ds9/parsers/precisionlex.fcl
+++ b/ds9/parsers/precisionlex.fcl
@@ -1,4 +1,4 @@
-#tab zoomparser.tab.tcl
+#tab precisionparser.tab.tcl
%{
%}
@@ -7,13 +7,6 @@
%%
-close {return $CLOSE_}
-in {return $IN_}
-fit {return $FIT_}
-open {return $OPEN_}
-out {return $OUT_}
-to {return $TO_}
-
#include numeric.fin
#include string.fin