979
|
1 |
#summary Hedgewars-specific Pascal syntax rules
|
|
2 |
= Hedgewars-specific Pascal syntax rules =
|
977
|
3 |
|
979
|
4 |
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
|
5 |
|
979
|
6 |
== Pascal rules for `pas2c` ==
|
977
|
7 |
|
|
8 |
# Never use `not` without brackets
|
|
9 |
# Never use `in` with numerals
|
|
10 |
|
|
11 |
=== Examples ===
|
|
12 |
|
|
13 |
Forbidden:
|
|
14 |
|
979
|
15 |
`if a in [1, 2] then`
|
977
|
16 |
|
|
17 |
Allowed:
|
|
18 |
|
979
|
19 |
`if a in [sprBubble, sprAmGirder] then`
|
977
|
20 |
|
|
21 |
Forbidden:
|
|
22 |
|
979
|
23 |
`if not isExploded then`
|
977
|
24 |
|
|
25 |
Allowed:
|
|
26 |
|
981
|
27 |
`if (not isExploded) then`
|
977
|
28 |
|
|
29 |
Allowed
|
|
30 |
|
979
|
31 |
`if isExploded <> true then`
|