Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect use of macros out of function causing infinite loop when scanning. #1

Open
riz0id opened this issue Jul 27, 2016 · 2 comments

Comments

@riz0id
Copy link

riz0id commented Jul 27, 2016

They're issues when using the read macron in this function. Possible infinite loop due to read() not incrementing pos.

Token Scanner::ScanString () {
    stringstream accum;
    char opening_char = Read (pos, source);
    while (CanAdvance (pos, 1, source)) {
        char current = Peek (pos, 1, source);
        if (current == opening_char) {
            ++pos;
            break;
        } else if (current == '\\') {
            accum << Read (pos, source);
            accum << Read (pos, source);
        } else
            accum << Read (pos, source);
    }
    cout << "String: " << accum.str () << endl;
    return Token (TokenType::String, accum.str ());
}```
@SplittyDev
Copy link
Contributor

Thanks a lot, I'll look into this when I get some time.
Cassium is very inactive anyway, so if you're interested in Hassium, you're far better off with HassiumTeam/Hassium :)

@riz0id
Copy link
Author

riz0id commented Aug 2, 2016

Yeah, I don't do a lot of c# so no thanks. I'm making my own language and was browsing levers on how to do it and that's how I found the issue with yours. I have the fix for it if you need.

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

No branches or pull requests

2 participants