diff options
author | fche <fche> | 2005-06-08 22:02:09 +0000 |
---|---|---|
committer | fche <fche> | 2005-06-08 22:02:09 +0000 |
commit | bb2e3076ea20631d4606050550bc9664204f2c62 (patch) | |
tree | ef9cfb841ddb001c1f3aa266523f1ff6f56b21b5 /testsuite/transok | |
parent | 22f4623195facb4cbc1b50c45c0bd689f6958a9d (diff) | |
download | systemtap-steved-bb2e3076ea20631d4606050550bc9664204f2c62.tar.gz systemtap-steved-bb2e3076ea20631d4606050550bc9664204f2c62.tar.xz systemtap-steved-bb2e3076ea20631d4606050550bc9664204f2c62.zip |
2005-06-08 Frank Ch. Eigler <fche@redhat.com>
systemtap/916
Implement all basic scalar operators, including modify-assignment.
* parse.cxx (lexer): Allow multi-character lookahead in order to
scan 1/2/3-character operators.
(parse_boolean_or/and/xor/shift): New routines.
* translate.cxx (visit_assignment, visit_binary_expression,
visit_*_crement): Generally rewrote.
(visit_*): Added more parentheses in output.
(emit_module_init): Initialize globals.
* staptree.h, elaborate.cxx, elaborate.h: Remove exponentiation.
* main.cxx (main): Add an end-of-line to output file.
* testsuite/*: Several new tests.
Diffstat (limited to 'testsuite/transok')
-rwxr-xr-x | testsuite/transok/five.stp | 2 | ||||
-rwxr-xr-x | testsuite/transok/one.stp | 56 | ||||
-rwxr-xr-x | testsuite/transok/three.stp | 7 | ||||
-rwxr-xr-x | testsuite/transok/two.stp | 2 |
4 files changed, 61 insertions, 6 deletions
diff --git a/testsuite/transok/five.stp b/testsuite/transok/five.stp index 266b3408..5cd50cb6 100755 --- a/testsuite/transok/five.stp +++ b/testsuite/transok/five.stp @@ -1,6 +1,6 @@ #! stap -probe two +probe begin { for (;;) ; for (a=0;;) { if (a > 4) break } diff --git a/testsuite/transok/one.stp b/testsuite/transok/one.stp new file mode 100755 index 00000000..6c624f14 --- /dev/null +++ b/testsuite/transok/one.stp @@ -0,0 +1,56 @@ +#! stap -p3 + +probe begin +{ + # all assignment operators + a = b + # a <<< b + a += b + a -= b + a *= b + a /= b + a %= b + a <<= b + a >>= b + a &= b + a ^= b + a |= b + + # all ternary operators + a ? b : c + + # all binary operators + a || b + a && b + a | b + a & b + a ^ b + a < b + a > b + a == b + a != b + a <= b + a >= b + a << b + a >> b + as . bs + as == bs # overload operators for strings + as != bs + a + b + a - b + a * b + a / b + a % b + + # all unary operators + a ++ + a -- + -- a + -- b + ~ a + ! a + ; # grammar glitch + + a + ; # grammar glitch + - a +} diff --git a/testsuite/transok/three.stp b/testsuite/transok/three.stp index c372b271..07703f90 100755 --- a/testsuite/transok/three.stp +++ b/testsuite/transok/three.stp @@ -5,7 +5,7 @@ function f1 (a, b) { d = "hello"; # poo[c] = bab[d] = "hi" bab = "hi"; - bab = poo[c]; + # bab = poo[c]; return 0 } @@ -14,14 +14,13 @@ function f2 () { } global koo -global poo, bab -probe z { +probe begin { f2 (); koo = 1 } -probe x,y { +probe begin, end { f2 (); f1 (f1 (3 * 2 + 1, "foo"), "canoe") } diff --git a/testsuite/transok/two.stp b/testsuite/transok/two.stp index d62e88a8..848934a7 100755 --- a/testsuite/transok/two.stp +++ b/testsuite/transok/two.stp @@ -1,5 +1,5 @@ #! stap -probe k,l { 2; } +probe begin, end { 2; } function poo (zoo) { n = poo2 (8); return "foo" . zoo } function poo2 (zoo) { return poo3 (2 + 4 * zoo) } function poo3 (zoo) { return zoo } |