Git Product home page Git Product logo

Comments (8)

Traveler98 avatar Traveler98 commented on September 20, 2024

I am new to this , so can you help a little and tell me what this function should do ? Thx

from snot_lang.

bryan-lunt avatar bryan-lunt commented on September 20, 2024

Oh, wow! A contributor!

Well, a pretty-printer for some hierarchical datastructure / markup languages is a print function that sets up nice indentation and spacing so that the markup will be easy to read.

For example:

{"first":[1,2,{"other":[7,8,0],"ahah":56.6}],"second":{"secondsfirst":4.5}}

is valid SNOT (and therefore valid JSON).
But:

{
    "first":[
        1, 2, {
            "other":[ 7, 8, 0],
            "ahah":56.6
              }
        ],
    "second":{
        "secondsfirst":4.5
     }
}

is significantly easier to read.

from snot_lang.

bryan-lunt avatar bryan-lunt commented on September 20, 2024

Basically the function needs either a stack or recursion and descends into the datastructure, keeping track of how many levels in it is, and applies some rules about indentation and formatting.

from snot_lang.

Traveler98 avatar Traveler98 commented on September 20, 2024

In what language should I implement this function ?

from snot_lang.

bryan-lunt avatar bryan-lunt commented on September 20, 2024

It should go in param_storage.h (in lexyacc/src ) , be written in standard C++98 , and complement/ work well with the existing code. It should either be a member method or static method of gsparams::DictList .

Thanks!

from snot_lang.

bryan-lunt avatar bryan-lunt commented on September 20, 2024

Except for potentially including a new standard header (which I hope can be avoided), the new function should be totally self-contained. I mean that you should not need to alter any other part of the code, just add the function to the DictList class.

from snot_lang.

Traveler98 avatar Traveler98 commented on September 20, 2024

Is there a document explaining the parts of code already written? I have a problem understanding thr DictList class functionality.

from snot_lang.

bryan-lunt avatar bryan-lunt commented on September 20, 2024

There isn't any proper doxygen API or anything, but there are examples at https://github.com/bryan-lunt/SNOT_lang/tree/master/lexyacc/examples

from snot_lang.

Related Issues (6)

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.