HaxeFoundation / intellij-haxe

Haxe plugin for IntelliJ Platform based IDEs (IDEA, Android-Studio)
http://intellij-haxe.org
Apache License 2.0
220 stars 99 forks source link

GrammarKit generate different types than what is currently in gen/ #155

Closed yanhick closed 9 years ago

yanhick commented 9 years ago

@EBatTiVo, @as3boyan, when I generate the haxe and hxml parsers from the command-line, I get differences in the types generated, a lot of them are wrapped in List.

For example HaxeBlockStatement becomes List.

I'm guessing this is because I don't use the right version of GrammarKit, I'm using 1.2.0, could you tell me which one do you use ? Thanks

sganapavarapu1 commented 9 years ago

The version I have is 1.2.0.1

Even for me, it sometimes generates those List types. At that time, I revert those changes... quit my IDE completely (not just closing the project) & relaunch it and try the same operation - it generates properly... weird but worked so far.

as3boyan commented 9 years ago

I use same version

yanhick commented 9 years ago

Weird bug, I have the same with 1.2.0.1, do you have the same issue @as3boyan ?

as3boyan commented 9 years ago

no, @yanhick

yanhick commented 9 years ago

@sganapavarapu1, are you sure that when you relaunch the IDE, GrammarKit just skips compilation since "gen" already exists ? What happens if you remove "gen" before restarting the IDE ?

as3boyan commented 9 years ago

@yanhick If I delete "gen" - get same issue.

yanhick commented 9 years ago

thanks, do you guys think that the generated "List" make sense given the current state of the BNF ? I don't understand enough about it to know.

as3boyan commented 9 years ago

Perhaps typeTag may have multiple function types, each function type may be corresponding to type or anonymous

sganapavarapu1 commented 9 years ago

@yanhick
I removed the "gen" directory and restarted my IDE - then regenerated the sources & rebuilt... I did 'not' run into the List issue. So, it seems that pre-existing "gen" directory isn't the issue.

FYI, I happened to find out in past, confirmedly - that, entries in idea.vmoptions in your $IDEA_INSTALL_DIR/bin also influences what's generated.

e.g. this is what I have in my idea.vmoptions

-ea -server -Xms1g -Xmx2g -Xss16m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseAdaptiveGCBoundary -XX:+HeapDumpOnOutOfMemoryError -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=60 -XX:+UseSplitVerifier -XX:CompileThreshold=10000 -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -Dawt.useSystemAAFontSettings=lcd

Earlier, I used to have something similar to what Adolfo's comments have (at this URL): https://intellij-support.jetbrains.com/entries/23395793-Configuring-JVM-options-and-platform-properties

e.g. some of these affect how grammar kit generates code:

-XX:+UseFastAccessorMethods
-XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+UseStringCache -XX:+UseCodeCacheFlushing

even with stabler older versions of grammar kit.

sganapavarapu1 commented 9 years ago

I did find another problem though - when I removed my "gen" ... following files were not regenerated!

    deleted:    gen/com/intellij/plugins/haxe/hxml/HXMLParser.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLClasspath.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLDefine.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLLib.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLMain.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLProperty.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLQualifiedName.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLTypes.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/HXMLVisitor.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/impl/HXMLClasspathImpl.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/impl/HXMLDefineImpl.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/impl/HXMLLibImpl.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/impl/HXMLMainImpl.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/impl/HXMLPropertyImpl.java
    deleted:    gen/com/intellij/plugins/haxe/hxml/psi/impl/HXMLQualifiedNameImpl.java
    deleted:    gen/com/intellij/plugins/haxe/lang/psi/HaxeConstructorName.java
    deleted:    gen/com/intellij/plugins/haxe/lang/psi/HaxeMacroMeta.java

I had to get them from git-hub repo.

as3boyan commented 9 years ago

@sganapavarapu1 They should be generated if you open hxml.bnf and trigger grammar generation for it

yanhick commented 9 years ago

Thanks guys. @as3boyan, we just discussed this at our standup, we'll file a bug on the GrammarKit project to ask why those extra List are generated.

sganapavarapu1 commented 9 years ago

@as3boyan Thanks,

EBatTiVo commented 9 years ago

Grammar-kit bug was filed: https://github.com/JetBrains/Grammar-Kit/issues/60

EBatTiVo commented 9 years ago

BTW, Grammar-Kit 1.1.x still works and doesn't have this bug.