the i() and v() function application have special semantics

This commit is contained in:
rlar 2011-08-20 15:33:26 +00:00
parent 53ac5a888a
commit 73c9cce851
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2011-08-20 Robert Larice
* src/frontend/parse-bison.y :
the i() and v() function application have special semantics
2011-08-20 Robert Larice
* src/maths/fft/Makefile.am ,
* visualc/vngspice.vcproj :

View File

@ -1,4 +1,7 @@
%{
/*
* (compile (concat "bison " buffer-file-name))
*/
#include <stdio.h>
#include <stdlib.h>
@ -75,7 +78,7 @@
* manifests my expectation, and will issue a `warning' when not met
*/
%expect 2
%expect 3
%token <num> TOK_NUM
%token <str> TOK_STR
@ -144,6 +147,18 @@ exp:
| '-' exp %prec NEG { $$ = mkunode(PT_OP_UMINUS, $2); }
| '~' exp { $$ = mkunode(PT_OP_NOT, $2); }
| TOK_STR '(' TOK_STR ')' {
char c = tolower($1[0]);
if((c == 'i' || c == 'v') && $1[1] == '\0') {
char buf[BSIZE_SP];
sprintf(buf, "%s(%s)", $1, $3);
$$ = mksnode(buf);
} else {
$$ = mkfnode($1, mksnode($3));
}
if(!$$) YYABORT;
}
| TOK_STR '(' exp ')' { $$ = mkfnode($1, $3); if(!$$) YYABORT; }
| exp '=' exp { $$ = mkbnode(PT_OP_EQ, $1, $3); }