Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Simple (...) capturing group is not present in AST #38

Closed
unkind opened this issue Dec 3, 2018 · 4 comments
Closed

Simple (...) capturing group is not present in AST #38

unkind opened this issue Dec 3, 2018 · 4 comments

Comments

@unkind
Copy link

unkind commented Dec 3, 2018

$ast = $compiler->parse('~(foo)(bar)~');
$visitor = new Dump();
$visitor->visit($ast);
>  #expression
>  >  #concatenation
>  >  >  token(literal, ~)
>  >  >  #concatenation
>  >  >  >  token(literal, f)
>  >  >  >  token(literal, o)
>  >  >  >  token(literal, o)
>  >  >  #concatenation
>  >  >  >  token(literal, b)
>  >  >  >  token(literal, a)
>  >  >  >  token(literal, r)
>  >  >  token(literal, ~)

I tried to dump ast via regular var_dump(), but I see no attribute for indexed capturing group. #concatenation is something different.

When I walk through AST, #capturing is never present.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@unkind
Copy link
Author

unkind commented Dec 3, 2018

After fixing Grammar file:

-capturing:
+#capturing:

it works:

>  #expression
>  >  #concatenation
>  >  >  token(literal, ~)
>  >  >  #capturing
>  >  >  >  #concatenation
>  >  >  >  >  token(literal, f)
>  >  >  >  >  token(literal, o)
>  >  >  >  >  token(literal, o)
>  >  >  #capturing
>  >  >  >  #concatenation
>  >  >  >  >  token(literal, b)
>  >  >  >  >  token(literal, a)
>  >  >  >  >  token(literal, r)
>  >  >  token(literal, ~)

@Hywan
Copy link
Member

Hywan commented Dec 4, 2018

Hey,

Thanks for the clear bug report. Do you want to try a PR?

@unkind
Copy link
Author

unkind commented Dec 6, 2018

@Hywan I can make a PR for this diff of course, but I don't see tests and composer install gives

  Problem 1
    - Installation request for hoa/exception dev-master -> satisfiable by hoa/exception[dev-master].
    - hoa/exception dev-master requires hoa/event dev-master -> satisfiable by hoa/event[dev-master] but these conflict with your requirements or minimum-stability.
  Problem 2
    - Installation request for hoa/math dev-master -> satisfiable by hoa/math[dev-master].
    - hoa/math dev-master requires hoa/consistency ~1.0 -> satisfiable by hoa/consistency[1.16.01.11, 1.16.01.14, 1.16.03.03, 1.17.01.10, 1.17.05.02] but these conflict with your requirements or minimum-stability.
  Problem 3
    - hoa/exception dev-master requires hoa/event dev-master -> satisfiable by hoa/event[dev-master] but these conflict with your requirements or minimum-stability.
    - hoa/ustring dev-master requires hoa/exception dev-master -> satisfiable by hoa/exception[dev-master].
    - Installation request for hoa/ustring dev-master -> satisfiable by hoa/ustring[dev-master].

I tried to add

+    },
+    "minimum-stability": "dev"

but issue is still present:

  Problem 1
    - Installation request for hoa/math dev-master -> satisfiable by hoa/math[dev-master].
    - hoa/math dev-master requires hoa/consistency ~1.0 -> satisfiable by hoa/consistency[1.16.01.11, 1.16.01.14, 1.16.03.03, 1.17.01.10, 1.17.05.02] but these conflict with your requirements or minimum-stability.

And so on.

Versioning doesn't look clear.

@Hywan
Copy link
Member

Hywan commented Dec 7, 2018

Yeah, we are migrating the entire Hoa project to a new version. Open the PR, and I will take care of everything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants