Skip to content

support C-style comments (line and block)#7

Open
dancomstock wants to merge 1 commit into
TylerGlaiel:masterfrom
dancomstock:handle-c-style-comments
Open

support C-style comments (line and block)#7
dancomstock wants to merge 1 commit into
TylerGlaiel:masterfrom
dancomstock:handle-c-style-comments

Conversation

@dancomstock
Copy link
Copy Markdown

@dancomstock dancomstock commented Feb 23, 2026

Resolves #5

I started work on a python implementation and noticed the "//" comments in the Mewgenics files so added support for it, figured I should backport it to the c++ code as well.

Changed inComment to inLineComment and added inBlockComment in order to differentiate.

Added a check for "/" and then check to see if the next character is another "/" or "*" to determine if it is starting a line or block comment and if so it also does an extra increment to skip the next character (or if not then just resume normal behavior)

the inLineComment end check is unchanged. inBlockComment checks for the ending "*/"

Tested with a basic GON file that looked like:

a 1 // line comment
b 2 /* block comment */
c 3 /* multi
line
comment */
d 4

Let me know if there's some other cases that might be good to test for.

@TylerGlaiel
Copy link
Copy Markdown
Owner

I have a separate "Text file preprocessor" that I use in my engine that handles /* */ and // style comments, along with macros, includes, and some other things. Unfortunately that system is a bit too dependent on other parts of my game engine solely due to handling #include, so I haven't yet included it here. I could upload the files for reference however.

@TylerGlaiel
Copy link
Copy Markdown
Owner

TylerGlaiel commented Feb 23, 2026

preprocessor.zip

(this is just directly uploaded from my engine. it would need a little bit of cleanup to include in this repro, but I might later)

@dancomstock
Copy link
Copy Markdown
Author

Thanks, I'll take a look. I've been wondering how the csv merges/appends work so this is great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

handle // and /**/ comments in GON

2 participants