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