Code structure view analyzing and previewing method

A structure analysis and code technology, applied in the field of code analysis, can solve problems such as low analysis efficiency, complexity, and inconvenience in real-time preview of target code positioning of code structure, so as to improve code reading efficiency and ease of use.

Pending Publication Date: 2022-05-24
北京简单一点科技有限公司
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] code structure view Figure 1 Generally, it is integrated and displayed in the developer's local IDE (development tool), but in the current common Saas code hosting platform on the market, the code browsing page does not yet have the function of displaying the overall code structure view, which is not convenient for real-time preview of the code structure and target code targeting
Moreover, the existing technology implementation is based on the abstract syntax tree: the code text needs to be converted into a tree structure for storage and traversal, which is more complicated and the parsing efficiency is relatively low

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Code structure view analyzing and previewing method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0029] The technical solution of the patent is further described in detail below in conjunction with the specific embodiments.

[0030] See Figure 1 , a code structure view parsing and previewing method, including code preprocessing module, code parsing module, result processing module and result storage module; the code preprocessing module is used to receive the code file or code text content passed by the supplicant, determine the code file language type, calculate the code file content md5, and determine whether there is a historical analysis result. The code parsing module is used to analyze the code file, combined with the language type involved in the code file for parsing, so as to obtain the syntax parsing tree; and based on the visitor pattern of the syntax parsing tree, the parsing starts from the code file syntax entry rules to obtain the code structure analysis results.

[0031] The code parsing module contains syntax description files based on Antlr4 and various comm...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a code structure view analyzing and previewing method. The code structure view analyzing and previewing method comprises a code preprocessing module, a code analyzing module, a result processing module and a result storage module. The code preprocessing module is used for receiving a code file transmitted by a requester, determining the language type of the code file, calculating the content md5 of the code file and judging whether a historical analysis result exists or not; the code analysis module is used for analyzing a code file and performing analysis in combination with a language type related to the code file so as to obtain a grammar analysis tree; based on a visitor mode of the grammar analysis tree, analysis is started from a code file grammar entry rule, and a code structure analysis result is obtained; according to the method, almost all mainstream language file code structure views can be previewed online, target code jumping and positioning are supported, code reading efficiency is remarkably improved, and usability is improved.

Description

Technical field [0001] The present invention relates to the field of code analysis, specifically a code structure view parsing and previewing method. Background [0002] The code structure view is when developers develop code in the IDE, the IDE will also give the overall structure of the current code: such as which class declarations are included, methods, function declarations and corresponding parameter return values and other signature information, global declaration statements, etc., so that developers have a global preview of the overall structure of the current code, convenient for development work. [0003] The technology used in the code structure view in the IDE is generally based on the code abstract syntax tree (AST) of the specific language for parsing, the abstract syntax tree is based on the tree structure obtained by the conversion of text code, and each node will correspond to the specific code, including line information, statement type, context and child nodes....

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F8/41G06F8/34
CPCG06F8/427G06F8/34
Inventor何军
Owner北京简单一点科技有限公司