Add a new syntax which when compiled prefixes an operation with a actor/object/performer operation, depending on which is chosen, serving as an alternative to the with-block.
Motivation
This makes reading and writing single operations that should be run in the context of a single entity much more succinct, requiring less syntax.
This would be the proposed syntax. In this example in the compiled output the MovePositionOffset operation would be prefixed with an lives operation with the parameter ACTOR_ATTENDANT1.
with (actor ACTOR_ATTENDANT1) {
MovePositionOffset(1, 24, 0);
}
The example is equivalent to using this with-block.
Language Changes
Parser and Lexer Changes
The parser must optionally allow "<" + CTX_TYPE + IDENTIFIER + ">" before the argument list of operations.
If this would also be optionally implemented for SsbScript CTX_TYPE, ACTOR, OBJECT and PERFORMER could no longer be tokens, since this would conflict with the object and performer operations. In this case CTX_TYPE would need to be replaced with IDENTIFIER wherever used and code needs to be adjusted in the compiler to handle this.
Behaviour
No behavioral changes.
Compiler Implementation
Compiler Interface Changes
No interface changes.
Decompiler Changes
Statements which could be represented using this new syntax (ie. everything currently decompiled to with-block with single statements) should be decompiled as such. Please also note #4: If a with block could contain multiple statements and #4 is implemented, then these should instead be decompiled by with blocks with multiple statements.
How to teach
Extend the documentation to include this syntax in the with-block and operation documentation.
Alternatives
4: Multiple statements in with blocks: Potential alternative but serves a slightly different goal
Summary
Add a new syntax which when compiled prefixes an operation with a
actor
/object
/performer
operation, depending on which is chosen, serving as an alternative to thewith-block
.Motivation
This makes reading and writing single operations that should be run in the context of a single entity much more succinct, requiring less syntax.
Examples
This would be the proposed syntax. In this example in the compiled output the
MovePositionOffset
operation would be prefixed with anlives
operation with the parameterACTOR_ATTENDANT1
.The example is equivalent to using this with-block.
Language Changes
Parser and Lexer Changes
The parser must optionally allow "<" + CTX_TYPE + IDENTIFIER + ">" before the argument list of operations.
If this would also be optionally implemented for SsbScript
CTX_TYPE
,ACTOR
,OBJECT
andPERFORMER
could no longer be tokens, since this would conflict with theobject
andperformer
operations. In this caseCTX_TYPE
would need to be replaced withIDENTIFIER
wherever used and code needs to be adjusted in the compiler to handle this.Behaviour
No behavioral changes.
Compiler Implementation
Compiler Interface Changes
No interface changes.
Decompiler Changes
Statements which could be represented using this new syntax (ie. everything currently decompiled to with-block with single statements) should be decompiled as such. Please also note #4: If a with block could contain multiple statements and #4 is implemented, then these should instead be decompiled by with blocks with multiple statements.
How to teach
Extend the documentation to include this syntax in the with-block and operation documentation.
Alternatives
4: Multiple statements in with blocks: Potential alternative but serves a slightly different goal
Backwards compatibility
This would be fully backwards compatible.