Skip to content
Snippets Groups Projects
Commit af494d7f authored by Wuttke, Joachim's avatar Wuttke, Joachim Committed by Wuttke, Joachim
Browse files

simplify; keep nodes out of lexer

parent 5428c75f
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,6 @@
#include "obj.hpp"
#include "var.hpp"
#include "expr.hpp"
#include "coord.hpp"
#include "node.hpp"
#include "xax_yacc.hpp"
// xaxtype must also be declared in xax_yacc
......@@ -76,16 +74,13 @@ inf {
return NUM; }
k {
xaxlval->t = RNode( new CNodeIdxK() );
return IDX; }
return xaxtext[0]; }
j {
xaxlval->t = RNode( new CNodeIdxJ() );
return IDX; }
return xaxtext[0]; }
i {
xaxlval->t = RNode( new CNodeIdxI() );
return IDX; }
return xaxtext[0]; }
[xy]|dy|n[ijk]|([zpr]{DIG}+)|outcome|chi2|R2 {
xaxlval->v = PVar( new CVar(xaxtext) );
......@@ -153,7 +148,6 @@ e {
[ \t\n]+ /* eat up whitespace */
"!"|"-"|"+"|"*"|"/"|"%"|"^"|"="|"("|")"|"["|"]"|","|"?"|":"|"{"|"}"|";" {
// printf( "lex: Special character: %s\n", xaxtext );
return xaxtext[0]; }
. {
......
......@@ -74,7 +74,7 @@ int xaxlex(YYSTYPE *xaxlval); // created by lex.l
%left BOP_PM /* error */
/* other tokens created by xax_lex.lpp: */
%token INT NUM STR IDX REF DUMMY CEV FNCT GENI CVIN END CONV PCONV DIRAC IDF
%token INT NUM STR REF DUMMY CEV FNCT GENI CVIN END CONV PCONV DIRAC IDF
/* Grammar follows */
......@@ -106,7 +106,9 @@ exp: /* scalar expression */
INT { $$.t = RNode( new CNodeVal( $1.i ) ); }
| NUM { $$.t = RNode( new CNodeVal( $1.d ) ); }
| STR { $$.t = RNode( new CNodeVal( $1.o ) ); }
| IDX { $$.t = $1.t; }
| 'k' { $$.t = RNode( new CNodeIdxK() ); }
| 'j' { $$.t = RNode( new CNodeIdxJ() ); }
| 'i' { $$.t = RNode( new CNodeIdxI() ); }
| REF bra { $$.t = RNode( new CNodeIva( $1.v, $2.r ) ); }
| IDF { $$.t = RNode( new CNodeIdf( (PCAST<const CObjStr>($1.o))->to_s() ) ); }
| DUMMY { $$.t = RNode( new CNodeDummy() ); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment