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

Referencing key items in groupings gives parsing error #19

Closed
demonicblue opened this issue Aug 5, 2016 · 3 comments
Closed

Referencing key items in groupings gives parsing error #19

demonicblue opened this issue Aug 5, 2016 · 3 comments

Comments

@demonicblue
Copy link
Contributor

The following code references a key in a grouping and fails parsing.

module foo {
    grouping quisling {
      leaf first {
        type string;
      }
      leaf second {
        type int32;
      }
    }
    container top {
      list kek {
        key "first";
        uses quisling;
      }
    }
  }

ExpressionError: foo/top/kek/key[first] referenced key items do not have leaf elements

I can write a test for this case but I'm unsure where it would fit. list.coffee or maybe grouping.coffee

@sekur
Copy link
Collaborator

sekur commented Aug 5, 2016

It should be a test case inside list. The order of the statements is what's
causing the issue (although it shouldn't matter in this context).

If you swap the order, "uses quisling" before "key" statement, it will work
properly. It's because the leaf item referenced by "key" doesn't yet exist
in the schema node being resolved since "uses" has yet to be resolved.

I'll see how I can change this up a bit to have the list resolve handler
process any uses statement before any other statements.
On Fri, Aug 5, 2016 at 1:54 AM Henrik Hugo notifications@github.com wrote:

The following code references a key in a grouping and fails parsing.

module foo {
grouping quisling {
leaf first {
type string;
}
leaf second {
type int32;
}
}
container top {
list kek {
key "first";
uses quisling;
}
}
}

ExpressionError: foo/top/kek/key[first] referenced key items do not have
leaf elements

I can write a test for this case but I'm unsure where it would fit.
list.coffee or maybe grouping.coffee


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#19, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6KbKdL2ApSxtW3Z8KvqEVT5cJ0o7sLks5qcvpfgaJpZM4Jde9P
.

Peter Lee
Corenova Technologies
+1 310 400 6450
peter@corenova.com

@demonicblue
Copy link
Contributor Author

Ok, thanks for the tip.

@sekur sekur closed this as completed in b0a5bde Aug 5, 2016
@sekur
Copy link
Collaborator

sekur commented Aug 5, 2016

@demonicblue - thanks for catching this issue. Please feel free to review the commit to see how I've resolved it.

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

No branches or pull requests

2 participants