Open SingingBush opened 7 years ago
Thanks. I fixed the typo.
wow that was quick. I'm having a slight issue. after running the jflex task I can see the generated-src in the build directory but it's empty. I have a flex file in src/main/jflex and when running the task there wasn't any error messages
What Gradle version do you use?
3.3
Can you give an example jflex? I would like to check if there is an issue with package configuration.
The result should be in directory build/generated-src/jflex
sure. It's likely to have problems. I've just started on it today and have never used jflex before
package com.singingbush.sdlplugin.lexer;
import com.intellij.lexer.*;
import com.intellij.psi.tree.IElementType;
%%
%{
private int nestedCommentDepth = 0;
private int blockCommentDepth = 0;
public SdlLexer() {
this((java.io.Reader)null);
}
%}
%public
%class SdlLexer
%implements FlexLexer
%function advance
%type IElementType
%unicode
EOL = "\n"
WHITE_SPACE_CHAR = [\ \t\f]
NEW_LINE = [\n\r]+
// maybe better off making NEW_LINE = [^\n]*
LETTER = [:letter:]
DIGIT = [:digit:]
ID = (_|{LETTER}) (_|{DIGIT}|{LETTER})*
LINE_COMMENT="//".*
BLOCK_COMMENT_START = "/*"
BLOCK_COMMENT_END = "*/"
%xstate BRACES, VALUE, VALUE_OR_KEY, VALUE_BRACE, INDENT_VALUE
// %state WAITING_VALUE, NESTING_COMMENT_CONTENT BLOCK_COMMENT_CONTENT
%%
<YYINITIAL> {WHITE_SPACE_CHAR}+ { return com.intellij.psi.TokenType.WHITE_SPACE; }
<YYINITIAL> {NEW_LINE}+ { return com.intellij.psi.TokenType.WHITE_SPACE; }
<YYINITIAL, BRACES, VALUE, VALUE_BRACE, VALUE_OR_KEY> {
";" {
return EOL
}
}
For now I'm just trying to get something running so I've at least got something to build on. It's for getting Intellij to support https://sdlang.org/
Can you check out https://github.com/jprante/jflex-example ?
When I enter ./gradlew jflex
I see the java source in ./build/generated-src/jflex/com/singingbush/sdlplugin/lexer/SdlLexer.java
ok that's odd. I checked out the repo and ran ./gradlew jflex and it worked fine. I tried changing gradle version in my project to 3.5 as that's what you have in that example but it still won't generate a Java file.
I'm using the jflex plugin in a module of a multi-module project so I tried restructuring the example so that it a sub module but it still worked fine. I wonder if the problem I'm seeing is due to other plugins I'm using. Besides yours I'm also using 'org.jetbrains.intellij' and 'kotlin'
Thanks for reporting back.
I will try to investigate to find out such situations when jflex might not write out to the specified directory, or situations when jflex fails (silently).
I'm making some progress with this jflex stuff albeit slow. 2 of the 3 flex files I have are generating Java classes.
It would be good if the plugin did more logging. When running gradle with --info or --debug there's no information about problems with the flex file that isn't producing a Java class.
in your readme the groupId for the plugin is org.xbib.gradle.plugins:
but that doesn't tally up with your maven repository org.xbib.gradle.plugin: http://xbib.org/repository/org/xbib/gradle/plugin/gradle-plugin-jflex/