* parse.cxx (scan): Support C and C++ comment styles.
* testsuite/parseok/four.stp: Test them some ...
* testsuite/parseko/nine.stp: ... and some more.
+2005-06-03 Frank Ch. Eigler <fche@redhat.com>
+
+ * parse.cxx (scan): Support C and C++ comment styles.
+ * testsuite/parseok/four.stp: Test them some ...
+ * testsuite/parseko/nine.stp: ... and some more.
+
2005-06-02 Frank Ch. Eigler <fche@redhat.com>
* translate.cxx (visit_concatenation, visit_binary_expression):
cerr << " -p NUM\tStop after pass NUM 1-3" << endl;
cerr << " \t(parse, elaborate, translate)" << endl;
cerr << " -I DIR\tLook in DIR for additional .stp script files." << endl;
- cerr << " -o FILE\tSend translator output to file instead of stdout." << endl;
+ cerr << " -o FILE\tSend output to file instead of stdout." << endl;
// XXX: other options:
// -s: safe mode
// -d: dump safety-related external references
{
int c2 = input.peek ();
- if (c == '#') // comment to end-of-line
+ if (c == '#') // shell comment
{
unsigned this_line = cursor_line;
while (input && cursor_line == this_line)
input_get ();
goto skip;
}
+ else if (c == '/' && c2 == '/') // C++ comment
+ {
+ unsigned this_line = cursor_line;
+ while (input && cursor_line == this_line)
+ input_get ();
+ goto skip;
+ }
+ else if (c == '/' && c2 == '*') // C comment
+ {
+ c2 = input_get ();
+ unsigned chars = 0;
+ while (input)
+ {
+ chars ++; // track this to prevent "/*/" from being accepted
+ c = c2;
+ c2 = input_get ();
+ if (chars > 1 && c == '*' && c2 == '/')
+ goto skip;
+ }
+ }
n->type = tok_operator;
n->content = (char) c;
--- /dev/null
+#! stap -p1
+probe foo {
+ /*/ 0
+}
#! stap -p1
probe syscall ("foo").foo.bar , syscall ("bar"), syscall ("*").return
-{
- $a = a$a = a$a$ = 0;
+{ # no comment
+ $a = /* comment */ a$a = /**/ a$a$ = 0; // more comment
}
-
+/* empty comment lines */
+/**/
+#
+//