-
Notifications
You must be signed in to change notification settings - Fork 225
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
Grammar details #185
Comments
@kylef or @ilyapuchka Can I please get some feedback on this? |
I haven't looked at the PR and grammar in details, but what I can say is:
|
@AliSoftware Thanks. Can you show an example of a filter with multiple parameters? Is this |
That's actually a very good question, since it seems that we don't use the |
Here is what I can tell to the extent of what I remember from implementation details. Might not be entirely correct. I would suggest to also refer to tests.
any string that can be a dictionary key,
any string except
any string except
everything inside double or single quotes is parsed as a string literal. As far as I can tell there is nothing implemented for escaping yet.
anything that can be converted to Int or Float in Swift. I would refer Swift docs for that or just try different representations in a playground or REPL. I think exponential and hex form (0x) is actually allowed, but (strangely) not binary (0b) or octet (0o), which are only supported as literals
they can be string or number literals or variables names
yes, comma is used as a separator, spaces are not allowed (there is PR for that #178)
not in the master, there is PR for that - #164
yes, expressions are not supported on master, there is PR for that - #164
yes, spaces are required between operators
if they are used as part of other expression, i.e. with operator or in tag then yes. Space is used as default separator for tokens. Other separators are
they are not required, but I agree that with spaces its more readable |
@ilyapuchka Thanks for your input!
I assume One more question: in |
|
@ilyapuchka @AliSoftware I've updated my questions to include your answers and how I've decided to implement it. With that, the code is ready to release and my Visual Studio Code extension can now be dowloaded from the Marketplace or from within Visual Studio code itself :) https://marketplace.visualstudio.com/items?itemName=svanimpe.stencil In the future, can you please @mention me or open an issue in https://github.com/svanimpe/vscode-stencil if you make changes to Stencil that require an update to my grammar? |
👍 |
I've written a TextMate grammar (https://github.com/svanimpe/stencil.tmbundle) for Stencil and intend to use this to build a Visual Studio Code extension. Before I can finish the grammar, I need an answer to the following questions:
[^\s\.,|%}]+
, meaning any string that does not contain whitespace, a dot (used as a separator), a pipe (indicates the start of a filter), a percent sign (as that may indicate the end of a tag) or a closing brace (as that may indicate the end of a variable).[^\s:|%}]+
, meaning any string that does not contain whitespace, a colon (indicates the start of the parameters), a pipe, a percent sign or a closing brace.[^\s%]+
, meaning any string that does not contain whitespace or a percent sign.-?(0|[1-9]\d*)(\.\d+)?
, which is simpler than what Swift supports, but it should be sufficient. I've also added support for numbers as properties and numbers as filter parameters.The text was updated successfully, but these errors were encountered: