-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fleet-compatible generation for Grammar-Kit (#359)
* [fleet] Fixing test compilation * [fleet] Adjusting Parser generation for Fleet * [fleet]Passing generate for Fleet as an option + modifying parse() function * [fleet]Making tests for Fleet * [fleet]Moving Fleet-related generation logic outside of general generator * [fleet]Fix import generation for Fleet * [fleet]Adding generation action for Fleet * [fleet]Refactor ParserGenerator * [fleet]Separate tests for fleet generator * [fleet]Lexer generator action for Fleet * [fleet]Improving import directives in output files * [fleet]Polishing imports in generated files * [fleet]Polishing tests for fleet * [fleet]Adding import setting support for lexer generation * [fleet]forcing main to generate Fleet files * [fleet]fix accidental typo * [fleet]Moving generated files to proper folder * [fleet]fix lexer generation location * [fleet] adjust type holder generation to not generate factory methods * [fleet] Generate additional fleet-specific files * [fleet] Adjust testing data * [fleet] Polishing outputs * [fleet] Polishing for the review * [fleet] Clarification on Main class usage * [fleet] adjusting GenOptions + including adjustPackagesForFleet * [fleet] Renamed fleet-related actions * [fleet] Cleaning-up test * [fleet] Removed IFileType generation from the BNF grammar * [fleet] Created "Run Fleet-Compatible JFlex Generator" * [fleet] adding filetype generation to the main function parameters + adjusting tests for the new API * [fleet] idea API version update * [fleet] fix lexer imports not adjusting to fleet * Revert "[fleet] idea API version update" This reverts commit 129503f. * Revert "[fleet] Fixing test compilation" This reverts commit f511e14. * [fleet] configuration files rollback + removal of unused resource * [fleet] removing unintentional whitespaces * [fleet] hiding fleet-related items for fleet-unrelated projects + changing string prompts * [fleet] reverting "hiding fleet-related items for fleet-unrelated projects" * [fleet] fixing BnfRunFleetJFlexAction adding "fleet." to "fleet." * [fleet] updating CHANGELOG.md * [fleet] Extract basic generator functionality to make a separate IFileType generator for fleet * [fleet] remove unused getAllPossibleAttributeValues * [fleet] remove unused GenOptions parameter from FleetFileTypeGenerator constructor * [fleet] implement FleetBnfFileImpl that adjusts class names for Fleet * [fleet] extract adjustPackagesForFleet into a separate attribute for easier access from outside of GenOptions * [fleet] fix tests and test data * [fleet] add TOKEN_TYPE_FACTORY default value override * [fleet] improve naming and streamline logic in FleetBnfFileWrapper * [fleet] restructure FleetConstants * [fleet] refactor ParserGenerator so that ParserGenerator extends GeneratorBase * [fleet] fix hasAttributeValue logic * [fleet] make ExpressionGeneratorHelper reference constant set, not BnfConstants * [fleet] fix parser generation action * [fleet] adjust test data * [fleet] fix Main after refactoring * [fleet] refactor contxt creation for generate lexer action * [fleet] move adjustPackages attribute inside generate attribute * [fleet] adjust test data for testExprParser * [fleet] adjust code style * [fleet] Move RuleInfo + NameShortener to ParserGenerator * [fleet] Move RuleInfo + NameShortener to ParserGenerator * [fleet] rename ParserConstantSet to IntelliJPlatformConstants * [fleet] cleanup GenerateAction * [fleet] move fleet-related classes to flat "fleet" package * [fleet] move fleet-related classes to flat "fleet" package * [fleet] adding spaces * [fleet] simplifying BnfRunJFlexAction * [fleet] remove json.bnf from test data * [fleet] reformat test + inline myFile * [fleet] remove adjustPackagesForFleet GenOption * [fleet] rename ExprParser test and add FleetExternalRules test * [fleet] replace FleetBnfFileWrapper as PsiFile for BNF for Fleet-related generation * [fleet] refactor FleetBnfFileWrapper creation * [fleet] rename file to minimize diff with master * [fleet] add explanation for forceCachedPsi(wrapped) call in FleetBnfFileWrapper.wrapBnfFile --------- Co-authored-by: Boris Krylov <boris.krylov@jetbrains.com>
- Loading branch information
Showing
37 changed files
with
3,809 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
Manifest-Version: 1.0 | ||
Class-Path: light-psi-all.jar | ||
lib/3rd-party-rt.jar | ||
lib/platform-api.jar | ||
lib/platform-impl.jar | ||
lib/util.jar | ||
lib/util-8.jar | ||
lib/util_rt.jar | ||
lib/app-client.jar | ||
lib/lib-client.jar | ||
lib/opentelemetry.jar | ||
Main-Class: org.intellij.grammar.Main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package $packageName; | ||
|
||
import fleet.com.intellij.lexer.FlexLexer; | ||
import fleet.com.intellij.psi.tree.IElementType; | ||
|
||
import static fleet.com.intellij.psi.TokenType.BAD_CHARACTER; | ||
import static fleet.com.intellij.psi.TokenType.WHITE_SPACE; | ||
import static $typesClass.*; | ||
|
||
%% | ||
|
||
%{ | ||
public $lexerClass() { | ||
this((java.io.Reader)null); | ||
} | ||
%} | ||
|
||
%public | ||
%class $lexerClass | ||
%implements FlexLexer | ||
%function advance | ||
%type IElementType | ||
%unicode | ||
|
||
EOL=\R | ||
WHITE_SPACE=\s+ | ||
|
||
#foreach( $token in $regexpTokens.keySet() ) | ||
$token=$regexpTokens.get($token) | ||
#end | ||
|
||
#macro(spaces $len) #set( $count = $maxTokenLength - $len ) $StringUtil.repeat(" ", $count) #end | ||
%% | ||
<YYINITIAL> { | ||
{WHITE_SPACE} #spaces(11) { return WHITE_SPACE; } | ||
|
||
#foreach( $token in $simpleTokens.keySet() ) | ||
"$simpleTokens.get($token)" #spaces($simpleTokens.get($token).length()) { return ${tokenPrefix}$token; } | ||
#end | ||
|
||
#foreach( $token in $regexpTokens.keySet() ) | ||
{$token} #spaces($token.length()) { return ${tokenPrefix}$token; } | ||
#end | ||
|
||
} | ||
|
||
[^] { return BAD_CHARACTER; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.