-
Notifications
You must be signed in to change notification settings - Fork 45
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
👔 Add identification logic of parameters in Spring #233
Conversation
- Added `src/miniparsers/java.cr` file - Added `JavaParser` class with `parse`, `parse_import_statements`, `parse_classes_body`, and `print_tokens` methods - Implemented tokenization logic in `MiniLexer` class - Added `line` property to `Token` class and updated `to_s` method to handle newline characters correctly - Added `src/minilexers/java.cr` file with keyword, literal, separator, and operator definitions for Java - Implemented `JavaLexer` class for tokenizing Java code, handling different types of tokens, and skipping whitespace and comments
- Refactor `@classes_body_tokens` variable to `@classes_tokens` in `java.cr` - Add `@class_annotation` variable for storing class annotations in `java.cr` - Modify `parse_classes` method in `java.cr` to also parse class annotations - Add `parse_formal_parameters` method for parsing formal parameters in `java.cr` - Add `parse_annotations` method for parsing annotations in `java.cr` - Modify `parse_methods` method in `java.cr` to correctly parse method declarations and bodies - Add imports for `java` lexer and parser in `analyzer_spring.cr` - Change variable name `has_class_been_imported` to `has_spring_web_bind_class_been_import` in `analyzer_spring.cr` - Refactor code in `analyzer_spring.cr` to use the `JavaLexer` and `JavaParser` classes - Modify `tokenize` method in `minilexer.cr` to pass line number obtained from `line()` method to `Token` constructor - Modify `<<` method in `minilexer.cr` to use the new `line()` method to calculate line number for each token
- Modify `JavaParser` class for improved handling of `{}` characters in `parse_formal_parameters` method - Update `parse_classes` method to correctly parse class bodies - Implement `parse_methods` method to handle parsing of methods within the class body - Refactor `analyzers/analyzer_spring.cr` by removing unnecessary `begin` and `rescue` blocks in `analyze` method - Rename `has_spring_web_bind_class_been_import` to `has_spring_web_bind_package_been_import` - Add parsing of base URL, methods, annotations, and parameters in the Spring MVC class - Improve handling of methods without `@RequestMapping` annotation - Remove unused code and variables related to the `Reactive Router` - Add `get_mapping_path` method for handling parsing of path parameters in method annotations - Modify logic for retrieving endpoint parameters in the Spring MVC class
- Made modifications to the `java.cr` file to improve logic in tokenization and matching of literals, identifiers, and operators - Added new methods and updated existing methods in the `java.cr` file to support class parsing and model creation - Updated the `AnalyzerSpring` class to handle parsing of Spring MVC and Reactive Router code, including endpoints, annotations, and parameters - Added a `.gitignore` file to the `kotlin_spring` fixtures and included `.gradle` in it - Added a `.gitignore` file to the `java_spring` fixtures and added `.gradle` to the ignore list
- Refactored and implemented various methods and classes in `src/miniparsers/java.cr` - Added a new file `detect_kotlin_spring_spe_spec.cr` and test case in `spec/unit_test/detector` for detecting Java Spring - Updated `src/models/minilexer/minilexer.cr` to include a new line and fix a typo in the method signature - Made modifications and additions to `src/models/noir.cr` including the addition of new methods - Updated `spec/functional_test/fixtures/java_spring/src/ItemController.java` to include a package statement and class definition - Created a new file `src/analyzer/analyzers/analyzer_kotlin_spring.cr` with various methods and functions - Deleted `src/analyzer/analyzers/analyzer_spring.cr` - Made changes to `spec/functional_test/testers/java_spring_spec.cr` related to endpoint definitions - Refactored and reordered code in `src/minilexers/java.cr` - Made changes to `src/models/endpoint.cr` including the addition of comparison methods - Modified `src/analyzer/analyzer.cr` to use updated analyzer functions and remove duplicate checks - Renamed `spec/unit_test/analyzer/analyzer_spring_spec.cr` to `analyzer_kotlin_spring_spec.cr` and updated its contents - Refactored conditions in `src/detector/detectors/java_spring.cr` for better readability - Modified `src/detector/detectors/kotlin_spring.cr` to add additional detection conditions - Added a new file `src/analyzer/analyzers/analyzer_java_spring.cr` with various methods and functions.
- Added support for RequestHeader annotation in endpoint parameters - Added support for HttpServletRequest argument in endpoint parameters
Hi~ I've implemented a simple lexer and parser for the Java language. |
@ksg97031 Have a wonderful refresh :D |
Hi @ksg97031 👋🏼
I've added some code to the SpringAnalyzer for #232. This code identifies well-known parameter processing logic and adds it as a parameter to the last added Endpoint during file content analysis. I've written it lightly for now, but please review and let me know if this method seems good!
If this direction is correct, I think it would be good to continue expanding the pattern together in the future. However, I'm slightly worried because developers have such a wide variety of ways to handle parameters.