Search HSL is a Python web application that facilitates the extraction and exploration of functions from .hsl, .hs_, and .hsi files in a specified directory. Built using Flask, it provides a user-friendly interface to list, search, and highlight function details from the selected files.
- Function Extraction: Scans
.hsl,.hs_, and.hsifiles in a directory to extract functions, arguments, return types, and file paths. - Web Interface: Displays extracted functions in a searchable table format.
- File Viewing: Highlights the function's location in the source file, with an option to view the file and jump to the relevant line.
- Directory Selection: Allows users to specify the directory containing the files to process.
- Python 3.8 or higher
- Flask
- Clone or download the repository:
git clone https://github.com/dcurrier/HSL-Search.git cd HSL-Search - Install required Python packages:
pip install flask
- Start the application:
python Search_HSL.py - Open your browser and navigate to:
http://127.0.0.1:5000/ - Enter the directory path containing
.hsl,.hs_, or.hsifiles and click "Submit". - View the list of extracted functions, search for specific functions, or click a function name to view its location in the source file.
Search_HSL.py: Main application file containing the Flask app and function extraction logic.
-
extract_functions_from_file(file_path, root_directory):- Extracts function names, arguments, return types, and line numbers from a given file using regex.
-
extract_all_functions(directory):- Iterates over files in the directory, extracting functions while resolving conflicts between
.hsl,.hs_, and.hsifiles.
- Iterates over files in the directory, extracting functions while resolving conflicts between
-
create_html(all_functions):- Generates an HTML table of the extracted functions for rendering in the web interface.
-
Routes:
/: Main route to input the directory and display results./view_file: Displays the selected file, highlighting the line containing the function.
- Search box for filtering functions.
- Table displaying function name, arguments, return type, and file path.
- File viewer with auto-scrolling to highlight specific lines.
- Modify
default_directoryin theindexroute to change the pre-filled directory path. - Update
function_patterninextract_functions_from_fileto accommodate additional syntax.
This project is licensed under the MIT License.
Feel free to fork the repository and submit pull requests for improvements or feature additions. For major changes, please open an issue first to discuss your ideas.
Enjoy exploring your HSL functions!