Browse Source

fix commit "frontend/parse.c, bug fix, PPlex(.."dc1.@m1[vth][1]"..)"

which broke
  let something = foo[var]
notably used in
  examples/Monte_Carlo/MC_ring.sp
pre-master-46
rlar 10 years ago
parent
commit
876086f768
  1. 5
      src/frontend/parse.c
  2. 8
      tests/regression/misc/bugs-2.cir

5
src/frontend/parse.c

@ -680,8 +680,9 @@ PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line)
atsign = 1; atsign = 1;
else if (!atsign && *sbuf == '[') else if (!atsign && *sbuf == '[')
break; break;
else if (atsign && *sbuf == ']') {
sbuf++;
else if (*sbuf == ']') {
if (atsign)
sbuf++;
break; break;
} }

8
tests/regression/misc/bugs-2.cir

@ -17,6 +17,9 @@ let gold = 500m
let bar = foo[2] let bar = foo[2]
let baz = @v1[dc][2] let baz = @v1[dc][2]
let two = 2
let argh = foo[two]
let fail_count = 0 let fail_count = 0
if bar <> 0.5 if bar <> 0.5
@ -29,6 +32,11 @@ if baz <> 0.5
let fail_count = fail_count + 1 let fail_count = fail_count + 1
end end
if argh <> 0.5
echo "ERROR: bar = $&argh should be 0.5"
let fail_count = fail_count + 1
end
if fail_count > 0 if fail_count > 0
echo "ERROR: $&fail_count tests failed" echo "ERROR: $&fail_count tests failed"
quit 1 quit 1

Loading…
Cancel
Save