Code Monkey home page Code Monkey logo

Comments (20)

Anteru avatar Anteru commented on August 27, 2024

Do you have a full example file I can try? This shouldn't be too hard to add.

from sjson.

Anteru avatar Anteru commented on August 27, 2024

Can you please try the speculative fix and see if that works? If so, I will prepare a new release with it.

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

Apologies, I was in transit trying to escape getting locked in by covid so I couldn't respond

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

We have a local version of your module to fix these issues
SGG-Modding/SGG-Mod-Format@ae60616
SGG-Modding/SGG-Mod-Format@0c75320
Can use them to see working examples

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

It looks like from the comparing code your speculative fix would work for the standard tripple quote case but not for the implicit quadruple quote case, don't blame you as I didn't mention that at all.

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

I tested the speculative fix, it doesn't crash but the output isn't kosher for the game, it crashes pretty violently (while the output from the local version does not crash the game)
Not exactly sure why.

from sjson.

Anteru avatar Anteru commented on August 27, 2024

What is the quadruple quoted case? Looking at your changes, I don't see test cases (I'm sure they're somewhere in the repo, just don't know where :) ). If you could point me at a sample file then I can make it work, without it I'm stabbing in the dark here.

from sjson.

Anteru avatar Anteru commented on August 27, 2024

Please try: 5e0c0b6 -- that comes with unit tests for quadruple (and while we're at it, quintuple) quoted strings.

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

This is what Paradigmsort/parasHadesMods said about it when I asked

"yeah, iirc the upstream only supports block quotes in the input, but it doesn't remember what was a block quote for the output
so it outputs strings with escape characters etc. in them that the game didn't understand
there were just too many differences i think for upstreaming the changes to make sense"

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

The tests we use are the actual game files from Hades, I don't want to distribute them wholesale

from sjson.

Anteru avatar Anteru commented on August 27, 2024

If the differences are too big, then I don't really see a point in trying to support Hades specific files to be honest. Please give the commit I referenced a try, if it works, great, if not, I guess I'll revert it as I'm not willing to support something I can't test (given I don't own the game!)

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

I think the issue is that the multiline strings in the input become regular strings containing escape characters in the ouput

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

So the object in memory needs to change to remember that it's block quoted

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

Failing that, yeah I guess you could revert and we'll try making a PR later which you can test still meets the rest of the features of the module

from sjson.

Anteru avatar Anteru commented on August 27, 2024

I'm not following: With the latest commit, a multi-line, triple-quoted string remains multi-line. If that's not helping anyone, I'd rather remove triple-quoted strings, but I don't follow your statement about multi-line -- I've even checked in a test case for it:

def testPythonStyleString():
and according to that, multi-line strings remain multi-line strings.

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

Alright, I'll test it

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

So again, program runs, but the game errors on reading data.
It might have something to do with encoding

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

Oh I see, the output doesn't place the (usually implicit) { and } over it
But fixing that manually does not make it readable still.

from sjson.

AndreLouisIssa avatar AndreLouisIssa commented on August 27, 2024

Since the issues seem to lie with the game, it's our responsibility to fix that (and we can with wrappers or using our current local version)
But I think adding support for tripple quotes is still gonna be useful for other applications. And you've tested that your output is fine subject to all the normal assumptions you can make.

Is there any reason why [=[ was chosen for block quotes originally?
That the devs of this game decided to use tripple quotes implies to me that sjson has no standard for block quotes (at least not established prior to 2018)

from sjson.

Anteru avatar Anteru commented on August 27, 2024

Yes, the main reason to choose [=[ was to match Lua and have an easier time parsing it than """ :) The advantage is that it only requires finding ]=] to terminate the search, while """ is "harder" in the sense that it requires more lookahead (and given SJSON doesn't use a tokenizing parser ...)

SJSON is not specified at all, so everything goes, when I added raw strings back in the day I picked the easiest variant. In any case, I'm going to keep the triple-quotes as-is now and prepare a new release with it.

from sjson.

Related Issues (2)

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.