public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/11038] New: Trailing semicolon as null-statement confusing
@ 2009-12-01 10:21 mjw at redhat dot com
  2009-12-01 10:23 ` [Bug translator/11038] " mjw at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mjw at redhat dot com @ 2009-12-01 10:21 UTC (permalink / raw)
  To: systemtap

semicolons (;) are optional, the parser really uses whitespace as separator of
statements. This is slightly confusing since semicolons are treated as
null-statements. This causes some confusion when writing code like:

probe begin {if (1 > 0) log("foo"); else log ("bar");}'

There will be an error for the else saying:
parse error: expected statement
	saw: keyword at <input>:1:37
     source: probe begin {if (1 > 0) log("foo"); else log ("bar");}

After encountering this a couple of time it dawns that one either has to put
braces around the then part or remove the semicolon. It would (imho) be better
if the null-statement following another statement expression was really silent
and optional.

-- 
           Summary: Trailing semicolon as null-statement confusing
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: mjw at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11038

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-21 21:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-01 10:21 [Bug translator/11038] New: Trailing semicolon as null-statement confusing mjw at redhat dot com
2009-12-01 10:23 ` [Bug translator/11038] " mjw at redhat dot com
2009-12-01 17:11 ` jistone at redhat dot com
2009-12-21 21:40 ` mjw at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).