Skip to content
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

Add nested ranges #579

Open
appeltaert opened this issue Oct 26, 2016 · 7 comments
Open

Add nested ranges #579

appeltaert opened this issue Oct 26, 2016 · 7 comments

Comments

@appeltaert
Copy link

I'm currently falling back on PHP alot because of the amount of nested looping i need to do to keep fixtures as dry as possible.

foreach($contentTypes as $type) {
    $return['Content']['content_'.$type.'{1..5}'] = [
        // ...
        'ctype' => '@ctype_' . $type
    ];
}

In YML this currently means:

Content:
    content_image_{1..5}:
        ctype: '@ctype_<current()>'
    content_video_{1..5}:
        ctype: '@ctype_<current()>'
    [...]

Could possibly be written as:

Content:
    content_{image, video}_{1..5}:
        ctype: '@ctype_<it|current|arg(1)>'
@theofidry
Copy link
Member

Sorry for the lack of feedback I completely missed the issue. I think that's a cool idea, I don't think I'll have time to work on it but it would be interesting to try to integrate it before the stable release, to see if the system is flexible enough for this kind of customization.

@theofidry theofidry added this to the 3.x milestone Oct 30, 2016
@appeltaert
Copy link
Author

No prob, i can take a look at it, this or the next week

@appeltaert
Copy link
Author

So i did some eyeballing, and while its not a terrible lexer, i think(not an expert) this feature requires a LL(k) parsing pattern to solve elegantly, and like you suggested yourself, #601 supports it.

I think this is a good move, a lot of open issues/tasks i saw on that 3.0 road map involves the lexer also right? Chances are that most new features/changes are going to involve the lexer.

@theofidry
Copy link
Member

I think this is a good move, a lot of open issues/tasks i saw on that 3.0 road map involves the lexer also right? Chances are that most new features/changes are going to involve the lexer.

Hm not so much actually. The lexer is involved as soon as something touches the Expression Language, i.e. the syntax to declare values. The parsing for the IDs or class names is done by the FlagParserInterface, which does not involve the lexer but good old regexes (which is more than enough there).

The main features left on my side:

  • Some benchmarking to see if there's things to improve and give the possibility to any contributor to quickly do a profile if he wants to check himself
  • Fix any obvious bottleneck
  • Finish Fixture lifecycle #388
  • Finish the doc
  • Check if we can do a caching of some sort:
  • A few other issues left and right

@theofidry
Copy link
Member

There is a few features I'm not aiming for the 3.0 stable release: if someone is ready to work on them before that I would welcome it obviously, but it's not my priority/goal.

I would love #601 to be done before the stable release as well, but I have little time to investigate how it would work (the list above is already more than enough :P)

@appeltaert
Copy link
Author

I totally missed contrbuting.md, i'll put some more time in into this. It is possible that it takes someone more acquainted with the internals to really pick this up, but its still a fun introduction to the internals.

@theofidry
Copy link
Member

It is possible that it takes someone more acquainted with the internals to really pick this up

For now there's only me 😛 I realise it's a big library which makes it not very easy to dig it, but I tried my best to make the code and doc regarding it as clear as possible. If you find something confusing while looking at something, don't hesitate to report it!

@theofidry theofidry changed the title (Suggestion) Nested ranges Add nested ranges Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants