summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-06-23 19:27:47 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-06-23 19:27:47 (GMT)
commitd6c3ee821cffa1719a2b730337ad67abe9b7e593 (patch)
treefe587021df801a03c2b30f2a2e296744f571cb3c /ds9
parenta5f2cd50b9abc36ededa34e3982064e5f7f07829 (diff)
downloadblt-d6c3ee821cffa1719a2b730337ad67abe9b7e593.zip
blt-d6c3ee821cffa1719a2b730337ad67abe9b7e593.tar.gz
blt-d6c3ee821cffa1719a2b730337ad67abe9b7e593.tar.bz2
new parser
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/lex.fcl26
-rw-r--r--ds9/library/parser.tac47
-rw-r--r--ds9/library/source.tcl4
-rw-r--r--ds9/make.include4
4 files changed, 69 insertions, 12 deletions
diff --git a/ds9/library/lex.fcl b/ds9/library/lex.fcl
index eb3ca74..c07811f 100644
--- a/ds9/library/lex.fcl
+++ b/ds9/library/lex.fcl
@@ -2,9 +2,27 @@
source $ds9(root)/library/parser.tab.tcl
%}
+%option noyywrap
+%option caseless
+%option nodefault
+%option nointeractive
+
%%
-about {return ABOUT_}
-. {set ::yylval $yytext; return $yytext}
-%%
-#yylex
+\n #
+\s # ignore whitespace
+. { set ::yylval $yytext; return $yytext }
+
+2mass {return $::2MASS_}
+3d {return $::3D_}
+about {return $::ABOUT_}
+align {return $::ALIGN_}
+analysis {return $::ANALYSIS_}
+array {return $::ARRAY_}
+asinh {return $::ASINH_}
+
+no {return $::NO_}
+
+yes {return $::YES_}
+
+
diff --git a/ds9/library/parser.tac b/ds9/library/parser.tac
index f791f7e..e0dd3d3 100644
--- a/ds9/library/parser.tac
+++ b/ds9/library/parser.tac
@@ -1,14 +1,53 @@
%{
-source $ds9(root)/library/lex.tcl
%}
+%token 2MASS_
+%token 3D_
%token ABOUT_
+%token ALIGN_
+%token ANALYSIS_
+%token ARRAY_
+%token ASINH_
+
+%token NO_
+
+%token YES_
%%
-command : ABOUT_
- ;
+commands : commands command
+ | command
+ ;
+
+command : 2MASS_ 2mass
+ | 3D_ 3d
+ | ABOUT_ about
+ | ALIGN_ align
+ | ANALYSIS_ analysis
+ | ARRAY_ array
+ | ASINH_ asinh
+ ;
+
+2mass : {puts "*** 3D ***"}
+ ;
+
+3d : {puts "*** 2MASS ***"}
+ ;
+
+about : {puts "*** ABOUT ***"}
+ ;
+
+align : {puts "*** ALIGN ***"}
+ ;
+
+analysis : {puts "*** ANALYSIS ***"}
+ ;
+
+array : {puts "*** ARRAY ***"}
+ ;
+
+asinh : {puts "*** ASINH ***"}
+ ;
%%
-#yyparse
diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl
index 7eb3603..cf78a6b 100644
--- a/ds9/library/source.tcl
+++ b/ds9/library/source.tcl
@@ -187,8 +187,8 @@ source $ds9(root)/library/wcs.tcl
source $ds9(root)/library/xmfbox.tcl
source $ds9(root)/library/xmlrpc.tcl
source $ds9(root)/library/xpa.tcl
-#source $ds9(root)/library/lex.tcl
-#source $ds9(root)/library/parser.tcl
+source $ds9(root)/library/lex.tcl
+source $ds9(root)/library/parser.tcl
switch [tk windowingsystem] {
x11 {}
diff --git a/ds9/make.include b/ds9/make.include
index 7692b2b..ff5930e 100644
--- a/ds9/make.include
+++ b/ds9/make.include
@@ -1,10 +1,10 @@
#--------------------------parser
$(prefix)/ds9/library/lex.tcl : $(prefix)/ds9/library/lex.fcl
- $(TCLSH_PROG) $(prefix)/fickle/fickle.tcl -v -i -o $@ $?
+ $(TCLSH_PROG) $(prefix)/fickle/fickle.tcl -o $@ $?
$(prefix)/ds9/library/parser.tcl : $(prefix)/ds9/library/parser.tac
- $(TCLSH_PROG) $(prefix)/taccle/taccle.tcl -d -v -w -o $@ $?
+ $(TCLSH_PROG) $(prefix)/taccle/taccle.tcl -d -o $@ $?
#--------------------------framework