-
Notifications
You must be signed in to change notification settings - Fork 1
UnrealScript Syntax Bugs
This page aims to enumerate all of the buggy syntax permitted by the UnrealScript compiler (ucc) where it deviates from contemporary language standards or just general sanity.
The ucc
compiler allows nested block comments.
/* Foo /* Terminated nested block comment
Nested block comments are problematic for trying to formalize into context-free grammars because, to parse handle them correctly, it requires stateful behavior in the parser (e.g., keeping a running tally of un-closed block comments), something that, to my knowledge, is impossible to do with pest.rs. Even running a dumb pre-processor on each file to do this manually wouldn't work because the terminal specifiers (/*
and */
) can be found inside of other rules like string literals, name literals, as well as in cpptext
blocks.
It's interesting to note that WOTgreal itself does not correctly syntax-highlight nested block comments.
The defaultproperties
block is the wild west of fucky syntax. It's very likely that, internally, the internals of the defaultproperties
block are handled in a completely separate pass of the compiler where a completely separate and less complete list of syntax rules are only just barely enforced.
The ucc
compiler will also simply silently do nothing if it encounters bad syntax in the defaultproperties
block, or worse, will do something completely unexpected without warning the user. What follows is a non-exhaustive list of the some of the common broken syntax that have been found throughout existing code.
defaultproperties
{
Foo=
}
It is untested if this simply does nothing, or if the value is set to whatever the default value is for the underlying type.
Foo=.0.1.2.3.4.5
It is untested as to what type of value this will result in.
Foo[0)=(Bar=[1)]]
The ucc
compiler made the bold decision of allowing multiple types of brackets (()
and []
) for things like array-assignment and struct syntax. Not only that, but you can mix and match different bracket types, even on the same line.
Foo="Bar
The string literal doesn't even need to be terminated. This probably also holds for other types of literals that have opening and closing terminals, and in fact those types of symbols are probably merely suggestions and not even enforced.
It gets worse, in this you can also have un-escaped nested literals, completely breaking all hopes of ever parsing things correctly using a formalized grammar.