From bb2e3076ea20631d4606050550bc9664204f2c62 Mon Sep 17 00:00:00 2001 From: fche Date: Wed, 8 Jun 2005 22:02:09 +0000 Subject: 2005-06-08 Frank Ch. Eigler 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. --- testsuite/transok/five.stp | 2 +- testsuite/transok/one.stp | 56 +++++++++++++++++++++++++++++++++++++++++++++ testsuite/transok/three.stp | 7 +++--- testsuite/transok/two.stp | 2 +- 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100755 testsuite/transok/one.stp (limited to 'testsuite/transok') 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 } -- cgit