diff --git a/ChangeLog b/ChangeLog index 3fcbf727a..6405f2511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 : diff --git a/src/frontend/parse-bison.y b/src/frontend/parse-bison.y index 271534f88..a997314b2 100644 --- a/src/frontend/parse-bison.y +++ b/src/frontend/parse-bison.y @@ -1,4 +1,7 @@ %{ + /* + * (compile (concat "bison " buffer-file-name)) + */ #include #include @@ -75,7 +78,7 @@ * manifests my expectation, and will issue a `warning' when not met */ -%expect 2 +%expect 3 %token TOK_NUM %token 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); }