Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for "+=" field separator? #35

Closed
vicenteg opened this issue Aug 1, 2015 · 3 comments · Fixed by #81
Closed

support for "+=" field separator? #35

vicenteg opened this issue Aug 1, 2015 · 3 comments · Fixed by #81

Comments

@vicenteg
Copy link

vicenteg commented Aug 1, 2015

I get an error when parsing a hocon file:

[ec2-user@ip-172-16-2-117 ~]$ pyhocon -i /opt/mapr/drill/drill-1.1.0/conf/drill-override-example.conf
Traceback (most recent call last):
  File "/usr/local/bin/pyhocon", line 9, in <module>
    load_entry_point('pyhocon==0.3.4', 'console_scripts', 'pyhocon')()
  File "/usr/local/lib/python2.7/site-packages/pyhocon/tool.py", line 188, in main
    HOCONConverter.convert(args.input, args.output, args.format)
  File "/usr/local/lib/python2.7/site-packages/pyhocon/tool.py", line 145, in convert
    config = ConfigFactory.parse_file(input_file)
  File "/usr/local/lib/python2.7/site-packages/pyhocon/__init__.py", line 40, in parse_file
    return ConfigFactory.parse_string(content, os.path.dirname(filename))
  File "/usr/local/lib/python2.7/site-packages/pyhocon/__init__.py", line 75, in parse_string
    return ConfigParser().parse(content, basedir)
  File "/usr/local/lib/python2.7/site-packages/pyhocon/__init__.py", line 216, in parse
    config = config_expr.parseString(content, parseAll=True)[0]
  File "/usr/local/lib/python2.7/site-packages/pyparsing.py", line 1125, in parseString
    raise exc
pyparsing.ParseSyntaxException: Expected "{" (at char 1087), (line:20, col:33)

Line 20 in the above looks like this:

drill.logical.function.packages += "org.apache.drill.exec.expr.fn.impl"

And column 33 implicates the "+=" field separator.

Any plans to add support for this?
https://github.com/typesafehub/config/blob/master/HOCON.md#the--field-separator

@akumarpatel
Copy link

It seems like the self referencing does not work with Pyhocon . Following cases does not work

  1. Examples of self-referential fields:
    a : ${a}
    a : ${a}bc
    path : ${path} [ /usr/bin ]
  2. a += b
    becomes:

a = ${?a} [b]

@darthbear darthbear added the bug label Aug 27, 2015
@alexey-terentiev
Copy link

I'm eager to have self-referencing feature too.

@maxharp3r
Copy link

Yay, thanks! Although, the fix requires a workaround in my case where I am not using top-level properties. This now works:

a.b {
    c += "foo"
}

These still do not work, and throw different exceptions:

a.b.c += "foo"
a.b.c = ${?a.b.c} ["foo"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants