tulipcc / tulipcc-maven-plugin

An updated version of the javacc-maven-plugin using ParserGeneratorCC
Apache License 2.0
40 stars 5 forks source link

issue with escaping #10

Closed eduarddrenth closed 4 years ago

eduarddrenth commented 6 years ago

Dear all,

I have this:

| <VALUE: ( ~[",",")","|"] )* ~["\\",",",")","|"] >

which results in this faulty code:


private int jjMoveStringLiteralDfa0_2(){
   switch(curChar)
   {
      case ')':
         return jjStopAtPos(0, 7);
      case ',':
         return jjStopAtPos(0, 9);
      case '\':
         return jjMoveStringLiteralDfa1_2(0x1000L);
      case '|':
         return jjStopAtPos(0, 11);
      default :
         return jjMoveNfa_2(2, 0);
   }
}

This works with maven plugin 2.6 / javacc 5 and 6.

It also works with https://github.com/javacc/javacc 7.0.3 commandline, in that case this is generated:

private int jjMoveStringLiteralDfa0_2(){
   switch(curChar)
   {
      case 41:
         return jjStopAtPos(0, 7);
      case 44:
         return jjStopAtPos(0, 9);
      case 92:
         return jjMoveStringLiteralDfa1_2(0x1000L);
      case 124:
         return jjStopAtPos(0, 11);
      default :
         return jjMoveNfa_2(2, 0);
   }
}
phax commented 6 years ago

I know there is an issue with escaping. Thanks für pointing that out

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

phax commented 4 years ago

This is the same as https://github.com/phax/ParserGeneratorCC/issues/20 and was fixed in PGCC 1.1.0 and this plugin version 4.1.0

eduarddrenth commented 4 years ago

allright, I'll give it a try, thnx!

phax commented 4 years ago

I wasn't expecting your reaction on that one - after nearly 2 years ;-) Please ensure to use the latest and greatest 4.1.4 version

eduarddrenth commented 4 years ago

Yeah, long time ago, I just don't like using old stuff (maven javacc plugin 2.6 from 2009) and would realy like to update.

First attempts unsuccessful, can you point me to the gid/artid/version of the maven plugin?

phax commented 4 years ago

Sounds like a plan. Try

<groupId>com.helger.maven</groupId>
<artifactId>ph-javacc-maven-plugin</artifactId>
<version>4.1.4</version>
phax commented 4 years ago

I kicked some very old legacy stuff (support for creating code for Java versions < 1.5 etc.)

eduarddrenth commented 4 years ago

Works (just intellij isn't satisfied with the version), build and tests succeed. All I had to do:

phax commented 4 years ago

Cool thanks. Maybe because 4.1.4 was just released yesterday and is not yet in your IDE's Maven artifact cache... Happy CCing :)

phax commented 4 years ago

I added your comments to the readme at https://github.com/phax/ph-javacc-maven-plugin#upgrading-from-the-original-plugin

eduarddrenth commented 4 years ago

Thanks again,

In the docs I read "fork of JavaCC 7.0.3 but with slightly improved code and output quality". Why deviate and not join JavaCC?

On Thu, 2020-05-14 at 01:28 -0700, Philip Helger wrote:

I added your comments to the readme at https://github.com/phax/ph-javacc-maven-plugin#upgrading-from-the-original-plugin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

phax commented 4 years ago

Bcause the guy(s) at JavaCC where very reluctant to approve PRs at that time, but I needed a quick fix (because the output was broken). Since that issue took 2 years to get fixed (don't recall the actual duration but it was veeeeery long) I was convinced that this is not the way forward.