1# statement-list
2
3A complete Pikchr source document consists of a list of zero or more
4statements. Individual statements within the list are separated from
5each other by semicolons ("`;`") and/or newlines.  Surplus semicolons
6and newlines are ignored.  A zero-length string, or a string consisting
7of only semicolons and newlines, is a valid Pikchr document.
8
9The *statement-list* is also a subpart of the syntax for
10the `[]`-collection object.
11
12## Rules
13
14  * *statement*
15  * *statement-list* NEWLINE *statement*
16  * *statement-list* **;** *statement*
17
18## Bubble Chart
19
20~~~~~ pikchr indent
21$r = 0.2in
22linerad = 0.75*$r
23linewid = 0.25
24
25# Start and end blocks
26#
27box "statement-list" bold fit
28line down 75% from last box.sw
29dot rad 250% color black
30X0: last.e + (0.3,0)
31arrow from last dot to X0
32move right 2in
33box wid 5% ht 25% fill black
34X9: last.w - (0.3,0)
35arrow from X9 to last box.w
36
37
38# The main rule that goes straight through from start to finish
39#
40box "statement" italic fit at 0.5<X0,X9>
41arrow to X9
42arrow from X0 to last box.w
43
44# The by-pass line
45#
46arrow right $r from X0 then up $r \
47  then right until even with 1/2 way between X0 and X9
48line right until even with X9 - ($r,0) \
49  then down until even with X9 then right $r
50
51# The Loop-back rule
52#
53oval "\"&#92;n\"" fit at $r*1.2 below 1/2 way between X0 and X9
54line right $r from X9-($r/2,0) then down until even with last oval \
55   then to last oval.e ->
56line from last oval.w left until even with X0-($r,0) \
57   then up until even with X0 then right $r
58oval "\";\"" fit at $r*1.2 below last oval
59line from 2*$r right of 2nd last oval.e left $r \
60   then down until even with last oval \
61   then to last oval.e ->
62line from last oval.w left $r then up until even with 2nd last oval \
63   then left 2*$r ->
64~~~~~
65
66## Whitespace
67
68Whitespace other a newline is ignored.  If a backslash is followed
69by one or more whitespace characters ending in a newline, then the
70backslash and all of the spaces that follow, including the newline,
71are considered whitespace.  Thus, a backslash at the end of a line
72causes a statement to continue onto the next line.
73
74## Comments
75
76Three comment formats are supported:
77
78   *  The "`#`" character and all characters that follow up to but not
79      including the next newline character.  (Bourne-shell style comments.)
80
81   *  Two forward slashes ("`//`") and all characters that follow up to
82      but not including the next newline character.  (C++ style comments.)
83
84   *  The sequence "`/*`" and all characters that follow up to and including
85      the next "`*/`".  (C style comments.)
86
87The first form (#-comments) is the only form supported by legacy-PIC.
88The C++ and C style commenting is new to Pikchr.
89
90For #-comments and //-comments, the newline that follows is not part of the
91comment.  Hence that newline will terminate the current statement.  There
92is no way to escape the newline at the end of a #- or //-comment.  If you
93need a comment at the end of a line but want to continue the statement on
94the next line, you must use `/*..*/` style comments.
95