Kevin Brown [Fri, 8 May 2020 21:19:04 +0000 (17:19 -0400)]
Converted more of parse tree to dictionary
This should make it easier to detect what type of literal has been
parsed (we don't differentiate between single and double quoted
strings) as well as determining the specific accessors that are
called on a given variable.
Tuple and list literals have also been normalized to hold their
values in a key called `value` which is the same as other literals.
Implicit identifier tuples have not been switched yet because those
are not currently parses like tuple literals.
Kevin Brown [Fri, 8 May 2020 20:56:26 +0000 (16:56 -0400)]
Support implicit tuples in block parameters
This fixes an issue where implicit tuples were not parsed correctly
when they were used as a key in a block parameter. Now for loops
and set statements with implicit tuples work properly. This only
supports implicit tuples when all values are identifiers, since
these are generally used for assignment and you cannot assign a
new value to a literal.
Kevin Brown [Fri, 8 May 2020 17:51:14 +0000 (13:51 -0400)]
Add support for tests
Right now these are very basic and don't appear to form the correct
parse tree for logical comparisons which use tests as well. But it
parses at lease somewaht correctly, so there is something to work
with here.
Kevin Brown [Fri, 8 May 2020 14:01:10 +0000 (10:01 -0400)]
Support assignment expressions in generic blocks
Because of the way assignment expressions handle implicit tuples,
it's now possible to support the complex for loops within the
standard generic block grammar.
Kevin Brown [Fri, 8 May 2020 13:54:35 +0000 (09:54 -0400)]
Added grammar for `for` loops
Since this needs to support assignment targets, it is difficult to
properly support this within a generic block syntax because of the
ability to create implicit tuples.
Kevin Brown [Fri, 8 May 2020 12:49:24 +0000 (08:49 -0400)]
Added tuple literal support
This maintains the expectation that tuple literals will always end
with a comma if there is a single item.
The example is the combined one from the Jinja docs but it does not
include the comma for the tuple assignment since the grammar does
not currently support that.
Kevin Brown [Fri, 8 May 2020 11:13:52 +0000 (07:13 -0400)]
Support key-value block parameters
Block parameters should support all of the things that a function
call parameter would normally support. This includes key-value
paramters and in our test we include the transaltion example from
the documentation.
Kevin Brown [Fri, 8 May 2020 11:08:04 +0000 (07:08 -0400)]
Support named parameters to calls
This also switches the parameters in calls to be returned as a
dictionary which should make it easier to differentiate between a
value-only parameter and a key-value parameter.
Kevin Brown [Fri, 8 May 2020 10:26:02 +0000 (06:26 -0400)]
Support dot accessors on variables
This adds support for dot accessors on variables in such a way that
it is flexible enough to match the handling provided by the existing
template engine.
Kevin Brown [Fri, 8 May 2020 10:21:58 +0000 (06:21 -0400)]
Start definining variable identifiers
Variables are standard identifiers or literals that can be
augmented by accessors (either dictionary or dot style). This
finally defines what a string is.
Kevin Brown [Fri, 8 May 2020 09:33:28 +0000 (05:33 -0400)]
Fix content overtaking expressions
This fixes a issue where content would try to overtake everything
following it, even if there was a better expression to match after
the content. This was fixed by telling content to match everything
but the start of different expressions, which appears to solve a
bunch of issues.
Ken Crowell [Sun, 12 Apr 2020 16:46:08 +0000 (13:46 -0300)]
Don't use setlocal in syntax file (#1164)
I'm not 100% sure that one should not use `setlocal` in a syntax file,
but this breaks other filetypes that may include this syntax file, like
the vim-markdown plugin. The `comments` and `commentstring` get set for
that markdown buffer with the jinja settings.
See
https://github.com/dhruvasagar/vim-table-mode/issues/162#issuecomment-595317626
for an example of side effects.
ldealmei [Fri, 28 Feb 2020 15:29:26 +0000 (16:29 +0100)]
Add link to template designer documentation
For those who were actually looking for the template design documentation putting a link directly to it might prevent them to have to google for it. When on the API page, there is no direct way to find the template design documentation. Hope this can help others.