8000 Parser should respect quoted or escaped delimiter · Issue #32 · go-ini/ini · GitHub
[go: up one dir, main page]

Skip to content

Parser should respect quoted or escaped delimiter #32

Closed

Description

@marcopaganini

If we have a field defined as a slice and using space as a delimiter, say:

ExtraArgs   []string `ini:"extra_args" delim:" "`

An entry in the ini file formatted as:

extra_args = aaa bbb ccc

Correctly generates a slice of three string elements, "aaa", "bbb", and "ccc".

However, things get complicated if we need one of the elements to contain a space. I tried the following constructs without success:

extra_args = aaa "bbb and space" ccc

extra_args = aaa bbb\ and\ space ccc

extra_args = """
aaa
bbb and space
ccc"""

And neither seems to work.

Ideally, the delimiter shouldn't be matched inside quoted strings of it it's quoted with a backslash.

Activity

  1. unknwon commented on Jan 26, 2016

    @unknwon
    Member

    Thank your feedback!

    It is indeed a problem... but why can you just use , :trollface:

  2. marcopaganini commented on Jan 26, 2016

    @marcopaganini
    Author

    Oh, but then we'd have the same problem with the comma, no? :)
    The fact is, unless we allow quoting or escaping, there will always be one
    character we can't use (the delmiter).

    On Tue, Jan 26, 2016 at 12:03 AM, 无闻 notifications@github.com wrote:

    Thank your feedback!

    It is indeed a problem... but why can you just use , [image: :trollface:]

    —
    Reply to this email directly or view it on GitHub
    #32 (comment).

  3. unknwon commented on Jan 26, 2016

    @unknwon
    Member

    If you have ,, then use ,,, then ,,,, and ,,,,, etc...

  4. added a commit that references this issue on Aug 27, 2017
    a051195
  5. added a commit that references this issue on Oct 14, 2017
    696b7e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0