Giter Site home page Giter Site logo

Pairs about grammar HOT 5 CLOSED

twalmsley avatar twalmsley commented on July 20, 2024
Pairs

from grammar.

Comments (5)

elliottinvent avatar elliottinvent commented on July 20, 2024

This works:

a=(b=(c=(d=(e=f))))

So does this:

a=b=c=d=e=f

This doesn't work in the playground:

a=(b=c=d=e=f)

I suppose the question is whether the last example works in the grammar and if the parse tree is the same for all three examples.

If so, then this could be a job for @alexdalitz in the interpreter. If the final example is difficult to handle in the interpreter we could just call this known behaviour.

from grammar.

twalmsley avatar twalmsley commented on July 20, 2024

The first two examples work correctly in the java interpreter and the sandbox, but the third example fails in both. It gives this stack trace:

com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value

	at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:1961)
	at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeFieldName(WriterBasedJsonGenerator.java:137)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:117)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:85)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:118)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:70)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:88)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:118)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:56)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeInternal(ModlValueJsonSerializer.java:45)
	at uk.modl.parser.printers.ModlValueJsonSerializer.serializeStructure(ModlValueJsonSerializer.java:41)
	at uk.modl.parser.printers.ModlObjectJsonSerializer.serialize(ModlObjectJsonSerializer.java:41)
	at uk.modl.parser.printers.ModlObjectJsonSerializer.serialize(ModlObjectJsonSerializer.java:33)
	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
	at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1396)
	at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1120)
	at com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString(ObjectWriter.java:993)
	at uk.modl.parser.printers.JsonPrinter.printModl(JsonPrinter.java:59)
	at uk.modl.parser.printers.JsonPrinter.printModl(JsonPrinter.java:34)

This is probably one for @alexdalitz (@elliottinvent can you reassign?)

from grammar.

alexdalitz avatar alexdalitz commented on July 20, 2024

@elliottinvent what is your expected output in this case?

from grammar.

elliottinvent avatar elliottinvent commented on July 20, 2024

@alexdalitz

a=(b=(c=(d=(e=f))))

and

a=b=c=d=e=f

Should ouput the same =>

{
    "a": {
        "b": {
            "c": {
                "d": {
                    "e": "f"
                }
            }
        }
    }
}

If the example below is difficult to handle in the interpreter then we could call it expected behaviour, but ideally it would output the same as the two other examples since it's effectively the same MODL structure, just expressed in a different way:

a=(b=c=d=e=f)

=>

{
    "a": {
        "b": {
            "c": {
                "d": {
                    "e": "f"
                }
            }
        }
    }
}

from grammar.

alexdalitz avatar alexdalitz commented on July 20, 2024

This is now working

from grammar.

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.