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

Bug: termFromId errors on deeply nested quads #304

Open
jeswr opened this issue Aug 19, 2022 · 1 comment
Open

Bug: termFromId errors on deeply nested quads #304

jeswr opened this issue Aug 19, 2022 · 1 comment

Comments

@jeswr
Copy link
Collaborator

jeswr commented Aug 19, 2022

This test

N3.js/test/Term-test.js

Lines 211 to 213 in a8cd436

it('should correctly handle deeply nested quads', () => {
termFromId(DEEP_TRIPLE_STRING).should.equal(DEEP_TRIPLE);
});
fails as termFromId does not handle nested quads. This is because this regex (
const quadId = /^<<("(?:""|[^"])*"[^ ]*|[^ ]+) ("(?:""|[^"])*"[^ ]*|[^ ]+) ("(?:""|[^"])*"[^ ]*|[^ ]+) ?("(?:""|[^"])*"[^ ]*|[^ ]+)?>>$/;
) cannot handle one of the terms being a quad.

Trying to look into a fix but am struggling to get the regex for it right.

@RubenVerborgh
Copy link
Member

RubenVerborgh commented Aug 22, 2022

am struggling to get the regex for it right

If the nesting is arbitrarily deep, no regex can capture it, so we'd need to actually parse.

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

Successfully merging a pull request may close this issue.

2 participants