They are transformed by the scanner to the identifier `inline`, which is how the parser identifies it. This solves the comment problem, but it results in a funny side effect. Now, in inline mode, /*pragma inline*/ will always be the identifier `inline`, therefore this is valid:
integer /*pragma inline*/ = 5;
llOwnerSay((string)inline); // will say 5
Not overly elegant, but better than making up a specific token or declaring comments as tokens or the like.
It's unlikely to hit this one (requires more than 10,000 identifiers to trigger) but it's a bug nevertheless.
While touching the file, try to explain the situation better in the first comment.
PCPP now includes a decent expression evaluator instead of relying on Python's, therefore our evaluator is removed. The corresponding license text no longer applies, because the snippet that used it has been removed.
This patch also corrects the handling of include files, which was supposed to raise an exception or return something (and now it needs an extra parameter). We just report an error and raise the special exception that pcpp uses to ignore and remove the directive.
This patch also handles #error and invalid directives, which were passed through in previous versions. #warning and #line are also passed through.
These changes make it ready for prime time, but main.py still does not expose the functionality.
Changes include:
- Instead of passing paths, we pass parameters, which are parsed to extract the paths (no syspaths, only regular paths) and the defines.
- Errors in the preprocessor are reported to the caller (i.e. to main).
1. When the last statement of a function is a RETURN statement which is syntactically required, it could still be deleted.
2. The child of a RETURN statement could be removed if the statement was not executed.
This commit fixes both issues.
Bug report and test case provided by @Tonaie. Fixes#14.
The limits were too low to be reasonable with more modern versions of Python.
Double exceptions were possible. Make use of soft/hard limits; raise the soft limit in case of exception. That should make it less likely to get a double exception.
Per bug report by @LeonaMorro (thanks!)
Fixes GitHub issue report #9 (fix#9).
E.g. llSubStringIndex(...) > -1 was converted into !~llSubStringIndex(...) which is incorrect. We even had a test case for it... with a wrong expected response file.
Bug report and test case by Sinha Hynes (thanks!)