libgdx / gdx-ai

Artificial Intelligence framework for games based on libGDX or not. Features: Steering Behaviors, Formation Motion, Pathfinding, Behavior Trees and Finite State Machines
Apache License 2.0
1.2k stars 242 forks source link

Allow to use inner classes in btree files #107

Closed Genhis closed 5 years ago

Genhis commented 5 years ago

Fixes #101

davebaol commented 5 years ago

The $ should be legal only after the last . I mean, if I got it right your change allows illegal stuff like package.Class$Inner.package2. Correct me if I'm wrong.

Genhis commented 5 years ago

You are correct; however, I couldn't find a way to do it, and since the issue has been open for more than a year, I wanted to contribute with my (though not optimal) solution.

I do not know Ragel, so I just edited the file manually in the simplest way I could and let ragel to build the java file. I would appreciate any advice regarding Ragel.

If you know how to quickly fix it, feel free to close this pull request.

davebaol commented 5 years ago

Please, try the following

id = [a-zA-Z_] [a-zA-Z_0-9]*;
...
taskName = idBegin ('.' id)* ('$' id)* '?'? %{isSubtreeRef = false;} %taskName;

This change should cover the following sample task names:

Please, let me know if it works as expected.

Genhis commented 5 years ago

It works as expected, thanks :) I updated the PR to reflect your changes.

davebaol commented 5 years ago

Merged! Thanks :)