blake-regalia / linked-data.syntaxes

Complete high-res syntaxes for SPARQL 1.1, Turtle, TriG, N-Triples, N-Quads, Notation3 and ShExC
ISC License
30 stars 7 forks source link

Possible evaluation of context for '$' character #21

Open griffin-rickle opened 4 years ago

griffin-rickle commented 4 years ago

Hi! I first want to say that this is the best, most comprehensive syntax highlighting library for Linked Data in Sublime I have come across. Great job!

When using it, I have some SPARQL queries that follow this sort of pattern:

INSERT{
  GRAPH ${var1}{
    ...
  }
}
${var2}
WHERE {
  ...
}

I'm not sure whether this actually breaks any of the rules for the SPARQL specification. If it does, then I would understand if you didn't want to do anything. However, it looks like the current context for the $ character does not look for any quotes around it, and all regular expressions I've used in any SPARQL query have been within quotes. I looked into it a bit myself, but I'm not sure how sublime packages work or how to make the changes myself. Is this behavior that could be implemented?

blake-regalia commented 4 years ago

the current context for the $ character does not look for any quotes around it, and all regular expressions I've used in any SPARQL query have been within quotes.

Hmm, could you clarify a bit more here? Are you trying to embed SPARQL queries within strings of another programming language? If so, what does this have to do with regular expressions and quotes? Maybe I am misunderstanding.

griffin-rickle commented 4 years ago

Are you trying to embed SPARQL queries within strings of another programming language?

Yeah I suppose it's similar to that, but I want to have these as separate files. Thinking about it now it doesn't make a ton of sense to change the whole highlighter for this use case, but I figured I would ask.

blake-regalia commented 4 years ago

The template would require its own language/syntax def, but if you're feeling savvy you could definitely clone the repo and extend the sparql.syntax-source with a few rules to accommodate the interpolations.