Verse Parser Changes in 23.00.UEFN

Verse

Be aware that Verse syntax is changing in this update. Your project may have errors when opened. To fix these errors:

  1. Open your project.
  2. If you observe Verse errors, open your project’s Verse files.
  3. Follow the guide below to update your Verse files.
  4. Save and compile your code but DO NOT save any project files.
  5. Shut down UEFN and re-open your project.

If all went well, your project should open with no errors and Verse device references should stay intact.

VS Code Plugin

  • The VS Code Verse extension has been updated. You may need to reinstall the extension. If your Verse code has a lot of red squiggles indicating that you have syntax errors and you feel you don’t, try a reinstall.
    • To Reinstall:
      • Open the extension menu
      • Find the “Verse” extension under Installed
      • Click it
      • Click the Uninstall button
      • Close VS Code
      • Reopen VS Code by opening one of your project’s Verse files again.
      • The latest version should be installed

Verse Changes

Here are the changes to Verse:

  • Logical Operators &&, || and ! must be replaced. Word forms of logical operators are now required.
    • Old: Replace all syntax &&, || and !
    • New: With and, or, not
  • Definitions now must must use an equal sign and not :=
    • Old: MyFunc():void := {}
    • New: MyFunc():void = {}
    • Old: MyNumber:int := 42
    • New: MyNumber:int = 42
  • Delimiting Attributes now just use whitespace - no semicolon needed
    • Old: @editable; TimerDevice:timer_device := timer_device{}
    • New: @editable TimerDevice:timer_device = timer_device{}
    • Note: The semicolon is missing in the new version
  • Extension functions can now be called on number literals
    • 42.Negate()
    • Assuming you’ve defined an extension function Negate()
  • Mathematical (dot space) blocks are now supported:
    • If (Test[]). DoStuff
    • See If.versetest for more examples
# Dot space examples using if
var Num:int = 123
if (1 < 2). set Num = 42  # dot space block
# Num = 42
 
var Num:int = 123
# dot space block
if (1 < 2). set Num = 42
else:
    set Num = 56
# Num = 42
 
var Num:int = 123
# dot space block for both
if (1 < 2). set Num = 42
else. set Num = 56
# Num = 42
 
var Num:int = 123
# dot space block for both in one line
if (1 < 2). set Num = 42 else. set Num = 56
# Num = 42
 
var Num:int = 123
if. 1 > 2
then. set Num = 42
else if. 3 > 4
then. set Num = 56
else. set Num = 78
# Num = 78
 
var Num:int = if(1 > 2). 42 else if(3 > 4). 56 else. 78
# Num = 78
 
Num:int = if. 1 > 2 then. 42 else if. 3 > 4 then. 56 else. 78
# Num = 78
 
var Num:int = 123
if (1 > 2). set Num = 42
else if (3 > 4). set Num = 56
else. set Num = 78
# Num = 78
 
var Num:int = if. 1 > 2
then. 42
else if. 3 > 4
then. 56
else. 78
# Num = 78
 
Num := if (1 > 2). 42
else if (3 > 4). 56
else. 78
# Num = 78
 
Num := if (1 > 2). 42 else if (3 > 4). 56 else. 78
# Num = 78

  • Significant comment indentation - in the recent parser update comments affect significant indented whitespace. Any comments in a code block must be at the same indent level of a block of expressions or the block will be broken into multiple blocks. [This is temporary - comments will be ignored by significant indentation in a future update]
# [Ok] No comments
Dummy1():void =
    1 + 1
    2 + 2
    3 + 3
    4 + 4
    5 + 5
 
# [Ok] Same indentation
Dummy2():void =
    1 + 1
    # Same indent
    2 + 2
    <# Same #>
    3 + 3
    <#>
        Same
    5 + 5
 
# [Error] Earlier indent level
Dummy3():void =
    1 + 1
    2 + 2
# Shouldn't affect significant indentation
    3 + 3
    4 + 4
    5 + 5
 
# [Ok] Earlier mid-indent level
Dummy4():void =
    1 + 1
    2 + 2
  # Shouldn't affect significant indentation
    3 + 3
    4 + 4
    5 + 5
 
# [Ok] Later indent level
Dummy5():void =
    1 + 1
    2 + 2
        # Shouldn't affect significant indentation
    3 + 3
    4 + 4
    5 + 5
 
# [Error] Earlier indent level
Dummy6():void =
    1 + 1
    2 + 2
<# Shouldn't affect significant indentation#>
    3 + 3
    4 + 4
    5 + 5
 
# [Ok] Earlier indent level
Dummy7():void =
    1 + 1
    2 + 2
  <# Shouldn't affect significant indentation#>
    3 + 3
    4 + 4
    5 + 5
 
# [Ok] Later indent level
Dummy8():void =
    1 + 1
    2 + 2
        <# Shouldn't affect significant indentation#>
    3 + 3
    4 + 4
    5 + 5
   
# [Error] Same line - earlier indent level
Dummy9():void =
    1 + 1
    2 + 2
    3 + 3
<##>4 + 4
    5 + 5
 
# [Error] Multiline - earlier indent level
Dummy10():void =
    1 + 1
    2 + 2
    3 + 3
<#
    4 + 4
#>
    5 + 5
 
# [Ok] Multiline - later indent level
Dummy11():void =
    1 + 1
    2 + 2
    3 + 3
        <#
    4 + 4
        #>
    5 + 5
 
# [Error] Multiline shared line - earlier indent level
Dummy12():void =
    1 + 1
    2 + 2
    3 + 3
<#  4 + 4
#>  5 + 5
 
# [Error] Multiline shared line
Dummy13():void =
    1 + 1
    2 + 2
    3 + 3
<#  4 + 4
        #>
    5 + 5
 
# [Error] Mixed comments
Dummy14():void =
    1 + 1
    2 + 2
    # Same indent
# Shouldn't affect significant indentation
  # Nope
    3 + 3  # Post comment
<##>4 + 4
    <#>
        test
    5 + 5
 
# [Syntax Error]
# Multiline shared line
Dummy15():void =
    1 + 1
    2 + 2
    3 + 3 <#
    4 + 4
#>  5 + 5