We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
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
Hello,
I am trying to parse a char sequence where all quted by quitaion marks:
["a", "b", "c"] // Or ['a', 'b', 'c']
I am using this struct to do the job:
type Char struct { Val *byte `("\""|"'")@Char("\""|"'")` }
However, when I am parse example, I got 1:1: unexpected token "'a'".
1:1: unexpected token "'a'"
Here is the testcase:
func TestParseSingleChar(t *testing.T) { parser := participle.MustBuild[Char]() tests := []struct { name string input string want byte }{ { "BackWithDoubleQuota", `"a"`, '0', }, { "BackWithNoQuote", `a`, '0', }, { "BackWithSingleQuota", `'a'`, '0', }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result, err := parser.ParseString("", tt.input) assert.NoError(t, err) }) } } }
Result:
Error: Received unexpected error: 1:1: unexpected token "\"a\"" Test: TestChar_getValue/BackWithDoubleQuota
How do I get the job done with correct definition for Char structure ?
Char
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I am trying to parse a char sequence where all quted by quitaion marks:
I am using this struct to do the job:
However, when I am parse example, I got
1:1: unexpected token "'a'"
.Here is the testcase:
Result:
How do I get the job done with correct definition for
Char
structure ?The text was updated successfully, but these errors were encountered: