Skip to content

Parser should respect quoted or escaped delimiter #32

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.

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