Coder Social home page Coder Social logo

Comments (9)

marcobambini avatar marcobambini commented on May 26, 2024

Hi @bardo84, can you please post an example?

from gravity.

mwasplund avatar mwasplund commented on May 26, 2024

Repro steps

Test.gravity

func main() {
	System.print("Run Tests!")
	error
}

Run

gravity Test.gravity

Expected

Error reported in file "Test.gravity" on line 3 character 2

Actual

SEMANTIC ERROR on 0 (5,2): Identifier error not found.

from gravity.

mwasplund avatar mwasplund commented on May 26, 2024

Should the '0' value be the file name?

from gravity.

mwasplund avatar mwasplund commented on May 26, 2024

FYI: Windows 11 running VS 2022 Version 17.4.3

from gravity.

marcobambini avatar marcobambini commented on May 26, 2024

Thanks @mwasplund, I see that you closed your pull request? That means that it was not ready to be applied?

from gravity.

marcobambini avatar marcobambini commented on May 26, 2024

Should the '0' value be the file name?

'0' is the fileID, the user is responsible to save the filename associated to each fileID.
See comment in

static const char *load_file (const char *file, size_t *size, uint32_t *fileid, void *xdata, bool *is_static) {
to get more information about to use the fileID.

from gravity.

mwasplund avatar mwasplund commented on May 26, 2024

Yes, it appears that in some cases when calling is_newline the current offset is pointing to the actual current token and in some cases it is already pointing to next. Still working out why this is the case.

from gravity.

marcobambini avatar marcobambini commented on May 26, 2024

I think that a good starting point to investigate is the is_newline function in gravity_lexer.c

static inline bool is_newline (gravity_lexer_t *lexer, int c) {

from gravity.

mwasplund avatar mwasplund commented on May 26, 2024

That was were I was looking, I had updated the checks in that method to use PEEK_NEXT instead of PEEK_CURRENT. This resolved a lot of issues where the LF was getting missed and then double counted. However, it appears that in some cases the caller is "peeking" in which case the next char is actually current... I sent an update to pass in the exact next and next2 characters to the is_newline call. Not the prettiest, but it is working. Let me know if you see a cleaner way to achieve the difference in state between calls.

from gravity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.