Git Product home page Git Product logo

Comments (3)

valarauca avatar valarauca commented on May 22, 2024

Appears to be only and and or. I'll try to write up a patch.

from minijinja.

mitsuhiko avatar mitsuhiko commented on May 22, 2024

I can imagine there being bugs but I am actually not able to reproduce. The following template:

{{ '{{ a }}' == 'a' and ( '{{ a }}' != 'b' or '{{ a }}' != 'c' ) }}

Produces the following AST:

Ok(
    Template {
        children: [
            EmitExpr {
                expr: BinOp {
                    op: ScAnd,
                    left: BinOp {
                        op: Eq,
                        left: Const {
                            value: "{{ a }}",
                        } @ 1:3-1:12,
                        right: Const {
                            value: "a",
                        } @ 1:16-1:19,
                    } @ 1:0-1:19,
                    right: BinOp {
                        op: ScOr,
                        left: BinOp {
                            op: Ne,
                            left: Const {
                                value: "{{ a }}",
                            } @ 1:26-1:35,
                            right: Const {
                                value: "b",
                            } @ 1:39-1:42,
                        } @ 1:24-1:42,
                        right: BinOp {
                            op: Ne,
                            left: Const {
                                value: "{{ a }}",
                            } @ 1:46-1:55,
                            right: Const {
                                value: "c",
                            } @ 1:59-1:62,
                        } @ 1:43-1:62,
                    } @ 1:24-1:62,
                } @ 1:0-1:64,
            } @ 1:0-1:64,
        ],
    } @ 0:0-1:67,
)

Which seems fine? Can you provide a minimal test case that shows this behavior?

from minijinja.

mitsuhiko avatar mitsuhiko commented on May 22, 2024

I'm unable to reproduce this. Jinja never had keywords and syntax wise it should not be necessary to enforce keywords to avoid ambiguities. The obvious exception is that if you name variables after soft keywords they won't function well in all contexts.

from minijinja.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.