979
|
1 |
#summary Hedgewars-specific Pascal syntax rules
|
|
2 |
|
|
3 |
= Hedgewars-specific Pascal syntax rules =
|
977
|
4 |
|
979
|
5 |
When programming in Pascal for Hedgewars, we have two rules which must be always obeyed. This is because of our tool `pas2c` which doesn't fully understand Pascal yet. If these rules are broken, `pas2c` will fail to operate.
|
977
|
6 |
|
979
|
7 |
== Pascal rules for `pas2c` ==
|
977
|
8 |
|
|
9 |
# Never use `not` without brackets
|
|
10 |
# Never use `in` with numerals
|
|
11 |
|
|
12 |
=== Examples ===
|
|
13 |
|
|
14 |
Forbidden:
|
|
15 |
|
979
|
16 |
`if a in [1, 2] then`
|
977
|
17 |
|
|
18 |
Allowed:
|
|
19 |
|
979
|
20 |
`if a in [sprBubble, sprAmGirder] then`
|
977
|
21 |
|
|
22 |
Forbidden:
|
|
23 |
|
979
|
24 |
`if not isExploded then`
|
977
|
25 |
|
|
26 |
Allowed:
|
|
27 |
|
979
|
28 |
`if not (isExploded) then`
|
977
|
29 |
|
|
30 |
Allowed
|
|
31 |
|
979
|
32 |
`if isExploded <> true then`
|