Skip to content

Preprocessor macros #10

@EliotVU

Description

@EliotVU

The usage of macros can lead to severe parsing and indexing issues, like the following code:

return ( `TimeSince( LastRenderTime ) < 0.3 );

The usage of `TimeSince here will tell the lexer that this is a PP command, when this is occurred the input will be thrown out thus leaving the parser with:

return ( < 0.3 );

Which leads to even bigger issues down the road, so as the end block of a method not being terminated.

One workaround for this issue could be to safely parse binary operators that are missing an expression on the left or right, however due the nature of UnrealScript allowance of custom defined pre and post operators, "< 0.3" could in theory be a post operator! Thus it cannot be assumed to be an incomplete binary operator (albeit it would be totally unexpected for "<" symbol, that cannot be said of other symbols).

The proper solution would be not to skip any PP commands and instead fully parse and evaluate any macro prior to parsing the document, this is however not an easy task!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions