summaryrefslogtreecommitdiffstats
path: root/ds9/parsers
diff options
context:
space:
mode:
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