Unlock instant, AI-driven research and patent intelligence for your innovation.

Front-end code generation method and device based on file scanning and storage medium

A technology for code generation and file scanning, which is applied in code compilation, program code conversion, program control devices, etc., and can solve problems such as manual writing, dependence on control libraries, and manual writing of front-end codes

Pending Publication Date: 2022-06-07
GUANGDONG SOUTH DIGITAL TECH
View PDF0 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] In order to overcome the deficiencies of the prior art, one of the purposes of the present invention is to provide a front-end code generation method based on file scanning, which can solve the problems that the existing front-end codes need to be manually written or rely on control libraries, etc.
[0005] The second object of the present invention is to provide a front-end code generation device based on file scanning, which can solve the problems that existing front-end codes need to be manually written or rely on control libraries, etc.
[0006] The third purpose of the present invention is to provide a storage medium, which can solve the problems that existing front-end codes need to be manually written or rely on control libraries, etc.

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
  • Front-end code generation method and device based on file scanning and storage medium
  • Front-end code generation method and device based on file scanning and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0029] The invention provides a front-end code generation method based on file scanning. The original source project file is scanned and analyzed, and the content of the analyzed file is converted and analyzed to extract the source code data information related to the control, and then the source code data information related to the control is obtained. It is combined with the configuration data of the front-end interface of the visualization system of the source project file to automatically generate the code of the front-end interface, so as to realize the automatic generation of the front-end code.

[0030] The present invention provides a preferred embodiment, a front-end code generation method based on file scanning, such as figure 1 shown, including the following steps:

[0031] Step S1, obtaining a source project file and scanning the source project file to obtain a file in a preset format.

[0032] Specifically, it can be imported into a specific application software ...

Embodiment 2

[0062]基于实施例二,本发明还提供基于文件扫描的前端代码生成装置,其包括存储器和处理器,所述存储器上存储有在处理器上运行的前端代码生成程序,所述前端代码生成程序为计算机程序,所述处理器执行所述前端代码生成程序时实现以下步骤:

[0063]文件扫描步骤:获取源工程文件并对源工程文件进行扫描以获取预设格式的文件;

[0064]解析步骤:对扫描得到的每个文件按照预设解析规则进行解析得出文件内容,并根据解析得出的文件内容得出文件的依赖关系,进而根据每个文件的文件内容、每个文件的代码和依赖关系得出文件的解析数据;

[0065]控件信息获取步骤:根据源工程文件对应的可视化系统导出每个前端界面的配置数据,并根据每个前端界面的配置数据提取得出对应控件信息;

[0066]代码生成步骤:将提取得出的每个前端界面的控件信息与每个文件的解析数据进行关联以生成每个控件的全量数据,进而得出每个前端界面的前端代码;所述每个控件的全量数据包括控件名称、控件位置信息和控件代码。

[0067]进一步地,所述解析步骤包括:首先对扫描得到的每个文件按照预设解析规则进行解析提取得出文件内容,并将解析得出的文件内容转换为抽象语法树,然后根据每个文件的抽象语法树得出每个文件的依赖关系。

[0068]进一步地,文件内容包括文件名称、文件路径、源代码和结构描述。

[0069]进一步地,根据每个文件的抽象语法树得出文件的依赖关系具体包括根据预设的依赖查找规则对每个抽象语法树的各个节点进行遍历,获取满足匹配条件的节点值并将其确定为对应文件的依赖关系,同时将节点值记录在该文件的依赖关系中。

[0070]进一步地,将文件的解析数据以JSON格式的文件进行保存。

[0071]进一步地,控件信息包括:控件名称、控件类型、显示样式、控件位置信息。

[0072]进一步地,预设格式的文件包括VUE格式的文件和JS格式的文件。

[0073]进一步地,文件扫描步骤具体包括对源工程文件的所有目录进行扫描或对源工程文件的预设目录进行扫描。

Embodiment 3

[0075]基于实施例一,本发明还提供另外一实施例,一种存储介质,该存储介质为计算机可读存储介质,其上存储有计算机程序,计算机程序为前端代码生成程序,所述前端代码生成程序被处理器执行时实现如以下步骤:

[0076]文件扫描步骤:获取源工程文件并对源工程文件进行扫描以获取预设格式的文件;

[0077]解析步骤:对扫描得到的每个文件按照预设解析规则进行解析得出文件内容,并根据解析得出的文件内容得出文件的依赖关系,进而根据每个文件的文件内容、每个文件的代码和依赖关系得出文件的解析数据;

[0078]控件信息获取步骤:根据源工程文件对应的可视化系统导出每个前端界面的配置数据,并根据每个前端界面的配置数据提取得出对应控件信息;

[0079]代码生成步骤:将提取得出的每个前端界面的控件信息与每个文件的解析数据进行关联以生成每个控件的全量数据,进而得出每个前端界面的前端代码;所述每个控件的全量数据包括控件名称、控件位置信息和控件代码。

[0080]进一步地,所述解析步骤包括:首先对扫描得到的每个文件按照预设解析规则进行解析提取得出文件内容,并将解析得出的文件内容转换为抽象语法树,然后根据每个文件的抽象语法树得出每个文件的依赖关系。

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 discloses a front-end code generation method based on file scanning. The method comprises the steps that a source project file is obtained and scanned to obtain a file in a preset format; analyzing each file according to a preset analysis rule to obtain file content and a dependency relationship of the files, and further obtaining analysis data of the files according to the file content of each file, the code of each file and the dependency relationship; exporting configuration data of each front-end interface according to a visualization system corresponding to the source project file and obtaining corresponding control information; and associating the extracted control information of each front-end interface with the analysis data of each file to generate full data of each control so as to obtain a front-end code of each front-end interface. According to the method, the problems of complicated operation, large repeated workload, inflexibility and the like caused by manual writing or dependence on a control library in the existing front-end code generation process can be solved. The invention further provides a file scanning-based front-end code generation device and a storage medium.

Description

technical field [0001] The present invention relates to the field of computer software codes, in particular to a method, device and storage medium for generating front-end code based on file scanning. Background technique [0002] In the business development process, a visual system is generally provided for the configuration and development of the front-end interface. However, with the continuous expansion of the business scale of the enterprise and the increase of the customer base, the diversity and customization requirements for the display effect of the front-end interface are increasing day by day, and the configuration cannot be completely completed through the visualization system, which requires system developers. Manually writing the code for certain functions in a targeted manner increases the workload of system developers. At the same time, if the additional business logic is mixed, the unity of the original visualization system will also be destroyed. Therefore...

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/30G06F8/41G06F9/445
CPCG06F8/31G06F9/4451G06F8/427
Inventor 黄坚辉张海山王向宇谢慧波肖佳佳梁绍威李赛梁雄师邓赟杨楠
Owner GUANGDONG SOUTH DIGITAL TECH