-
Notifications
You must be signed in to change notification settings - Fork 47
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
Support ANTLR 3.5 #164
Comments
Hi, how important is that for you? Is it needed or rather nice to have? |
It's an annoyance because we use ANTLR 3.5, forcing us to downgrade it to 3.4 in our frontend. So not really a big deal, but nice to have. |
@marcusk24 you could use JarJar maven plugin to solve this problem. |
@marcusk24 I'm working on extend #151 now and would like to finish it before I start something new. Of course, I would accept pull request if anyone would have time to do it :). |
I've updated ANTLR to 3.5.1 in my repo: https://github.com/jochenberger/less4j/tree/update-antlr-to-3.5 |
@jochenberger Unfortunately, I'm short on time right now and will not be able to get to it this week. Anyway, appenders are done in a non-standard way:
where three calls of method I guess that this stopped to work as expected after upgrade. I did it this way, spaces are normally insignificant and I throw them away. However, they are significant in some places and this is one of them. The above is a "hack" to make them matter here. |
Yes, the failures are probably related. For example,
the expected result is #blood.blood.red.black {
color: black;
} but it produces #blood.blood.red .black {
color: black;
} |
The
I guess that the token is not null if there is no whitespace anymore for some reason. The method is defined in less.g file. Antlr copies it into generated |
I suspected that too, but |
I just hit the same issue and started working on this. Is it worth doing an upgrade to 3.5 or do you think it's more worthwhile to jump to the antlr 4 line? |
@UnquietCode Is there a reason not to jump to antlr 4? I did not researched it. If there is no reason, then I think it should be worth it. |
Mainly it just looks quite a bit different. Different file extensions, different generated classes, "ground up rewrites" of their core classes, etc. Is it worth it? Definitely, especially as Antlr 3 won't be around forever. However my guess is this is probably a task requiring intimate knowledge of less4j which you ( @SomMeri ) would have to tackle. I'll make a fork and start exploring though in the meantime. |
Ok yeah the grammar in antrl4 seems to have changed quite a bit, and the tree concept has changed as well. Here is some initial work which updates the dependencies, plugin goals, basic package renaming, etc. There are still a lot of compile errors due to the missing classes. https://github.com/UnquietCode/less4j/commits/master |
@UnquietCode If you found a good write up about changes would you post it here? I have seen a presentation about it and it seemed like antlr 4 could allow me to remove some hacks/fragile places from less4j grammar. Plus, they promised that 4.2 will be faster. I would accept both move to 3.5 and move to 4.2. However, working on 3.5 might be waste of time if the thing will be moved on 4.2 later on. |
I had looked for a guide originally and could not find one, so I raised a question on the antlr 4 issue tracker. |
Thank you a lot. I subscribed to that antlr issue. |
tl;dr: As attractive as this task seems to be, I do not see myself doing it this winter. I would be thankful for pull request if anyone else does it. Based on the antlr4 answer, move to antlr 4 is possible but probably a lot of work. I seems like interesting challenge for someone with a lot of time. Less4j uses Although most changes will probably be trivial and straightforward, they will have to be done all at the same time as I do not see a way how to do them one by one. So it looks like the case of do a lot of coding and then debug for a long time. Another thing that will need to be rewritten is comments handing - how it works now is described here. On the plus side, adding new less features into antlr4 grammar will probably be easier then adding them into current one. |
Another potential problem: predicates. Less4j uses them a lot and if their handling changed, there might be a tricky error. Edited to add if. |
I am running into the same problem as marcusk24. It would be much appreciated if you could upgrade to either 3.5 or 4.x. |
@fscheffer Is it possible for you to give me less sheet example that causes the problem? Even if we would start move to 4.x tomorrow, which is physically impossible, it would take a lot of time to finish it. If I would have example sheet, there might try to find faster solution. |
There are no problems regarding less sheets. We have two dependencies in our project, StringTemplate4 and Tapestry5, that also depend on antlr-runtime. Both projects use antlr-runtime 3.5 at the moment, so it would be great if you could upgrade less4j to 3.5 too. Right now we have to downgrade to antlr-runtime manually to 3.4 to make less4j happy. Luckily both StringTemplate4 and Tapestry5 seem to work fine with antlr-runtime 3.4 but I am very concerned that this wont be the case in the (near) future. (Sorry for the late response) |
That sounds like a strong argument against move to antlr4 yet. If it is going to conflict (I'm not sure) with other antlr3 libraries, then we can not upgrade to it. I guess I will be able to bump up the priority of this after I finish missing functions. That seems like the last major missing language feature. |
It seems all ANTLR 4 classes are inside the |
@SomMeri I would suggest repackage antlr inside less4j (using something like JarJar Maven Plugin: http://sonatype.github.io/jarjar-maven-plugin/). As result, any project using less4j won't have any compatibility issues. |
I think alexo's solution is propably the easiest one at the moment. I would not upgrade to 3.5 or 4.x until there's a real benefit. |
antlr/antlr3#151 might cause many people to switch to 3.5 at least. |
I pulled the upgrade to antlr 3.5.2 and closing this issue. The upgrade to antlr4 is much bigger task, so I opened separate issue #223 for it. |
In ANTLR 3.5 the field Token.EOF_TOKEN has been removed, which causes a runtime error because it's used here:
https://github.com/SomMeri/less4j/blob/master/src/main/antlr3/com/github/sommeri/less4j/core/parser/Less.g#L138
In version 3.5 obtaining this token is done through Lexer#getEOFToken().
The text was updated successfully, but these errors were encountered: