GithubHelp home page GithubHelp logo

Comments (11)

MikaelSmith avatar MikaelSmith commented on May 27, 2024

That's strange, what does your include directive look like?

I think there are some pretty strict limitations on it right now, but I've definitely used it for something like include file("/absolute/path") and include classpath("local/file").

Actually, I take that back... not sure I've used those examples with this hocon parser.

from cpp-hocon.

luben avatar luben commented on May 27, 2024

I think you are hitting #94

from cpp-hocon.

luben avatar luben commented on May 27, 2024

BTW, as I see some people commenting, is this project maintained? I sent a PR for fixing another bug with included files (#95) without any reaction for more than 3 months. @dvhwgumby , sorry for the noise,

from cpp-hocon.

dvhwgumby avatar dvhwgumby commented on May 27, 2024

from cpp-hocon.

dvhwgumby avatar dvhwgumby commented on May 27, 2024

FWIW, the "spec" for HOCON ([https://github.com/lightbend/config/blob/master/HOCON.md#includes]) considers the syntax our team used to be legit.

from cpp-hocon.

MikaelSmith avatar MikaelSmith commented on May 27, 2024

Understood. This is currently an incomplete implementation of the spec. It would be nice to improve it, but I'm not personally spending a ton of time on it.

I'm surprised the lightbend parser rejected include file("foo"), since they seem to claim to support it in https://github.com/lightbend/config#features-of-hocon.

from cpp-hocon.

SeaTalk avatar SeaTalk commented on May 27, 2024

I ran into a similar situation.
In my case, I have a.conf and b.conf both in directory "ProjectDir/conf/".
a.conf is like

{ include "b.conf" ...}

when I run code in directory "ProjectDir/bin/", I always get an error:
Something went wrong when parsing hocon file. Exception message:reader() should not be called on resources

I wonder how I can fix that.

from cpp-hocon.

MikaelSmith avatar MikaelSmith commented on May 27, 2024

I can give some suggestions of where to look to start a fix. Our code mirrors the lightbend/config implementation fairly closely, so you can use that to compare where we might be missing some implementation.

The parser is in src/config_document_parser.cc. parse_context::parse_include is the first place I'd look, which at least accepts include "foo". It's possible we're setting that up with the wrong type, but I suspect the actual problem is later. It's possible parse_context::parse_include in src/config_parser.cc is a problem.

If b.conf is empty, do you get an error? Possible the parser for the included file is not setup correctly.

from cpp-hocon.

SeaTalk avatar SeaTalk commented on May 27, 2024

In my case, I fix it by changing some code. And my change exists here . For now, it works fine for me. I want you guys review my code and find out where bugs may lay.
Thanks a lot ~

from cpp-hocon.

MikaelSmith avatar MikaelSmith commented on May 27, 2024

Thanks for providing that! Not sure when someone might get to looking at it. If anyone's interested in turning that into a PR, I can try to help review it.

from cpp-hocon.

MikaelSmith avatar MikaelSmith commented on May 27, 2024

I believe this is fixed by #115. Please re-open the issue if I'm mistaken.

from cpp-hocon.

Related Issues (18)

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.