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

Whitespace treatment in grammar #42

Closed
OlegIlyenko opened this issue Jul 9, 2015 · 2 comments
Closed

Whitespace treatment in grammar #42

OlegIlyenko opened this issue Jul 9, 2015 · 2 comments

Comments

@OlegIlyenko
Copy link
Contributor

Please correct me if I missed it in the spec, but I haven't found a formal definition of the whitespace treatment combined with some of the tokens. For example in the detective definition. It's not 100% clear whether whitespace is allowed between @ and Name. The same is for the variable: can I put a whitespace between $ and the Name like this?

$ myVariable

Intuition tells me that in most cases whitespaces are allowed, so query like this:

query    , FetchLukeAndLeiaAliased{
  luke:human(id   :  2.1e-7) {
    name,
  }
  leia       ,  : human   ,,, ( , id ,, : ,, "10103") {
    name
  }
}

is a valid query and should be parsed without any errors. Is my assumption correct?

@devknoll
Copy link
Contributor

devknoll commented Jul 9, 2015

8.1.1 says Whitespace, other than within strings, is not significant. Your assumption should hold.

@leebyron
Copy link
Collaborator

leebyron commented Jul 9, 2015

You're correct. Anything defined as a token grammar (consumes characters) is sensitive to whitespace (eg, string and number literals). Anything defined as a syntax grammar (consumes tokens) is not sensitive to whitespace or other ignored characters.

I'll try to clarify this in the spec

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

3 participants