979
|
1 |
#summary Hedgewars-specific Pascal syntax rules
|
|
2 |
= Hedgewars-specific Pascal syntax rules =
|
977
|
3 |
|
2019
|
4 |
When programming in Pascal for Hedgewars, we have two rules which must be always obeyed. This is because of our tool [pas2CTutorial 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
|
2016
|
10 |
# Do not use Unicode characters anywhere (even in comments)
|
977
|
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 |
|
981
|
28 |
`if (not isExploded) then`
|
977
|
29 |
|
|
30 |
Allowed
|
|
31 |
|
979
|
32 |
`if isExploded <> true then`
|