PascalSyntax.wiki
author Wuzzy
Thu, 05 Dec 2019 16:12:25 +0000
changeset 2113 115b171c7e3e
parent 2019 12cc62c0ae38
permissions -rw-r--r--
DrawnMapFormat: More about polylines
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
979
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
     1
#summary Hedgewars-specific Pascal syntax rules
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
     2
= Hedgewars-specific Pascal syntax rules =
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
2019
12cc62c0ae38 PascalSyntax: add link
Wuzzy
parents: 2016
diff changeset
     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
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
979
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
     6
== Pascal rules for `pas2c` ==
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
 # Never use `not` without brackets
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
 # Never use `in` with numerals
2016
3e426e5979ec PascalSyntax: Add Unicode character restriction
Wuzzy
parents: 981
diff changeset
    10
 # Do not use Unicode characters anywhere (even in comments)
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
=== Examples ===
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
Forbidden:
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
979
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
    16
 `if a in [1, 2] then`
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
Allowed:
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
979
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
    20
 `if a in [sprBubble, sprAmGirder] then`
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
Forbidden:
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
979
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
    24
 `if not isExploded then`
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
Allowed:
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    27
981
a18f350d00ff PascalSyntax: fix `if not (isExploded) then`
Wuzzy
parents: 980
diff changeset
    28
 `if (not isExploded) then`
977
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
Allowed
2269c95056fe Add HW-specific rules for Pascal code
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
979
1455b4ad1ec3 PascalSyntax: Fix syntax
Wuzzy
parents: 977
diff changeset
    32
 `if isExploded <> true then`