SPCodeOrg / SPCode

A lightweight SourcePawn editor.
https://forums.alliedmods.net/showthread.php?p=2693577
61 stars 14 forks source link

[Bug] Apostrophe (Single Quote) character causes include files to be parsed incorrectly. #32

Closed Natanel-Shitrit closed 3 years ago

Natanel-Shitrit commented 3 years ago

Note: This is the latest version of the standalone version, not tested on the installer version but expected to be the same.

If apostrophe character (') is used in an include file, some of the natives are not getting parsed, hence not presented in the autocomplete suggestions. Not parsed natives compiles normally when used in plugins because it has nothing to do with ~lysis~the compiler.

Example: Default halflife.inc file (Lines 311 - 338): L311-L338

You can see the color of PrecacheSound(), which is light blue that indicates that it's a defined native. Hence, it will show the definition when clicked inside the parentheses: image

Unlike the example above, CreateDialog(), that should be treated same, is colored in a darker blue (that indicates a normal function, not sure, probably.) and does not open the definition when clicked inside the parentheses: image

To fix this i removed the apostrophe character in line 327, in the #pragma (that's a "comment", providing additional information to the compiler).

image

After force closing SPcode, now the natives below work normally as should be: image

Thanks you for this awesome program and i hope this will help fix this problem.

Natanel-Shitrit commented 3 years ago

Looks like a similar problem in #25.

Hexer10 commented 3 years ago

Seems like spcode doesn't read the the string after #pragma deprecated <string> as a string but instead a normal expression, and my guess is that it is trying to match the full '<string>'. I'm going to look into it

Natanel-Shitrit commented 3 years ago

Looks like it's closing in line 480: image

Everything after this line seem to be back to normal.

Hexer10 commented 3 years ago

Yep, most likely because there it has found a matching ' to end the string

Hexer10 commented 3 years ago

Fixed! Now the tokens after a preprocessor directive are ignored until a EOF