Code Monkey home page Code Monkey logo

Comments (5)

toniperic avatar toniperic commented on June 16, 2024

Just gonna add some more info related to this.

Template as a reference point:

{% set foobar = foo|map(bar => baz) %}

Tried using the Official ruleset on this, the following was the result:

l.1 c.29 : ERROR There should be 1 space(s) before ">".

When I printed out tokens, the following was the result:

BLOCK_START_TYPE()
ARROW_TYPE( )
NAME_TYPE(set)
ARROW_TYPE( )
NAME_TYPE(foobar)
ARROW_TYPE( )
OPERATOR_TYPE(=)
ARROW_TYPE( )
NAME_TYPE(foo)
PUNCTUATION_TYPE(|)
NAME_TYPE(map)
PUNCTUATION_TYPE(()
NAME_TYPE(bar)
ARROW_TYPE( )
OPERATOR_TYPE(=)
OPERATOR_TYPE(>)
ARROW_TYPE( )
NAME_TYPE(baz)
PUNCTUATION_TYPE())
ARROW_TYPE( )
BLOCK_END_TYPE()

from twigcs.

toniperic avatar toniperic commented on June 16, 2024

I've also found out about #69 but I'm not sure whether that means versions older than 4 would not be getting the arrow token support?

from twigcs.

OwlyCode avatar OwlyCode commented on June 16, 2024

The easiest way to fix this would be to change the numbers of the custom tokens Twigcs introduces but it feels like it's just a workaround. This problem lies inside a greater problem I'm trying to figure out how to solve: keeping up with twig versions in a consistent way.

Nowadays I'm tempted to go with some opinionated choices:

  • Stripping the Lexer from the official library, we copy it inside Twigcs and maintain it separately with our needed code (custom tokens, newlines handling): no more collisions, no more twig dependency inside composer, we gain full control on that.
  • Killing twigcs 3.x as fast as possible (so many unfixable things like arrow functions)
  • Adding Twig 1, 2 and 3 support inside twigcs 4.x before it is out of beta (using 3 rulesets ?)

from twigcs.

OwlyCode avatar OwlyCode commented on June 16, 2024

I've submitted a PR that will fix this issue here : #114.

from twigcs.

OwlyCode avatar OwlyCode commented on June 16, 2024

I'm closing this as the PR got merged!

from twigcs.

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.